1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-10-26 19:07:04 +00:00
|
|
|
// Name: wx/gtk/menu.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-29 18:03:18 +00:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
1998-07-23 16:07:05 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKMENUH__
|
|
|
|
#define __GTKMENUH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-10-26 19:07:04 +00:00
|
|
|
#pragma interface "menu.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenuBar
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-10-26 19:07:04 +00:00
|
|
|
class wxMenuBar : public wxMenuBarBase
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1998-07-23 16:07:05 +00:00
|
|
|
public:
|
1999-03-24 19:05:19 +00:00
|
|
|
// ctors
|
|
|
|
wxMenuBar();
|
|
|
|
wxMenuBar(long style);
|
|
|
|
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
1999-10-26 19:07:04 +00:00
|
|
|
virtual ~wxMenuBar();
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-10-26 19:07:04 +00: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 19:05:19 +00:00
|
|
|
|
|
|
|
virtual int FindMenuItem(const wxString& menuString,
|
|
|
|
const wxString& itemString) const;
|
1999-10-26 19:07:04 +00:00
|
|
|
virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const;
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-10-26 19:07:04 +00: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 22:17:40 +00:00
|
|
|
|
1999-10-26 19:07:04 +00:00
|
|
|
// implementation only from now on
|
1999-06-06 16:07:39 +00:00
|
|
|
void SetInvokingWindow( wxWindow *win );
|
|
|
|
void UnsetInvokingWindow( wxWindow *win );
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-12-04 13:43:59 +00:00
|
|
|
// common part of Append and Insert
|
|
|
|
bool GtkAppend(wxMenu *menu, const wxString& title);
|
|
|
|
|
1999-04-25 15:10:52 +00:00
|
|
|
GtkAccelGroup *m_accel;
|
|
|
|
GtkItemFactory *m_factory;
|
|
|
|
GtkWidget *m_menubar;
|
1999-06-17 14:08:00 +00:00
|
|
|
long m_style;
|
1999-08-19 18:41:41 +00:00
|
|
|
wxWindow *m_invokingWindow;
|
1999-10-26 19:07:04 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenu
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
class wxMenu : public wxMenuBase
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1998-07-23 16:07:05 +00:00
|
|
|
public:
|
1999-11-02 01:25:43 +00:00
|
|
|
// ctors & dtor
|
|
|
|
wxMenu(const wxString& title, long style = 0)
|
|
|
|
: wxMenuBase(title, style) { Init(); }
|
1998-07-23 16:07:05 +00:00
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
virtual ~wxMenu();
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
// implement base class virtuals
|
|
|
|
virtual bool DoAppend(wxMenuItem *item);
|
|
|
|
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
|
|
|
virtual wxMenuItem *DoRemove(wxMenuItem *item);
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
// TODO: virtual void SetTitle(const wxString& title);
|
1999-08-04 13:01:20 +00:00
|
|
|
|
2001-07-02 09:51:19 +00:00
|
|
|
// compatibility only
|
|
|
|
#if wxUSE_MENU_CALLBACK
|
1999-11-02 01:25:43 +00:00
|
|
|
wxMenu(const wxString& title, const wxFunction func)
|
|
|
|
: wxMenuBase(title)
|
|
|
|
{
|
2000-01-25 15:35:55 +00:00
|
|
|
Init();
|
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
Callback(func);
|
|
|
|
}
|
2001-07-02 09:51:19 +00:00
|
|
|
#endif // WXWIN_COMPATIBILITY_2
|
1999-03-24 19:05:19 +00:00
|
|
|
|
|
|
|
// implementation
|
|
|
|
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
|
|
|
|
|
1999-04-25 15:10:52 +00:00
|
|
|
// implementation GTK only
|
1999-04-09 18:01:17 +00:00
|
|
|
GtkWidget *m_menu; // GtkMenu
|
|
|
|
GtkWidget *m_owner;
|
|
|
|
GtkAccelGroup *m_accel;
|
|
|
|
GtkItemFactory *m_factory;
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-07-19 22:17:40 +00:00
|
|
|
private:
|
1999-11-02 01:25:43 +00:00
|
|
|
// common code for all constructors:
|
|
|
|
void Init();
|
|
|
|
|
1999-12-04 14:10:31 +00:00
|
|
|
// common part of Append and Insert
|
|
|
|
bool GtkAppend(wxMenuItem *item);
|
|
|
|
|
2002-03-18 19:41:35 +00:00
|
|
|
// if the last menu item was a radio one, this field contains its path,
|
|
|
|
// otherwise it is empty
|
|
|
|
wxString m_pathLastRadio;
|
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenu)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKMENUH__
|