+ wxStaticBox::DoMoveWindow(x, y, width, height);
+
+ wxSize maxSize = GetMaxButtonSize();
+ int maxWidth = maxSize.x,
+ maxHeight = maxSize.y;
+
+ // Now position all the buttons: the current button will be put at
+ // wxPoint(x_offset, y_offset) and the new row/column will start at
+ // startX/startY. The size of all buttons will be the same wxSize(maxWidth,
+ // maxHeight) except for the buttons in the last column which should extend
+ // to the right border of radiobox and thus can be wider than this.
+
+ // Also, remember that wxRA_SPECIFY_COLS means that we arrange buttons in
+ // left to right order and GetMajorDim() is the number of columns while
+ // wxRA_SPECIFY_ROWS means that the buttons are arranged top to bottom and
+ // GetMajorDim() is the number of rows.
+
+ int cx1, cy1;
+ wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
+
+ int x_offset = x + cx1;
+ int y_offset = y + cy1;
+
+ // Add extra space under the label, if it exists.
+ if (!wxControl::GetLabel().empty())
+ y_offset += cy1/2;
+
+ int startX = x_offset;
+ int startY = y_offset;
+
+ const unsigned int count = GetCount();
+ for (unsigned int i = 0; i < count; i++)
+ {
+ // the last button in the row may be wider than the other ones as the
+ // radiobox may be wider than the sum of the button widths (as it
+ // happens, for example, when the radiobox label is very long)
+ bool isLastInTheRow;
+ if ( m_windowStyle & wxRA_SPECIFY_COLS )
+ {
+ // item is the last in its row if it is a multiple of the number of
+ // columns or if it is just the last item
+ unsigned int n = i + 1;
+ isLastInTheRow = ((n % GetMajorDim()) == 0) || (n == count);
+ }
+ else // wxRA_SPECIFY_ROWS
+ {
+ // item is the last in the row if it is in the last columns
+ isLastInTheRow = i >= (count/GetMajorDim())*GetMajorDim();
+ }
+
+ // is this the start of new row/column?
+ if ( i && (i % GetMajorDim() == 0) )
+ {
+ if ( m_windowStyle & wxRA_SPECIFY_ROWS )
+ {
+ // start of new column
+ y_offset = startY;
+ x_offset += maxWidth + cx1;
+ }
+ else // start of new row
+ {
+ x_offset = startX;
+ y_offset += maxHeight;
+ if (m_radioWidth[0]>0)
+ y_offset += cy1/2;
+ }
+ }
+
+ int widthBtn;
+ if ( isLastInTheRow )
+ {
+ // make the button go to the end of radio box
+ widthBtn = startX + width - x_offset - 2*cx1;
+ if ( widthBtn < maxWidth )
+ widthBtn = maxWidth;
+ }
+ else
+ {
+ // normal button, always of the same size
+ widthBtn = maxWidth;
+ }
+
+ // make all buttons of the same, maximal size - like this they cover
+ // the radiobox entirely and the radiobox tooltips are always shown
+ // (otherwise they are not when the mouse pointer is in the radiobox
+ // part not belonging to any radiobutton)
+ DoMoveSibling((*m_radioButtons)[i], x_offset, y_offset, widthBtn, maxHeight);
+
+ // where do we put the next button?
+ if ( m_windowStyle & wxRA_SPECIFY_ROWS )
+ {
+ // below this one
+ y_offset += maxHeight;
+ if (m_radioWidth[0]>0)
+ y_offset += cy1/2;
+ }
+ else
+ {
+ // to the right of this one
+ x_offset += widthBtn + cx1;
+ }
+ }