Code clanup: removed some useless/unused member
variables/functions from wxWindow; used wxTranslateMouseEvent instead of duplicating its functionality. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20217 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -110,7 +110,8 @@ public:
|
|||||||
|
|
||||||
// Get main widget for this window, e.g. a text widget
|
// Get main widget for this window, e.g. a text widget
|
||||||
virtual WXWidget GetMainWidget() const;
|
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;
|
virtual WXWidget GetLabelWidget() const;
|
||||||
// Get the client widget for this window (something we can create other
|
// Get the client widget for this window (something we can create other
|
||||||
// windows on)
|
// windows on)
|
||||||
@@ -124,20 +125,14 @@ public:
|
|||||||
WXWindow GetXWindow() const;
|
WXWindow GetXWindow() const;
|
||||||
WXDisplay *GetXDisplay() 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)
|
void SetLastClick(int button, long timestamp)
|
||||||
{ m_lastButton = button; m_lastTS = timestamp; }
|
{ m_lastButton = button; m_lastTS = timestamp; }
|
||||||
|
|
||||||
int GetLastClickedButton() const { return m_lastButton; }
|
int GetLastClickedButton() const { return m_lastButton; }
|
||||||
long GetLastClickTime() const { return m_lastTS; }
|
long GetLastClickTime() const { return m_lastTS; }
|
||||||
|
|
||||||
// Gives window a chance to do something in response to a size message, e.g.
|
// Gives window a chance to do something in response to a size message,
|
||||||
// arrange status bar, toolbar etc.
|
// e.g. arrange status bar, toolbar etc.
|
||||||
virtual bool PreResize();
|
virtual bool PreResize();
|
||||||
|
|
||||||
// Generates a paint event
|
// Generates a paint event
|
||||||
@@ -160,10 +155,6 @@ public:
|
|||||||
void ClearUpdateRegion() { m_updateRegion.Clear(); }
|
void ClearUpdateRegion() { m_updateRegion.Clear(); }
|
||||||
void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; }
|
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
|
// For implementation purposes - sometimes decorations make the client area
|
||||||
// smaller
|
// smaller
|
||||||
virtual wxPoint GetClientAreaOrigin() const;
|
virtual wxPoint GetClientAreaOrigin() const;
|
||||||
@@ -172,9 +163,6 @@ protected:
|
|||||||
// event handlers (not virtual by design)
|
// event handlers (not virtual by design)
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
wxWindow *GetChild(int number) const
|
|
||||||
{ return GetChildren().Item(number)->GetData(); }
|
|
||||||
|
|
||||||
// Responds to colour changes: passes event on to children.
|
// Responds to colour changes: passes event on to children.
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
@@ -182,9 +170,6 @@ protected:
|
|||||||
|
|
||||||
void SetMainWidget(WXWidget w) { m_mainWidget = w; }
|
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
|
// See src/motif/window.cpp, near the top, for an explanation
|
||||||
// why this is necessary
|
// why this is necessary
|
||||||
void CanvasSetSizeIntr(int x, int y, int width, int height,
|
void CanvasSetSizeIntr(int x, int y, int width, int height,
|
||||||
@@ -213,7 +198,8 @@ public:
|
|||||||
void SetPixmapHeight(int h) { m_pixmapHeight = h; }
|
void SetPixmapHeight(int h) { m_pixmapHeight = h; }
|
||||||
|
|
||||||
// Change properties
|
// 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
|
// Change background and foreground colour using current background colour
|
||||||
// setting (Motif generates foreground based on background)
|
// setting (Motif generates foreground based on background)
|
||||||
@@ -246,8 +232,8 @@ protected:
|
|||||||
// unmanage and destroy an X widget f it's !NULL (passing NULL is ok)
|
// unmanage and destroy an X widget f it's !NULL (passing NULL is ok)
|
||||||
void UnmanageAndDestroy(WXWidget widget);
|
void UnmanageAndDestroy(WXWidget widget);
|
||||||
|
|
||||||
// map or unmap an X widget (passing NULL is ok), returns TRUE if widget was
|
// map or unmap an X widget (passing NULL is ok),
|
||||||
// mapped/unmapped
|
// returns TRUE if widget was mapped/unmapped
|
||||||
bool MapOrUnmap(WXWidget widget, bool map);
|
bool MapOrUnmap(WXWidget widget, bool map);
|
||||||
|
|
||||||
// scrolling stuff
|
// scrolling stuff
|
||||||
@@ -274,14 +260,10 @@ protected:
|
|||||||
// --------------------
|
// --------------------
|
||||||
|
|
||||||
bool m_needsRefresh:1; // repaint backing store?
|
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
|
// For double-click detection
|
||||||
long m_lastTS; // last timestamp
|
long m_lastTS; // last timestamp
|
||||||
int m_lastButton; // last pressed button
|
unsigned m_lastButton:2; // last pressed button
|
||||||
|
|
||||||
// List of wxRects representing damaged region
|
// List of wxRects representing damaged region
|
||||||
wxRectList m_updateRects;
|
wxRectList m_updateRects;
|
||||||
@@ -293,17 +275,15 @@ protected:
|
|||||||
WXWidget m_borderWidget;
|
WXWidget m_borderWidget;
|
||||||
WXWidget m_scrolledWindow;
|
WXWidget m_scrolledWindow;
|
||||||
WXWidget m_drawingArea;
|
WXWidget m_drawingArea;
|
||||||
bool m_winCaptured;
|
bool m_winCaptured:1;
|
||||||
bool m_hScroll;
|
|
||||||
bool m_vScroll;
|
|
||||||
WXPixmap m_backingPixmap;
|
WXPixmap m_backingPixmap;
|
||||||
int m_pixmapWidth;
|
int m_pixmapWidth;
|
||||||
int m_pixmapHeight;
|
int m_pixmapHeight;
|
||||||
int m_pixmapOffsetX;
|
int m_pixmapOffsetX;
|
||||||
int m_pixmapOffsetY;
|
int m_pixmapOffsetY;
|
||||||
|
|
||||||
// Store the last scroll pos, since in wxWin the pos isn't set automatically
|
// Store the last scroll pos, since in wxWin the pos isn't set
|
||||||
// by system
|
// automatically by system
|
||||||
int m_scrollPosX;
|
int m_scrollPosX;
|
||||||
int m_scrollPosY;
|
int m_scrollPosY;
|
||||||
|
|
||||||
@@ -343,7 +323,8 @@ private:
|
|||||||
// undesired effects.
|
// undesired effects.
|
||||||
//
|
//
|
||||||
// Usage: create an instance of this class on the stack to disable the size
|
// 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
|
class WXDLLEXPORT wxNoOptimize
|
||||||
|
@@ -101,8 +101,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
|
|
||||||
wxSize best = m_bmpNormal.Ok() ? GetBestSize() : wxSize(30, 30);
|
wxSize best = m_bmpNormal.Ok() ? GetBestSize() : wxSize(30, 30);
|
||||||
if( size.x != -1 ) best.x = size.x;
|
if( size.x != -1 ) best.x = size.x;
|
||||||
if( size.y != -1 ) best.y = size.y;
|
if( size.y != -1 ) best.y = size.y;
|
||||||
@@ -266,7 +264,7 @@ void wxBitmapButton::DoSetBitmap()
|
|||||||
|
|
||||||
void wxBitmapButton::ChangeBackgroundColour()
|
void wxBitmapButton::ChangeBackgroundColour()
|
||||||
{
|
{
|
||||||
DoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
|
wxDoChangeBackgroundColour(m_mainWidget, m_backgroundColour, TRUE);
|
||||||
|
|
||||||
// Must reset the bitmaps since the colours have changed.
|
// Must reset the bitmaps since the colours have changed.
|
||||||
DoSetBitmap();
|
DoSetBitmap();
|
||||||
|
@@ -75,8 +75,6 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
|
|
||||||
wxSize best = GetBestSize();
|
wxSize best = GetBestSize();
|
||||||
if( size.x != -1 ) best.x = size.x;
|
if( size.x != -1 ) best.x = size.x;
|
||||||
if( size.y != -1 ) best.y = size.y;
|
if( size.y != -1 ) best.y = size.y;
|
||||||
|
@@ -70,7 +70,6 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
|
|
||||||
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
|
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget( parent, m_mainWidget, (WXWidget)NULL,
|
AttachWidget( parent, m_mainWidget, (WXWidget)NULL,
|
||||||
pos.x, pos.y, size.x, size.y );
|
pos.x, pos.y, size.x, size.y );
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ int wxChoice::DoAppend(const wxString& item)
|
|||||||
#endif
|
#endif
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
|
wxDoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
|
||||||
|
|
||||||
if( m_font.Ok() )
|
if( m_font.Ok() )
|
||||||
wxDoChangeFont( w, m_font );
|
wxDoChangeFont( w, m_font );
|
||||||
@@ -459,22 +459,22 @@ void wxChoice::ChangeFont(bool keepOriginalSize)
|
|||||||
|
|
||||||
void wxChoice::ChangeBackgroundColour()
|
void wxChoice::ChangeBackgroundColour()
|
||||||
{
|
{
|
||||||
DoChangeBackgroundColour(m_formWidget, m_backgroundColour);
|
wxDoChangeBackgroundColour(m_formWidget, m_backgroundColour);
|
||||||
DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
|
wxDoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
|
||||||
DoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
|
wxDoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < m_noStrings; i++)
|
for (i = 0; i < m_noStrings; i++)
|
||||||
DoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour);
|
wxDoChangeBackgroundColour(m_widgetArray[i], m_backgroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::ChangeForegroundColour()
|
void wxChoice::ChangeForegroundColour()
|
||||||
{
|
{
|
||||||
DoChangeForegroundColour(m_formWidget, m_foregroundColour);
|
wxDoChangeForegroundColour(m_formWidget, m_foregroundColour);
|
||||||
DoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
|
wxDoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
|
||||||
DoChangeForegroundColour(m_menuWidget, m_foregroundColour);
|
wxDoChangeForegroundColour(m_menuWidget, m_foregroundColour);
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < m_noStrings; i++)
|
for (i = 0; i < m_noStrings; i++)
|
||||||
DoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
|
wxDoChangeForegroundColour(m_widgetArray[i], m_foregroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
int wxChoice::GetCount() const
|
||||||
|
@@ -86,7 +86,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
|
XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
@@ -114,7 +114,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if( size.x != -1 ) best.x = size.x;
|
if( size.x != -1 ) best.x = size.x;
|
||||||
if( size.y != -1 ) best.y = size.y;
|
if( size.y != -1 ) best.y = size.y;
|
||||||
|
|
||||||
SetCanAddEventHandler(true);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
||||||
pos.x, pos.y, best.x, best.y);
|
pos.x, pos.y, best.x, best.y);
|
||||||
|
|
||||||
|
@@ -445,11 +445,11 @@ void wxDialog::ChangeFont(bool keepOriginalSize)
|
|||||||
void wxDialog::ChangeBackgroundColour()
|
void wxDialog::ChangeBackgroundColour()
|
||||||
{
|
{
|
||||||
if (GetMainWidget())
|
if (GetMainWidget())
|
||||||
DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
|
wxDoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDialog::ChangeForegroundColour()
|
void wxDialog::ChangeForegroundColour()
|
||||||
{
|
{
|
||||||
if (GetMainWidget())
|
if (GetMainWidget())
|
||||||
DoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
|
wxDoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
|
||||||
}
|
}
|
||||||
|
@@ -188,12 +188,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
|
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
|
// Change colour of the scrolled areas of the listboxes
|
||||||
Widget listParent = XtParent (widget);
|
Widget listParent = XtParent (widget);
|
||||||
#if 0
|
#if 0
|
||||||
wxWindow::DoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) listParent, *wxWHITE, TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Widget hsb = (Widget) 0;
|
Widget hsb = (Widget) 0;
|
||||||
@@ -207,8 +207,8 @@ static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
|
|||||||
* function to change them (by default, taken from wxSystemSettings)
|
* function to change them (by default, taken from wxSystemSettings)
|
||||||
*/
|
*/
|
||||||
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
wxWindow::DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
||||||
wxWindow::DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
||||||
|
|
||||||
if (hsb)
|
if (hsb)
|
||||||
XtVaSetValues (hsb,
|
XtVaSetValues (hsb,
|
||||||
@@ -334,9 +334,9 @@ int wxFileDialog::ShowModal()
|
|||||||
XmNresizePolicy, XmRESIZE_NONE,
|
XmNresizePolicy, XmRESIZE_NONE,
|
||||||
NULL);
|
NULL);
|
||||||
#endif
|
#endif
|
||||||
// DoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
|
// wxDoChangeBackgroundColour((WXWidget) fileSel, m_backgroundColour);
|
||||||
DoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
|
wxDoChangeBackgroundColour((WXWidget) filterWidget, *wxWHITE);
|
||||||
DoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
|
wxDoChangeBackgroundColour((WXWidget) selectionWidget, *wxWHITE);
|
||||||
|
|
||||||
wxChangeListBoxColours(this, dirListWidget);
|
wxChangeListBoxColours(this, dirListWidget);
|
||||||
wxChangeListBoxColours(this, fileListWidget);
|
wxChangeListBoxColours(this, fileListWidget);
|
||||||
|
@@ -694,13 +694,13 @@ void wxFrame::ChangeFont(bool WXUNUSED(keepOriginalSize))
|
|||||||
void wxFrame::ChangeBackgroundColour()
|
void wxFrame::ChangeBackgroundColour()
|
||||||
{
|
{
|
||||||
if (GetClientWidget())
|
if (GetClientWidget())
|
||||||
DoChangeBackgroundColour(GetClientWidget(), m_backgroundColour);
|
wxDoChangeBackgroundColour(GetClientWidget(), m_backgroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::ChangeForegroundColour()
|
void wxFrame::ChangeForegroundColour()
|
||||||
{
|
{
|
||||||
if (GetClientWidget())
|
if (GetClientWidget())
|
||||||
DoChangeForegroundColour(GetClientWidget(), m_foregroundColour);
|
wxDoChangeForegroundColour(GetClientWidget(), m_foregroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MATTEW: Used to insure that hide-&-show within an event cycle works */
|
/* MATTEW: Used to insure that hide-&-show within an event cycle works */
|
||||||
|
@@ -136,7 +136,6 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y,
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y,
|
||||||
best.x, best.y);
|
best.x, best.y);
|
||||||
|
|
||||||
|
@@ -149,7 +149,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
(XtCallbackProc) wxListBoxCallback,
|
(XtCallbackProc) wxListBoxCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
||||||
pos.x, pos.y, best.x, best.y);
|
pos.x, pos.y, best.x, best.y);
|
||||||
|
|
||||||
@@ -619,8 +618,8 @@ void wxListBox::ChangeBackgroundColour()
|
|||||||
* function to change them (by default, taken from wxSystemSettings)
|
* function to change them (by default, taken from wxSystemSettings)
|
||||||
*/
|
*/
|
||||||
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
||||||
DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
||||||
|
|
||||||
XtVaSetValues (hsb,
|
XtVaSetValues (hsb,
|
||||||
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
|
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(hsb)),
|
||||||
@@ -630,7 +629,7 @@ void wxListBox::ChangeBackgroundColour()
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
// MBN: why change parent's background? It looks really ugly.
|
// 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()
|
void wxListBox::ChangeForegroundColour()
|
||||||
@@ -648,9 +647,9 @@ void wxListBox::ChangeForegroundColour()
|
|||||||
/* TODO: should scrollbars be affected? Should probably have separate
|
/* TODO: should scrollbars be affected? Should probably have separate
|
||||||
function to change them (by default, taken from wxSystemSettings)
|
function to change them (by default, taken from wxSystemSettings)
|
||||||
|
|
||||||
DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
|
wxDoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
|
||||||
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
|
wxDoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
|
||||||
DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
|
wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -391,7 +391,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
|
XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
@@ -168,7 +168,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
XtManageChild (radioBoxWidget);
|
XtManageChild (radioBoxWidget);
|
||||||
XtManageChild ((Widget)m_mainWidget);
|
XtManageChild ((Widget)m_mainWidget);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
@@ -385,7 +384,7 @@ void wxRadioBox::ChangeBackgroundColour()
|
|||||||
{
|
{
|
||||||
WXWidget radioButton = m_radioButtons[i];
|
WXWidget radioButton = m_radioButtons[i];
|
||||||
|
|
||||||
DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
|
wxDoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
|
||||||
|
|
||||||
XtVaSetValues ((Widget) radioButton,
|
XtVaSetValues ((Widget) radioButton,
|
||||||
XmNselectColor, selectPixel,
|
XmNselectColor, selectPixel,
|
||||||
@@ -402,7 +401,7 @@ void wxRadioBox::ChangeForegroundColour()
|
|||||||
{
|
{
|
||||||
WXWidget radioButton = m_radioButtons[i];
|
WXWidget radioButton = m_radioButtons[i];
|
||||||
|
|
||||||
DoChangeForegroundColour(radioButton, m_foregroundColour);
|
wxDoChangeForegroundColour(radioButton, m_foregroundColour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -95,7 +95,6 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
XtManageChild (radioButtonWidget);
|
XtManageChild (radioButtonWidget);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
@@ -96,7 +96,6 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XtAddCallback(scrollBarWidget, XmNtoTopCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
|
XtAddCallback(scrollBarWidget, XmNtoTopCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
|
||||||
XtAddCallback(scrollBarWidget, XmNtoBottomCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
|
XtAddCallback(scrollBarWidget, XmNtoBottomCallback, (XtCallbackProc)wxScrollBarCallback, (XtPointer)this);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
|
@@ -104,7 +104,6 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
|
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
@@ -75,8 +75,6 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
|
|
||||||
wxSize actualSize(size);
|
wxSize actualSize(size);
|
||||||
// work around the cases where the bitmap is a wxNull(Icon/Bitmap)
|
// work around the cases where the bitmap is a wxNull(Icon/Bitmap)
|
||||||
if (actualSize.x == -1)
|
if (actualSize.x == -1)
|
||||||
|
@@ -121,7 +121,6 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
|
@@ -117,7 +117,6 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_mainWidget = borderWidget ? borderWidget : m_labelWidget;
|
m_mainWidget = borderWidget ? borderWidget : m_labelWidget;
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour ();
|
ChangeBackgroundColour ();
|
||||||
|
@@ -197,7 +197,6 @@ bool wxTextCtrl::Create(wxWindow *parent,
|
|||||||
if( size.x != -1 ) best.x = size.x;
|
if( size.x != -1 ) best.x = size.x;
|
||||||
if( size.y != -1 ) best.y = size.y;
|
if( size.y != -1 ) best.y = size.y;
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
||||||
pos.x, pos.y, best.x, best.y);
|
pos.x, pos.y, best.x, best.y);
|
||||||
|
|
||||||
@@ -581,9 +580,9 @@ void wxTextCtrl::ChangeBackgroundColour()
|
|||||||
NULL);
|
NULL);
|
||||||
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
if (hsb)
|
if (hsb)
|
||||||
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
||||||
if (vsb)
|
if (vsb)
|
||||||
DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
||||||
|
|
||||||
// MBN: why change parent background?
|
// MBN: why change parent background?
|
||||||
// DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
|
// DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
|
||||||
@@ -611,7 +610,7 @@ void wxTextCtrl::ChangeForegroundColour()
|
|||||||
if (vsb)
|
if (vsb)
|
||||||
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
|
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
|
||||||
*/
|
*/
|
||||||
DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
|
wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -239,7 +239,6 @@ bool wxToolBar::Create(wxWindow *parent,
|
|||||||
if( rSize.x == -1 && GetParent() )
|
if( rSize.x == -1 && GetParent() )
|
||||||
rSize.x = GetParent()->GetSize().x;
|
rSize.x = GetParent()->GetSize().x;
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
|
||||||
rPos.x, rPos.y, rSize.x, rSize.y);
|
rPos.x, rPos.y, rSize.x, rSize.y);
|
||||||
|
|
||||||
@@ -361,8 +360,8 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
if( !tool->GetButtonWidget() )
|
if( !tool->GetButtonWidget() )
|
||||||
{
|
{
|
||||||
DoChangeBackgroundColour((WXWidget) button,
|
wxDoChangeBackgroundColour((WXWidget) button,
|
||||||
m_backgroundColour, TRUE);
|
m_backgroundColour, TRUE);
|
||||||
|
|
||||||
tool->SetWidget(button);
|
tool->SetWidget(button);
|
||||||
}
|
}
|
||||||
|
@@ -200,10 +200,6 @@ void wxWindow::Init()
|
|||||||
m_needsRefresh = TRUE;
|
m_needsRefresh = TRUE;
|
||||||
m_mainWidget = (WXWidget) 0;
|
m_mainWidget = (WXWidget) 0;
|
||||||
|
|
||||||
m_button1Pressed =
|
|
||||||
m_button2Pressed =
|
|
||||||
m_button3Pressed = FALSE;
|
|
||||||
|
|
||||||
m_winCaptured = FALSE;
|
m_winCaptured = FALSE;
|
||||||
|
|
||||||
m_isShown = TRUE;
|
m_isShown = TRUE;
|
||||||
@@ -215,9 +211,6 @@ void wxWindow::Init()
|
|||||||
m_scrolledWindow =
|
m_scrolledWindow =
|
||||||
m_drawingArea = (WXWidget) 0;
|
m_drawingArea = (WXWidget) 0;
|
||||||
|
|
||||||
m_hScroll =
|
|
||||||
m_vScroll = FALSE;
|
|
||||||
|
|
||||||
m_scrollPosX =
|
m_scrollPosX =
|
||||||
m_scrollPosY = 0;
|
m_scrollPosY = 0;
|
||||||
|
|
||||||
@@ -230,7 +223,6 @@ void wxWindow::Init()
|
|||||||
|
|
||||||
m_lastTS = 0;
|
m_lastTS = 0;
|
||||||
m_lastButton = 0;
|
m_lastButton = 0;
|
||||||
m_canAddEventHandler = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// real construction (Init() must have been called before!)
|
// real construction (Init() must have been called before!)
|
||||||
@@ -378,8 +370,8 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
|||||||
// Scrolled widget needs to have its colour changed or we get a little blue
|
// Scrolled widget needs to have its colour changed or we get a little blue
|
||||||
// square where the scrollbars abutt
|
// square where the scrollbars abutt
|
||||||
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
DoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE);
|
||||||
DoChangeBackgroundColour(m_drawingArea, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour(m_drawingArea, backgroundColour, TRUE);
|
||||||
|
|
||||||
XmScrolledWindowSetAreas(
|
XmScrolledWindowSetAreas(
|
||||||
(Widget)m_scrolledWindow,
|
(Widget)m_scrolledWindow,
|
||||||
@@ -529,7 +521,7 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
|
|||||||
m_hScrollBar = (WXWidget) hScrollBar;
|
m_hScrollBar = (WXWidget) hScrollBar;
|
||||||
|
|
||||||
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
|
||||||
|
|
||||||
XtRealizeWidget(hScrollBar);
|
XtRealizeWidget(hScrollBar);
|
||||||
|
|
||||||
@@ -537,8 +529,6 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
|
|||||||
XmNhorizontalScrollBar, (Widget) m_hScrollBar,
|
XmNhorizontalScrollBar, (Widget) m_hScrollBar,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_hScroll = TRUE;
|
|
||||||
|
|
||||||
wxAddWindowToTable( hScrollBar, this );
|
wxAddWindowToTable( hScrollBar, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,7 +554,7 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
|
|||||||
|
|
||||||
m_vScrollBar = (WXWidget) vScrollBar;
|
m_vScrollBar = (WXWidget) vScrollBar;
|
||||||
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
|
wxDoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
|
||||||
|
|
||||||
XtRealizeWidget(vScrollBar);
|
XtRealizeWidget(vScrollBar);
|
||||||
|
|
||||||
@@ -572,8 +562,6 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
|
|||||||
XmNverticalScrollBar, (Widget) m_vScrollBar,
|
XmNverticalScrollBar, (Widget) m_vScrollBar,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_vScroll = TRUE;
|
|
||||||
|
|
||||||
wxAddWindowToTable( vScrollBar, this );
|
wxAddWindowToTable( vScrollBar, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +582,6 @@ void wxWindow::DestroyScrollbar(wxOrientation orientation)
|
|||||||
XtDestroyWidget((Widget) m_hScrollBar);
|
XtDestroyWidget((Widget) m_hScrollBar);
|
||||||
}
|
}
|
||||||
m_hScrollBar = (WXWidget) 0;
|
m_hScrollBar = (WXWidget) 0;
|
||||||
m_hScroll = FALSE;
|
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_scrolledWindow,
|
XtVaSetValues((Widget) m_scrolledWindow,
|
||||||
XmNhorizontalScrollBar, (Widget) 0,
|
XmNhorizontalScrollBar, (Widget) 0,
|
||||||
@@ -610,7 +597,6 @@ void wxWindow::DestroyScrollbar(wxOrientation orientation)
|
|||||||
XtDestroyWidget((Widget) m_vScrollBar);
|
XtDestroyWidget((Widget) m_vScrollBar);
|
||||||
}
|
}
|
||||||
m_vScrollBar = (WXWidget) 0;
|
m_vScrollBar = (WXWidget) 0;
|
||||||
m_vScroll = FALSE;
|
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_scrolledWindow,
|
XtVaSetValues((Widget) m_scrolledWindow,
|
||||||
XmNverticalScrollBar, (Widget) 0,
|
XmNverticalScrollBar, (Widget) 0,
|
||||||
@@ -1884,14 +1870,12 @@ bool wxWindow::AttachWidget (wxWindow* WXUNUSED(parent), WXWidget mainWidget,
|
|||||||
WXWidget formWidget, int x, int y, int width, int height)
|
WXWidget formWidget, int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
wxAddWindowToTable((Widget) mainWidget, this);
|
wxAddWindowToTable((Widget) mainWidget, this);
|
||||||
if (CanAddEventHandler())
|
XtAddEventHandler( (Widget) mainWidget,
|
||||||
{
|
ButtonPressMask | ButtonReleaseMask
|
||||||
XtAddEventHandler((Widget) mainWidget,
|
| PointerMotionMask,
|
||||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask, // | KeyPressMask,
|
False,
|
||||||
False,
|
wxPanelItemEventHandler,
|
||||||
wxPanelItemEventHandler,
|
(XtPointer) this);
|
||||||
(XtPointer) this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!formWidget)
|
if (!formWidget)
|
||||||
{
|
{
|
||||||
@@ -1925,14 +1909,12 @@ bool wxWindow::AttachWidget (wxWindow* WXUNUSED(parent), WXWidget mainWidget,
|
|||||||
// Remove event handler, remove from hash table
|
// Remove event handler, remove from hash table
|
||||||
bool wxWindow::DetachWidget(WXWidget widget)
|
bool wxWindow::DetachWidget(WXWidget widget)
|
||||||
{
|
{
|
||||||
if (CanAddEventHandler())
|
XtRemoveEventHandler( (Widget) widget,
|
||||||
{
|
ButtonPressMask | ButtonReleaseMask
|
||||||
XtRemoveEventHandler((Widget) widget,
|
| PointerMotionMask,
|
||||||
ButtonPressMask | ButtonReleaseMask | PointerMotionMask, // | KeyPressMask,
|
False,
|
||||||
False,
|
wxPanelItemEventHandler,
|
||||||
wxPanelItemEventHandler,
|
(XtPointer)this);
|
||||||
(XtPointer)this);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxDeleteWindowFromTable((Widget) widget);
|
wxDeleteWindowFromTable((Widget) widget);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2092,168 +2074,14 @@ static void wxCanvasInputEvent(Widget drawingArea,
|
|||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
|
{
|
||||||
|
wxMouseEvent wxevent;
|
||||||
|
if(wxTranslateMouseEvent(wxevent, canvas, drawingArea, &local_event))
|
||||||
{
|
{
|
||||||
// FIXME: most of this mouse event code is more or less
|
canvas->GetEventHandler()->ProcessEvent(wxevent);
|
||||||
// duplicated in wxTranslateMouseEvent
|
}
|
||||||
//
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
{
|
{
|
||||||
wxKeyEvent event (wxEVT_CHAR);
|
wxKeyEvent event (wxEVT_CHAR);
|
||||||
@@ -2449,26 +2277,31 @@ void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event,
|
|||||||
// TranslateXXXEvent() functions
|
// 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)
|
switch (xevent->xany.type)
|
||||||
{
|
{
|
||||||
case EnterNotify: // never received here - yes ? MB
|
case EnterNotify:
|
||||||
case LeaveNotify: // never received here - yes ? MB
|
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 ButtonPress:
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
{
|
{
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
|
|
||||||
// FIXME: this is never true I think - MB
|
|
||||||
//
|
|
||||||
if (xevent->xany.type == LeaveNotify)
|
if (xevent->xany.type == LeaveNotify)
|
||||||
{
|
{
|
||||||
win->SetButton1(FALSE);
|
eventType = wxEVT_LEAVE_WINDOW;
|
||||||
win->SetButton2(FALSE);
|
}
|
||||||
win->SetButton3(FALSE);
|
if (xevent->xany.type == EnterNotify)
|
||||||
return FALSE;
|
{
|
||||||
|
eventType = wxEVT_ENTER_WINDOW;
|
||||||
}
|
}
|
||||||
else if (xevent->xany.type == MotionNotify)
|
else if (xevent->xany.type == MotionNotify)
|
||||||
{
|
{
|
||||||
@@ -2481,30 +2314,28 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget,
|
|||||||
if (xevent->xbutton.button == Button1)
|
if (xevent->xbutton.button == Button1)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_LEFT_DOWN;
|
eventType = wxEVT_LEFT_DOWN;
|
||||||
win->SetButton1(TRUE);
|
|
||||||
button = 1;
|
button = 1;
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button2)
|
else if (xevent->xbutton.button == Button2)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_MIDDLE_DOWN;
|
eventType = wxEVT_MIDDLE_DOWN;
|
||||||
win->SetButton2(TRUE);
|
|
||||||
button = 2;
|
button = 2;
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button3)
|
else if (xevent->xbutton.button == Button3)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_RIGHT_DOWN;
|
eventType = wxEVT_RIGHT_DOWN;
|
||||||
win->SetButton3(TRUE);
|
|
||||||
button = 3;
|
button = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a double click
|
// check for a double click
|
||||||
//
|
//
|
||||||
long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay());
|
long dclickTime = XtGetMultiClickTime(wxGlobalDisplay());
|
||||||
long ts = wxevent.GetTimestamp();
|
long ts = wxevent.GetTimestamp();
|
||||||
|
|
||||||
int buttonLast = win->GetLastClickedButton();
|
int buttonLast = win->GetLastClickedButton();
|
||||||
long lastTS = win->GetLastClickTime();
|
long lastTS = win->GetLastClickTime();
|
||||||
if ( buttonLast && buttonLast == button && (ts - lastTS) < dclickTime )
|
if ( buttonLast && buttonLast == button &&
|
||||||
|
(ts - lastTS) < dclickTime )
|
||||||
{
|
{
|
||||||
// I have a dclick
|
// I have a dclick
|
||||||
win->SetLastClick(0, ts);
|
win->SetLastClick(0, ts);
|
||||||
@@ -2526,19 +2357,17 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget,
|
|||||||
if (xevent->xbutton.button == Button1)
|
if (xevent->xbutton.button == Button1)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_LEFT_UP;
|
eventType = wxEVT_LEFT_UP;
|
||||||
win->SetButton1(FALSE);
|
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button2)
|
else if (xevent->xbutton.button == Button2)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_MIDDLE_UP;
|
eventType = wxEVT_MIDDLE_UP;
|
||||||
win->SetButton2(FALSE);
|
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button3)
|
else if (xevent->xbutton.button == Button3)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_RIGHT_UP;
|
eventType = wxEVT_RIGHT_UP;
|
||||||
win->SetButton3(FALSE);
|
|
||||||
}
|
}
|
||||||
else return FALSE;
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2706,30 +2535,16 @@ void wxWindow::ChangeBackgroundColour()
|
|||||||
{
|
{
|
||||||
WXWidget mainWidget = GetMainWidget();
|
WXWidget mainWidget = GetMainWidget();
|
||||||
if ( mainWidget )
|
if ( mainWidget )
|
||||||
DoChangeBackgroundColour(mainWidget, m_backgroundColour);
|
wxDoChangeBackgroundColour(mainWidget, m_backgroundColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::ChangeForegroundColour()
|
void wxWindow::ChangeForegroundColour()
|
||||||
{
|
{
|
||||||
WXWidget mainWidget = GetMainWidget();
|
WXWidget mainWidget = GetMainWidget();
|
||||||
if ( mainWidget )
|
if ( mainWidget )
|
||||||
DoChangeForegroundColour(mainWidget, m_foregroundColour);
|
wxDoChangeForegroundColour(mainWidget, m_foregroundColour);
|
||||||
if ( m_scrolledWindow && mainWidget != m_scrolledWindow )
|
if ( m_scrolledWindow && mainWidget != m_scrolledWindow )
|
||||||
DoChangeForegroundColour(m_scrolledWindow, m_foregroundColour);
|
wxDoChangeForegroundColour(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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::SetBackgroundColour(const wxColour& col)
|
bool wxWindow::SetBackgroundColour(const wxColour& col)
|
||||||
|
Reference in New Issue
Block a user