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