// License: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
-
// ============================================================================
// declarations
// ============================================================================
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "choicece.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
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
// ----------------------------------------------------------------------------
if ( style & wxSP_WRAP )
spiner_style |= UDS_WRAP;
- if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, _T(""), 0) )
+ if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxEmptyString, 0) )
return false;
// subclass the text ctrl to be able to intercept some events
if ( style & wxCB_SORT )
msStyle |= LBS_SORT;
+ msStyle |= LBS_NOTIFY;
+
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();
return (int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0);
}
-int wxChoice::FindString(const wxString& s) const
+int wxChoice::FindString(const wxString& s, bool bCase) const
{
+ // back to base class search for not native search type
+ if (bCase)
+ return wxItemContainerImmutable::FindString( s, bCase );
+
int pos = (int)::SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT,
(WPARAM)-1, (LPARAM)s.c_str());