]> git.saurik.com Git - wxWidgets.git/commitdiff
Code clanup: removed some useless/unused member
authorMattia Barbon <mbarbon@cpan.org>
Mon, 14 Apr 2003 17:27:28 +0000 (17:27 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Mon, 14 Apr 2003 17:27:28 +0000 (17:27 +0000)
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

23 files changed:
include/wx/motif/window.h
src/motif/bmpbuttn.cpp
src/motif/button.cpp
src/motif/checkbox.cpp
src/motif/choice.cpp
src/motif/combobox.cpp
src/motif/combobox_native.cpp
src/motif/dialog.cpp
src/motif/filedlg.cpp
src/motif/frame.cpp
src/motif/gauge.cpp
src/motif/listbox.cpp
src/motif/mdi.cpp
src/motif/radiobox.cpp
src/motif/radiobut.cpp
src/motif/scrolbar.cpp
src/motif/slider.cpp
src/motif/statbmp.cpp
src/motif/statbox.cpp
src/motif/stattext.cpp
src/motif/textctrl.cpp
src/motif/toolbar.cpp
src/motif/window.cpp

index d0cb75935eee135ddf1a800509d76d1ea661edbd..5f0e174557a8a78b4b3114e6372da03aa92c43c2 100644 (file)
@@ -110,7 +110,8 @@ public:
     
     // 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)
@@ -124,20 +125,14 @@ public:
     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
@@ -160,10 +155,6 @@ public:
     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;
@@ -172,9 +163,6 @@ protected:
     // 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);
     
@@ -182,9 +170,6 @@ protected:
     
     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,
@@ -213,7 +198,8 @@ public:
     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)
@@ -246,8 +232,8 @@ protected:
     // 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
@@ -274,14 +260,10 @@ protected:
     // --------------------
     
     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;
@@ -293,17 +275,15 @@ protected:
     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;
     
@@ -343,7 +323,8 @@ private:
 // 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
index aede52c9b0e970f9c86d2ded6f996a0a143373a8..721409d8a4c0f3c54018385818f92b567f93dbeb 100644 (file)
@@ -101,8 +101,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id,
                    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;
@@ -266,7 +264,7 @@ void wxBitmapButton::DoSetBitmap()
 
 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();
index 709a1a9ffcf1f0b416f39c9032da6df03e448f60..5272ec5984fb8fbff4511bf42c92bdca15bd2785 100644 (file)
@@ -75,8 +75,6 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
                    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;
index cd2b57c5b8ebb814e9dee1a03b47f286983bd377..edd27d1c2b84566d9f998eff2e0236494911d519 100644 (file)
@@ -70,7 +70,6 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 
     XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget( parent, m_mainWidget, (WXWidget)NULL,
                   pos.x, pos.y, size.x, size.y );
 
index 34079657648e46d8cd48b268ff568658c1f472ae..d8f2533de4fa76bf9ebd61a8965ba3cd8309aba7 100644 (file)
@@ -179,7 +179,7 @@ int wxChoice::DoAppend(const wxString& item)
 #endif
         NULL);
 
-    DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
+    wxDoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
 
     if( m_font.Ok() )
         wxDoChangeFont( w, m_font );
@@ -459,22 +459,22 @@ void wxChoice::ChangeFont(bool keepOriginalSize)
 
 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
index fb3e685bf18551e56a69ec3a09897063993a3b66..ef51038de6fb1f2eb60e9ee4ca0882533a90a8b8 100644 (file)
@@ -86,7 +86,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
     XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
         (XtPointer) this);
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
     ChangeBackgroundColour();
index 846d4e10f3e3d799569bbe7eec3a2411af4a0b57..95294fe5f8d340bf942c056ac6beb2dfaa3d2e53 100644 (file)
@@ -114,7 +114,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
     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);
 
index ab5c7eecccb02f5f792a5230385a0a03ca690db9..533cad7db575ab85c2181bf61cc99203391d7806 100644 (file)
@@ -445,11 +445,11 @@ void wxDialog::ChangeFont(bool keepOriginalSize)
 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);
 }
index c4ea2a4f4edcb7530b132cae6230eac8ca76308e..27ad5f831f7c4bf980ca2f9df009f8ccb629bc12 100644 (file)
@@ -188,12 +188,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
 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;
@@ -207,8 +207,8 @@ static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget)
     * 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,
@@ -334,9 +334,9 @@ int wxFileDialog::ShowModal()
         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);
index f65136d32db9eebc4d9001481da85feaca4305f7..d6fc8327db650d2bf2fd81509c26b2b04b2fbac4 100644 (file)
@@ -694,13 +694,13 @@ void wxFrame::ChangeFont(bool WXUNUSED(keepOriginalSize))
 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 */
index 6a7f0fb2bac0f6a1647d1aa1f806843cdff628d6..23931f09d9c97c8d031db7d3aa0f9f5ef00354f3 100644 (file)
@@ -136,7 +136,6 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
 
     ChangeFont(FALSE);
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y,
                   best.x, best.y);
 
index db682d40d422c5c0c7def309abd5f91d0c9021ad..e28473f61505a32b24acfc6e6b46338db1f32d97 100644 (file)
@@ -149,7 +149,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
                    (XtCallbackProc) wxListBoxCallback,
                    (XtPointer) this);
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
                   pos.x, pos.y, best.x, best.y);
 
@@ -619,8 +618,8 @@ void wxListBox::ChangeBackgroundColour()
     * 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)),
@@ -630,7 +629,7 @@ void wxListBox::ChangeBackgroundColour()
         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()
@@ -648,9 +647,9 @@ 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);
     */
 }
 
index daf09e25820feecc626fe448a3c9df0ef3d00f02..c4ad44a11ae69a328b4379b3bf35ba5960fd2b87 100644 (file)
@@ -391,7 +391,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
     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();
index 6659d3d324a9701d56e8c2b683a7fd9ca3cd5f93..6073ff07c36b54a1b890eb4bb75dfc42277fbd83 100644 (file)
@@ -168,7 +168,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
     XtManageChild (radioBoxWidget);
     XtManageChild ((Widget)m_mainWidget);
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
 
     ChangeBackgroundColour();
@@ -385,7 +384,7 @@ void wxRadioBox::ChangeBackgroundColour()
     {
         WXWidget radioButton = m_radioButtons[i];
 
-        DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
+        wxDoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
 
         XtVaSetValues ((Widget) radioButton,
           XmNselectColor, selectPixel,
@@ -402,7 +401,7 @@ void wxRadioBox::ChangeForegroundColour()
     {
         WXWidget radioButton = m_radioButtons[i];
 
-        DoChangeForegroundColour(radioButton, m_foregroundColour);
+        wxDoChangeForegroundColour(radioButton, m_foregroundColour);
     }
 }
 
index 9dc0df98d8c46a486a808c575ccdf3dfbe9c252e..87c20587a9b0fad998c6d30dcdceb77b52ef4d20 100644 (file)
@@ -95,7 +95,6 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
 
     XtManageChild (radioButtonWidget);
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
     ChangeBackgroundColour();
index e0a15b4a4ccdbfdd788b6d2e74a4923c14f29987..c882178a53bcc3601b95aef939812bfb249ca60b 100644 (file)
@@ -96,7 +96,6 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
     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();
 
index 0cf3134f88cea3bce325046c1ddc05b91731cf2a..69d6efb92ce8cf0a31e75755f8ee0bdd8dc44a0f 100644 (file)
@@ -104,7 +104,6 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
     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();
index 43e55139eec7c600b66333c38ddaff5890fe9ba1..c10ac0d74ae47a2031cf7c5cd5a2cfec71f5017f 100644 (file)
@@ -75,8 +75,6 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
     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)
index f836c53de3cb4a8327155d580aa9f6fb50afce5e..3aad2651532e4e6e394c79001c43ffd41e92ef7e 100644 (file)
@@ -121,7 +121,6 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
                 NULL);
     }
     
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
     ChangeBackgroundColour();
 
index ead5cd99b58190dba0deba0c50443d32fa7f033f..4f9b14740c5452424caf4d99363cbd2e29dc22e0 100644 (file)
@@ -117,7 +117,6 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
 
     m_mainWidget = borderWidget ? borderWidget : m_labelWidget;
 
-    SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
     ChangeBackgroundColour ();
index b518e2fe45162cc85d995ea2aee4736c1748a193..cb5b2b49a9964c833e241710876eb38b424d29b5 100644 (file)
@@ -197,7 +197,6 @@ bool wxTextCtrl::Create(wxWindow *parent,
     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);
 
@@ -581,9 +580,9 @@ void wxTextCtrl::ChangeBackgroundColour()
             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);
@@ -611,7 +610,7 @@ void wxTextCtrl::ChangeForegroundColour()
             if (vsb)
             DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
         */
-        DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
+        wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
     }
 }
 
index 08413938116aa073e299ca98bef77a5c02a0cb2d..6bdc23d9cd9e37c9a4fccf7ccf0d0a9b6a8f4cb0 100644 (file)
@@ -239,7 +239,6 @@ bool wxToolBar::Create(wxWindow *parent,
     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);
 
@@ -361,8 +360,8 @@ bool wxToolBar::Realize()
 
                 if( !tool->GetButtonWidget() )
                 {
-                    DoChangeBackgroundColour((WXWidget) button,
-                                             m_backgroundColour, TRUE);
+                    wxDoChangeBackgroundColour((WXWidget) button,
+                                               m_backgroundColour, TRUE);
 
                     tool->SetWidget(button);
                 }
index 17b3de81b2e22b1cf2aa9306ece6e576e291067d..cc55da5b8d20f46fa4c1913a873fdff62293ef8d 100644 (file)
@@ -200,10 +200,6 @@ void wxWindow::Init()
     m_needsRefresh = TRUE;
     m_mainWidget = (WXWidget) 0;
 
-    m_button1Pressed =
-    m_button2Pressed =
-    m_button3Pressed = FALSE;
-
     m_winCaptured = FALSE;
 
     m_isShown = TRUE;
@@ -215,9 +211,6 @@ void wxWindow::Init()
     m_scrolledWindow =
     m_drawingArea = (WXWidget) 0;
 
-    m_hScroll =
-    m_vScroll = FALSE;
-
     m_scrollPosX =
     m_scrollPosY = 0;
 
@@ -230,7 +223,6 @@ void wxWindow::Init()
 
     m_lastTS = 0;
     m_lastButton = 0;
-    m_canAddEventHandler = FALSE;
 }
 
 // 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
     // 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,
@@ -529,7 +521,7 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
         m_hScrollBar = (WXWidget) hScrollBar;
 
         wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
-        DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
+        wxDoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
 
         XtRealizeWidget(hScrollBar);
 
@@ -537,8 +529,6 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
             XmNhorizontalScrollBar, (Widget) m_hScrollBar,
             NULL);
 
-        m_hScroll = TRUE;
-
         wxAddWindowToTable( hScrollBar, this );
     }
 
@@ -564,7 +554,7 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
 
         m_vScrollBar = (WXWidget) vScrollBar;
         wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
-        DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
+        wxDoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
 
         XtRealizeWidget(vScrollBar);
 
@@ -572,8 +562,6 @@ void wxWindow::CreateScrollbar(wxOrientation orientation)
             XmNverticalScrollBar, (Widget) m_vScrollBar,
             NULL);
 
-        m_vScroll = TRUE;
-
         wxAddWindowToTable( vScrollBar, this );
     }
 
@@ -594,7 +582,6 @@ void wxWindow::DestroyScrollbar(wxOrientation orientation)
             XtDestroyWidget((Widget) m_hScrollBar);
         }
         m_hScrollBar = (WXWidget) 0;
-        m_hScroll = FALSE;
 
         XtVaSetValues((Widget) m_scrolledWindow,
             XmNhorizontalScrollBar, (Widget) 0,
@@ -610,7 +597,6 @@ void wxWindow::DestroyScrollbar(wxOrientation orientation)
             XtDestroyWidget((Widget) m_vScrollBar);
         }
         m_vScrollBar = (WXWidget) 0;
-        m_vScroll = FALSE;
 
         XtVaSetValues((Widget) m_scrolledWindow,
             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)
 {
     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)
     {
@@ -1925,14 +1909,12 @@ bool wxWindow::AttachWidget (wxWindow* WXUNUSED(parent), WXWidget mainWidget,
 // 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;
@@ -2092,168 +2074,14 @@ static void wxCanvasInputEvent(Widget drawingArea,
     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);
@@ -2449,26 +2277,31 @@ void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event,
 // 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)
             {
@@ -2481,30 +2314,28 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget,
                 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);
@@ -2526,19 +2357,17 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget,
                 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
             {
@@ -2706,30 +2535,16 @@ void wxWindow::ChangeBackgroundColour()
 {
     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)