2 * Copyright 2006-2007, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
9 #include <Archivable.h>
10 #include <InterfaceDefs.h>
19 class MenuItemPrivate
;
22 class BMenuItem
: public BArchivable
, public BInvoker
{
24 BMenuItem(const char* label
, BMessage
* message
,
25 char shortcut
= 0, uint32 modifiers
= 0);
26 BMenuItem(BMenu
* menu
,
27 BMessage
* message
= NULL
);
28 BMenuItem(BMessage
* data
);
31 static BArchivable
* Instantiate(BMessage
* archive
);
32 virtual status_t
Archive(BMessage
* archive
,
33 bool deep
= true) const;
35 virtual void SetLabel(const char* name
);
36 virtual void SetEnabled(bool enable
);
37 virtual void SetMarked(bool mark
);
38 virtual void SetTrigger(char trigger
);
39 virtual void SetShortcut(char shortcut
, uint32 modifiers
);
41 const char* Label() const;
42 bool IsEnabled() const;
43 bool IsMarked() const;
45 char Shortcut(uint32
* _modifiers
= NULL
) const;
47 BMenu
* Submenu() const;
52 virtual void GetContentSize(float* _width
, float* _height
);
53 virtual void TruncateLabel(float maxWidth
, char* newLabel
);
54 virtual void DrawContent();
56 virtual void Highlight(bool highlight
);
57 bool IsSelected() const;
58 BPoint
ContentLocation() const;
62 friend class BPopUpMenu
;
63 friend class BMenuBar
;
64 friend class BPrivate::MenuItemPrivate
;
66 virtual void _ReservedMenuItem1();
67 virtual void _ReservedMenuItem2();
68 virtual void _ReservedMenuItem3();
69 virtual void _ReservedMenuItem4();
71 void Install(BWindow
* window
);
73 void SetSuper(BMenu
* superMenu
);
74 void Select(bool select
);
75 void SetAutomaticTrigger(int32 index
,
79 virtual status_t
Invoke(BMessage
* message
= NULL
);
82 BMenuItem(const BMenuItem
& other
);
83 BMenuItem
& operator=(const BMenuItem
& other
);
87 void _InitMenuData(BMenu
* menu
);
89 void _DrawMarkSymbol();
90 void _DrawShortcutSymbol();
91 void _DrawSubmenuSymbol();
92 void _DrawControlChar(char shortcut
, BPoint where
);
113 // BSeparatorItem now has its own declaration file, but for source
114 // compatibility we're exporting that class from here too.
115 #include <SeparatorItem.h>
117 #endif // _MENU_ITEM_H