X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a236aa2058ccf3d36e9cafc20fa7375080c4be50..3e1924dd5f5744c3e2a8973de9b3e4f372b7fd85:/src/mac/carbon/combobox.cpp diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 1241f98b12..4db3c45a02 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -20,6 +20,7 @@ #include "wx/menu.h" #include "wx/containr.h" #include "wx/toplevel.h" + #include "wx/textctrl.h" #endif #include "wx/mac/uma.h" @@ -49,16 +50,11 @@ MenuHandle NewUniqueMenu() // ---------------------------------------------------------------------------- // the margin between the text control and the choice -#if TARGET_API_MAC_OSX // margin should be bigger on OS X due to blue highlight // around text control. static const wxCoord MARGIN = 4; // this is the border a focus rect on OSX is needing static const int TEXTFOCUSBORDER = 3 ; -#else -static const wxCoord MARGIN = 2; -static const int TEXTFOCUSBORDER = 0 ; -#endif // ---------------------------------------------------------------------------- @@ -87,14 +83,14 @@ protected: NavEvent.SetWindowChange(false); // Get the parent of the combo and have it process the navigation? - if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent)) + if (m_cb->GetParent()->HandleWindowEvent(NavEvent)) return; } // send the event to the combobox class in case the user has bound EVT_CHAR wxKeyEvent kevt(event); kevt.SetEventObject(m_cb); - if (m_cb->GetEventHandler()->ProcessEvent(kevt)) + if (m_cb->HandleWindowEvent(kevt)) // If the event was handled and not skipped then we're done return; @@ -107,7 +103,7 @@ protected: // This will invoke the dialog default action, // such as the clicking the default button. - if (!m_cb->GetEventHandler()->ProcessEvent( event )) + if (!m_cb->HandleWindowEvent( event )) { wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); if ( tlw && tlw->GetDefaultItem() ) @@ -132,7 +128,7 @@ protected: { event.SetEventObject(m_cb); event.SetId(m_cb->GetId()); - if (! m_cb->GetEventHandler()->ProcessEvent(event)) + if (! m_cb->HandleWindowEvent(event)) event.Skip(); } @@ -140,7 +136,7 @@ protected: { event.SetEventObject(m_cb); event.SetId(m_cb->GetId()); - if (! m_cb->GetEventHandler()->ProcessEvent(event)) + if (! m_cb->HandleWindowEvent(event)) event.Skip(); } @@ -148,7 +144,7 @@ protected: { event.SetEventObject(m_cb); event.SetId(m_cb->GetId()); - if (! m_cb->GetEventHandler()->ProcessEvent(event)) + if (! m_cb->HandleWindowEvent(event)) event.Skip(); } @@ -344,8 +340,13 @@ bool wxComboBox::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { - return Create( parent, id, value, pos, size, 0, NULL, - style, validator, name ); + if ( !Create( parent, id, value, pos, size, 0, NULL, + style, validator, name ) ) + return false; + + Append(choices); + + return true; } bool wxComboBox::Create(wxWindow *parent, @@ -417,6 +418,16 @@ void wxComboBox::SetValue(const wxString& value) m_text->SetValue( value ); } +void wxComboBox::WriteText(const wxString& text) +{ + m_text->WriteText(text); +} + +void wxComboBox::GetSelection(long *from, long *to) const +{ + m_text->GetSelection(from, to); +} + // Clipboard operations void wxComboBox::Copy() @@ -507,44 +518,37 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, void **clientData, wxClientDataType type) { - // wxItemContainer should probably be doing it itself but usually this is - // not necessary as the derived class DoInsertItems() calls - // AssignNewItemClientData() which initializes m_clientDataItemsType - // correctly; however as we just forward everything to wxChoice, we need to - // do it ourselves - // - // also notice that we never use wxClientData_Object with wxChoice as we - // don't want it to delete the data -- we will - int rc = m_choice->DoInsertItems(items, pos, clientData, - clientData ? wxClientData_Void - : wxClientData_None) ; - if ( rc != wxNOT_FOUND ) - { - if ( !HasClientData() && type != wxClientData_None ) - m_clientDataItemsType = type; - } - - return rc; + return m_choice->DoInsertItems(items, pos, clientData, type); } void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) { - return m_choice->SetClientData( n , clientData ) ; + return m_choice->DoSetItemClientData( n , clientData ) ; } void* wxComboBox::DoGetItemClientData(unsigned int n) const { - return m_choice->GetClientData( n ) ; + return m_choice->DoGetItemClientData( n ) ; +} + +wxClientDataType wxComboBox::GetClientDataType() const +{ + return m_choice->GetClientDataType(); +} + +void wxComboBox::SetClientDataType(wxClientDataType clientDataItemsType) +{ + m_choice->SetClientDataType(clientDataItemsType); } void wxComboBox::DoDeleteOneItem(unsigned int n) { - m_choice->Delete( n ); + m_choice->DoDeleteOneItem( n ); } void wxComboBox::DoClear() { - m_choice->Clear(); + m_choice->DoClear(); } int wxComboBox::GetSelection() const