// Get main widget for this window, e.g. a text widget
virtual WXWidget GetMainWidget() const;
- // Get the widget that corresponds to the label (for font setting, label setting etc.)
+ // Get the widget that corresponds to the label (for font setting,
+ // label setting etc.)
virtual WXWidget GetLabelWidget() const;
// Get the client widget for this window (something we can create other
// windows on)
WXWindow GetXWindow() const;
WXDisplay *GetXDisplay() const;
- // called from Motif callbacks - and should only be called from there
-
- void SetButton1(bool pressed) { m_button1Pressed = pressed; }
- void SetButton2(bool pressed) { m_button2Pressed = pressed; }
- void SetButton3(bool pressed) { m_button3Pressed = pressed; }
-
void SetLastClick(int button, long timestamp)
{ m_lastButton = button; m_lastTS = timestamp; }
int GetLastClickedButton() const { return m_lastButton; }
long GetLastClickTime() const { return m_lastTS; }
- // Gives window a chance to do something in response to a size message, e.g.
- // arrange status bar, toolbar etc.
+ // Gives window a chance to do something in response to a size message,
+ // e.g. arrange status bar, toolbar etc.
virtual bool PreResize();
// Generates a paint event
void ClearUpdateRegion() { m_updateRegion.Clear(); }
void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; }
- // sets the fore/background colour for the given widget
- static void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
- static void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
-
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// event handlers (not virtual by design)
void OnIdle(wxIdleEvent& event);
- wxWindow *GetChild(int number) const
- { return GetChildren().Item(number)->GetData(); }
-
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
void SetMainWidget(WXWidget w) { m_mainWidget = w; }
- bool CanAddEventHandler() const { return m_canAddEventHandler; }
- void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
-
// See src/motif/window.cpp, near the top, for an explanation
// why this is necessary
void CanvasSetSizeIntr(int x, int y, int width, int height,
void SetPixmapHeight(int h) { m_pixmapHeight = h; }
// Change properties
- virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
+ // Change to the current font (often overridden)
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
// Change background and foreground colour using current background colour
// setting (Motif generates foreground based on background)
// unmanage and destroy an X widget f it's !NULL (passing NULL is ok)
void UnmanageAndDestroy(WXWidget widget);
- // map or unmap an X widget (passing NULL is ok), returns TRUE if widget was
- // mapped/unmapped
+ // map or unmap an X widget (passing NULL is ok),
+ // returns TRUE if widget was mapped/unmapped
bool MapOrUnmap(WXWidget widget, bool map);
// scrolling stuff
// --------------------
bool m_needsRefresh:1; // repaint backing store?
- bool m_canAddEventHandler:1; // ???
- bool m_button1Pressed:1;
- bool m_button2Pressed:1;
- bool m_button3Pressed:1;
// For double-click detection
- long m_lastTS; // last timestamp
- int m_lastButton; // last pressed button
+ long m_lastTS; // last timestamp
+ unsigned m_lastButton:2; // last pressed button
// List of wxRects representing damaged region
wxRectList m_updateRects;
WXWidget m_borderWidget;
WXWidget m_scrolledWindow;
WXWidget m_drawingArea;
- bool m_winCaptured;
- bool m_hScroll;
- bool m_vScroll;
+ bool m_winCaptured:1;
WXPixmap m_backingPixmap;
int m_pixmapWidth;
int m_pixmapHeight;
int m_pixmapOffsetX;
int m_pixmapOffsetY;
- // Store the last scroll pos, since in wxWin the pos isn't set automatically
- // by system
+ // Store the last scroll pos, since in wxWin the pos isn't set
+ // automatically by system
int m_scrollPosX;
int m_scrollPosY;
// undesired effects.
//
// Usage: create an instance of this class on the stack to disable the size
-// optimisation, it will be reenabled as soon as the object goes out from scope.
+// optimisation, it will be reenabled as soon as the object goes out
+// from scope.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxNoOptimize
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this);
- SetCanAddEventHandler(TRUE);
-
wxSize best = m_bmpNormal.Ok() ? GetBestSize() : wxSize(30, 30);
if( size.x != -1 ) best.x = size.x;
if( size.y != -1 ) best.y = size.y;
void wxBitmapButton::ChangeBackgroundColour()
{
- DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
+ wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
// Must reset the bitmaps since the colours have changed.
DoSetBitmap();
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
(XtPointer) this);
- SetCanAddEventHandler(TRUE);
-
wxSize best = GetBestSize();
if( size.x != -1 ) best.x = size.x;
if( size.y != -1 ) best.y = size.y;
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
- SetCanAddEventHandler(TRUE);
AttachWidget( parent, m_mainWidget, (WXWidget)NULL,
pos.x, pos.y, size.x, size.y );
#endif
NULL);
- DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
+ wxDoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
if( m_font.Ok() )
wxDoChangeFont( w, m_font );
void wxChoice::ChangeBackgroundColour()
{
- DoChangeBackgroundColour(m_formWidget, m_backgroundColour);
- DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
- DoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
+ wxDoChangeBackgroundColour(m_formWidget, m_backgroundColour);
+ wxDoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
+ wxDoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
size_t i;
for (i = 0; i < m_noStrings; i++)
- DoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour);
+ wxDoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour);
}
void wxChoice::ChangeForegroundColour()
{
- DoChangeForegroundColour(m_formWidget, m_foregroundColour);
- DoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
- DoChangeForegroundColour(m_menuWidget, m_foregroundColour);
+ wxDoChangeForegroundColour(m_formWidget, m_foregroundColour);
+ wxDoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
+ wxDoChangeForegroundColour(m_menuWidget, m_foregroundColour);
size_t i;
for (i = 0; i < m_noStrings; i++)
- DoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
+ wxDoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
}
int wxChoice::GetCount() const
XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
(XtPointer) this);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
if( size.x != -1 ) best.x = size.x;
if( size.y != -1 ) best.y = size.y;
- SetCanAddEventHandler(true);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, best.x, best.y);
void wxDialog::ChangeBackgroundColour()
{
if (GetMainWidget())
- DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
+ wxDoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
}
void wxDialog::ChangeForegroundColour()
{
if (GetMainWidget())
- DoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
+ wxDoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
}
static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
{
- wxWindow::DoChangeBackgroundColour((WXWidget) widget, *wxWHITE);
+ wxDoChangeBackgroundColour((WXWidget) widget, *wxWHITE);
// Change colour of the scrolled areas of the listboxes
Widget listParent = XtParent (widget);
#if 0
- wxWindow::DoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
#endif
Widget hsb = (Widget) 0;
* function to change them (by default, taken from wxSystemSettings)
*/
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
- wxWindow::DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
- wxWindow::DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
if (hsb)
XtVaSetValues (hsb,
XmNresizePolicy, XmRESIZE_NONE,
NULL);
#endif
- // DoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
- DoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
- DoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
+ // wxDoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
+ wxDoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
+ wxDoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
wxChangeListBoxColours(this, dirListWidget);
wxChangeListBoxColours(this, fileListWidget);
void wxFrame::ChangeBackgroundColour()
{
if (GetClientWidget())
- DoChangeBackgroundColour(GetClientWidget(), m_backgroundColour);
+ wxDoChangeBackgroundColour(GetClientWidget(), m_backgroundColour);
}
void wxFrame::ChangeForegroundColour()
{
if (GetClientWidget())
- DoChangeForegroundColour(GetClientWidget(), m_foregroundColour);
+ wxDoChangeForegroundColour(GetClientWidget(), m_foregroundColour);
}
/* MATTEW: Used to insure that hide-&-show within an event cycle works */
ChangeFont(FALSE);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y,
best.x, best.y);
(XtCallbackProc) wxListBoxCallback,
(XtPointer) this);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, best.x, best.y);
* function to change them (by default, taken from wxSystemSettings)
*/
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
- DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
- DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
XtVaSetValues (hsb,
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
NULL);
// MBN: why change parent's background? It looks really ugly.
- // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
+ // wxDoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
}
void wxListBox::ChangeForegroundColour()
/* TODO: should scrollbars be affected? Should probably have separate
function to change them (by default, taken from wxSystemSettings)
- DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
- DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
- DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
+ wxDoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
+ wxDoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
+ wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
*/
}
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
XtManageChild (radioBoxWidget);
XtManageChild ((Widget)m_mainWidget);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
{
WXWidget radioButton = m_radioButtons[i];
- DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
+ wxDoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
XtVaSetValues ((Widget) radioButton,
XmNselectColor, selectPixel,
{
WXWidget radioButton = m_radioButtons[i];
- DoChangeForegroundColour(radioButton, m_foregroundColour);
+ wxDoChangeForegroundColour(radioButton, m_foregroundColour);
}
}
XtManageChild (radioButtonWidget);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
XtAddCallback(scrollBarWidget, XmNtoTopCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
XtAddCallback(scrollBarWidget, XmNtoBottomCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
ChangeBackgroundColour();
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
ChangeFont(FALSE);
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
m_font = parent->GetFont();
ChangeFont(FALSE);
- SetCanAddEventHandler(TRUE);
-
wxSize actualSize(size);
// work around the cases where the bitmap is a wxNull(Icon/Bitmap)
if (actualSize.x == -1)
NULL);
}
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
m_mainWidget = borderWidget ? borderWidget : m_labelWidget;
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour ();
if( size.x != -1 ) best.x = size.x;
if( size.y != -1 ) best.y = size.y;
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
pos.x, pos.y, best.x, best.y);
NULL);
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
if (hsb)
- DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
if (vsb)
- DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
// MBN: why change parent background?
// DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
if (vsb)
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
*/
- DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
+ wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
}
}
if( rSize.x == -1 && GetParent() )
rSize.x = GetParent()->GetSize().x;
- SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
rPos.x, rPos.y, rSize.x, rSize.y);
if( !tool->GetButtonWidget() )
{
- DoChangeBackgroundColour((WXWidget) button,
- m_backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) button,
+ m_backgroundColour, TRUE);
tool->SetWidget(button);
}
m_needsRefresh = TRUE;
m_mainWidget = (WXWidget) 0;
- m_button1Pressed =
- m_button2Pressed =
- m_button3Pressed = FALSE;
-
m_winCaptured = FALSE;
m_isShown = TRUE;
m_scrolledWindow =
m_drawingArea = (WXWidget) 0;
- m_hScroll =
- m_vScroll = FALSE;
-
m_scrollPosX =
m_scrollPosY = 0;
m_lastTS = 0;
m_lastButton = 0;
- m_canAddEventHandler = FALSE;
}
// real construction (Init() must have been called before!)
// Scrolled widget needs to have its colour changed or we get a little blue
// square where the scrollbars abutt
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
- DoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE);
- DoChangeBackgroundColour(m_drawingArea, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour(m_drawingArea, backgroundColour, TRUE);
XmScrolledWindowSetAreas(
(Widget)m_scrolledWindow,
m_hScrollBar = (WXWidget) hScrollBar;
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
- DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
XtRealizeWidget(hScrollBar);
XmNhorizontalScrollBar, (Widget) m_hScrollBar,
NULL);
- m_hScroll = TRUE;
-
wxAddWindowToTable( hScrollBar, this );
}
m_vScrollBar = (WXWidget) vScrollBar;
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
- DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
XtRealizeWidget(vScrollBar);
XmNverticalScrollBar, (Widget) m_vScrollBar,
NULL);
- m_vScroll = TRUE;
-
wxAddWindowToTable( vScrollBar, this );
}
XtDestroyWidget((Widget) m_hScrollBar);
}
m_hScrollBar = (WXWidget) 0;
- m_hScroll = FALSE;
XtVaSetValues((Widget) m_scrolledWindow,
XmNhorizontalScrollBar, (Widget) 0,
XtDestroyWidget((Widget) m_vScrollBar);
}
m_vScrollBar = (WXWidget) 0;
- m_vScroll = FALSE;
XtVaSetValues((Widget) m_scrolledWindow,
XmNverticalScrollBar, (Widget) 0,
WXWidget formWidget, int x, int y, int width, int height)
{
wxAddWindowToTable((Widget) mainWidget, this);
- if (CanAddEventHandler())
- {
- XtAddEventHandler((Widget) mainWidget,
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask, // | KeyPressMask,
- False,
- wxPanelItemEventHandler,
- (XtPointer) this);
- }
+ XtAddEventHandler( (Widget) mainWidget,
+ ButtonPressMask | ButtonReleaseMask
+ | PointerMotionMask,
+ False,
+ wxPanelItemEventHandler,
+ (XtPointer) this);
if (!formWidget)
{
// Remove event handler, remove from hash table
bool wxWindow::DetachWidget(WXWidget widget)
{
- if (CanAddEventHandler())
- {
- XtRemoveEventHandler((Widget) widget,
- ButtonPressMask | ButtonReleaseMask | PointerMotionMask, // | KeyPressMask,
- False,
- wxPanelItemEventHandler,
- (XtPointer)this);
- }
+ XtRemoveEventHandler( (Widget) widget,
+ ButtonPressMask | ButtonReleaseMask
+ | PointerMotionMask,
+ False,
+ wxPanelItemEventHandler,
+ (XtPointer)this);
wxDeleteWindowFromTable((Widget) widget);
return TRUE;
case ButtonPress:
case ButtonRelease:
case MotionNotify:
+ {
+ wxMouseEvent wxevent;
+ if(wxTranslateMouseEvent(wxevent, canvas, drawingArea, &local_event))
{
- // FIXME: most of this mouse event code is more or less
- // duplicated in wxTranslateMouseEvent
- //
- wxEventType eventType = wxEVT_NULL;
-
- if (local_event.xany.type == EnterNotify)
- {
- //if (local_event.xcrossing.mode!=NotifyNormal)
- // return ; // Ignore grab events
- eventType = wxEVT_ENTER_WINDOW;
- // canvas->GetEventHandler()->OnSetFocus();
- }
- else if (local_event.xany.type == LeaveNotify)
- {
- //if (local_event.xcrossingr.mode!=NotifyNormal)
- // return ; // Ignore grab events
- eventType = wxEVT_LEAVE_WINDOW;
- // canvas->GetEventHandler()->OnKillFocus();
- }
- else if (local_event.xany.type == MotionNotify)
- {
- eventType = wxEVT_MOTION;
- }
-
- else if (local_event.xany.type == ButtonPress)
- {
- if (local_event.xbutton.button == Button1)
- {
- eventType = wxEVT_LEFT_DOWN;
- canvas->SetButton1(TRUE);
- }
- else if (local_event.xbutton.button == Button2)
- {
- eventType = wxEVT_MIDDLE_DOWN;
- canvas->SetButton2(TRUE);
- }
- else if (local_event.xbutton.button == Button3)
- {
- eventType = wxEVT_RIGHT_DOWN;
- canvas->SetButton3(TRUE);
- }
- }
- else if (local_event.xany.type == ButtonRelease)
- {
- if (local_event.xbutton.button == Button1)
- {
- eventType = wxEVT_LEFT_UP;
- canvas->SetButton1(FALSE);
- }
- else if (local_event.xbutton.button == Button2)
- {
- eventType = wxEVT_MIDDLE_UP;
- canvas->SetButton2(FALSE);
- }
- else if (local_event.xbutton.button == Button3)
- {
- eventType = wxEVT_RIGHT_UP;
- canvas->SetButton3(FALSE);
- }
- }
-
- wxMouseEvent wxevent (eventType);
-
- wxevent.m_leftDown = ((eventType == wxEVT_LEFT_DOWN)
- || (event_left_is_down (&local_event)
- && (eventType != wxEVT_LEFT_UP)));
- wxevent.m_middleDown = ((eventType == wxEVT_MIDDLE_DOWN)
- || (event_middle_is_down (&local_event)
- && (eventType != wxEVT_MIDDLE_UP)));
- wxevent.m_rightDown = ((eventType == wxEVT_RIGHT_DOWN)
- || (event_right_is_down (&local_event)
- && (eventType != wxEVT_RIGHT_UP)));
-
- wxevent.m_shiftDown = local_event.xbutton.state & ShiftMask;
- wxevent.m_controlDown = local_event.xbutton.state & ControlMask;
- wxevent.m_altDown = local_event.xbutton.state & Mod3Mask;
- wxevent.m_metaDown = local_event.xbutton.state & Mod1Mask;
- wxevent.SetTimestamp(local_event.xbutton.time);
-
- if ( eventType == wxEVT_MOTION )
- {
- if (local_event.xmotion.is_hint == NotifyHint)
- {
- Window root, child;
- Display *dpy = XtDisplay (drawingArea);
-
- XQueryPointer (dpy, XtWindow (drawingArea),
- &root, &child,
- &local_event.xmotion.x_root,
- &local_event.xmotion.y_root,
- &local_event.xmotion.x,
- &local_event.xmotion.y,
- &local_event.xmotion.state);
- }
- else
- {
- }
- }
-
- // Now check if we need to translate this event into a double click
- if (TRUE) // canvas->doubleClickAllowed)
- {
- if (wxevent.ButtonDown())
- {
- long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay());
-
- // get button and time-stamp
- int button = 0;
- if (wxevent.LeftDown())
- button = 1;
- else if (wxevent.MiddleDown())
- button = 2;
- else if (wxevent.RightDown())
- button = 3;
- long ts = wxevent.GetTimestamp();
-
- // check, if single or double click
- int buttonLast = canvas->GetLastClickedButton();
- long lastTS = canvas->GetLastClickTime();
- if ( buttonLast && buttonLast == button && (ts - lastTS) < dclickTime )
- {
- // I have a dclick
- canvas->SetLastClick(0, ts);
-
- wxEventType typeDouble;
- if ( eventType == wxEVT_LEFT_DOWN )
- typeDouble = wxEVT_LEFT_DCLICK;
- else if ( eventType == wxEVT_MIDDLE_DOWN )
- typeDouble = wxEVT_MIDDLE_DCLICK;
- else if ( eventType == wxEVT_RIGHT_DOWN )
- typeDouble = wxEVT_RIGHT_DCLICK;
- else
- typeDouble = wxEVT_NULL;
-
- if ( typeDouble != wxEVT_NULL )
- {
- wxevent.SetEventType(typeDouble);
- }
- }
- else
- {
- // not fast enough or different button
- canvas->SetLastClick(button, ts);
- }
- }
- }
-
- wxevent.SetId(canvas->GetId());
- wxevent.SetEventObject(canvas);
- wxevent.m_x = local_event.xbutton.x;
- wxevent.m_y = local_event.xbutton.y;
- canvas->GetEventHandler()->ProcessEvent (wxevent);
-#if 0
- if (eventType == wxEVT_ENTER_WINDOW ||
- eventType == wxEVT_LEAVE_WINDOW ||
- eventType == wxEVT_MOTION
- )
- return;
-#endif // 0
- break;
- }
+ canvas->GetEventHandler()->ProcessEvent(wxevent);
+ }
+ break;
+ }
case KeyPress:
{
wxKeyEvent event (wxEVT_CHAR);
// TranslateXXXEvent() functions
// ----------------------------------------------------------------------------
-bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent)
+bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
+ Widget widget, XEvent *xevent)
{
switch (xevent->xany.type)
{
- case EnterNotify: // never received here - yes ? MB
- case LeaveNotify: // never received here - yes ? MB
+ case EnterNotify:
+ case LeaveNotify:
+#if 0
+ fprintf(stderr, "Widget 0x%p <-> window %p (%s), %s\n",
+ (WXWidget)widget, win, win->GetClassInfo()->GetClassName(),
+ (xevent->xany.type == EnterNotify ? "ENTER" : "LEAVE"));
+#endif
case ButtonPress:
case ButtonRelease:
case MotionNotify:
{
wxEventType eventType = wxEVT_NULL;
- // FIXME: this is never true I think - MB
- //
if (xevent->xany.type == LeaveNotify)
{
- win->SetButton1(FALSE);
- win->SetButton2(FALSE);
- win->SetButton3(FALSE);
- return FALSE;
+ eventType = wxEVT_LEAVE_WINDOW;
+ }
+ if (xevent->xany.type == EnterNotify)
+ {
+ eventType = wxEVT_ENTER_WINDOW;
}
else if (xevent->xany.type == MotionNotify)
{
if (xevent->xbutton.button == Button1)
{
eventType = wxEVT_LEFT_DOWN;
- win->SetButton1(TRUE);
button = 1;
}
else if (xevent->xbutton.button == Button2)
{
eventType = wxEVT_MIDDLE_DOWN;
- win->SetButton2(TRUE);
button = 2;
}
else if (xevent->xbutton.button == Button3)
{
eventType = wxEVT_RIGHT_DOWN;
- win->SetButton3(TRUE);
button = 3;
}
// check for a double click
//
- long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay());
+ long dclickTime = XtGetMultiClickTime(wxGlobalDisplay());
long ts = wxevent.GetTimestamp();
int buttonLast = win->GetLastClickedButton();
long lastTS = win->GetLastClickTime();
- if ( buttonLast && buttonLast == button && (ts - lastTS) < dclickTime )
+ if ( buttonLast && buttonLast == button &&
+ (ts - lastTS) < dclickTime )
{
// I have a dclick
win->SetLastClick(0, ts);
if (xevent->xbutton.button == Button1)
{
eventType = wxEVT_LEFT_UP;
- win->SetButton1(FALSE);
}
else if (xevent->xbutton.button == Button2)
{
eventType = wxEVT_MIDDLE_UP;
- win->SetButton2(FALSE);
}
else if (xevent->xbutton.button == Button3)
{
eventType = wxEVT_RIGHT_UP;
- win->SetButton3(FALSE);
}
- else return FALSE;
+ else
+ return FALSE;
}
else
{
{
WXWidget mainWidget = GetMainWidget();
if ( mainWidget )
- DoChangeBackgroundColour(mainWidget, m_backgroundColour);
+ wxDoChangeBackgroundColour(mainWidget, m_backgroundColour);
}
void wxWindow::ChangeForegroundColour()
{
WXWidget mainWidget = GetMainWidget();
if ( mainWidget )
- DoChangeForegroundColour(mainWidget, m_foregroundColour);
+ wxDoChangeForegroundColour(mainWidget, m_foregroundColour);
if ( m_scrolledWindow && mainWidget != m_scrolledWindow )
- DoChangeForegroundColour(m_scrolledWindow, m_foregroundColour);
-}
-
-// Change a widget's foreground and background colours.
-void wxWindow::DoChangeForegroundColour(WXWidget widget,
- wxColour& foregroundColour)
-{
- wxDoChangeForegroundColour( widget, foregroundColour );
-}
-
-void wxWindow::DoChangeBackgroundColour(WXWidget widget,
- wxColour& backgroundColour,
- bool changeArmColour)
-{
- wxDoChangeBackgroundColour( widget, backgroundColour, changeArmColour );
+ wxDoChangeForegroundColour(m_scrolledWindow, m_foregroundColour);
}
bool wxWindow::SetBackgroundColour(const wxColour& col)