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
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-02-03 02:43:48 +00:00
|
|
|
#ifndef _WX_GTKMENU_H_
|
|
|
|
#define _WX_GTKMENU_H_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenuBar
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE 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);
|
2005-03-17 23:45:24 +00:00
|
|
|
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
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 );
|
2012-01-15 13:41:17 +00:00
|
|
|
virtual bool IsEnabledTop(size_t pos) const;
|
2007-08-11 17:54:59 +00:00
|
|
|
virtual void SetMenuLabel( size_t pos, const wxString& label );
|
|
|
|
virtual wxString GetMenuLabel( size_t pos ) const;
|
1999-07-19 22:17:40 +00:00
|
|
|
|
2006-09-04 13:35:13 +00:00
|
|
|
void SetLayoutDirection(wxLayoutDirection dir);
|
|
|
|
wxLayoutDirection GetLayoutDirection() const;
|
|
|
|
|
2007-04-23 15:16:06 +00:00
|
|
|
// wxMenuBar is not a top level window but it still doesn't need a parent
|
|
|
|
// window
|
|
|
|
virtual bool GTKNeedsParent() const { return false; }
|
|
|
|
|
2010-04-24 15:08:00 +00:00
|
|
|
virtual void Attach(wxFrame *frame);
|
|
|
|
virtual void Detach();
|
2006-09-04 13:35:13 +00:00
|
|
|
|
1999-10-26 19:07:04 +00:00
|
|
|
// implementation only from now on
|
2009-09-24 12:36:34 +00:00
|
|
|
GtkWidget *m_menubar; // Public for hildon support
|
1999-03-24 19:05:19 +00:00
|
|
|
|
2008-02-03 02:43:48 +00:00
|
|
|
private:
|
1999-12-04 13:43:59 +00:00
|
|
|
// common part of Append and Insert
|
2011-12-01 06:57:44 +00:00
|
|
|
void GtkAppend(wxMenu* menu, const wxString& title, int pos = -1);
|
1999-12-04 13:43:59 +00:00
|
|
|
|
2005-03-17 23:45:24 +00:00
|
|
|
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
|
|
|
|
1999-10-26 19:07:04 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenu
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 22:58:06 +00:00
|
|
|
class WXDLLIMPEXP_CORE 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
|
|
|
|
2006-09-04 13:35:13 +00:00
|
|
|
void Attach(wxMenuBarBase *menubar);
|
2006-10-17 14:44:52 +00:00
|
|
|
|
2006-09-04 13:35:13 +00:00
|
|
|
void SetLayoutDirection(const wxLayoutDirection dir);
|
|
|
|
wxLayoutDirection GetLayoutDirection() const;
|
|
|
|
|
2010-11-16 22:38:53 +00:00
|
|
|
// Returns the title, with mnemonics translated to wx format
|
2010-11-17 05:57:21 +00:00
|
|
|
wxString GetTitle() const;
|
2010-11-16 22:38:53 +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
|
|
|
|
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;
|
2008-03-18 03:01:30 +00:00
|
|
|
bool m_popupShown;
|
1999-03-24 19:05:19 +00:00
|
|
|
|
2006-02-08 21:47:09 +00:00
|
|
|
protected:
|
|
|
|
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
|
|
|
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
|
|
|
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
|
|
|
|
1999-07-19 22:17:40 +00:00
|
|
|
private:
|
1999-11-02 01:25:43 +00:00
|
|
|
// common code for all constructors:
|
|
|
|
void Init();
|
|
|
|
|
2004-04-22 22:05:52 +00:00
|
|
|
// common part of Append (if pos == -1) and Insert
|
2011-12-01 06:57:44 +00:00
|
|
|
void GtkAppend(wxMenuItem* item, int pos = -1);
|
1999-12-04 14:10:31 +00:00
|
|
|
|
2002-03-18 19:41:35 +00:00
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenu)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2006-10-17 14:44:52 +00:00
|
|
|
#endif
|
2008-02-03 02:43:48 +00:00
|
|
|
// _WX_GTKMENU_H_
|