X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1f0c8f31f407ecfce909060464c0ea655221cdab..ec2df34e27ba41f202ecbf096cdfed082a9ddb8f:/src/osx/carbon/combobxc.cpp diff --git a/src/osx/carbon/combobxc.cpp b/src/osx/carbon/combobxc.cpp index 8a67fd323f..8f00357352 100644 --- a/src/osx/carbon/combobxc.cpp +++ b/src/osx/carbon/combobxc.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/combobxc.cpp +// Name: src/osx/carbon/combobxc.cpp // Purpose: wxComboBox class using HIView ComboBox // Author: Stefan Csomor // Modified by: @@ -25,8 +25,6 @@ #endif #endif -IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) - #if TARGET_API_MAC_OSX #define USE_HICOMBOBOX 1 //use hi combobox define #else @@ -61,7 +59,7 @@ static pascal OSStatus wxMacComboBoxEventHandler( EventHandlerCallRef handler , { case kEventTextAccepted : { - wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, cb->GetId() ); + wxCommandEvent event( wxEVT_COMBOBOX, cb->GetId() ); event.SetInt( cb->GetSelection() ); event.SetString( cb->GetStringSelection() ); event.SetEventObject( cb ); @@ -122,7 +120,7 @@ protected: // make Enter generate "selected" event if there is only one item // in the combobox - without it, it's impossible to select it at // all! - wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, m_cb->GetId() ); + wxCommandEvent event( wxEVT_COMBOBOX, m_cb->GetId() ); event.SetInt( 0 ); event.SetString( value ); event.SetEventObject( m_cb ); @@ -137,7 +135,7 @@ protected: m_cb->SetStringSelection(value); // and generate the selected event for it - wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, m_cb->GetId() ); + wxCommandEvent event( wxEVT_COMBOBOX, m_cb->GetId() ); event.SetInt( m_cb->GetCount() - 1 ); event.SetString( value ); event.SetEventObject( m_cb ); @@ -153,7 +151,7 @@ protected: wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); if ( def && def->IsEnabled() ) { - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); + wxCommandEvent event(wxEVT_BUTTON, def->GetId() ); event.SetEventObject(def); def->Command(event); return; @@ -191,7 +189,7 @@ protected: wxString s = e.GetString(); m_cb->DelegateChoice( s ); - wxCommandEvent event2(wxEVT_COMMAND_COMBOBOX_SELECTED, m_cb->GetId() ); + wxCommandEvent event2(wxEVT_COMBOBOX, m_cb->GetId() ); event2.SetInt(m_cb->GetSelection()); event2.SetEventObject(m_cb); event2.SetString(m_cb->GetStringSelection()); @@ -219,14 +217,8 @@ wxComboBox::~wxComboBox() // delete the controls now, don't leave them alive even though they would // still be eventually deleted by our parent - but it will be too late, the // user code expects them to be gone now - if (m_text != NULL) { - delete m_text; - m_text = NULL; - } - if (m_choice != NULL) { - delete m_choice; - m_choice = NULL; - } + wxDELETE( m_text ); + wxDELETE( m_choice ); } @@ -349,7 +341,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, m_text = NULL; m_choice = NULL; #if USE_HICOMBOBOX - m_macIsUserPane = false; + DontCreatePeer(); #endif if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , wxDefaultValidator, name) ) @@ -484,10 +476,9 @@ void wxComboBox::SetEditable(bool editable) { m_text = new wxComboBoxText( this ); } - else if ( ( m_text != NULL ) && !editable ) + else if ( !editable ) { - delete m_text; - m_text = NULL; + wxDELETE(m_text); } int currentX, currentY; @@ -782,12 +773,12 @@ bool wxComboBox::CanRedo() const #endif } -wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) ) +bool wxComboBox::OSXHandleClicked( double timestampsec ) { - wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId ); + wxCommandEvent event(wxEVT_COMBOBOX, m_windowId ); event.SetInt(GetSelection()); event.SetEventObject(this); event.SetString(GetStringSelection()); ProcessCommand(event); - return noErr; + return true; }