// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#ifdef __VMS
-#define XtDisplay XTDISPLAY
-#define XtWindow XTWINDOW
-#define XtScreen XTSCREEN
-#endif
-
#ifndef WX_PRECOMP
#include "wx/hash.h"
#include "wx/log.h"
#endif
#include "wx/evtloop.h"
+#include "wx/unix/utilsx11.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#endif
#include "wx/motif/private.h"
+#include "wx/motif/dcclient.h"
#include <string.h>
// event tables
// ----------------------------------------------------------------------------
- IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-
BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
END_EVENT_TABLE()
// Destructor
wxWindow::~wxWindow()
{
+ SendDestroyEvent();
+
if (g_captureWindow == this)
g_captureWindow = NULL;
- m_isBeingDeleted = true;
-
// Motif-specific actions first
WXWidget wMain = GetMainWidget();
if ( wMain )
// currently active.
// (2) The widget with the focus may not be in the widget table
// depending on which widgets I put in the table
- wxWindow *winFocus = (wxWindow *)NULL;
+ wxWindow *winFocus = NULL;
for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
return false;
}
- // wxASSERT_MSG( m_cursor.Ok(),
+ // wxASSERT_MSG( m_cursor.IsOk(),
// wxT("cursor must be valid after call to the base version"));
const wxCursor* cursor2 = NULL;
- if (m_cursor.Ok())
+ if (m_cursor.IsOk())
cursor2 = & m_cursor;
else
cursor2 = wxSTANDARD_CURSOR;
int y2 = (dy >= 0) ? y + dy : y;
wxClientDC dc(this);
+ wxClientDCImpl * const
+ dcimpl = static_cast<wxClientDCImpl *>(dc.GetImpl());
+ GC const gc = (GC) dcimpl->GetGC();
dc.SetLogicalFunction (wxCOPY);
Window window = XtWindow(widget);
Display* display = XtDisplay(widget);
- XCopyArea(display, window, window, (GC) dc.GetGC(),
- x1, y1, w1, h1, x2, y2);
+ XCopyArea(display, window, window, gc, x1, y1, w1, h1, x2, y2);
- dc.SetAutoSetting(true);
+ dcimpl->SetAutoSetting(true);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBrush(brush); // FIXME: needed?
rect->width = dx;
rect->height = h;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width, rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->width = -dx;
rect->height = h;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width,
- rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->width = w;
rect->height = dy;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width, rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->width = w;
rect->height = -dy;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width, rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
menu->SetId(1); /* Mark as popped-up */
menu->CreateMenu(NULL, widget, menu, 0);
- menu->SetInvokingWindow(this);
menu->UpdateUI();
{
int height;
- if (m_font.Ok())
+ if (m_font.IsOk())
wxGetTextExtent (GetXDisplay(), m_font, 1.0,
"x", NULL, &height, NULL, NULL);
else
{
int width;
- if (m_font.Ok())
+ if (m_font.IsOk())
wxGetTextExtent (GetXDisplay(), m_font, 1.0,
"x", &width, NULL, NULL, NULL);
else
return width;
}
-void wxWindow::GetTextExtent(const wxString& string,
- int *x, int *y,
- int *descent, int *externalLeading,
- const wxFont *theFont) const
+void wxWindow::DoGetTextExtent(const wxString& string,
+ int *x, int *y,
+ int *descent,
+ int *externalLeading,
+ const wxFont *theFont) const
{
const wxFont *fontToUse = theFont ? theFont : &m_font;
if (externalLeading)
*externalLeading = 0;
- if (fontToUse->Ok())
+ if (fontToUse->IsOk())
wxGetTextExtent (GetXDisplay(), *fontToUse, 1.0,
string, x, y, NULL, descent);
else
wxClientDC dc(this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush);
+
+ wxClientDCImpl * const
+ dcimpl = static_cast<wxClientDCImpl *>(dc.GetImpl());
if (rect)
- dc.Clear(*rect);
+ dcimpl->Clear(*rect);
else
- dc.Clear();
+ dcimpl->Clear();
}
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
{
wxPaintDC dc(this);
- GC tempGC = (GC) dc.GetBackingGC();
+ wxPaintDCImpl * const
+ dcimpl = static_cast<wxPaintDCImpl *>(dc.GetImpl());
+
+ GC tempGC = (GC) dcimpl->GetBackingGC();
Widget widget = (Widget) GetMainWidget();
}
}
-void wxWindow::OnInternalIdle()
-{
- // This calls the UI-update mechanism (querying windows for
- // menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
- UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
-}
-
// ----------------------------------------------------------------------------
// accelerators
// ----------------------------------------------------------------------------
bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
{
#if wxUSE_ACCEL
- if (!m_acceleratorTable.Ok())
+ if (!m_acceleratorTable.IsOk())
return false;
int count = m_acceleratorTable.GetCount();
wxMenuItem* item = frame->GetMenuBar()->FindItem(entry->GetCommand());
if (item)
{
- wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, entry->GetCommand());
+ wxCommandEvent commandEvent(wxEVT_MENU, entry->GetCommand());
commandEvent.SetEventObject(frame);
// If ProcessEvent returns true (it was handled), then
// For now, only buttons.
if ( wxDynamicCast(child, wxButton) )
{
- wxCommandEvent commandEvent (wxEVT_COMMAND_BUTTON_CLICKED, child->GetId());
+ wxCommandEvent commandEvent (wxEVT_BUTTON, child->GetId());
commandEvent.SetEventObject(child);
return child->HandleWindowEvent(commandEvent);
}
if ( wMain )
return (WXDisplay*) XtDisplay(wMain);
else
- return (WXDisplay*) NULL;
+ return NULL;
}
WXWidget wxWindow::GetMainWidget() const
XmScrollBarCallbackStruct *cbs)
{
wxWindow *win = wxGetWindowFromTable(scrollbar);
- wxCHECK_RET( win, _T("invalid widget in scrollbar callback") );
+ wxCHECK_RET( win, wxT("invalid widget in scrollbar callback") );
wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
// to its original size! We therefore have to set the size
// back again. TODO: a better way in Motif?
Widget w = (Widget) GetLabelWidget(); // Usually the main widget
- if (w && m_font.Ok())
+ if (w && m_font.IsOk())
{
int width, height, width1, height1;
GetSize(& width, & height);