- GetSize(&widthOld, &heightOld);
-
- x_offset = x;
- y_offset = y;
- GetPosition(&x_current, &y_current);
- if ((x == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- x_offset = x_current;
- if ((y == -1) || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
- y_offset = y_current;
-
-// define size
-
- int charWidth,charHeight;
- int maxWidth,maxHeight;
- int eachWidth[128],eachHeight[128];
- int totWidth,totHeight;
-
- SetFont(GetParent()->GetFont());
- GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
- charWidth/=52;
-
- maxWidth=-1;
- maxHeight=-1;
- for (i = 0 ; i < m_noItems; i++)
- {
- GetTextExtent(GetLabel(i), &eachWidth[i], &eachHeight[i]);
- eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
- eachHeight[i] = (int)((3*eachHeight[i])/2);
- if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
- if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
- }
-
- totHeight = GetNumVer() * (maxHeight + charHeight/2) + charHeight*3/2;
- totWidth = GetNumHor() * (maxWidth + charWidth) + charWidth;
-
- // only change our width/height if asked for
- if ( width == -1 )
+
+ GetSize( &widthOld, &heightOld );
+ GetPosition( &x_current, &y_current );
+
+ x_offset = x;
+ y_offset = y;
+ if (!(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ {
+ if (x == wxDefaultCoord)
+ x_offset = x_current;
+ if (y == wxDefaultCoord)
+ y_offset = y_current;
+ }
+
+ // define size
+ int charWidth, charHeight;
+ int maxWidth, maxHeight;
+ int eachWidth[128], eachHeight[128];
+ int totWidth, totHeight;
+
+ GetTextExtent(
+ wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+ &charWidth, &charHeight );
+
+ charWidth /= 52;
+
+ maxWidth = -1;
+ maxHeight = -1;
+ for (unsigned int i = 0 ; i < m_noItems; i++)
+ {
+ GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i] );
+ eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
+ eachHeight[i] = (int)((3 * eachHeight[i]) / 2);
+
+ if (maxWidth < eachWidth[i])
+ maxWidth = eachWidth[i];
+ if (maxHeight < eachHeight[i])
+ maxHeight = eachHeight[i];
+ }
+
+ totHeight = GetRowCount() * maxHeight;
+ totWidth = GetColumnCount() * (maxWidth + charWidth);
+
+ wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
+
+ // change the width / height only when specified
+ if ( width == wxDefaultCoord )