#include "wx/menuitem.h"
#include "wx/log.h"
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#endif
m_defaultForegroundColour = *wxBLACK ;
m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL;
#endif
m_lastTS = 0;
m_lastButton = 0;
m_canAddEventHandler = FALSE;
+ m_paintRegion = (WXRegion) 0;
}
// Destructor
wxWindow::~wxWindow()
{
- //// Motif-specific
+ //// Motif-specific
- if (GetMainWidget())
- DetachWidget(GetMainWidget()); // Removes event handlers
+ if (m_paintRegion)
+ XDestroyRegion ((Region) m_paintRegion);
+ m_paintRegion = (WXRegion) 0;
- // If m_drawingArea, we're a fully-fledged window with drawing area, scrollbars etc. (what wxCanvas used to be)
- if (m_drawingArea)
- {
- // Destroy children before destroying self
- DestroyChildren();
+ if (GetMainWidget())
+ DetachWidget(GetMainWidget()); // Removes event handlers
- if (m_backingPixmap)
- XFreePixmap (XtDisplay ((Widget) GetMainWidget()), (Pixmap) m_backingPixmap);
+ // If m_drawingArea, we're a fully-fledged window with drawing area, scrollbars etc. (what wxCanvas used to be)
+ if (m_drawingArea)
+ {
+ // Destroy children before destroying self
+ DestroyChildren();
- Widget w = (Widget) m_drawingArea;
- wxDeleteWindowFromTable(w);
+ if (m_backingPixmap)
+ XFreePixmap (XtDisplay ((Widget) GetMainWidget()), (Pixmap) m_backingPixmap);
- if (w)
- XtDestroyWidget(w);
- m_mainWidget = (WXWidget) 0;
+ Widget w = (Widget) m_drawingArea;
+ wxDeleteWindowFromTable(w);
- // Only if we're _really_ a canvas (not a dialog box/panel)
- if (m_scrolledWindow)
- {
- wxDeleteWindowFromTable((Widget) m_scrolledWindow);
- }
+ if (w)
+ XtDestroyWidget(w);
+ m_mainWidget = (WXWidget) 0;
- if (m_hScrollBar)
- {
- XtUnmanageChild ((Widget) m_hScrollBar);
- XtDestroyWidget ((Widget) m_hScrollBar);
- }
- if (m_vScrollBar)
- {
- XtUnmanageChild ((Widget) m_vScrollBar);
- XtDestroyWidget ((Widget) m_vScrollBar);
- }
- if (m_scrolledWindow)
- {
- XtUnmanageChild ((Widget) m_scrolledWindow);
- XtDestroyWidget ((Widget) m_scrolledWindow);
- }
+ // Only if we're _really_ a canvas (not a dialog box/panel)
+ if (m_scrolledWindow)
+ {
+ wxDeleteWindowFromTable((Widget) m_scrolledWindow);
+ }
- if (m_borderWidget)
- {
- XtDestroyWidget ((Widget) m_borderWidget);
- m_borderWidget = (WXWidget) 0;
+ if (m_hScrollBar)
+ {
+ XtUnmanageChild ((Widget) m_hScrollBar);
+ XtDestroyWidget ((Widget) m_hScrollBar);
+ }
+ if (m_vScrollBar)
+ {
+ XtUnmanageChild ((Widget) m_vScrollBar);
+ XtDestroyWidget ((Widget) m_vScrollBar);
+ }
+ if (m_scrolledWindow)
+ {
+ XtUnmanageChild ((Widget) m_scrolledWindow);
+ XtDestroyWidget ((Widget) m_scrolledWindow);
+ }
+
+ if (m_borderWidget)
+ {
+ XtDestroyWidget ((Widget) m_borderWidget);
+ m_borderWidget = (WXWidget) 0;
+ }
}
- }
- //// Generic stuff
+ //// Generic stuff
// Have to delete constraints/sizer FIRST otherwise
// sizers may try to look at deleted windows as they
// delete themselves.
-#if USE_CONSTRAINTS
+#if wxUSE_CONSTRAINTS
DeleteRelatedConstraints();
if (m_constraints)
{
m_sizerParent = NULL;
m_autoLayout = FALSE;
m_windowValidator = NULL;
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL;
#endif
m_caretWidth = 0; m_caretHeight = 0;
m_pixmapHeight = 0;
m_pixmapOffsetX = 0;
m_pixmapOffsetY = 0;
+ m_paintRegion = (WXRegion) 0;
if (!parent)
return FALSE;
XtAddEventHandler ((Widget) m_drawingArea, PointerMotionHintMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask,
False, (XtEventHandler) wxCanvasEnterLeave, (XtPointer) this);
- return TRUE;
+ SetSize(pos.x, pos.y, size.x, size.y);
+
+ return TRUE;
}
void wxWindow::SetFocus()
return NULL;
}
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
void wxWindow::SetDropTarget(wxDropTarget *pDropTarget)
{
if (eraseBack)
{
wxClientDC dc(this);
+ wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
+ dc.SetBackground(backgroundBrush);
dc.Clear();
}
{
m_windowFont = font;
- if (!m_windowFont.Ok())
- return;
- // TODO
+ Widget w = (Widget) GetMainWidget();
+ if (w && m_windowFont.Ok())
+ {
+ XtVaSetValues (w,
+ XmNfontList, (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(w)),
+ NULL);
+ }
}
void wxWindow::OnChar(wxKeyEvent& event)
void wxWindow::Clear()
{
- wxClientDC dc(this);
+ wxClientDC dc(this);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(brush);
dc.Clear();