projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for PCH-less build in markup code.
[wxWidgets.git]
/
src
/
motif
/
window.cpp
diff --git
a/src/motif/window.cpp
b/src/motif/window.cpp
index 3063917e6122e4a3e127698df2f855cfae5c9839..6078beb09c89d91ae39443d11880e263370ded12 100644
(file)
--- a/
src/motif/window.cpp
+++ b/
src/motif/window.cpp
@@
-20,12
+20,6
@@
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// 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"
#ifndef WX_PRECOMP
#include "wx/hash.h"
#include "wx/log.h"
@@
-44,6
+38,7
@@
#endif
#include "wx/evtloop.h"
#endif
#include "wx/evtloop.h"
+#include "wx/unix/utilsx11.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
@@
-80,6
+75,7
@@
#endif
#include "wx/motif/private.h"
#endif
#include "wx/motif/private.h"
+#include "wx/motif/dcclient.h"
#include <string.h>
#include <string.h>
@@
-136,8
+132,6
@@
static int str16len(const char *s)
// event tables
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
- IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-
BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
END_EVENT_TABLE()
@@
-230,6
+224,11
@@
bool wxWindow::Create(wxWindow *parent, wxWindowID id,
long style,
const wxString& name)
{
long style,
const wxString& name)
{
+ // Get default border
+ wxBorder border = GetBorder(style);
+ style &= ~wxBORDER_MASK;
+ style |= border;
+
wxCHECK_MSG( parent, false, "can't create wxWindow without parent" );
CreateBase(parent, id, pos, size, style, wxDefaultValidator, name);
wxCHECK_MSG( parent, false, "can't create wxWindow without parent" );
CreateBase(parent, id, pos, size, style, wxDefaultValidator, name);
@@
-345,11
+344,11
@@
bool wxWindow::Create(wxWindow *parent, wxWindowID id,
// Destructor
wxWindow::~wxWindow()
{
// Destructor
wxWindow::~wxWindow()
{
+ SendDestroyEvent();
+
if (g_captureWindow == this)
g_captureWindow = NULL;
if (g_captureWindow == this)
g_captureWindow = NULL;
- m_isBeingDeleted = true;
-
// Motif-specific actions first
WXWidget wMain = GetMainWidget();
if ( wMain )
// Motif-specific actions first
WXWidget wMain = GetMainWidget();
if ( wMain )
@@
-557,7
+556,7
@@
wxWindow *wxWindowBase::DoFindFocus()
// currently active.
// (2) The widget with the focus may not be in the widget table
// depending on which widgets I put in the table
// 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() )
for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
@@
-629,7
+628,8
@@
void wxWindow::Lower()
void wxWindow::SetLabel(const wxString& label)
{
void wxWindow::SetLabel(const wxString& label)
{
- XtVaSetValues((Widget)GetMainWidget(), XmNtitle, label.mb_str(), NULL);
+ XtVaSetValues((Widget)GetMainWidget(), XmNtitle,
+ (const char*)label.mb_str(), NULL);
}
wxString wxWindow::GetLabel() const
}
wxString wxWindow::GetLabel() const
@@
-874,6
+874,9
@@
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
int y2 = (dy >= 0) ? y + dy : y;
wxClientDC dc(this);
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);
dc.SetLogicalFunction (wxCOPY);
@@
-881,10
+884,9
@@
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
Window window = XtWindow(widget);
Display* display = XtDisplay(widget);
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);
+ dc
impl->
SetAutoSetting(true);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBrush(brush); // FIXME: needed?
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBrush(brush); // FIXME: needed?
@@
-912,8
+914,7
@@
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
rect->width = dx;
rect->height = h;
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->x = rect->x;
rect->y = rect->y;
@@
-931,9
+932,7
@@
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
rect->width = -dx;
rect->height = h;
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->x = rect->x;
rect->y = rect->y;
@@
-951,8
+950,7
@@
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
rect->width = w;
rect->height = dy;
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->x = rect->x;
rect->y = rect->y;
@@
-970,8
+968,7
@@
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
rect->width = w;
rect->height = -dy;
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->x = rect->x;
rect->y = rect->y;
@@
-1085,7
+1082,6
@@
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
menu->SetId(1); /* Mark as popped-up */
menu->CreateMenu(NULL, widget, menu, 0);
menu->SetId(1); /* Mark as popped-up */
menu->CreateMenu(NULL, widget, menu, 0);
- menu->SetInvokingWindow(this);
menu->UpdateUI();
menu->UpdateUI();
@@
-1171,7
+1167,7
@@
void wxWindow::DoGetSize(int *x, int *y) const
XmNwidth, &xx,
XmNheight, &yy,
NULL );
XmNwidth, &xx,
XmNheight, &yy,
NULL );
- if(x) *x = widget ? xx : -1;
+ if(x) *x = widget ? xx : -1;
if(y) *y = widget ? yy : -1;
}
if(y) *y = widget ? yy : -1;
}
@@
-1480,10
+1476,11
@@
int wxWindow::GetCharWidth() const
return width;
}
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;
{
const wxFont *fontToUse = theFont ? theFont : &m_font;
@@
-1543,10
+1540,13
@@
void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
wxClientDC dc(this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush);
wxClientDC dc(this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush);
+
+ wxClientDCImpl * const
+ dcimpl = static_cast<wxClientDCImpl *>(dc.GetImpl());
if (rect)
if (rect)
- dc
.
Clear(*rect);
+ dc
impl->
Clear(*rect);
else
else
- dc
.
Clear();
+ dc
impl->
Clear();
}
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
}
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
@@
-1559,7
+1559,10
@@
void wxWindow::DoPaint()
{
wxPaintDC dc(this);
{
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();
Widget widget = (Widget) GetMainWidget();
@@
-1616,11
+1619,11
@@
void wxWindow::DoPaint()
// Set an erase event first
wxEraseEvent eraseEvent(GetId(), &dc);
eraseEvent.SetEventObject(this);
// Set an erase event first
wxEraseEvent eraseEvent(GetId(), &dc);
eraseEvent.SetEventObject(this);
-
GetEventHandler()->Process
Event(eraseEvent);
+
HandleWindow
Event(eraseEvent);
wxPaintEvent event(GetId());
event.SetEventObject(this);
wxPaintEvent event(GetId());
event.SetEventObject(this);
-
GetEventHandler()->Process
Event(event);
+
HandleWindow
Event(event);
m_needsRefresh = false;
}
m_needsRefresh = false;
}
@@
-1642,21
+1645,13
@@
void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
{
wxSysColourChangedEvent event2;
event.SetEventObject(win);
{
wxSysColourChangedEvent event2;
event.SetEventObject(win);
- win->
GetEventHandler()->Process
Event(event2);
+ win->
HandleWindow
Event(event2);
}
node = node->GetNext();
}
}
}
node = node->GetNext();
}
}
-void wxWindow::OnInternalIdle()
-{
- // This calls the UI-update mechanism (querying windows for
- // menu/toolbar/control state information)
- if (wxUpdateUIEvent::CanUpdate(this))
- UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
-}
-
// ----------------------------------------------------------------------------
// accelerators
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// accelerators
// ----------------------------------------------------------------------------
@@
-1702,7
+1697,7
@@
bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
// If ProcessEvent returns true (it was handled), then
// the calling code will skip the event handling.
// If ProcessEvent returns true (it was handled), then
// the calling code will skip the event handling.
- return frame->
GetEventHandler()->Process
Event(commandEvent);
+ return frame->
HandleWindow
Event(commandEvent);
}
}
#endif
}
}
#endif
@@
-1721,7
+1716,7
@@
bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
{
wxCommandEvent commandEvent (wxEVT_COMMAND_BUTTON_CLICKED, child->GetId());
commandEvent.SetEventObject(child);
{
wxCommandEvent commandEvent (wxEVT_COMMAND_BUTTON_CLICKED, child->GetId());
commandEvent.SetEventObject(child);
- return child->
GetEventHandler()->Process
Event(commandEvent);
+ return child->
HandleWindow
Event(commandEvent);
}
return false;
}
return false;
@@
-1860,7
+1855,7
@@
WXDisplay *wxWindow::GetXDisplay() const
if ( wMain )
return (WXDisplay*) XtDisplay(wMain);
else
if ( wMain )
return (WXDisplay*) XtDisplay(wMain);
else
- return
(WXDisplay*)
NULL;
+ return NULL;
}
WXWidget wxWindow::GetMainWidget() const
}
WXWidget wxWindow::GetMainWidget() const
@@
-1907,7
+1902,7
@@
void wxWidgetResizeProc(Widget w, XConfigureEvent *WXUNUSED(event),
wxSize newSize(win->GetSize());
wxSizeEvent sizeEvent(newSize, win->GetId());
sizeEvent.SetEventObject(win);
wxSize newSize(win->GetSize());
wxSizeEvent sizeEvent(newSize, win->GetId());
sizeEvent.SetEventObject(win);
- win->
GetEventHandler()->Process
Event(sizeEvent);
+ win->
HandleWindow
Event(sizeEvent);
}
}
}
}
@@
-1993,7
+1988,7
@@
static void wxCanvasInputEvent(Widget drawingArea,
wxMouseEvent wxevent(0);
if (wxTranslateMouseEvent(wxevent, canvas, drawingArea, xevent))
{
wxMouseEvent wxevent(0);
if (wxTranslateMouseEvent(wxevent, canvas, drawingArea, xevent))
{
- canvas->
GetEventHandler()->Process
Event(wxevent);
+ canvas->
HandleWindow
Event(wxevent);
}
break;
}
}
break;
}
@@
-2010,7
+2005,7
@@
static void wxCanvasInputEvent(Widget drawingArea,
if (parent)
{
event.SetEventType(wxEVT_CHAR_HOOK);
if (parent)
{
event.SetEventType(wxEVT_CHAR_HOOK);
- if (parent->
GetEventHandler()->Process
Event(event))
+ if (parent->
HandleWindow
Event(event))
return;
}
return;
}
@@
-2019,10
+2014,10
@@
static void wxCanvasInputEvent(Widget drawingArea,
event.SetEventType(wxEVT_KEY_DOWN);
// Only process OnChar if OnKeyDown didn't swallow it
event.SetEventType(wxEVT_KEY_DOWN);
// Only process OnChar if OnKeyDown didn't swallow it
- if (!canvas->
GetEventHandler()->Process
Event (event))
+ if (!canvas->
HandleWindow
Event (event))
{
event.SetEventType(wxEVT_CHAR);
{
event.SetEventType(wxEVT_CHAR);
- canvas->
GetEventHandler()->Process
Event (event);
+ canvas->
HandleWindow
Event (event);
}
}
break;
}
}
break;
@@
-2032,7
+2027,7
@@
static void wxCanvasInputEvent(Widget drawingArea,
wxKeyEvent event (wxEVT_KEY_UP);
if (wxTranslateKeyEvent (event, canvas, (Widget) 0, xevent))
{
wxKeyEvent event (wxEVT_KEY_UP);
if (wxTranslateKeyEvent (event, canvas, (Widget) 0, xevent))
{
- canvas->
GetEventHandler()->Process
Event (event);
+ canvas->
HandleWindow
Event (event);
}
break;
}
}
break;
}
@@
-2042,7
+2037,7
@@
static void wxCanvasInputEvent(Widget drawingArea,
{
wxFocusEvent event(wxEVT_SET_FOCUS, canvas->GetId());
event.SetEventObject(canvas);
{
wxFocusEvent event(wxEVT_SET_FOCUS, canvas->GetId());
event.SetEventObject(canvas);
- canvas->
GetEventHandler()->Process
Event(event);
+ canvas->
HandleWindow
Event(event);
}
break;
}
}
break;
}
@@
-2052,7
+2047,7
@@
static void wxCanvasInputEvent(Widget drawingArea,
{
wxFocusEvent event(wxEVT_KILL_FOCUS, canvas->GetId());
event.SetEventObject(canvas);
{
wxFocusEvent event(wxEVT_KILL_FOCUS, canvas->GetId());
event.SetEventObject(canvas);
- canvas->
GetEventHandler()->Process
Event(event);
+ canvas->
HandleWindow
Event(event);
}
break;
}
}
break;
}
@@
-2074,7
+2069,7
@@
static void wxPanelItemEventHandler(Widget wid,
wxMouseEvent wxevent(0);
if (wxTranslateMouseEvent(wxevent, window, wid, event))
{
wxMouseEvent wxevent(0);
if (wxTranslateMouseEvent(wxevent, window, wid, event))
{
- window->
GetEventHandler()->Process
Event(wxevent);
+ window->
HandleWindow
Event(wxevent);
}
}
}
}
@@
-2093,7
+2088,7
@@
static void wxScrollBarCallback(Widget scrollbar,
XmScrollBarCallbackStruct *cbs)
{
wxWindow *win = wxGetWindowFromTable(scrollbar);
XmScrollBarCallbackStruct *cbs)
{
wxWindow *win = wxGetWindowFromTable(scrollbar);
- wxCHECK_RET( win,
_
T("invalid widget in scrollbar callback") );
+ wxCHECK_RET( win,
wx
T("invalid widget in scrollbar callback") );
wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
@@
-2152,7
+2147,7
@@
static void wxScrollBarCallback(Widget scrollbar,
cbs->value,
orientation);
event.SetEventObject( win );
cbs->value,
orientation);
event.SetEventObject( win );
- win->
GetEventHandler()->Process
Event(event);
+ win->
HandleWindow
Event(event);
}
// For repainting arbitrary windows
}
// For repainting arbitrary windows
@@
-2623,14
+2618,14
@@
void wxGetTextExtent(const wxWindow* window, const wxString& str,
{
XRectangle ink, logical;
WXFontSet fset = (WXFontSet) args[0].value;
{
XRectangle ink, logical;
WXFontSet fset = (WXFontSet) args[0].value;
-
+
XmbTextExtents( (XFontSet)fset, str.c_str(), str.length(),
&ink, &logical);
if( width ) *width = logical.width;
if( height ) *height = logical.height;
XmbTextExtents( (XFontSet)fset, str.c_str(), str.length(),
&ink, &logical);
if( width ) *width = logical.width;
if( height ) *height = logical.height;
- if( ascent ) *ascent = -logical.y;
- if( descent ) *descent = logical.height + logical.y;
+ if( ascent ) *ascent = -logical.y;
+ if( descent ) *descent = logical.height + logical.y;
}
else
{
}
else
{
@@
-2669,14
+2664,14
@@
void wxGetTextExtent(const wxWindow* window, const wxString& str,
if (type == XmFONT_IS_FONTSET)
{
XRectangle ink, logical;
if (type == XmFONT_IS_FONTSET)
{
XRectangle ink, logical;
-
+
XmbTextExtents( (XFontSet)thing, str.c_str(), str.length(),
&ink, &logical);
if( width ) *width = logical.width;
if( height ) *height = logical.height;
XmbTextExtents( (XFontSet)thing, str.c_str(), str.length(),
&ink, &logical);
if( width ) *width = logical.width;
if( height ) *height = logical.height;
- if( ascent ) *ascent = -logical.y;
- if( descent ) *descent = logical.height + logical.y;
+ if( ascent ) *ascent = -logical.y;
+ if( descent ) *descent = logical.height + logical.y;
}
else
{
}
else
{