* BMenu now scrolls when you press page up/down, if possible.

* BMenuWindow no longer uses a fixed scroll step - instead, the menu sets it
  to the height of its first item.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31389 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-07-03 12:09:16 +00:00
parent 9515252e02
commit 4e23bc0383
3 changed files with 136 additions and 80 deletions
+33 -28
View File
@@ -1,13 +1,13 @@
/*
* Copyright 2001-2006, Haiku, Inc.
* Copyright 2001-2009, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Marc Flerackers ([email protected])
* Stefano Ceccherini ([email protected])
*/
#ifndef __MENUWINDOW_H
#define __MENUWINDOW_H
#ifndef MENU_WINDOW_H
#define MENU_WINDOW_H
#include <Window.h>
@@ -22,34 +22,39 @@ class BMenuScroller;
class BMenuWindow : public BWindow {
public:
BMenuWindow(const char *name);
virtual ~BMenuWindow();
public:
BMenuWindow(const char* name);
virtual ~BMenuWindow();
virtual void DispatchMessage(BMessage *message, BHandler *handler);
void AttachMenu(BMenu *menu);
void DetachMenu();
void AttachScrollers();
void DetachScrollers();
virtual void DispatchMessage(BMessage* message,
BHandler* handler);
bool CheckForScrolling(const BPoint &cursor);
bool TryScrollBy(const float &step);
private:
BMenu *fMenu;
BMenuFrame *fMenuFrame;
BMenuScroller *fUpperScroller;
BMenuScroller *fLowerScroller;
float fValue;
float fLimit;
bool _Scroll(const BPoint &cursor);
void _ScrollBy(const float &step);
void AttachMenu(BMenu* menu);
void DetachMenu();
void AttachScrollers();
void DetachScrollers();
void SetSmallStep(float step);
void GetSteps(float* _smallStep, float* _largeStep);
bool HasScrollers() const;
bool CheckForScrolling(const BPoint& cursor);
bool TryScrollBy(const float& step);
private:
bool _Scroll(const BPoint& cursor);
void _ScrollBy(const float& step);
BMenu* fMenu;
BMenuFrame* fMenuFrame;
BMenuScroller* fUpperScroller;
BMenuScroller* fLowerScroller;
float fScrollStep;
float fValue;
float fLimit;
};
} // namespace BPrivate
#endif // __MENUWINDOW_H
#endif // MENU_WINDOW_H