]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/choice.cpp
fixed compilation problem with old gcc releases
[wxWidgets.git] / src / os2 / choice.cpp
index 0597080b722f910dd4f710f891167e841bf5da78..a1cdd262b1e2ed85a35cf333337d6995a404a235 100644 (file)
@@ -16,6 +16,7 @@
     #include "wx/choice.h"
     #include "wx/utils.h"
     #include "wx/log.h"
+    #include "wx/settings.h"
 #endif
 
 #include "wx/os2/private.h"
@@ -38,20 +39,20 @@ bool wxChoice::Create(
 {
     long                            lSstyle;
 
-    if (!OS2CreateControl( pParent
-                          ,vId
-                          ,rPos
-                          ,rSize
-                          ,lStyle
+    if (!CreateControl( pParent
+                       ,vId
+                       ,rPos
+                       ,rSize
+                       ,lStyle
 #if wxUSE_VALIDATORS
-                          ,rValidator
+                       ,rValidator
 #endif
-                          ,rsName
-                         ))
+                       ,rsName
+                      ))
         return FALSE;
     lSstyle = CBS_DROPDOWNLIST |
-             WS_TABSTOP       |
-             WS_VISIBLE;
+              WS_TABSTOP       |
+              WS_VISIBLE;
 
     if (lStyle & wxCLIP_SIBLINGS )
         lSstyle |= WS_CLIPSIBLINGS;
@@ -71,17 +72,23 @@ bool wxChoice::Create(
     // A choice/combobox normally has a white background (or other, depending
     // on global settings) rather than inheriting the parent's background colour.
     //
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
     for (int i = 0; i < n; i++)
     {
         Append(asChoices[i]);
     }
+    wxFont*                          pTextFont = new wxFont( 10
+                                                            ,wxMODERN
+                                                            ,wxNORMAL
+                                                            ,wxNORMAL
+                                                           );
+    SetFont(*pTextFont);
     SetSize( rPos.x
             ,rPos.y
             ,rSize.x
             ,rSize.y
            );
-
+    delete pTextFont;
     return TRUE;
 } // end of wxChoice::Create
 
@@ -181,12 +188,19 @@ void wxChoice::SetString(
 , const wxString&                   rsStr
 )
 {
-    wxFAIL_MSG(wxT("not implemented"));
+    SHORT                           nIndexType = 0;
 
-#if 0 // should do this, but no Insert() so far
-    Delete(n);
-    Insert(n + 1, s);
-#endif
+    ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0);
+
+    if (m_windowStyle & wxLB_SORT)
+        nIndexType = LIT_SORTASCENDING;
+    else
+        nIndexType = LIT_END;
+    ::WinSendMsg( GetHwnd()
+                 ,LM_INSERTITEM
+                 ,(MPARAM)nIndexType
+                 ,(MPARAM)rsStr.c_str()
+                );
 } // end of wxChoice::SetString
 
 wxString wxChoice::GetString(