1999-07-29 01:11:30 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: menuitem.h
|
|
|
|
// Purpose: wxMenuItem class
|
|
|
|
// Author: Vadim Zeitlin
|
1999-10-10 22:49:06 -04:00
|
|
|
// Modified by:
|
1999-07-29 01:11:30 -04:00
|
|
|
// Created: 11.11.97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _MENUITEM_H
|
|
|
|
#define _MENUITEM_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "menuitem.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "wx/setup.h"
|
|
|
|
|
|
|
|
// an exception to the general rule that a normal header doesn't include other
|
|
|
|
// headers - only because ownerdrw.h is not always included and I don't want
|
|
|
|
// to write #ifdef's everywhere...
|
|
|
|
#if wxUSE_OWNER_DRAWN
|
1999-10-10 22:49:06 -04:00
|
|
|
#include "wx/ownerdrw.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-11-01 23:38:14 -05:00
|
|
|
class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
|
1999-07-29 01:11:30 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
|
|
|
, public wxOwnerDrawn
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
public:
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
1999-11-01 23:38:14 -05:00
|
|
|
// ctor & dtor
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
2000-02-29 18:18:42 -05:00
|
|
|
wxMenuItem( wxMenu* pParentMenu = NULL
|
2000-03-10 15:55:15 -05:00
|
|
|
,int nId = wxID_SEPARATOR
|
2000-02-29 18:18:42 -05:00
|
|
|
,const wxString& rStrName = ""
|
|
|
|
,const wxString& rWxHelp = ""
|
2002-04-14 23:31:42 -04:00
|
|
|
,wxItemKind eKind = wxITEM_NORMAL
|
2000-02-29 18:18:42 -05:00
|
|
|
,wxMenu* pSubMenu = NULL
|
|
|
|
);
|
2002-03-25 13:06:12 -05:00
|
|
|
|
|
|
|
//
|
|
|
|
// Depricated, do not use in new code
|
|
|
|
//
|
|
|
|
wxMenuItem( wxMenu* pParentMenu
|
|
|
|
,int vId
|
|
|
|
,const wxString& rsText
|
|
|
|
,const wxString& rsHelp
|
|
|
|
,bool bIsCheckable
|
|
|
|
,wxMenu* pSubMenu = (wxMenu *)NULL
|
|
|
|
);
|
1999-11-01 23:38:14 -05:00
|
|
|
virtual ~wxMenuItem();
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
|
|
|
// Override base class virtuals
|
|
|
|
//
|
2000-02-29 18:18:42 -05:00
|
|
|
virtual void SetText(const wxString& rStrName);
|
|
|
|
virtual void SetCheckable(bool bCheckable);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-11-01 23:38:14 -05:00
|
|
|
virtual void Enable(bool bDoEnable = TRUE);
|
|
|
|
virtual void Check(bool bDoCheck = TRUE);
|
2000-02-29 18:18:42 -05:00
|
|
|
virtual bool IsChecked(void) const;
|
1999-10-10 22:49:06 -04:00
|
|
|
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
|
|
|
// Unfortunately needed to resolve ambiguity between
|
1999-11-01 23:38:14 -05:00
|
|
|
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
2000-02-29 18:18:42 -05:00
|
|
|
bool IsCheckable(void) const { return wxMenuItemBase::IsCheckable(); }
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
|
|
|
// The id for a popup menu is really its menu handle (as required by
|
1999-11-01 23:38:14 -05:00
|
|
|
// ::AppendMenu() API), so this function will return either the id or the
|
|
|
|
// menu handle depending on what we're
|
2002-03-25 13:06:12 -05:00
|
|
|
//
|
2000-02-29 18:18:42 -05:00
|
|
|
int GetRealId(void) const;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-04-14 23:31:42 -04:00
|
|
|
//
|
|
|
|
// Mark item as belonging to the given radio group
|
|
|
|
//
|
2002-03-25 13:06:12 -05:00
|
|
|
void SetAsRadioGroupStart(void);
|
|
|
|
void SetRadioGroupStart(int nStart);
|
|
|
|
void SetRadioGroupEnd(int nEnd);
|
|
|
|
|
2000-03-07 16:26:54 -05:00
|
|
|
//
|
|
|
|
// All OS/2PM Submenus and menus have one of these
|
|
|
|
//
|
|
|
|
MENUITEM m_vMenuData;
|
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
private:
|
2002-03-25 13:06:12 -05:00
|
|
|
void Init();
|
|
|
|
|
|
|
|
//
|
|
|
|
// The positions of the first and last items of the radio group this item
|
|
|
|
// belongs to or -1: start is the radio group start and is valid for all
|
|
|
|
// but first radio group items (m_isRadioGroupStart == FALSE), end is valid
|
|
|
|
// only for the first one
|
|
|
|
//
|
|
|
|
union
|
|
|
|
{
|
|
|
|
int m_nStart;
|
|
|
|
int m_nEnd;
|
2002-04-14 23:31:42 -04:00
|
|
|
} m_vRadioGroup;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Does this item start a radio group?
|
|
|
|
//
|
2002-03-25 13:06:12 -05:00
|
|
|
bool m_bIsRadioGroupStart;
|
2002-04-14 23:31:42 -04:00
|
|
|
|
1999-11-01 23:38:14 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
2000-02-29 18:18:42 -05:00
|
|
|
}; // end of CLASS wxMenuItem
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
#endif //_MENUITEM_H
|