X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/150e31d2088687cbfbab548f9e98918f8683d9b5..d059fe4a3c45594273788a502b715567850ac7d4:/src/mac/carbon/combobxc.cpp diff --git a/src/mac/carbon/combobxc.cpp b/src/mac/carbon/combobxc.cpp index b26e9741da..abb642fcde 100644 --- a/src/mac/carbon/combobxc.cpp +++ b/src/mac/carbon/combobxc.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: combobox.cpp +// Name: src/mac/carbon/combobox.cpp // Purpose: wxComboBox class // Author: Stefan Csomor // Modified by: @@ -9,9 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "combobox.h" -#endif +#include "wx/wxprec.h" #include "wx/combobox.h" #include "wx/button.h" @@ -19,13 +17,11 @@ #include "wx/mac/uma.h" #if TARGET_API_MAC_OSX #ifndef __HIVIEW__ - #include + #include #endif #endif -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) -#endif // composite combobox implementation by Dan "Bud" Keith bud@otsys.com @@ -163,7 +159,7 @@ protected: event.SetEventObject(def); def->Command(event); return ; - } + } } return; @@ -217,7 +213,7 @@ private: }; BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice) - EVT_CHOICE(-1, wxComboBoxChoice::OnChoice) + EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice) END_EVENT_TABLE() wxComboBox::~wxComboBox() @@ -246,7 +242,7 @@ wxComboBox::~wxComboBox() wxSize wxComboBox::DoGetBestSize() const { #if USE_HICOMBOBOX - return wxControl::DoGetBestSize(); + return wxControl::DoGetBestSize(); #else wxSize size = m_choice->GetBestSize(); @@ -263,7 +259,7 @@ wxSize wxComboBox::DoGetBestSize() const void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { #if USE_HICOMBOBOX - wxControl::DoMoveWindow(x, y, width, height); + wxControl::DoMoveWindow(x, y, width, height); #else height = POPUPHEIGHT; @@ -273,13 +269,13 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { { // we might not be fully constructed yet, therefore watch out... if ( m_choice ) - m_choice->SetSize(0, 0 , width, -1); + m_choice->SetSize(0, 0 , width, wxDefaultCoord); } else { wxCoord wText = width - POPUPWIDTH - MARGIN; m_text->SetSize(0, 0, wText, height); - m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, -1); + m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord); } #endif } @@ -293,23 +289,23 @@ 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() { #if USE_HICOMBOBOX - wxControl::SetFocus(); + wxControl::SetFocus(); #else if ( m_text != NULL) { m_text->SetFocus(); @@ -358,12 +354,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, m_text = NULL; m_choice = NULL; #if USE_HICOMBOBOX - m_macIsUserPane = FALSE ; + m_macIsUserPane = false ; #endif if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , wxDefaultValidator, name) ) { - return FALSE; + return false; } #if USE_HICOMBOBOX Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; @@ -380,8 +376,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, //hiRect.size.width = bounds.right - bounds.left; //hiRect.size.height = bounds.bottom - bounds.top; //printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom); - //printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height); - m_peer = new wxMacControl() ; + //printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height); + m_peer = new wxMacControl(this) ; verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) ); @@ -417,7 +413,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, else { m_text = new wxComboBoxText(this); - if ( size.y == -1 ) { + if ( size.y == wxDefaultCoord ) { csize.y = m_text->GetSize().y ; } } @@ -431,7 +427,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, SetBestSize(csize); // Needed because it is a wxControlWithItems #endif - return TRUE; + return true; } wxString wxComboBox::GetValue() const @@ -532,7 +528,7 @@ long wxComboBox::GetInsertionPoint() const return 0; } -long wxComboBox::GetLastPosition() const +wxTextPos wxComboBox::GetLastPosition() const { // TODO return 0; @@ -628,9 +624,9 @@ void wxComboBox::FreeData() int wxComboBox::GetCount() const { #if USE_HICOMBOBOX - return (int) HIComboBoxGetItemCount( *m_peer ); + return (int) HIComboBoxGetItemCount( *m_peer ); #else - return m_choice->GetCount() ; + return m_choice->GetCount() ; #endif } @@ -681,17 +677,17 @@ void wxComboBox::SetSelection(int n) #endif } -int wxComboBox::FindString(const wxString& s) const +int wxComboBox::FindString(const wxString& s, bool bCase) const { #if USE_HICOMBOBOX for( int i = 0 ; i < GetCount() ; i++ ) { - if ( GetString( i ).IsSameAs(s, FALSE) ) + if ( GetString( i ).IsSameAs(s, bCase) ) return i ; } return wxNOT_FOUND ; #else - return m_choice->FindString( s ); + return m_choice->FindString( s, bCase ); #endif } @@ -719,18 +715,6 @@ wxString wxComboBox::GetStringSelection() const #endif } -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) { #if USE_HICOMBOBOX @@ -745,17 +729,17 @@ void wxComboBox::SetString(int n, const wxString& s) bool wxComboBox::IsEditable() const { #if USE_HICOMBOBOX - // TODO - return !HasFlag(wxCB_READONLY); + // TODO + return !HasFlag(wxCB_READONLY); #else - return m_text != NULL && !HasFlag(wxCB_READONLY); + return m_text != NULL && !HasFlag(wxCB_READONLY); #endif } void wxComboBox::Undo() { #if USE_HICOMBOBOX - // TODO + // TODO #else if (m_text != NULL) m_text->Undo(); @@ -765,7 +749,7 @@ void wxComboBox::Undo() void wxComboBox::Redo() { #if USE_HICOMBOBOX - // TODO + // TODO #else if (m_text != NULL) m_text->Redo(); @@ -775,7 +759,7 @@ void wxComboBox::Redo() void wxComboBox::SelectAll() { #if USE_HICOMBOBOX - // TODO + // TODO #else if (m_text != NULL) m_text->SelectAll(); @@ -785,8 +769,8 @@ void wxComboBox::SelectAll() bool wxComboBox::CanCopy() const { #if USE_HICOMBOBOX - // TODO - return false; + // TODO + return false; #else if (m_text != NULL) return m_text->CanCopy(); @@ -798,8 +782,8 @@ bool wxComboBox::CanCopy() const bool wxComboBox::CanCut() const { #if USE_HICOMBOBOX - // TODO - return false; + // TODO + return false; #else if (m_text != NULL) return m_text->CanCut(); @@ -811,8 +795,8 @@ bool wxComboBox::CanCut() const bool wxComboBox::CanPaste() const { #if USE_HICOMBOBOX - // TODO - return false; + // TODO + return false; #else if (m_text != NULL) return m_text->CanPaste(); @@ -824,8 +808,8 @@ bool wxComboBox::CanPaste() const bool wxComboBox::CanUndo() const { #if USE_HICOMBOBOX - // TODO - return false; + // TODO + return false; #else if (m_text != NULL) return m_text->CanUndo(); @@ -837,8 +821,8 @@ bool wxComboBox::CanUndo() const bool wxComboBox::CanRedo() const { #if USE_HICOMBOBOX - // TODO - return false; + // TODO + return false; #else if (m_text != NULL) return m_text->CanRedo(); @@ -856,4 +840,3 @@ wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR ProcessCommand(event); return noErr ; } -