1 /* 2 * Copyright 2001-2009, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Marc Flerackers (mflerackers@androme.be) 7 * Stefano Ceccherini (burton666@libero.it) 8 */ 9 #ifndef MENU_WINDOW_H 10 #define MENU_WINDOW_H 11 12 13 #include <Window.h> 14 15 class BMenu; 16 17 18 namespace BPrivate { 19 20 class BMenuFrame; 21 class BMenuScroller; 22 23 24 class BMenuWindow : public BWindow { 25 public: 26 BMenuWindow(const char* name); 27 virtual ~BMenuWindow(); 28 29 virtual void DispatchMessage(BMessage* message, 30 BHandler* handler); 31 32 void AttachMenu(BMenu* menu); 33 void DetachMenu(); 34 35 void AttachScrollers(); 36 void DetachScrollers(); 37 38 void SetSmallStep(float step); 39 void GetSteps(float* _smallStep, float* _largeStep) const; 40 bool HasScrollers() const; 41 bool CheckForScrolling(const BPoint& cursor); 42 bool TryScrollBy(const float& step); 43 44 private: 45 bool _Scroll(const BPoint& cursor); 46 void _ScrollBy(const float& step); 47 48 BMenu* fMenu; 49 BMenuFrame* fMenuFrame; 50 BMenuScroller* fUpperScroller; 51 BMenuScroller* fLowerScroller; 52 53 float fScrollStep; 54 float fValue; 55 float fLimit; 56 }; 57 58 } // namespace BPrivate 59 60 #endif // MENU_WINDOW_H 61