X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/150e31d2088687cbfbab548f9e98918f8683d9b5..132422c4b93a0fe5d4f313350adf2c13423c07ac:/src/mac/carbon/combobox.cpp diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 070285404f..110daa1c21 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -9,10 +9,14 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "combobox.h" #endif +#include "wx/wxprec.h" + +#if wxUSE_COMBOBOX + #include "wx/combobox.h" #include "wx/button.h" #include "wx/menu.h" @@ -68,18 +72,18 @@ public: protected: void OnChar( wxKeyEvent& event ) { - // Allows processing the tab key to go to the next control - if (event.GetKeyCode() == WXK_TAB) - { - wxNavigationKeyEvent NavEvent; - NavEvent.SetEventObject(this); - NavEvent.SetDirection(true); - NavEvent.SetWindowChange(false); - - // Get the parent of the combo and have it process the navigation? - if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent)) + // Allows processing the tab key to go to the next control + if (event.GetKeyCode() == WXK_TAB) + { + wxNavigationKeyEvent NavEvent; + NavEvent.SetEventObject(this); + NavEvent.SetDirection(true); + NavEvent.SetWindowChange(false); + + // Get the parent of the combo and have it process the navigation? + if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent)) return; - } + } if ( event.GetKeyCode() == WXK_RETURN ) { wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId()); @@ -119,7 +123,7 @@ protected: // but this is less complicated than dealing with idle-ness, and is much better than nothing void OnKeyUp( wxKeyEvent& event ) { - if ( event.GetKeyCode() != WXK_RETURN ) + if ( event.GetKeyCode() != WXK_RETURN && event.GetKeyCode() != WXK_TAB ) { wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_cb->GetId()); event.SetString( GetValue() ); @@ -269,17 +273,17 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) bool wxComboBox::Enable(bool enable) { if ( !wxControl::Enable(enable) ) - return FALSE; + return false; - return TRUE; + return true; } bool wxComboBox::Show(bool show) { if ( !wxControl::Show(show) ) - return FALSE; + return false; - return TRUE; + return true; } void wxComboBox::SetFocus() @@ -330,7 +334,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , wxDefaultValidator, name) ) { - return FALSE; + return false; } m_choice = new wxComboBoxChoice(this, style ); @@ -357,8 +361,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, } SetBestSize(size); // Needed because it is a wxControlWithItems - - return TRUE; + SetStringSelection(value); + + return true; } wxString wxComboBox::GetValue() const @@ -452,7 +457,7 @@ long wxComboBox::GetInsertionPoint() const return 0; } -long wxComboBox::GetLastPosition() const +wxTextPos wxComboBox::GetLastPosition() const { // TODO return 0; @@ -563,18 +568,6 @@ wxString wxComboBox::GetStringSelection() const return wxEmptyString; } -bool wxComboBox::SetStringSelection(const wxString& sel) -{ - int s = FindString (sel); - if (s > -1) - { - SetSelection (s); - return TRUE; - } - else - return FALSE; -} - void wxComboBox::SetString(int n, const wxString& s) { m_choice->SetString( n , s ) ; @@ -582,7 +575,7 @@ void wxComboBox::SetString(int n, const wxString& s) bool wxComboBox::IsEditable() const { - return m_text != NULL && !HasFlag(wxCB_READONLY); + return m_text != NULL && !HasFlag(wxCB_READONLY); } void wxComboBox::Undo() @@ -654,3 +647,4 @@ wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR return noErr ; } +#endif