don't use wxSubwindows with a single element to store the dummy radio item, store it in radiobox itself (patch 1866053)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51078 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -160,7 +160,8 @@ protected:
|
|||||||
wxSubwindows *m_radioButtons;
|
wxSubwindows *m_radioButtons;
|
||||||
|
|
||||||
// and the special dummy button used only as a tab group boundary
|
// and the special dummy button used only as a tab group boundary
|
||||||
wxSubwindows *m_dummyButton;
|
WXHWND m_dummyHwnd;
|
||||||
|
wxWindowIDRef m_dummyId;
|
||||||
|
|
||||||
// array of widths and heights of the buttons, may be wxDefaultCoord if the
|
// array of widths and heights of the buttons, may be wxDefaultCoord if the
|
||||||
// corresponding quantity should be computed
|
// corresponding quantity should be computed
|
||||||
|
@@ -129,7 +129,7 @@ void wxRadioBox::Init()
|
|||||||
{
|
{
|
||||||
m_selectedButton = wxNOT_FOUND;
|
m_selectedButton = wxNOT_FOUND;
|
||||||
m_radioButtons = NULL;
|
m_radioButtons = NULL;
|
||||||
m_dummyButton = NULL;
|
m_dummyHwnd = NULL;
|
||||||
m_radioWidth = NULL;
|
m_radioWidth = NULL;
|
||||||
m_radioHeight = NULL;
|
m_radioHeight = NULL;
|
||||||
}
|
}
|
||||||
@@ -164,8 +164,6 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
// For instance, we don't want the bounding box of the radio
|
// For instance, we don't want the bounding box of the radio
|
||||||
// buttons to include the dummy button
|
// buttons to include the dummy button
|
||||||
m_radioButtons = new wxSubwindows(n);
|
m_radioButtons = new wxSubwindows(n);
|
||||||
m_dummyButton = new wxSubwindows(1);
|
|
||||||
|
|
||||||
|
|
||||||
m_radioWidth = new int[n];
|
m_radioWidth = new int[n];
|
||||||
m_radioHeight = new int[n];
|
m_radioHeight = new int[n];
|
||||||
@@ -206,19 +204,14 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a dummy radio control to end the group.
|
// Create a dummy radio control to end the group.
|
||||||
wxWindowIDRef subid = NewControlId();
|
m_dummyId = NewControlId();
|
||||||
|
|
||||||
HWND dummy = ::CreateWindow(_T("BUTTON"),
|
m_dummyHwnd = (WXHWND)::CreateWindow(_T("BUTTON"),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
|
WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
|
||||||
0, 0, 0, 0, GetHwndOf(parent),
|
0, 0, 0, 0, GetHwndOf(parent),
|
||||||
(HMENU)subid.GetValue(), wxGetInstance(), NULL);
|
(HMENU)m_dummyId.GetValue(), wxGetInstance(), NULL);
|
||||||
|
|
||||||
// Keep track of the subwindow so it will be destroyed when the radio
|
|
||||||
// box is and it's id will be freed.
|
|
||||||
// Also, do we need to consider this dummy item a subcontrol and add it
|
|
||||||
// to m_subControls
|
|
||||||
m_dummyButton->Set(0, dummy, subid);
|
|
||||||
|
|
||||||
m_radioButtons->SetFont(GetFont());
|
m_radioButtons->SetFont(GetFont());
|
||||||
|
|
||||||
@@ -258,7 +251,8 @@ wxRadioBox::~wxRadioBox()
|
|||||||
m_isBeingDeleted = true;
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
delete m_radioButtons;
|
delete m_radioButtons;
|
||||||
delete m_dummyButton;
|
if ( m_dummyHwnd )
|
||||||
|
DestroyWindow((HWND)m_dummyHwnd);
|
||||||
delete[] m_radioWidth;
|
delete[] m_radioWidth;
|
||||||
delete[] m_radioHeight;
|
delete[] m_radioHeight;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user