X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e40298d54ecd5b109222a7c60aa2ef084a304d69..613b6bb90a2345b7160dca1a72685c1ad19f3457:/src/mac/radiobox.cpp diff --git a/src/mac/radiobox.cpp b/src/mac/radiobox.cpp index 15ac067af7..bfc9b87637 100644 --- a/src/mac/radiobox.cpp +++ b/src/mac/radiobox.cpp @@ -77,6 +77,8 @@ wxRadioBox::wxRadioBox() wxRadioBox::~wxRadioBox() { + m_isBeingDeleted = TRUE; + wxRadioButton *next,*current; current=m_radioButtonCycle->NextInCycle(); @@ -100,6 +102,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, int majorDim, long style, const wxValidator& val, const wxString& name) { + if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) + return false; + int i; m_noItems = n; @@ -122,8 +127,15 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, for (i = 0; i < n; i++) { - wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(), wxStripMenuCodes(choices[i]),wxPoint(5,20*i+10), - wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ; + wxRadioButton *radBtn = new wxRadioButton + ( + this, + wxID_ANY, + wxStripMenuCodes(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); @@ -203,7 +215,7 @@ wxString wxRadioBox::GetString(int item) const wxRadioButton *current; if ((item < 0) || (item >= m_noItems)) - return wxString(""); + return wxEmptyString; i = 0; current = m_radioButtonCycle; @@ -379,7 +391,7 @@ void wxRadioBox::SetFocus() //------------------------------------------------------------------------------------- // Simulates the effect of the user issuing a command to the item -#define RADIO_SIZE 40 +#define RADIO_SIZE 20 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { @@ -409,7 +421,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) int totWidth,totHeight; SetFont(GetParent()->GetFont()); - GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight); + GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight); charWidth/=52; maxWidth=-1; @@ -423,7 +435,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (maxHeightGetFont(); - GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), + GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight, NULL, NULL, &font); charWidth /= 52; @@ -506,7 +518,7 @@ wxSize wxRadioBox::DoGetBestSize() const if (maxHeight < eachHeight) maxHeight = eachHeight; } - totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight * 3/2; + totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight ; totWidth = GetColumnCount() * (maxWidth + charWidth) + charWidth; // handle radio box title as well