1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-01-22 21:28:01 -05:00
|
|
|
// Name: wx/gtk1/menu.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-29 13:03:18 -05:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKMENUH__
|
|
|
|
#define __GTKMENUH__
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenuBar
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1998-07-23 12:07:05 -04:00
|
|
|
public:
|
1999-03-24 14:05:19 -05:00
|
|
|
// ctors
|
|
|
|
wxMenuBar();
|
|
|
|
wxMenuBar(long style);
|
2005-03-17 18:45:24 -05:00
|
|
|
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
1999-10-26 15:07:04 -04:00
|
|
|
virtual ~wxMenuBar();
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-10-26 15:07:04 -04:00
|
|
|
// implement base class (pure) virtuals
|
|
|
|
virtual bool Append( wxMenu *menu, const wxString &title );
|
|
|
|
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
|
|
|
|
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
|
|
|
|
virtual wxMenu *Remove(size_t pos);
|
1999-03-24 14:05:19 -05:00
|
|
|
|
|
|
|
virtual int FindMenuItem(const wxString& menuString,
|
|
|
|
const wxString& itemString) const;
|
1999-10-26 15:07:04 -04:00
|
|
|
virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const;
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-10-26 15:07:04 -04:00
|
|
|
virtual void EnableTop( size_t pos, bool flag );
|
|
|
|
virtual void SetLabelTop( size_t pos, const wxString& label );
|
|
|
|
virtual wxString GetLabelTop( size_t pos ) const;
|
1999-07-19 18:17:40 -04:00
|
|
|
|
1999-10-26 15:07:04 -04:00
|
|
|
// implementation only from now on
|
1999-06-06 12:07:39 -04:00
|
|
|
void SetInvokingWindow( wxWindow *win );
|
|
|
|
void UnsetInvokingWindow( wxWindow *win );
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-12-04 08:43:59 -05:00
|
|
|
// common part of Append and Insert
|
2004-04-22 18:05:52 -04:00
|
|
|
bool GtkAppend(wxMenu *menu, const wxString& title, int pos=-1);
|
1999-12-04 08:43:59 -05:00
|
|
|
|
1999-04-25 11:10:52 -04:00
|
|
|
GtkAccelGroup *m_accel;
|
|
|
|
GtkWidget *m_menubar;
|
1999-06-17 10:08:00 -04:00
|
|
|
long m_style;
|
1999-08-19 14:41:41 -04:00
|
|
|
wxWindow *m_invokingWindow;
|
1999-10-26 15:07:04 -04:00
|
|
|
|
|
|
|
private:
|
2005-03-17 18:45:24 -05:00
|
|
|
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
|
|
|
|
1999-10-26 15:07:04 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenu
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1998-07-23 12:07:05 -04:00
|
|
|
public:
|
1999-11-01 20:25:43 -05:00
|
|
|
// ctors & dtor
|
|
|
|
wxMenu(const wxString& title, long style = 0)
|
|
|
|
: wxMenuBase(title, style) { Init(); }
|
1998-07-23 12:07:05 -04:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
virtual ~wxMenu();
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
// implement base class virtuals
|
2004-01-23 13:46:05 -05:00
|
|
|
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
|
|
|
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
|
|
|
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
// TODO: virtual void SetTitle(const wxString& title);
|
1999-08-04 09:01:20 -04:00
|
|
|
|
1999-03-24 14:05:19 -05:00
|
|
|
// implementation
|
|
|
|
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
|
|
|
|
|
1999-04-25 11:10:52 -04:00
|
|
|
// implementation GTK only
|
1999-04-09 14:01:17 -04:00
|
|
|
GtkWidget *m_menu; // GtkMenu
|
|
|
|
GtkWidget *m_owner;
|
|
|
|
GtkAccelGroup *m_accel;
|
1999-03-24 14:05:19 -05:00
|
|
|
|
1999-07-19 18:17:40 -04:00
|
|
|
private:
|
1999-11-01 20:25:43 -05:00
|
|
|
// common code for all constructors:
|
|
|
|
void Init();
|
|
|
|
|
2004-04-22 18:05:52 -04:00
|
|
|
// common part of Append (if pos == -1) and Insert
|
|
|
|
bool GtkAppend(wxMenuItem *item, int pos=-1);
|
1999-12-04 09:10:31 -05:00
|
|
|
|
2006-10-17 10:44:52 -04:00
|
|
|
GtkWidget *m_prevRadio;
|
2002-03-18 14:41:35 -05:00
|
|
|
|
1999-11-01 20:25:43 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenu)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2006-10-17 10:44:52 -04:00
|
|
|
#endif
|
|
|
|
// __GTKMENUH__
|