haiku/headers/os/interface/MenuScrollView.h
John Scipione 49ff476d13 Make ScrollMenu not rely on Menu.cpp
Rename ScrollMenu.cpp to MenuScrollView.cpp

Half step towards making this class work as part of Deskbar without
extending any other classes. Scrolling works both with mouse and
scroll wheel. Redraws on scroll, need to make that work better.
Also need to move classes out of the Interface Kit and into Deskbar.
2012-11-12 22:03:17 -05:00

56 lines
1.2 KiB
C++

/*
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers (mflerackers@androme.be)
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
* John Scipione (jscipione@gmail.com)
*/
#ifndef MENU_SCROLL_VIEW_H
#define MENU_SCROLL_VIEW_H
#include <View.h>
class BLayout;
class BMenu;
class BMenuScroller;
class BMenuScrollView : public BView {
public:
BMenuScrollView(BMenu* menu);
virtual ~BMenuScrollView();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect);
virtual void FrameResized(float newWidth, float newHeight);
void AttachScrollers();
void DetachScrollers();
bool HasScrollers() const;
void SetSmallStep(float step);
void GetSteps(float* _smallStep, float* _largeStep) const;
bool CheckForScrolling(const BPoint& cursor);
bool TryScrollBy(const float& step);
protected:
bool _Scroll(const BPoint& cursor);
void _ScrollBy(const float& step);
private:
BMenu* fMenu;
BMenuScroller* fUpperScroller;
BMenuScroller* fLowerScroller;
float fScrollStep;
float fValue;
float fLimit;
};
#endif // MENU_SCROLL_VIEW_H