wxMenuItem* pItem
)
{
- return wxMenuBase::DoAppend(pItem) && DoInsertOrAppend(pItem);
-}
+ wxCHECK_MSG( pItem, FALSE, _T("NULL item in wxMenu::DoAppend") );
+
+ bool bCheck = FALSE;
+
+ if (pItem->GetKind() == wxITEM_RADIO)
+ {
+ int nCount = GetMenuItemCount();
+
+ if (m_lStartRadioGroup == -1)
+ {
+ //
+ // Start a new radio group
+ //
+ m_lStartRadioGroup = lCount;
+
+ //
+ // For now it has just one element
+ //
+ pItem->SetAsRadioGroupStart();
+ pItem->SetRadioGroupEnd(m_startRadioGroup);
+
+ //
+ // Ensure that we have a checked item in the radio group
+ //
+ bCheck = TRUE;
+ }
+ else // extend the current radio group
+ {
+ //
+ // We need to update its end item
+ //
+ pItem->SetRadioGroupStart(m_lStartRadioGroup);
+ wxMenuItemList::Node *node = GetMenuItems().Item(m_startRadioGroup);
+
+ if (node)
+ {
+ node->GetData()->SetRadioGroupEnd(count);
+ }
+ else
+ {
+ wxFAIL_MSG( _T("where is the radio group start item?") );
+ }
+ }
+ }
+ else // not a radio item
+ {
+ EndRadioGroup();
+ }
+ if (!wxMenuBase::DoAppend(pItem) || !DoInsertOrAppend(pItem))
+ {
+ return FALSE;
+ }
+ if (bCheck)
+ {
+ pItem->Check(TRUE);
+ }
+ return TRUE;
+} // end of wxMenu::DoInsert
bool wxMenu::DoInsert(
size_t nPos
{
wxASSERT_MSG(pParentMenu != NULL, wxT("a menu item should have a parent"));
-#if wxUSE_OWNER_DRAWN
+ Init();
+} // end of wxMenuItem::wxMenuItem
- //
- // Set default menu colors
- //
+wxMenuItem::wxMenuItem(
+ wxMenu* pParentMenu
+, int nId
+, const wxString& rText
+, const wxString& rStrHelp
+, bool bIsCheckable
+, wxMenu* pSubMenu
+)
+: wxMenuItemBase(pParentMenu, nId, rText, rStrHelp, bIsCheckable ? kITEM_CHECK : kITEM_NORMAL, pSubMenu)
+#if wxUSE_OWNER_DRAWN
+, wxOwnerDrawn( TextToLabel(rText)
+ ,bCheckable
+ )
+#endif // owner drawn
+{
+ wxASSERT_MSG(pParentMenu != NULL, wxT("a menu item should have a parent"));
+
+ Init();
+} // end of wxMenuItem::wxMenuItem
+
+void wxMenuItem::Init()
+{
+ m_radioGroup.start = -1;
+ m_isRadioGroupStart = FALSE;
+
+#if wxUSE_OWNER_DRAWN
+ // set default menu colors
#define SYS_COLOR(c) (wxSystemSettings::GetColour(wxSYS_COLOUR_##c))
SetTextColour(SYS_COLOR(MENUTEXT));
SetBackgroundColour(SYS_COLOR(MENU));
- //
- // We don't want normal items be owner-drawn
- //
- ResetOwnerDrawn();
-
#undef SYS_COLOR
-#endif // wxUSE_OWNER_DRAWN
- m_text = TextToLabel(rText);
+ // we don't want normal items be owner-drawn
+ ResetOwnerDrawn();
- memset(&m_vMenuData, '\0', sizeof(m_vMenuData));
- m_vMenuData.id= nId;
-} // end of wxMenuItem::wxMenuItem
+ // tell the owner drawing code to to show the accel string as well
+ SetAccelString(m_text.AfterFirst(_T('\t')));
+#endif // wxUSE_OWNER_DRAWN
+}
wxMenuItem::~wxMenuItem()
{
return label;
}
+// radio group stuff
+// -----------------
+
+void wxMenuItem::SetAsRadioGroupStart()
+{
+ m_bIsRadioGroupStart = TRUE;
+} // end of wxMenuItem::SetAsRadioGroupStart
+
+void wxMenuItem::SetRadioGroupStart(
+ int nStart
+)
+{
+ wxASSERT_MSG( !m_bIsRadioGroupStart,
+ _T("should only be called for the next radio items") );
+
+ m_vRadioGroup.m_nStart = nStart;
+} // end of wxMenuItem::SetRadioGroupStart
+
+void wxMenuItem::SetRadioGroupEnd(
+ int nEnd
+)
+{
+ wxASSERT_MSG( m_bIsRadioGroupStart,
+ _T("should only be called for the first radio item") );
+
+ m_vRadioGroup.m_nEnd = nEnd;
+} // end of wxMenuItem::SetRadioGroupEnd
+
// change item state
// -----------------
wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
if (m_isChecked == bCheck)
return;
+
if (bCheck)
bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
,MM_SETITEMATTR
CODE LOADONCALL
EXPORTS
-;From library: H:\dev\wx2\wxwindows\lib\wx.lib
+;From library: F:\DEV\WX2\WXWINDOWS\LIB\wx.lib
;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file):
wxDummyChar
wxEVT_NC_LEFT_DCLICK
wxEVT_INIT_DIALOG
wxEVT_COMMAND_SET_FOCUS
- ;From object file: H:\DEV\WX2\WXWINDOWS\src\common\extended.c
+ ;From object file: F:\DEV\WX2\WXWINDOWS\src\common\extended.c
;PUBDEFs (Symbols available from object file):
ConvertToIeeeExtended
ConvertFromIeeeExtended
LoadFile__12wxXPMHandlerFP7wxImageR13wxInputStreamUli
;From object file: ..\common\intl.cpp
;PUBDEFs (Symbols available from object file):
+ ;wxMsgCatalogFile::FillHash(wxMessagesHash&,unsigned long) const
+ FillHash__16wxMsgCatalogFileCFR14wxMessagesHashUl
;wxLocale::Init(int,int)
Init__8wxLocaleFiT1
;wxLocaleModule::sm_classwxLocaleModule
sm_classwxLocaleModule__14wxLocaleModule
;wxLanguageInfoArray::Insert(const wxLanguageInfo&,unsigned int)
Insert__19wxLanguageInfoArrayFRC14wxLanguageInfoUi
- ;wxMsgCatalog::wxMsgCatalog()
- __ct__12wxMsgCatalogFv
+ ;wxLocale::GetSystemEncoding()
+ GetSystemEncoding__8wxLocaleFv
;wxLocale::~wxLocale()
__dt__8wxLocaleFv
;wxLocale::GetSystemLanguage()
GetSystemLanguage__8wxLocaleFv
- ;wxLocale::GetSystemEncoding()
- GetSystemEncoding__8wxLocaleFv
;wxLocale::CreateLanguagesDB()
CreateLanguagesDB__8wxLocaleFv
;wxLanguageInfoArray::Index(const wxLanguageInfo&,unsigned long) const
Index__19wxLanguageInfoArrayCFRC14wxLanguageInfoUl
;wxLanguageInfoArray::wxLanguageInfoArray(const wxLanguageInfoArray&)
__ct__19wxLanguageInfoArrayFRC19wxLanguageInfoArray
- ;wxMsgCatalog::~wxMsgCatalog()
- __dt__12wxMsgCatalogFv
+ ;wxMsgCatalogFile::~wxMsgCatalogFile()
+ __dt__16wxMsgCatalogFileFv
;wxConstructorForwxLocaleModule()
wxConstructorForwxLocaleModule__Fv
;wxLocale::GetSysName() const
GetSysName__8wxLocaleCFv
;wxLanguageInfoArray::DoEmpty()
DoEmpty__19wxLanguageInfoArrayFv
- ;wxMsgCatalog::ConvertEncoding()
- ConvertEncoding__12wxMsgCatalogFv
;wxLocale::AddCatalog(const char*)
AddCatalog__8wxLocaleFPCc
;wxMsgCatalog::Load(const char*,const char*,unsigned long)
Load__12wxMsgCatalogFPCcT1Ul
- ;wxLocale::InitLanguagesDB()
- InitLanguagesDB__8wxLocaleFv
+ ;wxMsgCatalogFile::wxMsgCatalogFile()
+ __ct__16wxMsgCatalogFileFv
;wxLocale::wxLocale()
__ct__8wxLocaleFv
+ ;wxLocale::InitLanguagesDB()
+ InitLanguagesDB__8wxLocaleFv
;wxLocale::GetSystemEncodingName()
GetSystemEncodingName__8wxLocaleFv
;wxLanguageInfoArray::Add(const wxLanguageInfo&)
GetString__8wxLocaleCFPCcT1
;wxLocale::ms_languagesDB
ms_languagesDB__8wxLocale
+ ;wxMsgCatalogFile::Load(const char*,const char*)
+ Load__16wxMsgCatalogFileFPCcT1
;wxGetLocale()
wxGetLocale__Fv
;NoTransErr::ms_suppressCount
ms_suppressCount__10NoTransErr
;wxLanguageInfoArray::~wxLanguageInfoArray()
__dt__19wxLanguageInfoArrayFv
+ ;wxMsgCatalogFile::GetCharset() const
+ GetCharset__16wxMsgCatalogFileCFv
;wxLocale::DestroyLanguagesDB()
DestroyLanguagesDB__8wxLocaleFv
;wxMsgCatalog::GetString(const char*) const
__as__19wxLanguageInfoArrayFRC19wxLanguageInfoArray
;wxLanguageInfoArray::RemoveAt(unsigned int)
RemoveAt__19wxLanguageInfoArrayFUi
- ;wxMsgCatalog::GetHash(const char*)
- GetHash__12wxMsgCatalogFPCc
- ;wxLocale::IsLoaded(const char*) const
- IsLoaded__8wxLocaleCFPCc
;wxLocale::AddCatalogLookupPathPrefix(const wxString&)
AddCatalogLookupPathPrefix__8wxLocaleFRC8wxString
+ ;wxLocale::IsLoaded(const char*) const
+ IsLoaded__8wxLocaleCFPCc
;From object file: ..\common\ipcbase.cpp
;PUBDEFs (Symbols available from object file):
;wxConnectionBase::sm_classwxConnectionBase
Read32__17wxTextInputStreamFv
;wxTextInputStream::SkipIfEndOfLine(char)
SkipIfEndOfLine__17wxTextInputStreamFc
- ;From object file: H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
+ ;From object file: F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
;PUBDEFs (Symbols available from object file):
unzReadCurrentFile
unzGetCurrentFileInfo