]> git.saurik.com Git - wxWidgets.git/blame - src/stubs/menuitem.cpp
Corrected test for _vsnprintf
[wxWidgets.git] / src / stubs / menuitem.cpp
CommitLineData
93cf77c0
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: menuitem.cpp
3// Purpose: wxMenuItem implementation
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// headers & declarations
14// ============================================================================
15
16#include "wx/menu.h"
17#include "wx/menuitem.h"
18
19// ============================================================================
20// implementation
21// ============================================================================
22
23// ----------------------------------------------------------------------------
24// dynamic classes implementation
25// ----------------------------------------------------------------------------
26
93cf77c0 27 IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
93cf77c0
JS
28
29// ----------------------------------------------------------------------------
30// wxMenuItem
31// ----------------------------------------------------------------------------
32
33// ctor & dtor
34// -----------
35
36wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id,
37 const wxString& strName, const wxString& strHelp,
38 bool bCheckable,
39 wxMenu *pSubMenu) :
40 m_bCheckable(bCheckable),
41 m_strName(strName),
42 m_strHelp(strHelp)
43{
44 wxASSERT( pParentMenu != NULL );
45
46 m_pParentMenu = pParentMenu;
47 m_pSubMenu = pSubMenu;
48 m_idItem = id;
49 m_bEnabled = TRUE;
50}
51
52wxMenuItem::~wxMenuItem()
53{
54}
55
56// misc
57// ----
58
59// delete the sub menu
60void wxMenuItem::DeleteSubMenu()
61{
62 wxASSERT( m_pSubMenu != NULL );
63
64 delete m_pSubMenu;
65 m_pSubMenu = NULL;
66}
67
68// change item state
69// -----------------
70
71void wxMenuItem::Enable(bool bDoEnable)
72{
73 if ( m_bEnabled != bDoEnable ) {
74 if ( m_pSubMenu == NULL ) { // normal menu item
75 // TODO
76 }
77 else // submenu
78 {
79 // TODO
80 }
81
82 m_bEnabled = bDoEnable;
83 }
84}
85
86void wxMenuItem::Check(bool bDoCheck)
87{
88 wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
89
90 if ( m_bChecked != bDoCheck ) {
91 // TODO
92 m_bChecked = bDoCheck;
93 }