X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bda0e173844e8e0f8acf4e8ad8b5c26e5c6fe5d..42ff6409d9aff9ba1b771842a256feaeb40e28cd:/src/msw/combobox.cpp diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 5c7888dab5..01a8df28be 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -24,7 +24,7 @@ #include "wx/setup.h" #endif -#if USE_COMBOBOX +#if wxUSE_COMBOBOX #include "wx/combobox.h" #include "wx/clipbrd.h" @@ -34,11 +34,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) #endif -bool wxComboBox::MSWCommand(const WXUINT param, const WXWORD WXUNUSED(id)) +bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { if (param == CBN_SELCHANGE) { - wxCommandEvent event(wxEVENT_TYPE_COMBOBOX_COMMAND, m_windowId); + wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId); event.SetInt(GetSelection()); event.SetEventObject(this); event.SetString(copystring(GetStringSelection())); @@ -46,15 +46,24 @@ bool wxComboBox::MSWCommand(const WXUINT param, const WXWORD WXUNUSED(id)) delete[] event.GetString(); return TRUE; } + else if (param == CBN_EDITCHANGE) + { + wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); + event.SetString(copystring(GetValue())); + event.SetEventObject(this); + ProcessCommand(event); + delete[] event.GetString(); + return TRUE; + } else return FALSE; } -bool wxComboBox::Create(wxWindow *parent, const wxWindowID id, +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, - const int n, const wxString choices[], - const long style, + int n, const wxString choices[], + long style, const wxValidator& validator, const wxString& name) { @@ -63,7 +72,7 @@ bool wxComboBox::Create(wxWindow *parent, const wxWindowID id, if (parent) parent->AddChild(this); SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; SetForegroundColour(parent->GetDefaultForegroundColour()) ; - no_strings = n; + m_noStrings = n; m_windowStyle = style; @@ -130,10 +139,9 @@ bool wxComboBox::Create(wxWindow *parent, const wxWindowID id, return TRUE; } -wxString wxComboBox::GetValue(void) const +wxString wxComboBox::GetValue() const { - GetWindowText((HWND) GetHWND(), wxBuffer, 500); - return wxString(wxBuffer); + return wxGetWindowText(GetHWND()); } void wxComboBox::SetValue(const wxString& value) @@ -170,32 +178,32 @@ void wxComboBox::SetValue(const wxString& value) } // Clipboard operations -void wxComboBox::Copy(void) +void wxComboBox::Copy() { HWND hWnd = (HWND) GetHWND(); SendMessage(hWnd, WM_COPY, 0, 0L); } -void wxComboBox::Cut(void) +void wxComboBox::Cut() { HWND hWnd = (HWND) GetHWND(); SendMessage(hWnd, WM_CUT, 0, 0L); } -void wxComboBox::Paste(void) +void wxComboBox::Paste() { HWND hWnd = (HWND) GetHWND(); SendMessage(hWnd, WM_PASTE, 0, 0L); } -void wxComboBox::SetEditable(const bool editable) +void wxComboBox::SetEditable(bool editable) { // Can't implement in MSW? // HWND hWnd = (HWND) GetHWND(); // SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L); } -void wxComboBox::SetInsertionPoint(const long pos) +void wxComboBox::SetInsertionPoint(long pos) { /* HWND hWnd = (HWND) GetHWND(); @@ -210,7 +218,7 @@ void wxComboBox::SetInsertionPoint(const long pos) */ } -void wxComboBox::SetInsertionPointEnd(void) +void wxComboBox::SetInsertionPointEnd() { /* long pos = GetLastPosition(); @@ -218,7 +226,7 @@ void wxComboBox::SetInsertionPointEnd(void) */ } -long wxComboBox::GetInsertionPoint(void) const +long wxComboBox::GetInsertionPoint() const { /* DWORD Pos=(DWORD)SendMessage((HWND) GetHWND(), EM_GETSEL, 0, 0L); @@ -227,7 +235,7 @@ long wxComboBox::GetInsertionPoint(void) const return 0; } -long wxComboBox::GetLastPosition(void) const +long wxComboBox::GetLastPosition() const { /* HWND hWnd = (HWND) GetHWND(); @@ -247,9 +255,9 @@ long wxComboBox::GetLastPosition(void) const return 0; } -void wxComboBox::Replace(const long from, const long to, const wxString& value) +void wxComboBox::Replace(long from, long to, const wxString& value) { -#if USE_CLIPBOARD +#if wxUSE_CLIPBOARD HWND hWnd = (HWND) GetHWND(); long fromChar = from; long toChar = to; @@ -263,14 +271,14 @@ void wxComboBox::Replace(const long from, const long to, const wxString& value) SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0); // Now replace with 'value', by pasting. - wxSetClipboardData(wxCF_TEXT, (wxObject *)(const char *)value, 0, 0); + wxSetClipboardData(wxDF_TEXT, (wxObject *)(const char *)value, 0, 0); // Paste into edit control SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L); #endif } -void wxComboBox::Remove(const long from, const long to) +void wxComboBox::Remove(long from, long to) { HWND hWnd = (HWND) GetHWND(); long fromChar = from; @@ -285,7 +293,7 @@ void wxComboBox::Remove(const long from, const long to) SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0); } -void wxComboBox::SetSelection(const long from, const long to) +void wxComboBox::SetSelection(long from, long to) { HWND hWnd = (HWND) GetHWND(); long fromChar = from; @@ -309,5 +317,5 @@ void wxComboBox::SetSelection(const long from, const long to) } #endif - // USE_COMBOBOX + // wxUSE_COMBOBOX