{
if ( m_bmpNormal.Ok() )
{
- return wxSize(m_bmpNormal.GetWidth() + 2*m_marginX,
+ wxSize best(m_bmpNormal.GetWidth() + 2*m_marginX,
m_bmpNormal.GetHeight() + 2*m_marginY);
+ CacheBestSize(best);
+ return best;
}
// no idea what our best size should be, defer to the base class
return sz;
}
- return wxSize(wBtn, hBtn);
+ wxSize best(wBtn, hBtn);
+ CacheBestSize(best);
+ return best;
}
/* static */
hCheckbox += 1;
#endif
- return wxSize(wCheckbox, hCheckbox);
+ wxSize best(wCheckbox, hCheckbox);
+ CacheBestSize(best);
+ return best;
}
void wxCheckBox::SetValue(bool val)
{
wxSize best = wxListBox::DoGetBestSize();
best.x += wxOwnerDrawn::GetDefaultMarginWidth(); // add room for the checkbox
+ CacheBestSize(best);
return best;
}
UpdateVisibleHeight();
}
+ InvalidateBestSize();
return n;
}
UpdateVisibleHeight();
}
+ InvalidateBestSize();
return n;
}
if ( !IsFrozen() )
UpdateVisibleHeight();
+
+ InvalidateBestSize();
}
void wxChoice::Clear()
if ( !IsFrozen() )
UpdateVisibleHeight();
+
+ InvalidateBestSize();
}
void wxChoice::Free()
DoSetItemClientData(n, data);
}
//else: it's already NULL by default
+
+ InvalidateBestSize();
}
wxString wxChoice::GetString(int n) const
{
const int y = GetCharHeight();
- return wxSize(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
+ wxSize best(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
+ CacheBestSize(best);
+ return best;
}
// ----------------------------------------------------------------------------
m_noItems--;
SetHorizontalExtent(wxEmptyString);
+
+ InvalidateBestSize();
}
int wxListBox::DoAppend(const wxString& item)
{
- InvalidateBestSize();
-
int index = ListBox_AddString(GetHwnd(), item);
m_noItems++;
SetHorizontalExtent(item);
+ InvalidateBestSize();
return index;
}
// show the listbox back if we hid it
ShowWindow(GetHwnd(), SW_SHOW);
}
+
+ InvalidateBestSize();
}
int wxListBox::FindString(const wxString& s) const
m_noItems = 0;
SetHorizontalExtent();
+
+ InvalidateBestSize();
}
void wxListBox::Free()
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
wxT("invalid index in wxListBox::InsertItems") );
- InvalidateBestSize();
-
int nItems = items.GetCount();
for ( int i = 0; i < nItems; i++ )
{
m_noItems += nItems;
SetHorizontalExtent();
+
+ InvalidateBestSize();
}
void wxListBox::SetString(int N, const wxString& s)
// we may have lost the selection
if ( wasSelected )
Select(N);
+
+ InvalidateBestSize();
}
int wxListBox::GetCount() const
int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*
wxMin(wxMax(m_noItems, 3), 10);
- return wxSize(wListbox, hListbox);
+ wxSize best(wListbox, hListbox);
+ CacheBestSize(best);
+ return best;
}
// ----------------------------------------------------------------------------
m_radioHeight[item] = wxDefaultCoord;
::SetWindowText((*m_radioButtons)[item], label.c_str());
+
+ InvalidateBestSize();
}
void wxRadioBox::SetSelection(int N)
BOOL ret = ::ShowWindow((*m_radioButtons)[item], show ? SW_SHOW : SW_HIDE);
- return (ret != 0) == show;
+ bool changed = (ret != 0) == show;
+ if( changed )
+ InvalidateBestSize();
+ return changed;
}
WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxRadioBox, wxStaticBox, m_radioButtons)
wxSize wxRadioBox::DoGetBestSize() const
{
- return GetTotalButtonSize(GetMaxButtonSize());
+ wxSize best = GetTotalButtonSize(GetMaxButtonSize());
+ CacheBestSize(best);
+ return best;
}
// Restored old code.
hRadio = s_radioSize;
}
- return wxSize(wRadio, hRadio);
+ wxSize best(wRadio, hRadio);
+ CacheBestSize(best);
+ return best;
}
#endif // wxUSE_RADIOBTN
h = wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
}
- return wxSize(w, h);
+ wxSize best(w, h);
+ CacheBestSize(best);
+ return best;
}
WXDWORD wxScrollBar::MSWGetStyle(long style, WXDWORD *exstyle) const
wxSize wxStaticBitmap::DoGetBestSize() const
{
if ( ImageIsOk() )
- return wxSize(m_image->GetWidth(), m_image->GetHeight());
+ {
+ wxSize best(m_image->GetWidth(), m_image->GetHeight());
+ CacheBestSize(best);
+ return best;
+ }
// this is completely arbitrary
return wxSize(16, 16);
wBox += 3*cx;
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
- return wxSize(wBox, hBox);
+ wxSize best(wBox, hBox);
+ CacheBestSize(best);
+ return best;
}
void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
widthTextMax += 2;
#endif // __WXWINCE__
- return wxSize(widthTextMax, heightTextTotal);
+ wxSize best(widthTextMax, heightTextTotal);
+ CacheBestSize(best);
+ return best;
}
void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
sizeBest.y = size.cy;
}
+ CacheBestSize(sizeBest);
return sizeBest;
}
wxSize sz(wBtn, hBtn);
#endif
+ CacheBestSize(sz);
return sz;
}