From 9806a47c30050b2beeb772f69d4cef4a20dc8745 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Mon, 9 Jul 2001 13:14:28 +0000
Subject: [PATCH] Various wxMotif fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/chkconf.h          | 10 ++++++++++
 include/wx/generic/scrolwin.h |  2 +-
 include/wx/motif/window.h     |  5 ++++-
 include/wx/spinctrl.h         |  2 ++
 src/generic/notebook.cpp      | 18 ++++++++++++++++++
 src/generic/scrlwing.cpp      | 20 ++++++++++----------
 src/html/helpfrm.cpp          |  4 ++++
 src/motif/menu.cpp            |  2 +-
 src/motif/spinbutt.cpp        |  1 -
 src/motif/window.cpp          | 18 +++++++++++++++---
 10 files changed, 65 insertions(+), 17 deletions(-)

diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h
index a5170724b4..339deef635 100644
--- a/include/wx/chkconf.h
+++ b/include/wx/chkconf.h
@@ -587,6 +587,16 @@
 #   endif
 #endif /* wxGTK && !wxUniv */
 
+/* wxMotif-specific dependencies */
+#if defined(__WXMOTIF__) && wxUSE_NOTEBOOK && !wxUSE_TAB_DIALOG
+#  undef wxUSE_TAB_DIALOG
+#  define wxUSE_TAB_DIALOG 1
+#endif
+#if defined(__WXMOTIF__) && wxUSE_TOGGLEBTN
+#  undef wxUSE_TOGGLEBTN
+#  define wxUSE_TOGGLEBTN 0
+#endif
+
 /* generic controls dependencies */
 #if !defined(__WXMSW__) || defined(__WXUNIVERSAL__)
 #   if wxUSE_FONTDLG || wxUSE_FILEDLG || wxUSE_CHOICEDLG
diff --git a/include/wx/generic/scrolwin.h b/include/wx/generic/scrolwin.h
index 43cc01fcad..a8f180e034 100644
--- a/include/wx/generic/scrolwin.h
+++ b/include/wx/generic/scrolwin.h
@@ -42,7 +42,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
 class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
                                             public wxScrollHelper
 {
-public:
+ public:
     wxGenericScrolledWindow() : wxScrollHelper(this) { }
     wxGenericScrolledWindow(wxWindow *parent,
                      wxWindowID id = -1,
diff --git a/include/wx/motif/window.h b/include/wx/motif/window.h
index aefcae03a3..85dbde9f24 100644
--- a/include/wx/motif/window.h
+++ b/include/wx/motif/window.h
@@ -203,11 +203,14 @@ protected:
     bool CanAddEventHandler() const { return m_canAddEventHandler; }
     void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
 
+public:
     WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
+    void SetBackingPixmap(WXPixmap pixmap) { m_backingPixmap = pixmap; }
     int GetPixmapWidth() const { return m_pixmapWidth; }
     int GetPixmapHeight() const { return m_pixmapHeight; }
+    void SetPixmapWidth(int w) { m_pixmapWidth = w; }
+    void SetPixmapHeight(int h) { m_pixmapHeight = h; }
 
-public:
     // Change properties
     virtual void ChangeFont(bool keepOriginalSize = TRUE);             // Change to the current font (often overridden)
 
diff --git a/include/wx/spinctrl.h b/include/wx/spinctrl.h
index 6bc0d71f5f..453175ebbb 100644
--- a/include/wx/spinctrl.h
+++ b/include/wx/spinctrl.h
@@ -58,6 +58,8 @@ protected:
     #include "wx/os2/spinctrl.h"
 #elif defined(__WXGTK__)
     #include "wx/gtk/spinctrl.h"
+#elif defined(__WXMOTIF__)
+    #include "wx/generic/spinctlg.h"
 #elif defined(__WXMAC__)
     #include "wx/generic/spinctlg.h"
 #else // Win16 || !Win
diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp
index b1c74e6fb6..94170c605e 100644
--- a/src/generic/notebook.cpp
+++ b/src/generic/notebook.cpp
@@ -214,6 +214,24 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
     return FALSE;
 }
 
+// set the size (the same for all pages)
+void wxNotebook::SetPageSize(const wxSize& size)
+{
+    // TODO
+}
+
+// set the padding between tabs (in pixels)
+void wxNotebook::SetPadding(const wxSize& padding)
+{
+    // TODO
+}
+
+// set the size of the tabs for wxNB_FIXEDWIDTH controls
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
+    // TODO
+}
+
 // ----------------------------------------------------------------------------
 // wxNotebook operations
 // ----------------------------------------------------------------------------
diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp
index 575df5c5c0..e0dea8a41e 100644
--- a/src/generic/scrlwing.cpp
+++ b/src/generic/scrlwing.cpp
@@ -319,22 +319,22 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX,
 
         int totalPixelWidth = m_xScrollLines * m_xScrollPixelsPerLine;
         int totalPixelHeight = m_yScrollLines * m_yScrollPixelsPerLine;
-        if (m_targetWindow->m_backingPixmap &&
-           !((m_targetWindow->m_pixmapWidth == totalPixelWidth) &&
-             (m_targetWindow->m_pixmapHeight == totalPixelHeight)))
+        if (m_targetWindow->GetBackingPixmap() &&
+           !((m_targetWindow->GetPixmapWidth() == totalPixelWidth) &&
+             (m_targetWindow->GetPixmapHeight() == totalPixelHeight)))
         {
-            XFreePixmap (dpy, (Pixmap) m_targetWindow->m_backingPixmap);
-            m_targetWindow->m_backingPixmap = (WXPixmap) 0;
+            XFreePixmap (dpy, (Pixmap) m_targetWindow->GetBackingPixmap());
+            m_targetWindow->SetBackingPixmap((WXPixmap) 0);
         }
 
-        if (!m_targetWindow->m_backingPixmap &&
+        if (!m_targetWindow->GetBackingPixmap() &&
            (noUnitsX != 0) && (noUnitsY != 0))
         {
             int depth = wxDisplayDepth();
-            m_pixmapWidth = totalPixelWidth;
-            m_pixmapHeight = totalPixelHeight;
-            m_backingPixmap = (WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)),
-            m_pixmapWidth, m_pixmapHeight, depth);
+            m_targetWindow->SetPixmapWidth(totalPixelWidth);
+            m_targetWindow->SetPixmapHeight(totalPixelHeight);
+            m_targetWindow->SetBackingPixmap((WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)),
+              m_targetWindow->GetPixmapWidth(), m_targetWindow->GetPixmapHeight(), depth));
         }
 
     }
diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp
index 7fba6120af..f5b05c3df3 100644
--- a/src/html/helpfrm.cpp
+++ b/src/html/helpfrm.cpp
@@ -76,6 +76,10 @@
 // what is considered "small index"?
 #define INDEX_IS_SMALL 100
 
+/* Motif defines this as a macro */
+#ifdef Below
+#undef Below
+#endif
 
 //--------------------------------------------------------------------------
 // wxHtmlHelpTreeItemData (private)
diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp
index ba16e31c36..05c0912007 100644
--- a/src/motif/menu.cpp
+++ b/src/motif/menu.cpp
@@ -286,7 +286,7 @@ bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
         menu->SetButtonWidget(w);
     }
 
-    menu->SetMenuBar(this);
+    //menu->SetMenuBar(this);
 
     m_titles.Add(title);
 
diff --git a/src/motif/spinbutt.cpp b/src/motif/spinbutt.cpp
index 1c763d4603..7f00a8a420 100644
--- a/src/motif/spinbutt.cpp
+++ b/src/motif/spinbutt.cpp
@@ -20,7 +20,6 @@
 // put wxSpinCtrl here too because it doesn't have a separate file for it in
 // wxMotif (yet)
 IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
-IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent)
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size),
diff --git a/src/motif/window.cpp b/src/motif/window.cpp
index c639ebf210..b2f4037d0e 100644
--- a/src/motif/window.cpp
+++ b/src/motif/window.cpp
@@ -80,6 +80,8 @@ static const int SCROLL_MARGIN = 4;
 // ----------------------------------------------------------------------------
 
 extern wxHashTable *wxWidgetHashTable;
+static wxWindow* g_captureWindow = NULL;
+
 
 // ----------------------------------------------------------------------------
 // private functions
@@ -383,6 +385,9 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
 // Destructor
 wxWindow::~wxWindow()
 {
+    if (g_captureWindow == this)
+	g_captureWindow = NULL;
+    
     m_isBeingDeleted = TRUE;
     
     // Motif-specific actions first
@@ -710,6 +715,7 @@ wxString wxWindow::GetTitle() const
 
 void wxWindow::CaptureMouse()
 {
+    g_captureWindow = this;
     if ( m_winCaptured )
         return;
 
@@ -722,6 +728,7 @@ void wxWindow::CaptureMouse()
 
 void wxWindow::ReleaseMouse()
 {
+    g_captureWindow = NULL;
     if ( !m_winCaptured )
         return;
 
@@ -2977,6 +2984,13 @@ wxWindow *wxGetActiveWindow()
     return NULL;
 }
 
+/* static */
+wxWindow *wxWindowBase::GetCapture()
+{
+    return (wxWindow *)g_captureWindow;
+}
+
+
 // Find the wxWindow at the current mouse position, returning the mouse
 // position.
 wxWindow* wxFindWindowAtPointer(wxPoint& pt)
@@ -3001,12 +3015,10 @@ wxPoint wxGetMousePosition()
     return wxPoint(rootX, rootY);
 }
 
+
 // ----------------------------------------------------------------------------
 // wxNoOptimize: switch off size optimization
 // ----------------------------------------------------------------------------
 
 int wxNoOptimize::ms_count = 0;
 
-
-
-
-- 
2.47.2