// generate a new id if the user doesn't care about it
m_windowId = id == wxID_ANY ? NewControlId() : id;
+ // don't use SetWindowStyleFlag() here, this function should only be called
+ // to change the flag after creation as it tries to reflect the changes in
+ // flags by updating the window dynamically and we don't need this here
+ m_windowStyle = style;
+
SetName(name);
- SetWindowStyleFlag(style);
SetParent(parent);
#if wxUSE_VALIDATORS
return true;
}
+bool wxWindowBase::ToggleWindowStyle(int flag)
+{
+ wxASSERT_MSG( flag, _T("flags with 0 value can't be toggled") );
+
+ bool rc;
+ long style = GetWindowStyleFlag();
+ if ( style & flag )
+ {
+ style &= ~flag;
+ rc = false;
+ }
+ else // currently off
+ {
+ style |= flag;
+ rc = true;
+ }
+
+ SetWindowStyleFlag(style);
+
+ return rc;
+}
+
// ----------------------------------------------------------------------------
// destruction
// ----------------------------------------------------------------------------
{
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent((wxWindow*)this),
wxTopLevelWindow);
-
+
if ( tlw && tlw->GetDefaultItem() == this )
tlw->SetDefaultItem(NULL);
if ( tlw && tlw->GetTmpDefaultItem() == this )
if ( m_windowSizer )
{
- best = GetWindowSizeForVirtualSize(m_windowSizer->GetMinSize());
+ // Adjust to window size, since the return value of GetWindowSizeForVirtualSize is
+ // expressed in window and not client size
+ wxSize minSize = m_windowSizer->GetMinSize();
+ wxSize size(GetSize());
+ wxSize clientSize(GetClientSize());
+
+ wxSize minWindowSize(minSize.x + size.x - clientSize.x,
+ minSize.y + size.y - clientSize.y);
+
+ best = GetWindowSizeForVirtualSize(minWindowSize);
+
+ return best;
}
#if wxUSE_CONSTRAINTS
else if ( m_constraints )
msg.Printf(_T("wxWidgets Library (%s port)\n")
_T("Version %d.%d.%d%s%s, compiled at %s %s\n")
_T("Runtime version of toolkit used is %d.%d.%s\n")
- _T("Copyright (c) 1995-2006 wxWidgets team"),
+ _T("Copyright (c) 1995-2007 wxWidgets team"),
wxPlatformInfo::Get().GetPortIdName().c_str(),
wxMAJOR_VERSION,
wxMINOR_VERSION,
event.SetEventObject(win);
if ( !win->GetEventHandler()->ProcessEvent(event) )
{
+ // windows must handle this event, otherwise the app wouldn't behave
+ // correctly if it loses capture unexpectedly; see the discussion here:
+ // http://sourceforge.net/tracker/index.php?func=detail&aid=1153662&group_id=9863&atid=109863
+ // http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/82376
wxFAIL_MSG( _T("window that captured the mouse didn't process wxEVT_MOUSE_CAPTURE_LOST") );
}
}