]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/wince/choicece.cpp
another compilation fix after wxMenuBar ctor patch
[wxWidgets.git] / src / msw / wince / choicece.cpp
index 231b96e90f9da40e31c8d0a348176352b570aabf..397ba4ec1403ec0f87cffbb3c4ef63451a23a97d 100644 (file)
@@ -109,6 +109,22 @@ LRESULT APIENTRY _EXPORT wxBuddyChoiceWndProc(HWND hwnd,
                             hwnd, message, wParam, lParam);
 }
 
                             hwnd, message, wParam, lParam);
 }
 
+wxChoice *wxChoice::GetChoiceForListBox(WXHWND hwndBuddy)
+{
+    wxChoice *choice = (wxChoice *)wxGetWindowUserData((HWND)hwndBuddy);
+
+    int i = ms_allChoiceSpins.Index(choice);
+
+    if ( i == wxNOT_FOUND )
+        return NULL;
+
+    // sanity check
+    wxASSERT_MSG( choice->m_hwndBuddy == hwndBuddy,
+                  _T("wxChoice has incorrect buddy HWND!") );
+
+    return choice;
+}
+
 // ----------------------------------------------------------------------------
 // creation
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // creation
 // ----------------------------------------------------------------------------
@@ -284,9 +300,36 @@ WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const
     if ( style & wxCB_SORT )
         msStyle |= LBS_SORT;
 
     if ( style & wxCB_SORT )
         msStyle |= LBS_SORT;
 
+    msStyle |= LBS_NOTIFY;
+
     return msStyle;
 }
 
     return msStyle;
 }
 
+bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
+{
+    if ( param != LBN_SELCHANGE)
+    {
+        // "selection changed" is the only event we're after
+        return false;
+    }
+
+    int n = GetSelection();
+    if (n > -1)
+    {
+        wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
+        event.SetInt(n);
+        event.SetEventObject(this);
+        event.SetString(GetStringSelection());
+        if ( HasClientObjectData() )
+            event.SetClientObject( GetClientObject(n) );
+        else if ( HasClientUntypedData() )
+            event.SetClientData( GetClientData(n) );
+        ProcessCommand(event);
+    }
+
+    return true;
+}
+
 wxChoice::~wxChoice()
 {
     Free();
 wxChoice::~wxChoice()
 {
     Free();