#if wxUSE_CONSTRAINTS
#include "wx/layout.h"
- #include "wx/sizer.h"
#endif // wxUSE_CONSTRAINTS
+#include "wx/sizer.h"
+
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#endif // wxUSE_DRAG_AND_DROP
// no constraints whatsoever
m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxWindowList *) NULL;
+#endif // wxUSE_CONSTRAINTS
+
m_windowSizer = (wxSizer *) NULL;
+ m_containingSizer = (wxSizer *) NULL;
m_autoLayout = FALSE;
-#endif // wxUSE_CONSTRAINTS
#if wxUSE_DRAG_AND_DROP
m_dropTarget = (wxDropTarget *)NULL;
#endif // wxUSE_CARET
#if wxUSE_PALETTE
- m_custompalette = false;
+ m_hasCustomPalette = FALSE;
#endif // wxUSE_PALETTE
// Whether we're using the current theme for this window (wxGTK only for now)
m_constraints = NULL;
}
+#endif // wxUSE_CONSTRAINTS
+
+ if ( m_containingSizer )
+ m_containingSizer->Remove((wxWindow*)this);
+
if ( m_windowSizer )
delete m_windowSizer;
-#endif // wxUSE_CONSTRAINTS
-
#if wxUSE_DRAG_AND_DROP
if ( m_dropTarget )
delete m_dropTarget;
wxRect rect = wxGetClientDisplayRect();
wxSize size (rect.width,rect.height);
- if (posParent.x >= 0) // if parent is on the main display
+ // NB: in wxMSW, negative position may not neccessary mean "out of screen",
+ // but it may mean that the window is placed on other than the main
+ // display. Therefore we only make sure centered window is on the main display
+ // if the parent is at least partially present here.
+ if (posParent.x + widthParent >= 0) // if parent is (partially) on the main display
{
if (xNew < 0)
xNew = 0;
else if (xNew+width > size.x)
xNew = size.x-width-1;
}
- if (posParent.y >= 0) // if parent is on the main display
+ if (posParent.y + heightParent >= 0) // if parent is (partially) on the main display
{
if (yNew+height > size.y)
yNew = size.y-height-1;
return TRUE;
}
+#if wxUSE_PALETTE
+
+void wxWindowBase::SetPalette(const wxPalette& pal)
+{
+ m_hasCustomPalette = TRUE;
+ m_palette = pal;
+
+ // VZ: can anyone explain me what do we do here?
+ wxWindowDC d((wxWindow *) this);
+ d.SetPalette(pal);
+}
+
+wxWindow *wxWindowBase::GetAncestorWithCustomPalette() const
+{
+ wxWindow *win = (wxWindow *)this;
+ while ( win && !win->HasCustomPalette() )
+ {
+ win = win->GetParent();
+ }
+
+ return win;
+}
+
+#endif // wxUSE_PALETTE
+
#if wxUSE_CARET
void wxWindowBase::SetCaret(wxCaret *caret)
{
m_constraintsInvolvedIn = (wxWindowList *) NULL;
}
}
+#endif
void wxWindowBase::SetSizer(wxSizer *sizer)
{
GetClientSize(&w, &h);
GetSizer()->SetDimension( 0, 0, w, h );
-#if defined __WXPM__
- OS2Layout(w, h);
-#endif
}
+#if wxUSE_CONSTRAINTS
else
{
wxLayoutConstraints *constr = GetConstraints();
DoPhase(2); // Layout grand children
SetConstraintSizes(); // Recursively set the real window sizes
}
+#endif
return TRUE;
}
-
+#if wxUSE_CONSTRAINTS
// Do a phase of evaluating constraints: the default behaviour. wxSizers may
// do a similar thing, but also impose their own 'constraints' and order the
// evaluation differently.
GetClientSize(w, h);
}
-void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
+void wxWindowBase::GetPositionConstraint(int *x, int *y) const
+{
+ wxLayoutConstraints *constr = GetConstraints();
+ if ( constr )
+ {
+ *x = constr->left.GetValue();
+ *y = constr->top.GetValue();
+ }
+ else
+ GetPosition(x, y);
+}
+
+#endif // wxUSE_CONSTRAINTS
+
+void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) const
{
// don't do it for the dialogs/frames - they float independently of their
// parent
}
}
-
-void wxWindowBase::GetPositionConstraint(int *x, int *y) const
-{
- wxLayoutConstraints *constr = GetConstraints();
- if ( constr )
- {
- *x = constr->left.GetValue();
- *y = constr->top.GetValue();
- }
- else
- GetPosition(x, y);
-}
-
-#endif // wxUSE_CONSTRAINTS
-
// ----------------------------------------------------------------------------
// do Update UI processing for child controls
// ----------------------------------------------------------------------------
wxWindow *winOld = GetCapture();
if ( winOld )
{
+ ((wxWindowBase*) winOld)->DoReleaseMouse();
+
// save it on stack
wxWindowNext *item = new wxWindowNext;
item->win = winOld;
if ( ms_winCaptureNext )
{
- ms_winCaptureNext->win->CaptureMouse();
-
+ ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
+
wxWindowNext *item = ms_winCaptureNext;
ms_winCaptureNext = item->next;
delete item;