]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/window.cpp
Added "set new icon" menu item to taskbar sample; updated some makefiles
[wxWidgets.git] / src / motif / window.cpp
index 4ec50c783906d6989e9fadaaf826ad121dc650f6..ba7350acb3729372804f170208a9e5c44d147232 100644 (file)
     #pragma implementation "window.h"
 #endif
 
     #pragma implementation "window.h"
 #endif
 
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#define XtWindow XTWINDOW
+#define XtScreen XTSCREEN
+#endif
+
 #include "wx/setup.h"
 #include "wx/menu.h"
 #include "wx/dc.h"
 #include "wx/setup.h"
 #include "wx/menu.h"
 #include "wx/dc.h"
@@ -441,6 +447,9 @@ wxWindow::~wxWindow()
             m_borderWidget = (WXWidget) 0;
         }
     }
             m_borderWidget = (WXWidget) 0;
         }
     }
+    else // Why wasn't this here before? JACS 8/3/2000
+        DestroyChildren();
+
 
     // Destroy the window
     if (GetMainWidget())
 
     // Destroy the window
     if (GetMainWidget())
@@ -744,11 +753,16 @@ bool wxWindow::SetCursor(const wxCursor& cursor)
         return FALSE;
     }
 
         return FALSE;
     }
 
-    wxASSERT_MSG( m_cursor.Ok(),
-                  wxT("cursor must be valid after call to the base version"));
+    //    wxASSERT_MSG( m_cursor.Ok(),
+    //                  wxT("cursor must be valid after call to the base version"));
+    wxCursor* cursor2 = NULL;
+    if (m_cursor.Ok())
+        cursor2 = & m_cursor;
+    else
+        cursor2 = wxSTANDARD_CURSOR;
 
     WXDisplay *dpy = GetXDisplay();
 
     WXDisplay *dpy = GetXDisplay();
-    WXCursor x_cursor = m_cursor.GetXCursor(dpy);
+    WXCursor x_cursor = cursor2->GetXCursor(dpy);
 
     Widget w = (Widget) GetMainWidget();
     Window win = XtWindow(w);
 
     Widget w = (Widget) GetMainWidget();
     Window win = XtWindow(w);
@@ -1191,7 +1205,7 @@ void wxWindow::DoGetSize(int *x, int *y) const
     Widget widget = (Widget) GetTopWidget();
     Dimension xx, yy;
     XtVaGetValues(widget, XmNwidth, &xx, XmNheight, &yy, NULL);
     Widget widget = (Widget) GetTopWidget();
     Dimension xx, yy;
     XtVaGetValues(widget, XmNwidth, &xx, XmNheight, &yy, NULL);
-    *x = xx; *y = yy;
+    if(x) *x = xx; if(y) *y = yy;
 }
 
 void wxWindow::DoGetPosition(int *x, int *y) const
 }
 
 void wxWindow::DoGetPosition(int *x, int *y) const
@@ -1214,7 +1228,7 @@ void wxWindow::DoGetPosition(int *x, int *y) const
         yy -= pt.y;
     }
 
         yy -= pt.y;
     }
 
-    *x = xx; *y = yy;
+    if(x) *x = xx; if(y) *y = yy;
 }
 
 void wxWindow::DoScreenToClient(int *x, int *y) const
 }
 
 void wxWindow::DoScreenToClient(int *x, int *y) const
@@ -1250,7 +1264,7 @@ void wxWindow::DoGetClientSize(int *x, int *y) const
     Widget widget = (Widget) GetClientWidget();
     Dimension xx, yy;
     XtVaGetValues(widget, XmNwidth, &xx, XmNheight, &yy, NULL);
     Widget widget = (Widget) GetClientWidget();
     Dimension xx, yy;
     XtVaGetValues(widget, XmNwidth, &xx, XmNheight, &yy, NULL);
-    *x = xx; *y = yy;
+    if(x) *x = xx; if(y) *y = yy;
 }
 
 void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 }
 
 void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
@@ -2085,22 +2099,21 @@ static void wxCanvasInputEvent(Widget drawingArea,
                     {
                         // I have a dclick
                         canvas->SetLastClick(0, ts);
                     {
                         // I have a dclick
                         canvas->SetLastClick(0, ts);
-                        switch ( eventType )
+
+                        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 )
                         {
                         {
-                        case wxEVT_LEFT_DOWN:
-                            wxevent.SetEventType(wxEVT_LEFT_DCLICK);
-                            break;
-                        case wxEVT_MIDDLE_DOWN:
-                            wxevent.SetEventType(wxEVT_MIDDLE_DCLICK);
-                            break;
-                        case wxEVT_RIGHT_DOWN:
-                            wxevent.SetEventType(wxEVT_RIGHT_DCLICK);
-                            break;
-
-                        default :
-                            break;
+                            wxevent.SetEventType(typeDouble);
                         }
                         }
-
                     }
                     else
                     {
                     }
                     else
                     {
@@ -2642,22 +2655,12 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Widget widget,
                 {
                     // I have a dclick
                     win->SetLastClick(0, ts);
                 {
                     // I have a dclick
                     win->SetLastClick(0, ts);
-                    switch ( eventType )
-                    {
-                        case wxEVT_LEFT_DOWN:
-                            eventType = wxEVT_LEFT_DCLICK;
-                            break;
-                        case wxEVT_MIDDLE_DOWN:
-                            eventType = wxEVT_MIDDLE_DCLICK;
-                            break;
-                        case wxEVT_RIGHT_DOWN:
-                            eventType = wxEVT_RIGHT_DCLICK;
-                            break;
-
-                        default :
-                            break;
-                    }
-                    
+                    if ( eventType == wxEVT_LEFT_DOWN )
+                        eventType = wxEVT_LEFT_DCLICK;
+                    else if ( eventType == wxEVT_MIDDLE_DOWN )
+                        eventType = wxEVT_MIDDLE_DCLICK;
+                    else if ( eventType == wxEVT_RIGHT_DOWN )
+                        eventType = wxEVT_RIGHT_DCLICK;
                 }
                 else
                 {
                 }
                 else
                 {
@@ -2970,9 +2973,34 @@ void wxWindow::ChangeFont(bool keepOriginalSize)
 wxWindow *wxGetActiveWindow()
 {
     // TODO
 wxWindow *wxGetActiveWindow()
 {
     // TODO
+    wxFAIL_MSG("Not implemented");
     return NULL;
 }
 
     return NULL;
 }
 
+// Find the wxWindow at the current mouse position, returning the mouse
+// position.
+wxWindow* wxFindWindowAtPointer(wxPoint& pt)
+{
+    return wxFindWindowAtPoint(wxGetMousePosition());
+}
+
+// Get the current mouse position.
+wxPoint wxGetMousePosition()
+{
+    Display *display = (Display*) wxGetDisplay();
+    Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
+    Window rootReturn, childReturn;
+    int rootX, rootY, winX, winY;
+    unsigned int maskReturn;
+
+    XQueryPointer (display,
+                  rootWindow,
+                  &rootReturn,
+                   &childReturn,
+                   &rootX, &rootY, &winX, &winY, &maskReturn);
+    return wxPoint(rootX, rootY);
+}
+
 // ----------------------------------------------------------------------------
 // wxNoOptimize: switch off size optimization
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxNoOptimize: switch off size optimization
 // ----------------------------------------------------------------------------