wxWidgets/include/wx/univ/menuitem.h
Vadim Zeitlin d65c269b3f 1. implemented radio menu items for wxGTK
2. changed (in most cases blindly) code for all the others
3. added wx/features.h
4. update wxMenu[Item] docs

----------------------------------------------------------------------
Committing in .

Modified Files:
	distrib/msw/tmake/filelist.txt docs/changes.txt
	docs/latex/wx/menu.tex docs/latex/wx/menuitem.tex
	include/wx/defs.h include/wx/menu.h include/wx/menuitem.h
	include/wx/gtk/menu.h include/wx/gtk/menuitem.h
	include/wx/mac/menuitem.h include/wx/motif/menuitem.h
	include/wx/msw/menuitem.h include/wx/os2/MENUITEM.H
	include/wx/univ/menuitem.h samples/menu/menu.cpp
	src/common/menucmn.cpp src/gtk/menu.cpp src/mac/menuitem.cpp
	src/motif/menuitem.cpp src/msw/menuitem.cpp
	src/os2/MENUITEM.CPP src/univ/menu.cpp
Added Files:
	include/wx/features.h
----------------------------------------------------------------------


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2002-03-18 19:41:35 +00:00

108 lines
3.3 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: wx/univ/menuitem.h
// Purpose: wxMenuItem class for wxUniversal
// Author: Vadim Zeitlin
// Modified by:
// Created: 05.05.01
// RCS-ID: $Id$
// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIV_MENUITEM_H_
#define _WX_UNIV_MENUITEM_H_
#ifdef __GNUG__
#pragma interface "univmenuitem.h"
#endif
// ----------------------------------------------------------------------------
// wxMenuItem implements wxMenuItemBase
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMenuItem : public wxMenuItemBase
{
public:
// ctor & dtor
wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
int id = wxID_SEPARATOR,
const wxString& name = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxItem_Normal,
wxMenu *subMenu = (wxMenu *)NULL);
virtual ~wxMenuItem();
// override base class virtuals to update the item appearance on screen
virtual void SetText(const wxString& text);
virtual void SetCheckable(bool checkable);
virtual void Enable(bool enable = TRUE);
virtual void Check(bool check = TRUE);
// we add some extra functions which are also available under MSW from
// wxOwnerDrawn class - they will be moved to wxMenuItemBase later
// hopefully
void SetBitmaps(const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked = wxNullBitmap);
void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); }
const wxBitmap& GetBitmap(bool checked = TRUE) const
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
// wxUniv-specific methods for implementation only starting from here
// get the accel index of our label or -1 if none
int GetAccelIndex() const { return m_indexAccel; }
// get the accel string (displayed to the right of the label)
const wxString& GetAccelString() const { return m_strAccel; }
// set/get the y coord and the height of this item: note that it must be
// set first and retrieved later, the item doesn't calculate it itself
void SetGeometry(wxCoord y, wxCoord height)
{
m_posY = y;
m_height = height;
}
wxCoord GetPosition() const
{
wxASSERT_MSG( m_posY != -1, _T("must call SetHeight first!") );
return m_posY;
}
wxCoord GetHeight() const
{
wxASSERT_MSG( m_height != -1, _T("must call SetHeight first!") );
return m_height;
}
protected:
// notify the menu about the change in this item
inline void NotifyMenu();
// set the accel index and string from text
void UpdateAccelInfo();
// the bitmaps (may be invalid, then they're not used)
wxBitmap m_bmpChecked,
m_bmpUnchecked;
// the position of the accelerator in our label, -1 if none
int m_indexAccel;
// the accel string (i.e. "Ctrl-Q" or "Alt-F1")
wxString m_strAccel;
// the position and height of the displayed item
wxCoord m_posY,
m_height;
private:
DECLARE_DYNAMIC_CLASS(wxMenuItem)
};
#endif // _WX_UNIV_MENUITEM_H_