]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/scrolbar.cpp
Only give capture to wxPopupTransientWindow child if it's the only one.
[wxWidgets.git] / src / motif / scrolbar.cpp
index bb3f97a8d24262bd4506ade89412a5af3da16c89..f8af5bbd774c70a61e484f0cba6dcd946197bf42 100644 (file)
@@ -1,27 +1,20 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        scrolbar.cpp
+// Name:        src/motif/scrolbar.cpp
 // Purpose:     wxScrollBar
 // Author:      Julian Smart
 // Modified by:
 // Created:     17/09/98
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "scrolbar.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/defs.h"
 #include "wx/scrolbar.h"
 
 #ifdef __VMS__
 #pragma message disable nosimpint
-#define XtDisplay XTDISPLAY
 #endif
 #include <Xm/Xm.h>
 #include <Xm/ScrollBar.h>
@@ -34,8 +27,6 @@
 static void wxScrollBarCallback(Widget widget, XtPointer clientData,
                         XmScaleCallbackStruct *cbs);
 
-IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
-
 // Scrollbar
 bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
@@ -45,6 +36,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
 {
     if( !CreateControl( parent, id, pos, size, style, validator, name ) )
         return false;
+    PreCreation();
 
     wxSize newSize =
         ( style & wxHORIZONTAL ) ? wxSize( 140, 16 ) : wxSize( 16, 140 );
@@ -58,9 +50,9 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
                            (wxOrientation)(style & (wxHORIZONTAL|wxVERTICAL)),
                            (void (*)())wxScrollBarCallback );
 
+    PostCreation();
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
                   pos.x, pos.y, newSize.x, newSize.y);
-    ChangeBackgroundColour();
 
     return true;
 }
@@ -130,7 +122,9 @@ static void wxScrollBarCallback(Widget widget, XtPointer clientData,
                                 XmScaleCallbackStruct *cbs)
 {
     wxScrollBar *scrollBar = (wxScrollBar*)wxGetWindowFromTable(widget);
-    wxOrientation orientation = (wxOrientation)(int)clientData;
+    wxCHECK_RET( scrollBar, wxT("invalid widget in scrollbar callback") );
+
+    wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
     wxEventType eventType = wxEVT_NULL;
 
     switch (cbs->reason)
@@ -186,5 +180,5 @@ static void wxScrollBarCallback(Widget widget, XtPointer clientData,
     wxScrollEvent event(eventType, scrollBar->GetId(),
                         cbs->value, orientation);
     event.SetEventObject(scrollBar);
-    scrollBar->GetEventHandler()->ProcessEvent(event);
+    scrollBar->HandleWindowEvent(event);
 }