]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: menuitem.h | |
3 | // Purpose: wxMenuItem class | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 11.11.97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_MOTIF_MENUITEM_H | |
13 | #define _WX_MOTIF_MENUITEM_H | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "menuitem.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/bitmap.h" | |
20 | ||
21 | class WXDLLEXPORT wxMenuBar; | |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | class wxMenuItem : public wxMenuItemBase | |
28 | { | |
29 | public: | |
30 | // ctor & dtor | |
31 | wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, | |
32 | int id = wxID_SEPARATOR, | |
33 | const wxString& text = wxEmptyString, | |
34 | const wxString& help = wxEmptyString, | |
35 | wxItemKind kind = wxITEM_NORMAL, | |
36 | wxMenu *subMenu = (wxMenu *)NULL); | |
37 | ~wxMenuItem(); | |
38 | ||
39 | // accessors (some more are inherited from wxOwnerDrawn or are below) | |
40 | virtual void SetText(const wxString& label); | |
41 | virtual void Enable(bool enable = TRUE); | |
42 | virtual void Check(bool check = TRUE); | |
43 | // included SetBitmap and GetBitmap as copied from the GTK include file | |
44 | // I'm not sure if this works but it silences the linker in the | |
45 | // menu sample. | |
46 | // JJ | |
47 | virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } | |
48 | virtual const wxBitmap& GetBitmap() const { return m_bitmap; } | |
49 | ||
50 | void DeleteSubMenu(); | |
51 | ||
52 | // implementation from now on | |
53 | void CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMenu); | |
54 | void DestroyItem(bool full); | |
55 | ||
56 | WXWidget GetButtonWidget() const { return m_buttonWidget; } | |
57 | ||
58 | wxMenuBar* GetMenuBar() const { return m_menuBar; } | |
59 | void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } | |
60 | ||
61 | wxMenu* GetTopMenu() const { return m_topMenu; } | |
62 | void SetTopMenu(wxMenu* menu) { m_topMenu = menu; } | |
63 | ||
64 | private: | |
65 | WXWidget m_buttonWidget; | |
66 | wxMenuBar* m_menuBar; | |
67 | wxMenu* m_topMenu; // Top-level menu e.g. popup-menu | |
68 | wxBitmap m_bitmap; // Bitmap for menuitem, if any | |
69 | ||
70 | DECLARE_DYNAMIC_CLASS(wxMenuItem) | |
71 | }; | |
72 | ||
73 | #endif // _WX_MOTIF_MENUITEM_H |