1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/menu.h
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling, Julian Smart
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 //-----------------------------------------------------------------------------
14 //-----------------------------------------------------------------------------
16 class WXDLLIMPEXP_CORE wxMenuBar
: public wxMenuBarBase
21 wxMenuBar(long style
);
22 wxMenuBar(size_t n
, wxMenu
*menus
[], const wxString titles
[], long style
= 0);
25 // implement base class (pure) virtuals
26 virtual bool Append( wxMenu
*menu
, const wxString
&title
);
27 virtual bool Insert(size_t pos
, wxMenu
*menu
, const wxString
& title
);
28 virtual wxMenu
*Replace(size_t pos
, wxMenu
*menu
, const wxString
& title
);
29 virtual wxMenu
*Remove(size_t pos
);
31 virtual int FindMenuItem(const wxString
& menuString
,
32 const wxString
& itemString
) const;
33 virtual wxMenuItem
* FindItem( int id
, wxMenu
**menu
= NULL
) const;
35 virtual void EnableTop( size_t pos
, bool flag
);
36 virtual void SetMenuLabel( size_t pos
, const wxString
& label
);
37 virtual wxString
GetMenuLabel( size_t pos
) const;
39 // common part of Append and Insert
40 bool GtkAppend(wxMenu
*menu
, const wxString
& title
, int pos
=-1);
42 virtual void Attach(wxFrame
*frame
);
43 virtual void Detach();
45 GtkAccelGroup
*m_accel
;
50 void Init(size_t n
, wxMenu
*menus
[], const wxString titles
[], long style
);
52 DECLARE_DYNAMIC_CLASS(wxMenuBar
)
55 //-----------------------------------------------------------------------------
57 //-----------------------------------------------------------------------------
59 class WXDLLIMPEXP_CORE wxMenu
: public wxMenuBase
63 wxMenu(const wxString
& title
, long style
= 0)
64 : wxMenuBase(title
, style
) { Init(); }
66 wxMenu(long style
= 0) : wxMenuBase(style
) { Init(); }
70 // implement base class virtuals
71 virtual wxMenuItem
* DoAppend(wxMenuItem
*item
);
72 virtual wxMenuItem
* DoInsert(size_t pos
, wxMenuItem
*item
);
73 virtual wxMenuItem
* DoRemove(wxMenuItem
*item
);
75 // Returns the title, with mnemonics translated to wx format
76 wxString
GetTitle() const;
78 // TODO: virtual void SetTitle(const wxString& title);
81 int FindMenuIdByMenuItem( GtkWidget
*menuItem
) const;
83 // implementation GTK only
84 GtkWidget
*m_menu
; // GtkMenu
86 GtkAccelGroup
*m_accel
;
89 // common code for all constructors:
92 // common part of Append (if pos == -1) and Insert
93 bool GtkAppend(wxMenuItem
*item
, int pos
=-1);
95 GtkWidget
*m_prevRadio
;
97 DECLARE_DYNAMIC_CLASS(wxMenu
)