-int wxPickerBase::GetTextCtrlWidth(int given)
-{
- // compute the width of m_text like a wxBoxSizer(wxHORIZONTAL) would do
- // NOTE: the proportion of m_picker is fixed to 1
- return ((given - m_margin) / (m_textProportion + 1)) * m_textProportion;
-}
-
-void wxPickerBase::DoSetSizeHints(int minW, int minH, int maxW, int maxH, int incW, int incH)
-{
- wxControl::DoSetSizeHints(minW, minH, maxW, maxH, incW, incH);
-
- if (m_text)
- {
- // compute minWidth and maxWidth of the ausiliary textctrl
- int textCtrlMinW = -1, textCtrlMaxW = -1;
- if (minW != -1)
- {
- textCtrlMinW = GetTextCtrlWidth(minW);
- minW -= textCtrlMinW + m_margin;
- }
-
- if (maxW != -1)
- {
- textCtrlMaxW = GetTextCtrlWidth(maxW);
- maxW -= textCtrlMaxW + m_margin;
- }
-
- m_text->SetSizeHints(textCtrlMinW, minH, textCtrlMaxW, maxH, incW, incH);
- }
-
- if (m_picker)
- m_picker->SetSizeHints(minW, minH, maxW, maxH, incW, incH);
-}
-
-void wxPickerBase::DoSetSize(int x, int y, int width, int height, int sizeFlags)
-{
- wxControl::DoSetSize(x, y, width, height, sizeFlags);
-
- int pickerx = 0;
- if (m_text)
- {
- // compute width of the ausiliary textctrl
- int textCtrlW = GetTextCtrlWidth(width);
-
- // set the m_text's position relatively to this window
- m_text->SetSize(0, 0, textCtrlW, height, sizeFlags);
-
- // change position of the real picker
- pickerx += textCtrlW + m_margin;
- width -= textCtrlW + m_margin;
- }
-
- if (m_picker)
- m_picker->SetSize(pickerx, 0, width, height, sizeFlags);
-}
-
-wxSize wxPickerBase::DoGetBestSize() const
-{
- wxSize ret = m_picker->GetBestSize();
-
- if (m_text)
- {
- wxSize sz = m_text->GetBestSize();
-
- ret.SetWidth( ret.GetWidth() + sz.GetWidth() + m_margin );
- ret.SetHeight( wxMax(ret.GetHeight(), sz.GetHeight()) );
- }
-
- return ret;
-}