X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8208e181cb576ec6cda37624923f95a59af43072..87dde0b5fcb80e2192df0af481bc63b2f945e54f:/src/mac/radiobox.cpp diff --git a/src/mac/radiobox.cpp b/src/mac/radiobox.cpp index 416ba0b18f..b18f098d3c 100644 --- a/src/mac/radiobox.cpp +++ b/src/mac/radiobox.cpp @@ -18,9 +18,12 @@ #endif #include "wx/radiobox.h" -#include +#include "wx/radiobut.h" +#include "wx/mac/uma.h" +#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) +#endif #pragma mark - #pragma mark ### Constructors & destructor ### @@ -29,6 +32,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) // ¥ wxRadioBox() //------------------------------------------------------------------------------------- // Default constructor +BEGIN_EVENT_TABLE(wxRadioBox, wxControl) +EVT_RADIOBUTTON( -1 , wxRadioBox::OnRadioButton ) +END_EVENT_TABLE() + +void wxRadioBox::OnRadioButton( wxCommandEvent &outer ) +{ + wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId); + int i = GetSelection() ; + event.SetInt( i ); + event.SetString( GetString( i ) ); + event.SetEventObject( this ); + ProcessCommand(event); +} wxRadioBox::wxRadioBox() { @@ -93,7 +109,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, Rect bounds ; Str255 title ; - MacPreControlCreate( parent , id , label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ; + MacPreControlCreate( parent , id , label , pos , size ,style, val , name , &bounds , title ) ; m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, kControlGroupBoxTextTitleProc , (long) this ) ; @@ -102,8 +118,11 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, for (i = 0; i < n; i++) { - wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(),choices[i],wxPoint(5,20*i+10)); - m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle); + wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(),choices[i],wxPoint(5,20*i+10), + wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ; + if ( i == 0 ) + m_radioButtonCycle = radBtn ; +// m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle); } SetSelection(0); @@ -435,9 +454,9 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) x_offset = x; y_offset = y; GetPosition(&x_current, &y_current); - if ((x == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) x_offset = x_current; - if ((y == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) y_offset = y_current; // define size @@ -490,7 +509,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) x_start = charWidth; - y_start = charHeight*3/2; + y_start = 15 ; x_offset = x_start; y_offset = y_start; @@ -507,7 +526,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) else { x_offset = x_start; - y_offset += maxHeight + charHeight/2; + y_offset += maxHeight ; /*+ charHeight/2;*/ } } @@ -515,7 +534,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) current=current->NextInCycle(); if (m_windowStyle & wxRA_SPECIFY_ROWS) - y_offset += maxHeight + charHeight/2; + y_offset += maxHeight ; /*+ charHeight/2;*/ else x_offset += maxWidth + charWidth; }