We only updated the button positions when the radio box was moved or resized
after being created but didn't do it initially, so a radio box created with
fixed position and size didn't lay out its buttons correctly. Do lay them out
immediately after creating the radio box to fix this.
Closes #13912.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70498
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// get the total size occupied by the radio box buttons
wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
// get the total size occupied by the radio box buttons
wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
+ // Adjust all the buttons to the new window size.
+ void PositionAllButtons(int x, int y, int width, int height);
+
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
// Now that we have items determine what is the best size and set it.
SetInitialSize(size);
// Now that we have items determine what is the best size and set it.
SetInitialSize(size);
+ // And update all the buttons positions to match it.
+ const wxSize actualSize = GetSize();
+ PositionAllButtons(pos.x, pos.y, actualSize.x, actualSize.y);
+
{
wxStaticBox::DoMoveWindow(x, y, width, height);
{
wxStaticBox::DoMoveWindow(x, y, width, height);
+ PositionAllButtons(x, y, width, height);
+}
+
+void
+wxRadioBox::PositionAllButtons(int x, int y, int width, int WXUNUSED(height))
+{
wxSize maxSize = GetMaxButtonSize();
int maxWidth = maxSize.x,
maxHeight = maxSize.y;
wxSize maxSize = GetMaxButtonSize();
int maxWidth = maxSize.x,
maxHeight = maxSize.y;