+
+ int startX = x_offset;
+ int startY = y_offset;
+
+ for ( int i = 0; i < m_noItems; 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
+ int n = i + 1;
+ isLastInTheRow = ((n % m_majorDim) == 0) || (n == m_noItems);
+ }
+ else // wxRA_SPECIFY_ROWS
+ {
+ // item is the last in the row if it is in the last columns
+ isLastInTheRow = i >= (m_noItems/m_majorDim)*m_majorDim;
+ }
+
+ // is this the start of new row/column?
+ if ( i && (i % m_majorDim == 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;
+ }
+
+ // VZ: 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)
+ ::MoveWindow((HWND)m_radioButtons[i],
+ x_offset, y_offset, widthBtn, maxHeight,
+ TRUE);
+
+ // 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;
+ }