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 bool TryScrollTo(const float& where); 44 45 private: 46 bool _Scroll(const BPoint& cursor); 47 void _ScrollBy(const float& step); 48 49 BMenu* fMenu; 50 BMenuFrame* fMenuFrame; 51 BMenuScroller* fUpperScroller; 52 BMenuScroller* fLowerScroller; 53 54 float fScrollStep; 55 float fValue; 56 float fLimit; 57 }; 58 59 } // namespace BPrivate 60 61 #endif // MENU_WINDOW_H 62