From f95255e2e7e617ffc48d9d83c6aa1f922ea85b8d Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 25 Mar 2002 05:39:07 +0000 Subject: [PATCH] no message git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/bitmap.cpp | 4 +-- src/os2/menu.cpp | 60 ++++++++++++++++++++++++++++++++-- src/os2/menuitem.cpp | 78 ++++++++++++++++++++++++++++++++++++-------- src/os2/wx23.def | 36 ++++++++++---------- 4 files changed, 143 insertions(+), 35 deletions(-) diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp index 9ce09578e5..285a736eda 100644 --- a/src/os2/bitmap.cpp +++ b/src/os2/bitmap.cpp @@ -384,7 +384,7 @@ bool wxBitmap::LoadFile( if (!vImage.LoadFile(rFilename, lType) || !vImage.Ok() ) return(FALSE); - *this = vImage.ConvertToBitmap(); + *this = wxBitmap(vImage); return(TRUE); } @@ -444,7 +444,7 @@ bool wxBitmap::SaveFile( else { // FIXME what about palette? shouldn't we use it? - wxImage vImage(*this); + wxImage vImage = ConvertToImage(); if (!vImage.Ok()) return(FALSE); diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp index fa4a093a6b..2ed0039e5a 100644 --- a/src/os2/menu.cpp +++ b/src/os2/menu.cpp @@ -398,8 +398,64 @@ bool wxMenu::DoAppend( 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 diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp index 9b5bc2fed4..3c065c11fd 100644 --- a/src/os2/menuitem.cpp +++ b/src/os2/menuitem.cpp @@ -122,29 +122,50 @@ wxMenuItem::wxMenuItem( { 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() { @@ -195,6 +216,34 @@ wxString wxMenuItemBase::GetLabelFromText( 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 // ----------------- @@ -234,6 +283,7 @@ void wxMenuItem::Check( 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 diff --git a/src/os2/wx23.def b/src/os2/wx23.def index d479372745..a6e79a5ea2 100644 --- a/src/os2/wx23.def +++ b/src/os2/wx23.def @@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL 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 @@ -1878,7 +1878,7 @@ EXPORTS 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 @@ -3334,44 +3334,44 @@ EXPORTS 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&) @@ -3384,12 +3384,16 @@ EXPORTS 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 @@ -3402,12 +3406,10 @@ EXPORTS __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 @@ -5929,7 +5931,7 @@ EXPORTS 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 -- 2.45.2