// static data
// ----------------------------------------------------------------------------
+#if defined(__WXPM__)
+int wxWindowBase::ms_lastControlId = 2000;
+#else
int wxWindowBase::ms_lastControlId = -200;
+#endif
IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler)
#endif // wxUSE_CONSTRAINTS
if ( m_containingSizer )
- m_containingSizer->Remove((wxWindow*)this);
+ m_containingSizer->Detach( (wxWindow*)this );
if ( m_windowSizer )
delete m_windowSizer;
}
}
+ // there is no wxTopLevelWindow under wxMotif yet
+#ifndef __WXMOTIF__
// we shouldn't center the dialog on the iconized window: under
// Windows, for example, this places it completely off the screen
if ( parent )
parent = NULL;
}
}
+#endif // __WXMOTIF__
// did we find the parent?
if ( !parent )
//else: do nothing if we have no children
}
+// fits virtual size (ie. scrolled area etc.) around children
+void wxWindowBase::FitInside()
+{
+ if ( GetChildren().GetCount() > 0 )
+ {
+ SetVirtualSize( GetBestVirtualSize() );
+ }
+}
+
// return the size best suited for the current window
wxSize wxWindowBase::DoGetBestSize() const
{
m_maxVirtualWidth = maxW;
m_minVirtualHeight = minH;
m_maxVirtualHeight = maxH;
-
- SetVirtualSize( GetClientSize() );
}
void wxWindowBase::DoSetVirtualSize( int x, int y )
void wxWindowBase::PushEventHandler(wxEvtHandler *handler)
{
- handler->SetNextHandler(GetEventHandler());
+ wxEvtHandler *handlerOld = GetEventHandler();
+
+ handler->SetNextHandler(handlerOld);
+
+ if ( handlerOld )
+ GetEventHandler()->SetPreviousHandler(handler);
+
SetEventHandler(handler);
}
{
wxEvtHandler *handlerB = handlerA->GetNextHandler();
handlerA->SetNextHandler((wxEvtHandler *)NULL);
+
+ if ( handlerB )
+ handlerB->SetPreviousHandler((wxEvtHandler *)NULL);
SetEventHandler(handlerB);
+
if ( deleteHandler )
{
delete handlerA;
SetEventHandler(handlerNext);
}
+ if ( handlerNext )
+ {
+ handlerNext->SetPreviousHandler ( handlerPrev );
+ }
handler->SetNextHandler(NULL);
return TRUE;
#if wxUSE_TEXTCTRL
wxTextCtrl *text = wxDynamicCast(control, wxTextCtrl);
if ( text )
- text->SetValue(event.GetText());
+ {
+ if ( event.GetText() != text->GetValue() )
+ text->SetValue(event.GetText());
+ }
else
#endif // wxUSE_TEXTCTRL
- control->SetLabel(event.GetText());
+ {
+ if ( event.GetText() != control->GetLabel() )
+ control->SetLabel(event.GetText());
+ }
}
}
switch ( wxGetOsVersion() )
{
- case wxMOTIF_X: port = _T("Motif"); break;
+ case wxMOTIF_X: port += _T("Motif"); break;
case wxMAC:
- case wxMAC_DARWIN: port = _T("Mac"); break;
- case wxBEOS: port = _T("BeOS"); break;
+ case wxMAC_DARWIN: port += _T("Mac"); break;
+ case wxBEOS: port += _T("BeOS"); break;
case wxGTK:
case wxGTK_WIN32:
case wxGTK_OS2:
- case wxGTK_BEOS: port = _T("GTK"); break;
+ case wxGTK_BEOS: port += _T("GTK"); break;
case wxWINDOWS:
case wxPENWINDOWS:
case wxWINDOWS_NT:
case wxWIN32S:
case wxWIN95:
- case wxWIN386: port = _T("MS Windows"); break;
+ case wxWIN386: port += _T("MS Windows"); break;
case wxMGL_UNIX:
case wxMGL_X:
case wxMGL_WIN32:
- case wxMGL_OS2: port = _T("MGL"); break;
+ case wxMGL_OS2: port += _T("MGL"); break;
case wxWINDOWS_OS2:
- case wxOS2_PM: port = _T("OS/2"); break;
- default: port = _T("unknown"); break;
+ case wxOS2_PM: port += _T("OS/2"); break;
+ default: port += _T("unknown"); break;
}
wxMessageBox(wxString::Format(
void wxWindowBase::CaptureMouse()
{
- wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this);
+ wxLogTrace(_T("mousecapture"), _T("CaptureMouse(%p)"), this);
wxWindow *winOld = GetCapture();
if ( winOld )
{
((wxWindowBase*) winOld)->DoReleaseMouse();
-
+
// save it on stack
wxWindowNext *item = new wxWindowNext;
item->win = winOld;
void wxWindowBase::ReleaseMouse()
{
- wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(0x%08x)"), this);
+ wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(%p)"), this);
wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") );
if ( ms_winCaptureNext )
{
((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
-
+
wxWindowNext *item = ms_winCaptureNext;
ms_winCaptureNext = item->next;
delete item;
//else: stack is empty, no previous capture
wxLogTrace(_T("mousecapture"),
- _T("After ReleaseMouse() mouse is captured by 0x%08x"),
+ _T("After ReleaseMouse() mouse is captured by %p"),
GetCapture());
}
return win;
}
+// vi:sts=4:sw=4:et