// static data
// ----------------------------------------------------------------------------
-#if defined(__WXPM__)
+#if defined(__WXPALMOS__)
+int wxWindowBase::ms_lastControlId = 32767;
+#elif defined(__WXPM__)
int wxWindowBase::ms_lastControlId = 2000;
#else
int wxWindowBase::ms_lastControlId = -200;
int widthParent, heightParent;
wxWindow *parent = NULL;
+ wxTopLevelWindow *winTop = NULL;
if ( !(direction & wxCENTRE_ON_SCREEN) )
{
// Windows, for example, this places it completely off the screen
if ( parent )
{
- wxTopLevelWindow *winTop = wxDynamicCast(parent, wxTopLevelWindow);
+ winTop = wxDynamicCast(parent, wxTopLevelWindow);
if ( winTop && winTop->IsIconized() )
{
+ winTop = NULL;
parent = NULL;
}
}
{
if ( IsTopLevel() )
{
- // centre on the parent
- parent->GetSize(&widthParent, &heightParent);
+ if(winTop)
+ winTop->GetRectForTopLevelChildren(&posParent.x, &posParent.y, &widthParent, &heightParent);
+ else
+ {
+ // centre on the parent
+ parent->GetSize(&widthParent, &heightParent);
- // adjust to the parents position
- posParent = parent->GetPosition();
+ // adjust to the parents position
+ posParent = parent->GetPosition();
+ }
}
else
{
{
if ( GetChildren().GetCount() > 0 )
{
- SetClientSize(GetBestSize());
+ SetSize(GetBestSize());
}
//else: do nothing if we have no children
}
return (realChildCount > 0);
}
#endif
-
+
void wxWindowBase::InvalidateBestSize()
{
m_bestSizeCache = wxDefaultSize;
// return the size best suited for the current window
wxSize wxWindowBase::DoGetBestSize() const
{
+ wxSize best;
+
if ( m_windowSizer )
{
- return m_windowSizer->GetMinSize();
+ best = m_windowSizer->GetMinSize();
}
#if wxUSE_CONSTRAINTS
else if ( m_constraints )
// will never return a size bigger than the current one :-(
}
- return wxSize(maxX, maxY);
+ best = wxSize(maxX, maxY);
}
#endif // wxUSE_CONSTRAINTS
else if ( !GetChildren().empty()
maxX += 7;
maxY += 14;
- return wxSize(maxX, maxY);
+ best = wxSize(maxX, maxY);
}
else // ! has children
{
- // for a generic window there is no natural best size - just use either the
- // minimum size if there is one, or the current size
+ // For a generic window there is no natural best size - just use
+ // either the minimum size if there is one, or the current size.
+ // These are returned as-is, unadjusted by the client size difference.
if ( GetMinSize().IsFullySpecified() )
return GetMinSize();
else
return GetSize();
}
+
+ // Add any difference between size and client size
+ wxSize diff = GetSize() - GetClientSize();
+ best.x += wxMax(0, diff.x);
+ best.y += wxMax(0, diff.y);
+
+ return best;
}
if ( parent->m_inheritFgCol && !m_hasFgCol )
SetForegroundColour(parent->GetForegroundColour());
+ // inheriting (solid) background colour is wrong as it totally breaks
+ // any kind of themed backgrounds
+ //
+ // instead, the controls should use the same background as their parent
+ // (ideally by not drawing it at all)
+#if 0
if ( parent->m_inheritBgCol && !m_hasBgCol )
SetBackgroundColour(parent->GetBackgroundColour());
+#endif // 0
}
}
// find child window by id or name
// ----------------------------------------------------------------------------
-wxWindow *wxWindowBase::FindWindow( long id )
+wxWindow *wxWindowBase::FindWindow(long id) const
{
if ( id == m_windowId )
return (wxWindow *)this;
return (wxWindow *)res;
}
-wxWindow *wxWindowBase::FindWindow( const wxString& name )
+wxWindow *wxWindowBase::FindWindow(const wxString& name) const
{
if ( name == m_windowName )
return (wxWindow *)this;
wxWindow *
wxWindowBase::FindWindowById( long id, const wxWindow* parent )
{
- return wxFindWindowHelper(parent, _T(""), id, wxFindWindowCmpIds);
+ return wxFindWindowHelper(parent, wxEmptyString, id, wxFindWindowCmpIds);
}
// ----------------------------------------------------------------------------
void wxWindowBase::UpdateWindowUI(long flags)
{
wxUpdateUIEvent event(GetId());
- event.m_eventObject = this;
+ event.SetEventObject(this);
if ( GetEventHandler()->ProcessEvent(event) )
{
if ( !win->IsTopLevel() )
{
wxSysColourChangedEvent event2;
- event.m_eventObject = win;
+ event.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event2);
}
#ifdef __WXDEBUG__
_T(" Debug build"),
#else
- _T(""),
+ wxEmptyString,
#endif
__TDATE__,
__TTIME__
#endif
title = GetWindow()->GetName();
- if (!title.IsEmpty())
+ if (!title.empty())
{
*name = title;
return wxACC_OK;
return wxACC_FAIL;
wxString ht(GetWindow()->GetHelpText());
- if (!ht.IsEmpty())
+ if (!ht.empty())
{
*description = ht;
return wxACC_OK;
return wxACC_FAIL;
wxString ht(GetWindow()->GetHelpText());
- if (!ht.IsEmpty())
+ if (!ht.empty())
{
*helpText = ht;
return wxACC_OK;