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:
@@ -45,9 +45,11 @@ virtual void FrameResized(float width, float height);
|
|||||||
virtual void MessageReceived(BMessage* msg);
|
virtual void MessageReceived(BMessage* msg);
|
||||||
virtual void MakeFocus(bool focused = true);
|
virtual void MakeFocus(bool focused = true);
|
||||||
|
|
||||||
void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; }
|
void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; }
|
||||||
bool IsPopUpMarkerShown() const { return fShowPopUpMarker; }
|
bool IsPopUpMarkerShown() const { return fShowPopUpMarker; }
|
||||||
|
|
||||||
|
virtual BSize MaxSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
_BMCMenuBar_&operator=(const _BMCMenuBar_ &);
|
_BMCMenuBar_&operator=(const _BMCMenuBar_ &);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <BMCPrivate.h>
|
#include <BMCPrivate.h>
|
||||||
|
#include <LayoutUtils.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Message.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_
|
||||||
&_BMCMenuBar_::operator=(const _BMCMenuBar_ &)
|
&_BMCMenuBar_::operator=(const _BMCMenuBar_ &)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user