Implement _BMCMenuBar_::MaxSize() to override BMenuBar::MaxSize() and limit

the maximum width. The latter supports unlimited maximum width. The
_BMCMenuBar_ draws fine when resized wider than its min/preferred width, but
not the complete "button" area will cause the menu to open when being pressed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21465 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-06-19 23:09:01 +00:00
parent 23b9a91178
commit ec592aa9e5
2 changed files with 17 additions and 3 deletions
+5 -3
View File
@@ -45,9 +45,11 @@ virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* msg);
virtual void MakeFocus(bool focused = true);
void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; }
bool IsPopUpMarkerShown() const { return fShowPopUpMarker; }
void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; }
bool IsPopUpMarkerShown() const { return fShowPopUpMarker; }
virtual BSize MaxSize();
private:
_BMCMenuBar_&operator=(const _BMCMenuBar_ &);
+12
View File
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <BMCPrivate.h>
#include <LayoutUtils.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Message.h>
@@ -321,6 +322,17 @@ _BMCMenuBar_::MakeFocus(bool focused)
}
BSize
_BMCMenuBar_::MaxSize()
{
// The maximum width of a normal BMenuBar is unlimited, but we want it
// limited.
BSize size;
BMenuBar::GetPreferredSize(&size.width, &size.height);
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
}
_BMCMenuBar_
&_BMCMenuBar_::operator=(const _BMCMenuBar_ &)
{