1998-09-18 17:36:20 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: menuitem.h
|
|
|
|
// Purpose: wxMenuItem class
|
|
|
|
// Author: Vadim Zeitlin
|
1999-03-24 14:05:19 -05:00
|
|
|
// Modified by:
|
1998-09-18 17:36:20 -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
|
1998-09-18 17:36:20 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _MENUITEM_H
|
|
|
|
#define _MENUITEM_H
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
1999-10-25 11:51:37 -04:00
|
|
|
#include "wx/ownerdrw.h" // base class
|
1998-09-18 17:36:20 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-10-25 11:51:37 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxMenuItem : public wxMenuItemBase
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
1999-10-25 11:51:37 -04:00
|
|
|
, public wxOwnerDrawn
|
1998-09-18 17:36:20 -04:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
public:
|
1999-10-25 11:51:37 -04:00
|
|
|
// ctor & dtor
|
|
|
|
wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
|
|
|
|
int id = wxID_SEPARATOR,
|
|
|
|
const wxString& name = wxEmptyString,
|
|
|
|
const wxString& help = wxEmptyString,
|
2002-03-22 14:18:51 -05:00
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
1999-10-25 11:51:37 -04:00
|
|
|
wxMenu *subMenu = (wxMenu *)NULL);
|
|
|
|
virtual ~wxMenuItem();
|
|
|
|
|
|
|
|
// override base class virtuals
|
|
|
|
virtual void SetText(const wxString& strName);
|
|
|
|
virtual void SetCheckable(bool checkable);
|
|
|
|
|
2004-08-30 06:18:55 -04:00
|
|
|
virtual void Enable(bool bDoEnable = true);
|
|
|
|
virtual void Check(bool bDoCheck = true);
|
1999-10-26 15:35:25 -04:00
|
|
|
virtual bool IsChecked() const;
|
1999-10-25 11:51:37 -04:00
|
|
|
|
|
|
|
// unfortunately needed to resolve ambiguity between
|
|
|
|
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
|
|
|
|
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
|
|
|
|
|
|
|
|
// the id for a popup menu is really its menu handle (as required by
|
|
|
|
// ::AppendMenu() API), so this function will return either the id or the
|
|
|
|
// menu handle depending on what we're
|
|
|
|
int GetRealId() const;
|
|
|
|
|
2002-03-20 21:35:08 -05:00
|
|
|
// mark item as belonging to the given radio group
|
2002-03-23 20:24:16 -05:00
|
|
|
void SetAsRadioGroupStart();
|
|
|
|
void SetRadioGroupStart(int start);
|
|
|
|
void SetRadioGroupEnd(int end);
|
2002-03-20 21:35:08 -05:00
|
|
|
|
2002-03-22 20:23:11 -05: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);
|
|
|
|
|
1998-09-18 17:36:20 -04:00
|
|
|
private:
|
2002-03-22 20:23:11 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2002-03-20 21:35:08 -05:00
|
|
|
// the positions of the first and last items of the radio group this item
|
2002-03-23 20:24:16 -05:00
|
|
|
// belongs to or -1: start is the radio group start and is valid for all
|
2004-08-30 06:18:55 -04:00
|
|
|
// but first radio group items (m_isRadioGroupStart == false), end is valid
|
2002-03-23 20:24:16 -05:00
|
|
|
// only for the first one
|
|
|
|
union
|
|
|
|
{
|
|
|
|
int start;
|
|
|
|
int end;
|
|
|
|
} m_radioGroup;
|
|
|
|
|
|
|
|
// does this item start a radio group?
|
|
|
|
bool m_isRadioGroupStart;
|
2002-03-20 21:35:08 -05:00
|
|
|
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem)
|
1998-09-18 17:36:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //_MENUITEM_H
|