* Added layout-friendly constructor.
* Fixed invalidation in FrameResized(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21427 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -36,12 +36,15 @@ class BMenuField;
|
|||||||
class BMenuBar : public BMenu
|
class BMenuBar : public BMenu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BMenuBar( BRect frame,
|
BMenuBar(BRect frame,
|
||||||
const char *title,
|
const char *title,
|
||||||
uint32 resizeMask =
|
uint32 resizeMask =
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
|
||||||
menu_layout layout = B_ITEMS_IN_ROW,
|
menu_layout layout = B_ITEMS_IN_ROW,
|
||||||
bool resizeToFit = true);
|
bool resizeToFit = true);
|
||||||
|
BMenuBar(const char *title,
|
||||||
|
menu_layout layout = B_ITEMS_IN_ROW,
|
||||||
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS);
|
||||||
BMenuBar(BMessage *data);
|
BMenuBar(BMessage *data);
|
||||||
virtual ~BMenuBar();
|
virtual ~BMenuBar();
|
||||||
static BArchivable *Instantiate(BMessage *data);
|
static BArchivable *Instantiate(BMessage *data);
|
||||||
|
|||||||
@@ -51,6 +51,21 @@ BMenuBar::BMenuBar(BRect frame, const char *title, uint32 resizeMask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BMenuBar::BMenuBar(const char *title, menu_layout layout, uint32 flags)
|
||||||
|
: BMenu(BRect(), title, B_FOLLOW_NONE,
|
||||||
|
flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT,
|
||||||
|
layout, false),
|
||||||
|
fBorder(B_BORDER_FRAME),
|
||||||
|
fTrackingPID(-1),
|
||||||
|
fPrevFocusToken(-1),
|
||||||
|
fMenuSem(-1),
|
||||||
|
fLastBounds(NULL),
|
||||||
|
fTracking(false)
|
||||||
|
{
|
||||||
|
InitData(layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BMenuBar::BMenuBar(BMessage *data)
|
BMenuBar::BMenuBar(BMessage *data)
|
||||||
: BMenu(data),
|
: BMenu(data),
|
||||||
fBorder(B_BORDER_FRAME),
|
fBorder(B_BORDER_FRAME),
|
||||||
@@ -222,11 +237,21 @@ BMenuBar::FrameMoved(BPoint newPosition)
|
|||||||
void
|
void
|
||||||
BMenuBar::FrameResized(float newWidth, float newHeight)
|
BMenuBar::FrameResized(float newWidth, float newHeight)
|
||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
// invalidate right border
|
||||||
BRect rect(fLastBounds->right - 12, fLastBounds->top, bounds.right, bounds.bottom);
|
if (newWidth != fLastBounds->Width()) {
|
||||||
fLastBounds->Set(0, 0, newWidth, newHeight);
|
BRect rect(min_c(fLastBounds->right, newWidth), 0,
|
||||||
|
max_c(fLastBounds->right, newWidth), newHeight);
|
||||||
|
Invalidate(rect);
|
||||||
|
}
|
||||||
|
|
||||||
Invalidate(rect);
|
// invalidate bottom border
|
||||||
|
if (newHeight != fLastBounds->Height()) {
|
||||||
|
BRect rect(0, min_c(fLastBounds->bottom, newHeight) - 1,
|
||||||
|
newWidth, max_c(fLastBounds->bottom, newHeight));
|
||||||
|
Invalidate(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
fLastBounds->Set(0, 0, newWidth, newHeight);
|
||||||
|
|
||||||
BMenu::FrameResized(newWidth, newHeight);
|
BMenu::FrameResized(newWidth, newHeight);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user