From 4296233f0e47fd8f99f86fde3aba51d7b9cdd8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 6 May 2011 20:04:55 +0000 Subject: [PATCH] * Made the messed up BMessage* constructors private - since it only affects the layout API, we probably can just phase it out after a while. * Introduced new constructors, and added missing flags to one of them to make it more convenient to use. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41350 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/MenuField.h | 14 ++++++++++---- src/kits/interface/MenuField.cpp | 31 +++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/headers/os/interface/MenuField.h b/headers/os/interface/MenuField.h index 5abf0247b5..bb2e0db959 100644 --- a/headers/os/interface/MenuField.h +++ b/headers/os/interface/MenuField.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Copyright 2006-2011, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _MENU_FIELD_H @@ -25,10 +25,9 @@ public: uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BMenuField(const char* name, const char* label, BMenu* menu, - BMessage* message = NULL, uint32 flags = B_WILL_DRAW | B_NAVIGABLE); - BMenuField(const char* label, - BMenu* menu, BMessage* message = NULL); + BMenuField(const char* label, BMenu* menu, + uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BMenuField(BMessage* data); virtual ~BMenuField(); @@ -113,6 +112,13 @@ private: friend class MenuBarLayoutItem; friend class LayoutData; + BMenuField(const char* name, + const char* label, BMenu* menu, + BMessage* message, + uint32 flags); + BMenuField(const char* label, + BMenu* menu, BMessage* message); + void InitObject(const char* label); void InitObject2(); void DrawLabel(BRect bounds, BRect update); diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index dfb19b3c49..08cb23f086 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Haiku, Inc. + * Copyright 2001-2011, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -167,6 +167,32 @@ BMenuField::BMenuField(BRect frame, const char* name, const char* label, } +BMenuField::BMenuField(const char* name, const char* label, BMenu* menu, + uint32 flags) + : + BView(name, flags | B_FRAME_EVENTS) +{ + InitObject(label); + + _InitMenuBar(menu, BRect(0, 0, 100, 15), true); + + InitObject2(); +} + + +BMenuField::BMenuField(const char* label, BMenu* menu, uint32 flags) + : + BView(NULL, flags | B_FRAME_EVENTS) +{ + InitObject(label); + + _InitMenuBar(menu, BRect(0, 0, 100, 15), true); + + InitObject2(); +} + + +//! Copy&Paste error, should be removed at some point (already private) BMenuField::BMenuField(const char* name, const char* label, BMenu* menu, BMessage* message, uint32 flags) : @@ -180,6 +206,7 @@ BMenuField::BMenuField(const char* name, const char* label, BMenu* menu, } +//! Copy&Paste error, should be removed at some point (already private) BMenuField::BMenuField(const char* label, BMenu* menu, BMessage* message) : BView(NULL, B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS) @@ -207,7 +234,7 @@ BMenuField::BMenuField(BMessage* data) int32 align; if (data->FindInt32("_align", &align) == B_OK) SetAlignment((alignment)align); - + if (!BUnarchiver::IsArchiveManaged(data)) _InitMenuBar(data); unarchiver.Finish();