]> git.saurik.com Git - wxWidgets.git/commitdiff
no message
authorDavid Webster <Dave.Webster@bhmi.com>
Mon, 25 Mar 2002 05:39:07 +0000 (05:39 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Mon, 25 Mar 2002 05:39:07 +0000 (05:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/os2/bitmap.cpp
src/os2/menu.cpp
src/os2/menuitem.cpp
src/os2/wx23.def

index 9ce09578e53c5007bb305b0a12c67bb7125aae3f..285a736eda2e9345453b4de5e3f9918f0b655977 100644 (file)
@@ -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);
index fa4a093a6bc035b5f778724c01b7127ee92824a8..2ed0039e5a644fc6a10026dbdb5fbfc6430a3436 100644 (file)
@@ -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
index 9b5bc2fed425ee3de751cf36bc28149d5c9c3749..3c065c11fd96d1796236b6f4fa8c555092ff0e57 100644 (file)
@@ -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
index d479372745acc27b1219824ac6f9146d9ce46951..a6e79a5ea24ac17fbfa695b3e72547805adf3968 100644 (file)
@@ -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