]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/menuitem.h
factored out key handling for better integrating with carbon
[wxWidgets.git] / include / wx / mac / menuitem.h
CommitLineData
0dbd6262
SC
1///////////////////////////////////////////////////////////////////////////////
2// Name: menuitem.h
3// Purpose: wxMenuItem class
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 11.11.97
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9// Licence: wxWindows license
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _MENUITEM_H
13#define _MENUITEM_H
14
15#ifdef __GNUG__
16#pragma interface "menuitem.h"
17#endif
18
19// ----------------------------------------------------------------------------
20// headers
21// ----------------------------------------------------------------------------
22
23#include "wx/setup.h"
24
25// an exception to the general rule that a normal header doesn't include other
26// headers - only because ownerdrw.h is not always included and I don't want
27// to write #ifdef's everywhere...
28#if wxUSE_OWNER_DRAWN
29#include "wx/ownerdrw.h"
30#endif
31
0dbd6262
SC
32// ----------------------------------------------------------------------------
33// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
34// ----------------------------------------------------------------------------
519cb848 35class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
0dbd6262
SC
36#if wxUSE_OWNER_DRAWN
37 , public wxOwnerDrawn
38#endif
39{
0dbd6262 40public:
519cb848
SC
41 // ctor & dtor
42 wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
43 int id = wxID_SEPARATOR,
44 const wxString& name = wxEmptyString,
45 const wxString& help = wxEmptyString,
546bfbea 46 wxItemKind kind = wxITEM_NORMAL,
519cb848
SC
47 wxMenu *subMenu = (wxMenu *)NULL);
48 virtual ~wxMenuItem();
49
50 // override base class virtuals
51 virtual void SetText(const wxString& strName);
52 virtual wxString GetLabel() const;
53 virtual void SetCheckable(bool checkable);
54
55 virtual void Enable(bool bDoEnable = TRUE);
56 virtual void Check(bool bDoCheck = TRUE);
57 virtual bool IsChecked() const;
58
d062e17f
GD
59 virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
60 virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
61
519cb848
SC
62#if wxUSE_ACCEL
63 virtual wxAcceleratorEntry *GetAccel() const;
64#endif // wxUSE_ACCEL
65
66 // unfortunately needed to resolve ambiguity between
67 // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
68 bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
69
70 // the id for a popup menu is really its menu handle (as required by
71 // ::AppendMenu() API), so this function will return either the id or the
72 // menu handle depending on what we're
73 int GetRealId() const;
0dbd6262 74
5273bf2f 75 static int MacBuildMenuString(unsigned char* outMacItemText, wxInt16 *outMacShortcutChar , wxUint8 *outMacModifiers , const char *inItemName , bool useShortcuts ) ;
05adb9d2 76
0dbd6262 77private:
d062e17f 78 wxBitmap m_bitmap; // Bitmap for menuitem, if any
ac398c14 79 void* m_menu ; // the appropriate menu , may also be a system menu
d062e17f 80
519cb848 81 DECLARE_DYNAMIC_CLASS(wxMenuItem)
0dbd6262
SC
82};
83
84#endif //_MENUITEM_H