don't call SetSize() twice in ResizeChild(), this is useless

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-03-24 23:35:42 +00:00
parent a12546634d
commit 67631cee52

View File

@@ -192,7 +192,7 @@ public:
bool Create(); bool Create();
void AddChild(wxWindow *window); void AddChild(wxWindow *window);
DynamicSashRegion GetRegion(int x, int y); DynamicSashRegion GetRegion(int x, int y);
void ResizeChild(wxSize size); void ResizeChild(const wxSize& size);
wxScrollBar *FindScrollBar(const wxWindow *child, int vert) const; wxScrollBar *FindScrollBar(const wxWindow *child, int vert) const;
void OnSize(wxSizeEvent &event); void OnSize(wxSizeEvent &event);
@@ -1159,22 +1159,17 @@ DynamicSashRegion wxDynamicSashWindowLeaf::GetRegion(int x, int y)
return DSR_NONE; return DSR_NONE;
} }
void wxDynamicSashWindowLeaf::ResizeChild(wxSize size) void wxDynamicSashWindowLeaf::ResizeChild(const wxSize& size)
{ {
if (m_child) if (m_child)
{ {
if (m_impl->m_window->GetWindowStyle() & wxDS_MANAGE_SCROLLBARS) if (m_impl->m_window->HasFlag(wxDS_MANAGE_SCROLLBARS))
{ {
m_child->SetSize(size);
wxSize best_size = m_child->GetBestSize(); wxSize best_size = m_child->GetBestSize();
if (best_size.GetWidth() < size.GetWidth()) if (best_size.GetWidth() < size.GetWidth())
{
best_size.SetWidth(size.GetWidth()); best_size.SetWidth(size.GetWidth());
}
if (best_size.GetHeight() < size.GetHeight()) if (best_size.GetHeight() < size.GetHeight())
{
best_size.SetHeight(size.GetHeight()); best_size.SetHeight(size.GetHeight());
}
m_child->SetSize(best_size); m_child->SetSize(best_size);
int hpos = m_hscroll->GetThumbPosition(); int hpos = m_hscroll->GetThumbPosition();
@@ -1202,7 +1197,7 @@ void wxDynamicSashWindowLeaf::ResizeChild(wxSize size)
wxPoint pos = m_child->GetPosition(); wxPoint pos = m_child->GetPosition();
m_viewport->ScrollWindow(-hpos - pos.x, -vpos - pos.y); m_viewport->ScrollWindow(-hpos - pos.x, -vpos - pos.y);
} }
else else // !wxDS_MANAGE_SCROLLBARS
{ {
m_child->SetSize(size); m_child->SetSize(size);
} }