1998-09-18 21:36:20 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: menuitem.h
|
|
|
|
// Purpose: wxMenuItem class
|
1998-11-03 11:19:58 +00:00
|
|
|
// Author: Robert Roebling
|
1998-09-18 21:36:20 +00:00
|
|
|
// RCS-ID: $Id$
|
1998-11-03 11:19:58 +00:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-09-18 21:36:20 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-11-03 11:19:58 +00:00
|
|
|
#ifndef __GTKMENUITEMH__
|
|
|
|
#define __GTKMENUITEMH__
|
1998-09-18 21:36:20 +00:00
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1998-11-03 11:19:58 +00:00
|
|
|
#pragma interface
|
1998-09-18 21:36:20 +00:00
|
|
|
#endif
|
|
|
|
|
2000-09-01 08:35:30 +00:00
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
1998-11-03 11:19:58 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMenuItem
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-09-18 21:36:20 +00:00
|
|
|
|
1999-10-25 15:51:37 +00:00
|
|
|
class wxMenuItem : public wxMenuItemBase
|
1998-11-03 11:19:58 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-10-25 15:51:37 +00:00
|
|
|
wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
|
|
|
|
int id = wxID_SEPARATOR,
|
|
|
|
const wxString& text = wxEmptyString,
|
|
|
|
const wxString& help = wxEmptyString,
|
2002-03-22 19:18:51 +00:00
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
1999-10-25 15:51:37 +00:00
|
|
|
wxMenu *subMenu = (wxMenu *)NULL);
|
1999-10-11 19:32:58 +00:00
|
|
|
~wxMenuItem();
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-10-25 15:51:37 +00:00
|
|
|
// implement base class virtuals
|
1999-10-30 15:08:33 +00:00
|
|
|
virtual void SetText( const wxString& str );
|
1999-10-25 15:51:37 +00:00
|
|
|
virtual void Enable( bool enable = TRUE );
|
|
|
|
virtual void Check( bool check = TRUE );
|
|
|
|
virtual bool IsChecked() const;
|
2000-09-01 08:35:30 +00:00
|
|
|
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
|
|
|
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-11-02 01:25:43 +00:00
|
|
|
#if wxUSE_ACCEL
|
|
|
|
virtual wxAcceleratorEntry *GetAccel() const;
|
|
|
|
#endif // wxUSE_ACCEL
|
|
|
|
|
1999-03-24 19:05:19 +00:00
|
|
|
// implementation
|
|
|
|
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
|
|
|
|
GtkWidget *GetMenuItem() const { return m_menuItem; }
|
2000-09-01 08:35:30 +00:00
|
|
|
GtkWidget *GetLabelWidget() const { return m_labelWidget; }
|
|
|
|
void SetLabelWidget(GtkWidget *labelWidget) { m_labelWidget = labelWidget; }
|
1999-10-30 15:08:33 +00:00
|
|
|
wxString GetFactoryPath() const;
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-10-25 15:51:37 +00:00
|
|
|
wxString GetHotKey() const { return m_hotKey; }
|
1999-03-24 19:05:19 +00:00
|
|
|
|
2002-03-23 01:23:11 +00:00
|
|
|
// compatibility only, don't use in new code
|
|
|
|
wxMenuItem(wxMenu *parentMenu,
|
|
|
|
int id,
|
|
|
|
const wxString& text,
|
|
|
|
const wxString& help,
|
|
|
|
bool isCheckable,
|
|
|
|
wxMenu *subMenu = (wxMenu *)NULL);
|
|
|
|
|
1999-03-24 19:05:19 +00:00
|
|
|
private:
|
2002-03-23 01:23:11 +00:00
|
|
|
// common part of all ctors
|
2002-03-25 14:31:43 +00:00
|
|
|
void Init(const wxString& text);
|
2002-03-23 01:23:11 +00:00
|
|
|
|
1999-10-25 15:51:37 +00:00
|
|
|
// DoSetText() transforms the accel mnemonics in our label from MSW/wxWin
|
|
|
|
// style to GTK+ and is called from ctor and SetText()
|
|
|
|
void DoSetText(const wxString& text);
|
|
|
|
|
|
|
|
wxString m_hotKey;
|
2000-09-01 08:35:30 +00:00
|
|
|
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
1999-10-25 15:51:37 +00:00
|
|
|
|
|
|
|
GtkWidget *m_menuItem; // GtkMenuItem
|
2000-09-01 08:35:30 +00:00
|
|
|
GtkWidget* m_labelWidget; // Label widget
|
1999-03-24 19:05:19 +00:00
|
|
|
|
1999-10-25 15:51:37 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
1998-09-18 21:36:20 +00:00
|
|
|
};
|
|
|
|
|
1998-11-03 11:19:58 +00:00
|
|
|
|
1998-12-09 17:30:17 +00:00
|
|
|
#endif
|
1998-11-03 11:19:58 +00:00
|
|
|
//__GTKMENUITEMH__
|