-
- int w = m_buttons.GetCount() * 100;
- if (message_size.x > w) w = message_size.x;
- int space = w / (m_buttons.GetCount()*2);
-
- int n = 0;
- wxNode *node = m_buttons.First();
- while (node)
- {
- wxWindow *win = (wxWindow*)node->Data();
- int x = (n*2+1)*space - 40 + 15;
- win->Move( x, -1 );
- node = node->Next();
- n++;
+
+ // get the longest caption and also calc the number of buttons
+ size_t nBtn, nButtons = 0;
+ long widthBtnMax = 0;
+ for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) {
+ if ( buttons[nBtn] ) {
+ nButtons++;
+ dc.GetTextExtent(buttons[nBtn]->GetLabel(), &width, NULL);
+ if ( width > widthBtnMax )
+ widthBtnMax = width;
+ }
+ }
+
+ // now we can place the buttons
+ if ( widthBtnMax < 75 )
+ widthBtnMax = 75;
+ else
+ widthBtnMax += 10;
+ long heightButton = widthBtnMax*23/75;
+
+ // *1.2 baselineskip
+ heightTextMax *= 12;
+ heightTextMax /= 10;
+
+ size_t nLineCount = lines.Count();
+
+ long widthButtonsTotal = nButtons * (widthBtnMax + LAYOUT_X_MARGIN) -
+ LAYOUT_X_MARGIN;
+
+ // the size of the dialog
+ long widthDlg = wxMax(widthTextMax + iconSize + 4*LAYOUT_X_MARGIN,
+ wxMax(widthButtonsTotal, width)) +
+ 2*LAYOUT_X_MARGIN,
+ heightDlg = 8*LAYOUT_Y_MARGIN + heightButton +
+ heightTextMax*(nLineCount + 1);
+
+ // create the controls
+ // -------------------
+
+ // the icon first
+ c = new wxLayoutConstraints;
+ c->width.Absolute(iconSize);
+ c->height.Absolute(iconSize);
+ c->top.SameAs(this, wxTop, 3*LAYOUT_Y_MARGIN);
+ c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
+ icon->SetConstraints(c);
+
+ wxStaticText *text = NULL;
+ for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) {
+ c = new wxLayoutConstraints;
+ if ( text == NULL )
+ c->top.SameAs(this, wxTop, 3*LAYOUT_Y_MARGIN);
+ else
+ c->top.Below(text);
+
+ c->left.RightOf(icon, 2*LAYOUT_X_MARGIN);
+ c->width.Absolute(widthTextMax);
+ c->height.Absolute(heightTextMax);
+ text = new wxStaticText(this, -1, lines[nLine]);
+ text->SetConstraints(c);