From 4b5f3fe655deeb91d5d3abe8fad30c4a1cae63dc Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Mon, 26 Oct 1998 17:10:25 +0000
Subject: [PATCH] Motif and other mods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 distrib/msw/generic.rsp       |   1 +
 docs/latex/wx/splitter.tex    |   6 +-
 docs/msw/todo.txt             |   9 +-
 include/wx/docview.h          |   4 +-
 include/wx/generic/tabg.h     |  20 ++--
 include/wx/log.h              |   3 +-
 include/wx/memory.h           |   3 +-
 include/wx/motif/button.h     |   2 +-
 include/wx/motif/checkbox.h   |   2 +-
 include/wx/motif/choice.h     |   2 +-
 include/wx/motif/combobox.h   |   2 +-
 include/wx/motif/dialog.h     |   2 +-
 include/wx/motif/frame.h      |   2 +-
 include/wx/motif/gauge.h      |   2 +-
 include/wx/motif/listbox.h    |   2 +-
 include/wx/motif/notebook.h   |  50 +++++++-
 include/wx/motif/radiobox.h   |   2 +-
 include/wx/motif/radiobut.h   |   2 +-
 include/wx/motif/scrolbar.h   |   2 +-
 include/wx/motif/slider.h     |   2 +-
 include/wx/motif/spinbutt.h   |   2 +-
 include/wx/motif/statbmp.h    |   2 +-
 include/wx/motif/statbox.h    |   2 +-
 include/wx/motif/stattext.h   |   2 +-
 include/wx/motif/textctrl.h   |   2 +-
 include/wx/motif/window.h     |   2 +-
 include/wx/msw/colour.h       |   2 +-
 include/wx/object.h           |   3 +-
 include/wx/string.h           |   3 +-
 samples/controls/controls.cpp |   2 +-
 samples/tab/makefile.unx      |   2 +-
 samples/tab/test.cpp          | 207 +++++++++++++++++++++++++++-------
 samples/tab/test.h            |  38 +++++++
 src/common/ftp.cpp            |   4 +-
 src/generic/tabg.cpp          |  82 ++++++++++----
 src/gtk/colour.cpp            |   4 +-
 src/gtk1/colour.cpp           |   4 +-
 src/motif/app.cpp             |   2 +
 src/motif/bmpbuttn.cpp        |   6 +-
 src/motif/button.cpp          |   7 +-
 src/motif/checkbox.cpp        |   9 +-
 src/motif/choice.cpp          |  17 ++-
 src/motif/combobox.cpp        |   8 +-
 src/motif/dialog.cpp          |   8 +-
 src/motif/frame.cpp           |   5 +-
 src/motif/gauge.cpp           |   8 +-
 src/motif/listbox.cpp         |   8 +-
 src/motif/notebook.cpp        | 186 +++++++++++++++++++++++++-----
 src/motif/radiobox.cpp        |   6 +-
 src/motif/radiobut.cpp        |   8 +-
 src/motif/scrolbar.cpp        |   2 +-
 src/motif/slider.cpp          |   8 +-
 src/motif/spinbutt.cpp        |   2 +-
 src/motif/statbmp.cpp         |   9 +-
 src/motif/statbox.cpp         |   4 +-
 src/motif/stattext.cpp        |   9 +-
 src/motif/textctrl.cpp        |   8 +-
 src/motif/toolbar.cpp         |  14 ++-
 src/motif/window.cpp          |   4 +-
 src/stubs/app.cpp             |   2 +
 60 files changed, 619 insertions(+), 204 deletions(-)

diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp
index 73dd6266e9..0cd8544c3f 100644
--- a/distrib/msw/generic.rsp
+++ b/distrib/msw/generic.rsp
@@ -393,6 +393,7 @@ samples/controls/*.xpm
 samples/controls/*.ico
 samples/controls/*.bmp
 samples/controls/*.rc
+samples/controls/icons/*
 
 samples/fractal/*.cpp
 samples/fractal/*.h
diff --git a/docs/latex/wx/splitter.tex b/docs/latex/wx/splitter.tex
index f2631badff..bf1087b6c8 100644
--- a/docs/latex/wx/splitter.tex
+++ b/docs/latex/wx/splitter.tex
@@ -143,7 +143,7 @@ This should be called if you wish to initially view only a single pane in the sp
 \wxheading{See also}
 
 \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically},\rtfsp
-\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}.
+\helpref{wxSplitterWindow::SplitHorizontally}{wxsplitterwindowsplithorizontally}
 
 \membersection{wxSplitterWindow::IsSplit}\label{wxsplitterwindowissplit}
 
@@ -191,7 +191,7 @@ may wish to delete the window.
 
 \membersection{wxSplitterWindow::OnSashPositionChange}\label{wxsplitterwindowonsashpositionchange}
 
-\func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition}
+\func{virtual bool}{OnSashPositionChange}{\param{int }{newSashPosition}}
 
 Application-overridable function called when the sash position is changed by 
 user. It may return FALSE to prevent the change or TRUE to allow it.
@@ -299,7 +299,7 @@ window is not currently split using \helpref{IsSplit}{wxsplitterwindowissplit}.
 \wxheading{See also}
 
 \helpref{wxSplitterWindow::SplitVertically}{wxsplitterwindowsplitvertically}, \helpref{wxSplitterWindow::IsSplit}{wxsplitterwindowissplit},\rtfsp
-\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}.
+\helpref{wxSplitterWindow::Unsplit}{wxsplitterwindowunsplit}
 
 \membersection{wxSplitterWindow::SplitVertically}\label{wxsplitterwindowsplitvertically}
 
diff --git a/docs/msw/todo.txt b/docs/msw/todo.txt
index 7b1ebecf5b..20fcd05992 100644
--- a/docs/msw/todo.txt
+++ b/docs/msw/todo.txt
@@ -7,9 +7,6 @@ HIGH PRIORITY
 
 Find/add wxThread sample - Arthur T-D?
 
-wxControl dimensions should be optionally based on dialog font
-size for portability (dialog units as per Windows).
-
 Implement wxDC floating point transformations.
 
 Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors).
@@ -17,10 +14,6 @@ Add wxDC::DeviceToLogical -> wxPoint etc (convenience accessors).
 Revamp Dialog Editor for new controls and properties (e.g.
 window id).
 
-Tidy wxConfig API.
-
-Change DnD classes to use global symbols, and wxString.
-
 Update manual.
     wxApp changes       DONE
     wxMenu changes      DONE
@@ -187,3 +180,5 @@ more efficient).
 
 Perhaps rewrite wxFile to use FILE* descriptors, so Eof and Flush
 can work.
+
+Find out how to set wxFileSelector position.
diff --git a/include/wx/docview.h b/include/wx/docview.h
index 7e63ff80f4..f3717c44bf 100644
--- a/include/wx/docview.h
+++ b/include/wx/docview.h
@@ -37,8 +37,8 @@ class WXDLLEXPORT wxFileHistory;
 class WXDLLEXPORT wxConfigBase;
 
 #if wxUSE_IOSTREAMH
-#  include <istream.h>
-#  include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+#  include <iostream.h>
 #else
 #  include <istream>
 #  include <ostream>
diff --git a/include/wx/generic/tabg.h b/include/wx/generic/tabg.h
index 0924fa0c2d..5a1b934d26 100644
--- a/include/wx/generic/tabg.h
+++ b/include/wx/generic/tabg.h
@@ -20,15 +20,16 @@
 
 #include "wx/hash.h"
 #include "wx/string.h"
+#include "wx/dialog.h"
 
-class wxTabView;
+class WXDLLEXPORT wxTabView;
 
 /*
  * A wxTabControl is the internal and visual representation
  * of the tab.
  */
  
-class wxTabControl: public wxObject
+class WXDLLEXPORT wxTabControl: public wxObject
 {
 DECLARE_DYNAMIC_CLASS(wxTabControl)
 public:
@@ -82,7 +83,7 @@ protected:
  * are 3 layers in the MS Word Options dialog.
  */
  
-class wxTabLayer: public wxList
+class WXDLLEXPORT wxTabLayer: public wxList
 {
   DECLARE_DYNAMIC_CLASS(wxTabLayer)
   public:
@@ -98,7 +99,7 @@ class wxTabLayer: public wxList
 #define wxTAB_STYLE_DRAW_BOX         1   // Draws 3D boxes round tab layers
 #define wxTAB_STYLE_COLOUR_INTERIOR  2   // Colours interior of tabs, otherwise draws outline
 
-class wxTabView: public wxObject
+class WXDLLEXPORT wxTabView: public wxObject
 {
 DECLARE_DYNAMIC_CLASS(wxTabView)
 public:
@@ -162,6 +163,10 @@ public:
   inline int GetTabHeight(void) const { return m_tabHeight; }
   inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; }
   inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; }
+
+  // Returns the total height of the tabs component -- this may be several
+  // times the height of a tab, if there are several tab layers (rows).
+  int GetTotalTabHeight();
   
   inline int GetTopMargin(void) const { return m_topMargin; }
   inline void SetTopMargin(int margin) { m_topMargin = margin; }
@@ -260,7 +265,7 @@ protected:
  * A dialog box class that is tab-friendly
  */
  
-class wxTabbedDialog: public wxDialog
+class WXDLLEXPORT wxTabbedDialog: public wxDialog
 {
 DECLARE_DYNAMIC_CLASS(wxTabbedDialog)
  
@@ -289,7 +294,7 @@ DECLARE_EVENT_TABLE()
  * A panel class that is tab-friendly
  */
 
-class wxTabbedPanel: public wxPanel
+class WXDLLEXPORT wxTabbedPanel: public wxPanel
 {
 DECLARE_DYNAMIC_CLASS(wxTabbedPanel)
  
@@ -313,7 +318,7 @@ protected:
 DECLARE_EVENT_TABLE()
 };
 
-class wxPanelTabView: public wxTabView
+class WXDLLEXPORT wxPanelTabView: public wxTabView
 {
 DECLARE_DYNAMIC_CLASS(wxPanelTabView)
 public:
@@ -330,6 +335,7 @@ public:
    inline wxWindow *GetCurrentWindow() const { return m_currentWindow; }
    
    void ShowWindowForTab(int id);
+   inline wxList& GetWindows() const { return (wxList&) m_tabWindows; }
 
 protected:
    // List of panels, one for each tab. Indexed
diff --git a/include/wx/log.h b/include/wx/log.h
index 219301b80f..4e482faf1c 100644
--- a/include/wx/log.h
+++ b/include/wx/log.h
@@ -57,7 +57,8 @@ class WXDLLEXPORT wxLogFrame;
 class WXDLLEXPORT wxFrame;
 
 #if wxUSE_IOSTREAMH
-#  include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+#  include <iostream.h>
 #else
 #  include <ostream>
 #  ifdef _MSC_VER
diff --git a/include/wx/memory.h b/include/wx/memory.h
index 8f5c81ae95..4a4117e410 100644
--- a/include/wx/memory.h
+++ b/include/wx/memory.h
@@ -28,7 +28,8 @@
 #include <stddef.h>
 
 #if wxUSE_IOSTREAMH
-#  include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+#  include <iostream.h>
 #else
 #  include <ostream>
 #  ifdef _MSC_VER
diff --git a/include/wx/motif/button.h b/include/wx/motif/button.h
index bbfbb3bed2..3c155e38b3 100644
--- a/include/wx/motif/button.h
+++ b/include/wx/motif/button.h
@@ -46,7 +46,7 @@ class WXDLLEXPORT wxButton: public wxControl
   virtual void Command(wxCommandEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 };
diff --git a/include/wx/motif/checkbox.h b/include/wx/motif/checkbox.h
index 4f795aa843..6dfd1d9d18 100644
--- a/include/wx/motif/checkbox.h
+++ b/include/wx/motif/checkbox.h
@@ -47,7 +47,7 @@ class WXDLLEXPORT wxCheckBox: public wxControl
   virtual void Command(wxCommandEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 };
diff --git a/include/wx/motif/choice.h b/include/wx/motif/choice.h
index f9f0c43be9..e3cf3d1cc7 100644
--- a/include/wx/motif/choice.h
+++ b/include/wx/motif/choice.h
@@ -68,7 +68,7 @@ class WXDLLEXPORT wxChoice: public wxControl
   void SetFocus();
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   WXWidget GetTopWidget() const { return m_formWidget; }
diff --git a/include/wx/motif/combobox.h b/include/wx/motif/combobox.h
index 8f7e949f42..0948077c71 100644
--- a/include/wx/motif/combobox.h
+++ b/include/wx/motif/combobox.h
@@ -74,7 +74,7 @@ class WXDLLEXPORT wxComboBox: public wxChoice
   virtual void SetEditable(bool editable);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 };
diff --git a/include/wx/motif/dialog.h b/include/wx/motif/dialog.h
index 594de2a305..7c7ffdd345 100644
--- a/include/wx/motif/dialog.h
+++ b/include/wx/motif/dialog.h
@@ -94,7 +94,7 @@ public:
   void OnSysColourChanged(wxSysColourChangedEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   inline WXWidget GetTopWidget() const { return m_mainWidget; }
diff --git a/include/wx/motif/frame.h b/include/wx/motif/frame.h
index 02723a313d..c92ac4ba78 100644
--- a/include/wx/motif/frame.h
+++ b/include/wx/motif/frame.h
@@ -145,7 +145,7 @@ public:
   virtual void ReleaseMouse();
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   WXWidget GetMenuBarWidget() const ;
diff --git a/include/wx/motif/gauge.h b/include/wx/motif/gauge.h
index 551aa00577..ff8dfa00ad 100644
--- a/include/wx/motif/gauge.h
+++ b/include/wx/motif/gauge.h
@@ -61,7 +61,7 @@ class WXDLLEXPORT wxGauge: public wxControl
   virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 
diff --git a/include/wx/motif/listbox.h b/include/wx/motif/listbox.h
index 77315ae0fe..50954e53dd 100644
--- a/include/wx/motif/listbox.h
+++ b/include/wx/motif/listbox.h
@@ -90,7 +90,7 @@ class WXDLLEXPORT wxListBox: public wxControl
   void Command(wxCommandEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   WXWidget GetTopWidget() const;
diff --git a/include/wx/motif/notebook.h b/include/wx/motif/notebook.h
index e4c93c3eea..d21311e216 100644
--- a/include/wx/motif/notebook.h
+++ b/include/wx/motif/notebook.h
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        notebook.h
-// Purpose:     MSW/GTK compatible notebook (a.k.a. property sheet)
+// Purpose:     wxNotebook class (a.k.a. property sheet, tabbed dialog)
 // Author:      Julian Smart
 // Modified by:
 // RCS-ID:      $Id$
@@ -21,6 +21,7 @@
 #include "wx/dynarray.h"
 #include "wx/event.h"
 #include "wx/control.h"
+#include "wx/generic/tabg.h"
 
 // ----------------------------------------------------------------------------
 // types
@@ -59,9 +60,38 @@ private:
 // wxNotebook
 // ----------------------------------------------------------------------------
 
-// @@@ this class should really derive from wxTabCtrl, but the interface is not
-//     exactly the same, so I can't do it right now and instead we reimplement
-//     part of wxTabCtrl here
+class WXDLLEXPORT wxNotebook;
+
+// This reuses wxTabView to draw the tabs.
+class WXDLLEXPORT wxNotebookTabView: public wxTabView
+{
+DECLARE_DYNAMIC_CLASS(wxNotebookTabView)
+public:
+  wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR);
+  ~wxNotebookTabView(void);
+
+  // Called when a tab is activated
+  virtual void OnTabActivate(int activateId, int deactivateId);
+
+/*
+  // Specific to this class
+   void AddTabWindow(int id, wxWindow *window);
+   wxWindow *GetTabWindow(int id) const ;
+   void ClearWindows(bool deleteWindows = TRUE);
+   inline wxWindow *GetCurrentWindow() const { return m_currentWindow; }
+   void ShowWindowForTab(int id);
+*/
+
+protected:
+/*
+   // List of panels, one for each tab. Indexed
+   // by tab ID.
+   wxList           m_tabWindows;
+   wxWindow*        m_currentWindow;
+*/
+   wxNotebook*      m_notebook;
+};
+
 class wxNotebook : public wxControl
 {
 public:
@@ -163,7 +193,15 @@ public:
   virtual bool DoPhase(int nPhase);
 
 // Implementation
-  virtual void ChangeFont();
+
+  // wxNotebook on Motif uses a generic wxTabView to implement itself.
+  inline wxTabView *GetTabView() const { return m_tabView; }
+  inline void SetTabView(wxTabView *v) { m_tabView = v; }
+  
+  void OnMouseEvent(wxMouseEvent& event);
+  void OnPaint(wxPaintEvent& event);
+
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 
@@ -179,6 +217,8 @@ protected:
 
   int m_nSelection;           // the current selection (-1 if none)
 
+  wxTabView*   m_tabView;
+
   DECLARE_DYNAMIC_CLASS(wxNotebook)
   DECLARE_EVENT_TABLE()
 };
diff --git a/include/wx/motif/radiobox.h b/include/wx/motif/radiobox.h
index db1bdd3d8e..3b30067d9f 100644
--- a/include/wx/motif/radiobox.h
+++ b/include/wx/motif/radiobox.h
@@ -69,7 +69,7 @@ public:
   inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   WXWidget GetTopWidget() const { return m_formWidget; }
diff --git a/include/wx/motif/radiobut.h b/include/wx/motif/radiobut.h
index 15c4c8e789..1292321fad 100644
--- a/include/wx/motif/radiobut.h
+++ b/include/wx/motif/radiobut.h
@@ -49,7 +49,7 @@ public:
     void Command(wxCommandEvent& event);
 
 // Implementation
-    virtual void ChangeFont();
+    virtual void ChangeFont(bool keepOriginalSize = TRUE);
     virtual void ChangeBackgroundColour();
     virtual void ChangeForegroundColour();
 };
diff --git a/include/wx/motif/scrolbar.h b/include/wx/motif/scrolbar.h
index 60a09c34ab..63bc35f17d 100644
--- a/include/wx/motif/scrolbar.h
+++ b/include/wx/motif/scrolbar.h
@@ -57,7 +57,7 @@ public:
   void Command(wxCommandEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 
diff --git a/include/wx/motif/slider.h b/include/wx/motif/slider.h
index c61f865c56..adb5433418 100644
--- a/include/wx/motif/slider.h
+++ b/include/wx/motif/slider.h
@@ -78,7 +78,7 @@ public:
   void Command(wxCommandEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 
diff --git a/include/wx/motif/spinbutt.h b/include/wx/motif/spinbutt.h
index 6976f07e70..0f3b2dafd7 100644
--- a/include/wx/motif/spinbutt.h
+++ b/include/wx/motif/spinbutt.h
@@ -65,7 +65,7 @@ class WXDLLEXPORT wxSpinButton: public wxControl
   void Command(wxCommandEvent& event) { ProcessCommand(event); };
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 
diff --git a/include/wx/motif/statbmp.h b/include/wx/motif/statbmp.h
index e4dcd4f9e2..600168a84e 100644
--- a/include/wx/motif/statbmp.h
+++ b/include/wx/motif/statbmp.h
@@ -57,7 +57,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
   virtual bool AcceptsFocus() const { return FALSE; }
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 
diff --git a/include/wx/motif/statbox.h b/include/wx/motif/statbox.h
index 0cd45846a4..375c000195 100644
--- a/include/wx/motif/statbox.h
+++ b/include/wx/motif/statbox.h
@@ -52,7 +52,7 @@ class WXDLLEXPORT wxStaticBox: public wxControl
   wxString GetLabel() const;
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   WXWidget GetTopWidget() const { return m_formWidget; }
diff --git a/include/wx/motif/stattext.h b/include/wx/motif/stattext.h
index f9e322e1b9..c4205fa426 100644
--- a/include/wx/motif/stattext.h
+++ b/include/wx/motif/stattext.h
@@ -48,7 +48,7 @@ class WXDLLEXPORT wxStaticText: public wxControl
   virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
 };
diff --git a/include/wx/motif/textctrl.h b/include/wx/motif/textctrl.h
index 165ef72006..984432970f 100644
--- a/include/wx/motif/textctrl.h
+++ b/include/wx/motif/textctrl.h
@@ -127,7 +127,7 @@ public:
   virtual void Command(wxCommandEvent& event);
 
 // Implementation
-  virtual void ChangeFont();
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);
   virtual void ChangeBackgroundColour();
   virtual void ChangeForegroundColour();
   inline void SetModified(bool mod) { m_modified = mod; }
diff --git a/include/wx/motif/window.h b/include/wx/motif/window.h
index 2a8bee3a32..833d47fe4d 100644
--- a/include/wx/motif/window.h
+++ b/include/wx/motif/window.h
@@ -488,7 +488,7 @@ public:
   virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
 
   // Change properties
-  virtual void ChangeFont();             // Change to the current font (often overridden)
+  virtual void ChangeFont(bool keepOriginalSize = TRUE);             // Change to the current font (often overridden)
   virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
   virtual void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
   // These to be overridden as needed (may change several widgets)
diff --git a/include/wx/msw/colour.h b/include/wx/msw/colour.h
index 4770bf7a53..08f4e8ef17 100644
--- a/include/wx/msw/colour.h
+++ b/include/wx/msw/colour.h
@@ -31,7 +31,7 @@ public:
 
     // copy ctors and assignment operators
   wxColour( const wxColour& col );
-  wxColour( const wxColour* col );
+//  wxColour( const wxColour* col );
   wxColour& operator = ( const wxColour& col );
 
     // dtor
diff --git a/include/wx/object.h b/include/wx/object.h
index b5af8484bb..bc9d5c480c 100644
--- a/include/wx/object.h
+++ b/include/wx/object.h
@@ -37,7 +37,8 @@ class WXDLLEXPORT wxHashTable;
 class WXDLLEXPORT wxObject_Serialize;
 
 #if wxUSE_IOSTREAMH
-#  include <ostream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+#  include <iostream.h>
 #else
 #  include <ostream>
 #  ifdef _MSC_VER
diff --git a/include/wx/string.h b/include/wx/string.h
index 94ef9cb88e..e239f8bca7 100644
--- a/include/wx/string.h
+++ b/include/wx/string.h
@@ -923,7 +923,8 @@ inline bool operator>=(const char  * s1, const wxString& s2) { return s2.Cmp(s1)
 // replacing with includes (on advice of ungod@pasdex.com.au)
 // class WXDLLEXPORT istream;
 #if wxUSE_IOSTREAMH
-#include <istream.h>
+// N.B. BC++ doesn't have istream.h, ostream.h
+#include <iostream.h>
 #else
 #include <istream>
 #  ifdef _MSC_VER
diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp
index 0b1ef70b22..24829d02de 100644
--- a/samples/controls/controls.cpp
+++ b/samples/controls/controls.cpp
@@ -26,7 +26,7 @@
 #include "wx/notebook.h"
 #include "wx/imaglist.h"
 
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
 #include "mondrian.xpm"
 #include "icons/choice.xpm"
 #include "icons/combo.xpm"
diff --git a/samples/tab/makefile.unx b/samples/tab/makefile.unx
index ad1b7690ec..1c66f71f22 100644
--- a/samples/tab/makefile.unx
+++ b/samples/tab/makefile.unx
@@ -9,7 +9,7 @@
 #
 # Makefile for tab example (UNIX).
 
-PROGRAM=tab
+PROGRAM=test
 
 OBJECTS=$(PROGRAM).o
 
diff --git a/samples/tab/test.cpp b/samples/tab/test.cpp
index 93b5807759..734025be6c 100644
--- a/samples/tab/test.cpp
+++ b/samples/tab/test.cpp
@@ -23,60 +23,63 @@
 #include "wx/tab.h"
 #include "test.h"
 
-// Declare two frames
-MyDialog   *dialog = (MyDialog *) NULL;
+// If 1, use a dialog. Otherwise use a frame.
+#define USE_TABBED_DIALOG 0
+
+MyDialog* dialog = (MyDialog *) NULL;
+MyFrame*  frame = (MyFrame *) NULL;
 
 IMPLEMENT_APP(MyApp)
 
 bool MyApp::OnInit(void)
 {
-  // Create the main frame window
+  // Create the main window
+#if USE_TABBED_DIALOG
   dialog = new MyDialog((wxFrame *) NULL, -1, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE);
 
   dialog->ShowModal();
 
   // Quit immediately the dialog has been dismissed
   return FALSE;
-}
-
-BEGIN_EVENT_TABLE(MyDialog, wxTabbedDialog)
-    EVT_BUTTON(wxID_OK, MyDialog::OnOK)
-    EVT_BUTTON(wxID_CANCEL, MyDialog::OnOK)
-//    EVT_MENU(TEST_ABOUT, MyDialog::OnAbout)
-END_EVENT_TABLE()
-
-MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
-    const wxPoint& pos, const wxSize& size, const long windowStyle):
-  wxTabbedDialog(parent, id, title, pos, size, windowStyle)
-{
-    Init();
-}
+#else
+  frame = new MyFrame((wxFrame*) NULL, -1, (char *) "Tabbed Panel", wxPoint(-1, -1), wxSize(365, 390), wxDEFAULT_FRAME_STYLE);
 
-void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
-{
-    EndModal(wxID_OK);
-}
-
-void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
-{
-    EndModal(wxID_CANCEL);
+  return TRUE;
+#endif
 }
 
-void MyDialog::Init(void)
+void MyApp::InitTabView(wxPanelTabView* view, wxWindow* window)
 {
   int dialogWidth = 365;
   int dialogHeight = 390;
   
-  wxButton *okButton = new wxButton(this, wxID_OK, "Close", wxPoint(100, 330), wxSize(80, 25));
-  (void)new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(185, 330), wxSize(80, 25));
-  (void)new wxButton(this, wxID_HELP, "Help", wxPoint(270, 330), wxSize(80, 25));
-  okButton->SetDefault();
+  m_okButton = new wxButton(window, wxID_OK, "Close", wxPoint(-1, -1), wxSize(80, 25));
+  m_cancelButton = new wxButton(window, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(80, 25));
+  m_helpButton = new wxButton(window, wxID_HELP, "Help", wxPoint(-1, -1), wxSize(80, 25));
+  m_okButton->SetDefault();
 
-  // Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match
-  // with the panel background, and save a bit of time.
-  wxPanelTabView *view = new wxPanelTabView((wxPanel*)this, wxTAB_STYLE_DRAW_BOX);
+  wxLayoutConstraints* c = new wxLayoutConstraints;
+  c->right.SameAs(window, wxRight, 4);
+  c->bottom.SameAs(window, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  m_helpButton->SetConstraints(c);
 
-  wxRectangle rect;
+  c = new wxLayoutConstraints;
+  c->right.SameAs(m_helpButton, wxLeft, 4);
+  c->bottom.SameAs(window, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  m_cancelButton->SetConstraints(c);
+
+  c = new wxLayoutConstraints;
+  c->right.SameAs(m_cancelButton, wxLeft, 4);
+  c->bottom.SameAs(window, wxBottom, 4);
+  c->height.AsIs();
+  c->width.AsIs();
+  m_okButton->SetConstraints(c);
+
+  wxRect rect;
   rect.x = 5;
   rect.y = 70;
   // Could calculate the view width from the tab width and spacing,
@@ -119,29 +122,155 @@ void MyDialog::Init(void)
     return;
     
   // Add some panels
-  wxPanel *panel1 = new wxPanel(this, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220), wxTAB_TRAVERSAL);
+  wxPanel *panel1 = new wxPanel(window, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220), wxTAB_TRAVERSAL);
   (void)new wxButton(panel1, -1, "Press me", wxPoint(10, 10));
   (void)new wxTextCtrl(panel1, -1, "1234", wxPoint(10, 40), wxSize(120, 150));
   
   view->AddTabWindow(TEST_TAB_CAT, panel1);
 
-  wxPanel *panel2 = new wxPanel(this, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220));
+  wxPanel *panel2 = new wxPanel(window, -1, wxPoint(rect.x + 20, rect.y + 10), wxSize(290, 220));
 
   wxString animals[] = { "Fox", "Hare", "Rabbit", "Sabre-toothed tiger", "T Rex" };
   (void)new wxListBox(panel2, -1, wxPoint(5, 5), wxSize(170, 80), 5, animals);
 
-  (void)new wxTextCtrl(panel2, -1, "Some notes about the animals in this house", wxPoint(5, 100), wxSize(170, 100)),
-    wxTE_MULTILINE;
+  (void)new wxTextCtrl(panel2, -1, "Some notes about the animals in this house", wxPoint(5, 100), wxSize(170, 100),
+    wxTE_MULTILINE);
   
   view->AddTabWindow(TEST_TAB_DOG, panel2);
+  view->SetTabSelection(TEST_TAB_CAT);
+}
+
+BEGIN_EVENT_TABLE(MyDialog, wxTabbedDialog)
+    EVT_BUTTON(wxID_OK, MyDialog::OnOK)
+    EVT_BUTTON(wxID_CANCEL, MyDialog::OnOK)
+END_EVENT_TABLE()
+
+MyDialog::MyDialog(wxWindow* parent, const wxWindowID id, const wxString& title,
+    const wxPoint& pos, const wxSize& size, const long windowStyle):
+  wxTabbedDialog(parent, id, title, pos, size, windowStyle)
+{
+    Init();
+}
+
+void MyDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
+{
+    EndModal(wxID_OK);
+}
+
+void MyDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
+{
+    EndModal(wxID_CANCEL);
+}
+
+void MyDialog::Init(void)
+{
+  int dialogWidth = 365;
+  int dialogHeight = 390;
   
+  // Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match
+  // with the panel background, and save a bit of time.
+  wxPanelTabView *view = new wxPanelTabView(this, wxTAB_STYLE_DRAW_BOX);
+
+  wxGetApp().InitTabView(view, this);
+
   // Don't know why this is necessary under Motif...
 #ifndef __WXMSW__
   this->SetSize(dialogWidth, dialogHeight-20);
 #endif
 
-  view->SetTabSelection(TEST_TAB_CAT);
+  Layout();
+
+  this->Centre(wxBOTH);
+}
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+    EVT_BUTTON(wxID_OK, MyFrame::OnOK)
+    EVT_BUTTON(wxID_CANCEL, MyFrame::OnOK)
+    EVT_SIZE(MyFrame::OnSize)
+END_EVENT_TABLE()
+
+MyFrame::MyFrame(wxFrame* parent, const wxWindowID id, const wxString& title,
+    const wxPoint& pos, const wxSize& size, const long windowStyle):
+  wxFrame(parent, id, title, pos, size, windowStyle)
+{
+    m_panel = (wxTabbedPanel*) NULL;
+    m_view = (wxPanelTabView*) NULL;
+    Init();
+}
+
+void MyFrame::OnOK(wxCommandEvent& WXUNUSED(event) )
+{
+    this->Destroy();
+}
+
+void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event) )
+{
+    this->Destroy();
+}
+
+void MyFrame::Init(void)
+{
+  int dialogWidth = 365;
+  int dialogHeight = 390;
+
+  m_panel = new wxTabbedPanel(this, -1);
   
+  // Note, omit the wxTAB_STYLE_COLOUR_INTERIOR, so we will guarantee a match
+  // with the panel background, and save a bit of time.
+  m_view = new wxPanelTabView(m_panel, wxTAB_STYLE_DRAW_BOX);
+
+  wxGetApp().InitTabView(m_view, m_panel);
+
   this->Centre(wxBOTH);
+
+  Show(TRUE);
+}
+
+void MyFrame::OnSize(wxSizeEvent& event)
+{
+    wxFrame::OnSize(event);
+
+    int cw, ch;
+    GetClientSize(& cw, & ch);
+
+    if (m_view && m_panel)
+    {
+        m_panel->Layout();
+
+        int tabHeight = m_view->GetTotalTabHeight();
+        wxRect rect;
+        rect.x = 4;
+        rect.y = tabHeight + 4;
+        rect.width = cw - 8;
+        rect.height = ch - 4 - rect.y - 30; // 30 for buttons
+  
+        m_view->SetViewRect(rect);
+
+        m_view->Layout();
+
+        // Need to do it a 2nd time to get the tab height with
+        // the new view width
+        tabHeight = m_view->GetTotalTabHeight();
+        rect.x = 4;
+        rect.y = tabHeight + 4;
+        rect.width = cw - 8;
+        rect.height = ch - 4 - rect.y - 30; // 30 for buttons
+  
+        m_view->SetViewRect(rect);
+
+        m_view->Layout();
+
+        // Move all the panels to the new view position and size
+        wxNode* node = m_view->GetWindows().First();
+        while (node)
+        {
+            wxWindow* win = (wxWindow*) node->Data();
+            win->SetSize(rect.x+2, rect.y+2, rect.width-4, rect.height-4);
+
+            node = node->Next();
+        }
+
+        m_panel->Refresh();
+    }
 }
 
diff --git a/samples/tab/test.h b/samples/tab/test.h
index 2cbdeb60a1..adb13a16fc 100644
--- a/samples/tab/test.h
+++ b/samples/tab/test.h
@@ -14,8 +14,15 @@ class MyApp: public wxApp
 {
 public:
     bool OnInit(void);
+    void InitTabView(wxPanelTabView* view, wxWindow* window);
+
+    wxButton*   m_okButton;
+    wxButton*   m_cancelButton;
+    wxButton*   m_helpButton;
 };
 
+DECLARE_APP(MyApp)
+
 class MyDialog: public wxTabbedDialog
 {
 public:
@@ -24,6 +31,37 @@ public:
 
     void OnOK(wxCommandEvent& event);
     void OnCloseWindow(wxCloseEvent& event);
+    void Init(void);
+
+DECLARE_EVENT_TABLE()
+};
+
+class MyFrame: public wxFrame
+{
+public:
+    MyFrame(wxFrame* parent, const wxWindowID id, const wxString& title,
+        const wxPoint& pos, const wxSize& size, const long windowStyle = wxDEFAULT_FRAME_STYLE);
+
+    void OnOK(wxCommandEvent& event);
+    void OnCloseWindow(wxCloseEvent& event);
+    void OnSize(wxSizeEvent& event);
+    void Init(void);
+protected:
+    wxTabbedPanel*      m_panel;
+    wxPanelTabView*     m_view;
+
+DECLARE_EVENT_TABLE()
+};
+
+
+class MyTabbedPanel: public wxTabbedPanel
+{
+public:
+    MyTabbedPanel(wxWindow* parent, const wxWindowID id,
+        const wxPoint& pos, const wxSize& size, const long windowStyle = 0);
+
+    void OnOK(wxCommandEvent& event);
+    void OnCloseWindow(wxCloseEvent& event);
 //    void OnAbout(wxCommandEvent& event);
     void Init(void);
 
diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp
index 00d44539cd..5d1731ad77 100644
--- a/src/common/ftp.cpp
+++ b/src/common/ftp.cpp
@@ -158,12 +158,12 @@ bool wxFTP::GetResult(char exp)
 {
   if ((m_lastError = GetLine(this, m_lastResult)))
     return FALSE;
-  if (m_lastResult[0] != exp) {
+  if (m_lastResult.GetChar(0) != exp) {
     m_lastError = wxPROTO_PROTERR;
     return FALSE;
   }
 
-  if (m_lastResult[3] == '-') {
+  if (m_lastResult.GetChar(3) == '-') {
     wxString key = m_lastResult.Left((size_t)3);
 
     key += ' ';
diff --git a/src/generic/tabg.cpp b/src/generic/tabg.cpp
index 433d3c1801..5adc584c4c 100644
--- a/src/generic/tabg.cpp
+++ b/src/generic/tabg.cpp
@@ -31,6 +31,10 @@
 
 #include "wx/tab.h"
 
+// not defined: use old, square tab implementation (fills in tabs)
+// defined: use new, rounded tab implementation (doesn't colour in tabs)
+// #define wxUSE_NEW_METHOD
+
 IMPLEMENT_DYNAMIC_CLASS(wxTabControl, wxObject)
 
 IMPLEMENT_DYNAMIC_CLASS(wxTabLayer, wxList)
@@ -56,7 +60,7 @@ wxTabControl::~wxTabControl(void)
 void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
 {
     // Old, but in some ways better (drawing opaque tabs)
-#if 0
+#ifndef wxUSE_NEW_METHOD
   if (!m_view)
     return;
     
@@ -70,23 +74,23 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
   int tabHeightInc = 0;
   if (m_isSelected)
   {
-    tabHeightInc = (view->GetTabSelectionHeight() - view->GetTabHeight());
+    tabHeightInc = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight());
     tabY -= tabHeightInc;
   }
   
-  dc.SetPen(wxTRANSPARENT_PEN);
+  dc.SetPen(*wxTRANSPARENT_PEN);
 
   // Draw grey background
-  if (view->GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR)
+  if (m_view->GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR)
   {
-    dc.SetBrush(m_view->GetBackgroundBrush());
+    dc.SetBrush(*m_view->GetBackgroundBrush());
 
     // Add 1 because the pen is transparent. Under Motif, may be different.
     dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + 1 + tabHeightInc));
   }
   
   // Draw highlight and shadow
-  dc.SetPen(m_view->GetHighlightPen());
+  dc.SetPen(*m_view->GetHighlightPen());
 
   // Calculate the top of the tab beneath. It's the height of the tab, MINUS
   // a bit if the tab below happens to be selected. Check.
@@ -107,7 +111,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
     dc.DrawLine(tabX, tabY, tabX, (tabY + GetHeight() + tabHeightInc - subtractThis));
 
   dc.DrawLine(tabX, tabY, (tabX + GetWidth()), tabY);
-  dc.SetPen(m_view->GetShadowPen());
+  dc.SetPen(*m_view->GetShadowPen());
 
   // Test if we're outside the right-hand edge of the view area
   if (((tabX + GetWidth()) >= m_view->GetViewRect().x + m_view->GetViewRect().width) && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX))
@@ -126,7 +130,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
       (tabX + GetWidth()), (bottomY-1));
 
     // Draw black line to emphasize shadow
-    dc.SetPen(wxBLACK_PEN);
+    dc.SetPen(*wxBLACK_PEN);
     dc.DrawLine((tabX + GetWidth() + 1), (tabY+1),
       (tabX + GetWidth() + 1), bottomY);
 
@@ -145,13 +149,13 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
       int maxPositions = ((wxTabLayer *)m_view->GetLayers().Nth(0)->Data())->Number();
 
       // Only down to the bottom of the tab, not to the top of the view
-      if ( GetColPosition() < maxPositions )
+      if ( GetRowPosition() < (maxPositions - 1) )
         topY = tabY + GetHeight() + tabHeightInc;
 
       // Shadow
       dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), topY);
       // Draw black line to emphasize shadow
-      dc.SetPen(wxBLACK_PEN);
+      dc.SetPen(*wxBLACK_PEN);
       dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1),
          topY);
     }
@@ -171,7 +175,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
          (tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc - subtractThis));
 
       // Draw black line to emphasize shadow
-      dc.SetPen(wxBLACK_PEN);
+      dc.SetPen(*wxBLACK_PEN);
       dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1),
          (tabY + GetHeight() + tabHeightInc - subtractThis));
     }
@@ -181,15 +185,14 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
   int textY = tabY + m_view->GetVerticalTabTextSpacing() + tabHeightInc;
 
   if (m_isSelected)
-    dc.SetFont(m_view->GetSelectedTabFont());
+    dc.SetFont(*m_view->GetSelectedTabFont());
   else
-    dc.SetFont(GetFont());
+    dc.SetFont(*GetFont());
 
   wxColour col(m_view->GetTextColour());
-  dc.SetTextForeground(&col);
-//  dc.SetTextForeground(&(m_view->GetTextColour()));
+  dc.SetTextForeground(col);
   dc.SetBackgroundMode(wxTRANSPARENT);
-  float textWidth, textHeight;
+  long textWidth, textHeight;
   dc.GetTextExtent(GetLabel(), &textWidth, &textHeight);
 
   int textX = (int)(tabX + (GetWidth() - textWidth)/2.0);
@@ -197,7 +200,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
 
   if (m_isSelected)
   {
-    dc.SetPen(m_view->GetHighlightPen());
+    dc.SetPen(*m_view->GetHighlightPen());
 
     // Draw white highlight from the tab's left side to the left hand edge of the view
     dc.DrawLine(m_view->GetViewRect().x, (tabY + GetHeight() + tabHeightInc),
@@ -207,10 +210,9 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
     dc.DrawLine((tabX + GetWidth()), (tabY + GetHeight() + tabHeightInc),
      m_view->GetViewRect().x + m_view->GetViewRect().width, (tabY + GetHeight() + tabHeightInc));
   }
-#endif
+#else
+    // New HEL version with rounder tabs
 
-// New HEL version with rounder tabs
-#if 1
 	if (!m_view) return;
 
 	int tabInc   = 0;
@@ -518,6 +520,9 @@ wxTabView::~wxTabView()
 }
   
 // Automatically positions tabs
+// TODO: this should just add the tab to a list, and then
+// a layout function (e.g. Realize) should be called when all tabs have been added.
+// The view rect could easily change as the view window is resized.
 wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *existingTab)
 {
   // First, find which layer we should be adding to.
@@ -581,6 +586,32 @@ wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *exi
   return tabControl;
 }
   
+// Returns the total height of the tabs component -- this may be several
+// times the height of a tab, if there are several tab layers (rows).
+int wxTabView::GetTotalTabHeight()
+{
+  int minY = 0;
+
+  wxNode *layerNode = m_layers.First();
+  while (layerNode)
+  {
+    wxTabLayer *layer = (wxTabLayer *)layerNode->Data();
+    wxNode *tabNode = layer->First();
+    while (tabNode)
+    {
+      wxTabControl *tab = (wxTabControl *)tabNode->Data();
+
+      if (tab->GetY() < minY)
+        minY = tab->GetY();
+
+      tabNode = tabNode->Next();
+    }
+    layerNode = layerNode->Next();
+  }
+
+  return - minY;
+}
+
 void wxTabView::ClearTabs(bool deleteTabs)
 {
   wxNode *layerNode = m_layers.First();
@@ -603,7 +634,8 @@ void wxTabView::ClearTabs(bool deleteTabs)
     layerNode = nextLayerNode;
   }
 }
-  
+
+
 // Layout tabs (optional, e.g. if resizing window)
 void wxTabView::Layout(void)
 {
@@ -720,7 +752,7 @@ void wxTabView::Draw(wxDC& dc)
 	}
 
 
-#if 0
+#ifndef wxUSE_NEW_METHOD
 	if (GetTabStyle() & wxTAB_STYLE_DRAW_BOX)
 	{
 		dc.SetPen(GetShadowPen());
@@ -729,7 +761,7 @@ void wxTabView::Draw(wxDC& dc)
 		dc.DrawLine(
 				(GetViewRect().x + 1),
 				(GetViewRect().y + GetViewRect().height),
-				(GetViewRect().x + GetViewRect().width),
+				(GetViewRect().x + GetViewRect().width + 1),
 				(GetViewRect().y + GetViewRect().height)
 				);
 
@@ -747,7 +779,7 @@ void wxTabView::Draw(wxDC& dc)
 		dc.DrawLine(
 				(GetViewRect().x),
 				(GetViewRect().y + GetViewRect().height + 1),
-				(GetViewRect().x + GetViewRect().width),
+				(GetViewRect().x + GetViewRect().width + 2),
 				(GetViewRect().y + GetViewRect().height + 1)
 				);
 
@@ -1088,7 +1120,7 @@ void wxTabbedPanel::OnPaint(wxPaintEvent& WXUNUSED(event) )
 }
 
 /*
- * wxDialogTabView
+ * wxPanelTabView
  */
  
 IMPLEMENT_CLASS(wxPanelTabView, wxTabView)
diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp
index de361155a8..09479c1230 100644
--- a/src/gtk/colour.cpp
+++ b/src/gtk/colour.cpp
@@ -67,7 +67,7 @@ wxColour::wxColour()
 {
 }
 
-wxColour::wxColour( char red, char green, char blue )
+wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
 {
   m_refData = new wxColourRefData();
   M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
@@ -128,7 +128,7 @@ bool wxColour::operator != ( const wxColour& col)
   return m_refData != col.m_refData; 
 }
 
-void wxColour::Set( const unsigned char red, const unsigned char green, const unsigned char blue )
+void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
 {
   UnRef();
   m_refData = new wxColourRefData();
diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp
index de361155a8..09479c1230 100644
--- a/src/gtk1/colour.cpp
+++ b/src/gtk1/colour.cpp
@@ -67,7 +67,7 @@ wxColour::wxColour()
 {
 }
 
-wxColour::wxColour( char red, char green, char blue )
+wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
 {
   m_refData = new wxColourRefData();
   M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
@@ -128,7 +128,7 @@ bool wxColour::operator != ( const wxColour& col)
   return m_refData != col.m_refData; 
 }
 
-void wxColour::Set( const unsigned char red, const unsigned char green, const unsigned char blue )
+void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
 {
   UnRef();
   m_refData = new wxColourRefData();
diff --git a/src/motif/app.cpp b/src/motif/app.cpp
index ba176dce6f..0c10b96db0 100644
--- a/src/motif/app.cpp
+++ b/src/motif/app.cpp
@@ -79,6 +79,8 @@ bool wxApp::Initialize()
 
     wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
     wxTheColourDatabase->Initialize();
+
+    wxInitializeStockLists();
     wxInitializeStockObjects();
 
 #if wxUSE_WX_RESOURCES
diff --git a/src/motif/bmpbuttn.cpp b/src/motif/bmpbuttn.cpp
index 9f8f221f7b..2be27c9439 100644
--- a/src/motif/bmpbuttn.cpp
+++ b/src/motif/bmpbuttn.cpp
@@ -90,6 +90,9 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
 
     m_mainWidget = (WXWidget) buttonWidget;
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     ChangeBackgroundColour ();
 
     DoSetBitmap();
@@ -100,9 +103,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
-
-
     return TRUE;
 }
 
diff --git a/src/motif/button.cpp b/src/motif/button.cpp
index 6a402a0229..c3f5be3ec4 100644
--- a/src/motif/button.cpp
+++ b/src/motif/button.cpp
@@ -74,11 +74,12 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
     XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
             (XtPointer) this);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
 
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -135,9 +136,9 @@ void wxButtonCallback (Widget w, XtPointer clientData, XtPointer ptr)
   item->ProcessCommand (event);
 }
 
-void wxButton::ChangeFont()
+void wxButton::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxButton::ChangeBackgroundColour()
diff --git a/src/motif/checkbox.cpp b/src/motif/checkbox.cpp
index 0c59e67684..7d40ee4330 100644
--- a/src/motif/checkbox.cpp
+++ b/src/motif/checkbox.cpp
@@ -66,12 +66,13 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 
     XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
     ChangeBackgroundColour();
-    SetFont(* parent->GetFont());
-
     return TRUE;
 }
 
@@ -151,9 +152,9 @@ void wxCheckBoxCallback (Widget w, XtPointer clientData,
   item->ProcessCommand (event);
 }
 
-void wxCheckBox::ChangeFont()
+void wxCheckBox::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxCheckBox::ChangeBackgroundColour()
diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp
index 1c34cb25db..2585d18a6a 100644
--- a/src/motif/choice.cpp
+++ b/src/motif/choice.cpp
@@ -125,9 +125,11 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
 
     XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -173,9 +175,12 @@ void wxChoice::Append(const wxString& item)
 
   WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
   int i;
-  for (i = 0; i < m_noStrings; i++)
-    new_widgetList[i] = m_widgetList[i];
+  if (m_widgetList)
+    for (i = 0; i < m_noStrings; i++)
+      new_widgetList[i] = m_widgetList[i];
+
   new_widgetList[m_noStrings] = (WXWidget) w;
+
   if (m_widgetList)
     delete[] m_widgetList;
   m_widgetList = new_widgetList;
@@ -420,7 +425,7 @@ void wxChoiceCallback (Widget w, XtPointer clientData,
     }
 }
 
-void wxChoice::ChangeFont()
+void wxChoice::ChangeFont(bool keepOriginalSize)
 {
     // Note that this causes the widget to be resized back
     // to its original size! We therefore have to set the size
@@ -434,11 +439,13 @@ void wxChoice::ChangeFont()
         XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
         XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
 
+        /* TODO: why does this cause a crash in XtWidgetToApplicationContext?
         int i;
         for (i = 0; i < m_noStrings; i++)
             XtVaSetValues ((Widget) m_widgetList[i], XmNfontList, fontList, NULL);
+        */
         GetSize(& width1, & height1);
-        if (width != width1 || height != height1)
+        if (keepOriginalSize && (width != width1 || height != height1))
         {
             SetSize(-1, -1, width, height);
         }
diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp
index 71918fbbc9..95d66b984d 100644
--- a/src/motif/combobox.cpp
+++ b/src/motif/combobox.cpp
@@ -83,10 +83,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
 
     SetValue(value);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -207,10 +209,10 @@ void  wxComboBoxCallback (Widget w, XtPointer clientData,
     }
 }
 
-void wxComboBox::ChangeFont()
+void wxComboBox::ChangeFont(bool keepOriginalSize)
 {
     // Don't use the base class wxChoice's ChangeFont
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxComboBox::ChangeBackgroundColour()
diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp
index 8c521c4b10..7edbb5df91 100644
--- a/src/motif/dialog.cpp
+++ b/src/motif/dialog.cpp
@@ -139,12 +139,15 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
         XmStringFree(str);
     }
 
+    m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+    ChangeFont(FALSE);
+
     wxAddWindowToTable(dialogShell, this);
 
     // Intercept CLOSE messages from the window manager
     Atom WM_DELETE_WINDOW = XmInternAtom(XtDisplay(shell), "WM_DELETE_WINDOW", False);
 
-    /* MATTHEW: [8] Remove and add WM_DELETE_WINDOW so ours is only handler */
+    /* Remove and add WM_DELETE_WINDOW so ours is only handler */
     /* Why do we have to do this for wxDialog, but not wxFrame? */
     XmRemoveWMProtocols(shell, &WM_DELETE_WINDOW, 1);
     XmAddWMProtocols(shell, &WM_DELETE_WINDOW, 1);
@@ -236,7 +239,6 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
        (XtPointer)this);
 
     ChangeBackgroundColour();
-    SetFont(* parent->GetFont());
 
     return TRUE;
 }
@@ -745,7 +747,7 @@ static void wxUnmapBulletinBoard(Widget dialog, wxDialog *client,XtPointer call)
   */
 }
 
-void wxDialog::ChangeFont()
+void wxDialog::ChangeFont(bool keepOriginalSize)
 {
     // TODO
 }
diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp
index bb2f47ac62..c294be1df8 100644
--- a/src/motif/frame.cpp
+++ b/src/motif/frame.cpp
@@ -128,6 +128,7 @@ bool wxFrame::Create(wxWindow *parent,
 
   m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
   m_foregroundColour = *wxBLACK;
+  m_windowFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
 
   if ( id > -1 )
     m_windowId = id;
@@ -222,6 +223,8 @@ bool wxFrame::Create(wxWindow *parent,
 
   m_mainWidget = m_frameWidget;
 
+  ChangeFont(FALSE);
+
   // This patch comes from Torsten Liermann lier@lier1.muc.de
   if (XmIsMotifWMRunning( (Widget) m_frameShell ))
   {
@@ -1040,7 +1043,7 @@ WXWidget wxFrame::GetClientWidget() const
   return m_clientArea;
 }
 
-void wxFrame::ChangeFont()
+void wxFrame::ChangeFont(bool keepOriginalSize)
 {
     // TODO
 }
diff --git a/src/motif/gauge.cpp b/src/motif/gauge.cpp
index 81d9d65c10..d47c8d976a 100644
--- a/src/motif/gauge.cpp
+++ b/src/motif/gauge.cpp
@@ -123,10 +123,12 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
     if (height == -1)
         height = 80;
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -188,9 +190,9 @@ int wxGauge::GetValue() const
 //    return m_gaugePos;
 }
 
-void wxGauge::ChangeFont()
+void wxGauge::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxGauge::ChangeBackgroundColour()
diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp
index 246ee2d909..2952cadbab 100644
--- a/src/motif/listbox.cpp
+++ b/src/motif/listbox.cpp
@@ -107,11 +107,13 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
     XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc,
          (XtPointer) this);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height);
 
     m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -741,9 +743,9 @@ WXWidget wxListBox::GetTopWidget() const
   return (WXWidget) XtParent( (Widget) m_mainWidget );
 }
 
-void wxListBox::ChangeFont()
+void wxListBox::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxListBox::ChangeBackgroundColour()
diff --git a/src/motif/notebook.cpp b/src/motif/notebook.cpp
index c93dbba6f9..7b520792b9 100644
--- a/src/motif/notebook.cpp
+++ b/src/motif/notebook.cpp
@@ -24,6 +24,7 @@
 #include  <wx/log.h>
 #include  <wx/imaglist.h>
 #include  <wx/notebook.h>
+#include  <wx/dcclient.h>
 
 // ----------------------------------------------------------------------------
 // macros
@@ -39,8 +40,9 @@
 #if !USE_SHARED_LIBRARIES
 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
     EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
-
     EVT_SIZE(wxNotebook::OnSize)
+    EVT_PAINT(wxNotebook::OnPaint)
+    EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent)
     EVT_SET_FOCUS(wxNotebook::OnSetFocus)
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
 END_EVENT_TABLE()
@@ -60,6 +62,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
 // common part of all ctors
 void wxNotebook::Init()
 {
+    m_tabView = (wxNotebookTabView*) NULL;
     m_pImageList = NULL;
     m_nSelection = -1;
 }
@@ -103,14 +106,19 @@ bool wxNotebook::Create(wxWindow *parent,
     if ( parent != NULL )
         parent->AddChild(this);
 
-    // TODO
+    // It's like a normal window...
+    if (!wxWindow::Create(parent, id, pos, size, style, name))
+        return FALSE;
 
-    return FALSE;
+    SetTabView(new wxNotebookTabView(this));
+
+    return TRUE;
 }
 
 // dtor
 wxNotebook::~wxNotebook()
 {
+    delete m_tabView;
 }
 
 // ----------------------------------------------------------------------------
@@ -192,6 +200,10 @@ void wxNotebook::SetImageList(wxImageList* imageList)
 // remove one page from the notebook
 bool wxNotebook::DeletePage(int nPage)
 {
+    wxFAIL_MSG("Sorry, DeletePage not implemented for Motif wxNotebook because wxTabView doesn't support it.");
+    return FALSE;
+
+/*
     wxCHECK( IS_VALID_PAGE(nPage), FALSE );
 
     // TODO: delete native widget page
@@ -200,12 +212,13 @@ bool wxNotebook::DeletePage(int nPage)
     m_aPages.Remove(nPage);
 
     return TRUE;
+*/
 }
 
 // remove all pages
 bool wxNotebook::DeleteAllPages()
 {
-    // TODO: delete native widget pages
+    m_tabView->ClearTabs(TRUE);
 
     int nPageCount = GetPageCount();
     int nPage;
@@ -236,7 +249,12 @@ bool wxNotebook::InsertPage(int nPage,
     wxASSERT( pPage != NULL );
     wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
 
-    // TODO: insert native widget page
+    m_tabView->AddTab(nPage, strText);
+
+/*
+    if (bSelect)
+        m_tabView->SetTabSelection(nPage, TRUE);
+*/
 
     // save the pointer to the page
     m_aPages.Insert(pPage, nPage);
@@ -265,24 +283,51 @@ void wxNotebook::OnSize(wxSizeEvent& event)
         s_bFirstTime = FALSE;
     }
 
-    // TODO: all this may or may not be necessary for your platform
-
-    // emulate page change (it's esp. important to do it first time because
-    // otherwise our page would stay invisible)
-    int nSel = m_nSelection;
-    m_nSelection = -1;
-    SetSelection(nSel);
-
-    // fit the notebook page to the tab control's display area
-    int w, h;
-    GetSize(&w, &h);
-
-    unsigned int nCount = m_aPages.Count();
-    for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
-        wxNotebookPage *pPage = m_aPages[nPage];
-        pPage->SetSize(0, 0, w, h);
-        if ( pPage->GetAutoLayout() )
-            pPage->Layout();
+    if (m_tabView)
+    {
+        int cw, ch;
+        GetClientSize(& cw, & ch);
+
+        int tabHeight = m_tabView->GetTotalTabHeight();
+        wxRect rect;
+        rect.x = 4;
+        rect.y = tabHeight + 4;
+        rect.width = cw - 8;
+        rect.height = ch - 4 - rect.y ;
+  
+        m_tabView->SetViewRect(rect);
+
+        m_tabView->Layout();
+
+        // Need to do it a 2nd time to get the tab height with
+        // the new view width, since changing the view width changes the
+        // tab layout.
+        tabHeight = m_tabView->GetTotalTabHeight();
+        rect.x = 4;
+        rect.y = tabHeight + 4;
+        rect.width = cw - 8;
+        rect.height = ch - 4 - rect.y ;
+  
+        m_tabView->SetViewRect(rect);
+
+        m_tabView->Layout();
+
+        // emulate page change (it's esp. important to do it first time because
+        // otherwise our page would stay invisible)
+        int nSel = m_nSelection;
+        m_nSelection = -1;
+        SetSelection(nSel);
+
+        // fit the notebook page to the tab control's display area
+
+        unsigned int nCount = m_aPages.Count();
+        for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
+            wxNotebookPage *pPage = m_aPages[nPage];
+            pPage->SetSize(rect.x + 2, rect.y + 2, rect.width - 2, rect.height - 2);
+            if ( pPage->GetAutoLayout() )
+                pPage->Layout();
+        }
+        Refresh();
     }
 
     // Processing continues to next OnSize
@@ -365,18 +410,105 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
     m_nSelection = nSel;
 }
 
-void wxNotebook::ChangeFont()
+void wxNotebook::ChangeFont(bool keepOriginalSize)
 {
-    // TODO
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxNotebook::ChangeBackgroundColour()
 {
-    // TODO
+    wxWindow::ChangeBackgroundColour();
 }
 
 void wxNotebook::ChangeForegroundColour()
 {
-    // TODO
+    wxWindow::ChangeForegroundColour();
+}
+
+void wxNotebook::OnMouseEvent(wxMouseEvent& event)
+{
+  if (m_tabView)
+    m_tabView->OnEvent(event);
+}
+
+void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event) )
+{
+    wxPaintDC dc(this);
+    if (m_tabView)
+        m_tabView->Draw(dc);
+}
+
+/*
+ * wxNotebookTabView
+ */
+ 
+IMPLEMENT_CLASS(wxNotebookTabView, wxTabView)
+
+wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style): wxTabView(style)
+{
+  m_notebook = notebook;
+
+//  m_currentWindow = (wxWindow *) NULL;
+
+  m_notebook->SetTabView(this);
+
+  SetWindow(m_notebook);
+}
+
+wxNotebookTabView::~wxNotebookTabView(void)
+{
+//  ClearWindows(TRUE);
+}
+
+// Called when a tab is activated
+void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
+{
+  if (!m_notebook)
+    return;
+    
+  wxWindow *oldWindow = ((deactivateId == -1) ? 0 : m_notebook->GetPage(deactivateId));
+  wxWindow *newWindow = m_notebook->GetPage(activateId);
+
+  if (oldWindow)
+    oldWindow->Show(FALSE);
+  if (newWindow)
+    newWindow->Show(TRUE);
+    
+  m_notebook->Refresh();
 }
 
+#if 0
+void wxNotebookTabView::AddTabWindow(int id, wxWindow *window)
+{
+  m_tabWindows.Append((long)id, window);
+  window->Show(FALSE);
+}
+
+wxWindow *wxNotebookTabView::GetTabWindow(int id) const
+{
+  wxNode *node = m_tabWindows.Find((long)id);
+  if (!node)
+    return (wxWindow *) NULL;
+  return (wxWindow *)node->Data();    
+}
+
+void wxNotebookTabView::ClearWindows(bool deleteWindows)
+{
+  if (deleteWindows)
+    m_tabWindows.DeleteContents(TRUE);
+  m_tabWindows.Clear();
+  m_tabWindows.DeleteContents(FALSE);
+}
+
+void wxNotebookTabView::ShowWindowForTab(int id)
+{
+  wxWindow *newWindow = GetTabWindow(id);
+  if (newWindow == m_currentWindow)
+    return;
+  if (m_currentWindow)
+    m_currentWindow->Show(FALSE);
+  newWindow->Show(TRUE);
+  newWindow->Refresh();
+}
+#endif
+
diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp
index 152e1d3888..d1ec6278cd 100644
--- a/src/motif/radiobox.cpp
+++ b/src/motif/radiobox.cpp
@@ -172,12 +172,14 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
     }
     SetSelection (0);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     XtManageChild (radioBoxWidget);
 
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -391,7 +393,7 @@ void wxRadioBox::Command (wxCommandEvent & event)
     ProcessCommand (event);
 }
 
-void wxRadioBox::ChangeFont()
+void wxRadioBox::ChangeFont(bool keepOriginalSize)
 {
     // TODO
 }
diff --git a/src/motif/radiobut.cpp b/src/motif/radiobut.cpp
index 69e95f82b0..9e2ec2d427 100644
--- a/src/motif/radiobut.cpp
+++ b/src/motif/radiobut.cpp
@@ -81,12 +81,14 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
 
     m_mainWidget = (WXWidget) radioButtonWidget;
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     XtManageChild (radioButtonWidget);
 
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -111,9 +113,9 @@ void wxRadioButton::Command (wxCommandEvent & event)
   ProcessCommand (event);
 }
 
-void wxRadioButton::ChangeFont()
+void wxRadioButton::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxRadioButton::ChangeBackgroundColour()
diff --git a/src/motif/scrolbar.cpp b/src/motif/scrolbar.cpp
index 3ac6967bf6..0f19d1e20f 100644
--- a/src/motif/scrolbar.cpp
+++ b/src/motif/scrolbar.cpp
@@ -152,7 +152,7 @@ void wxScrollBar::Command(wxCommandEvent& event)
     ProcessCommand(event);
 }
 
-void wxScrollBar::ChangeFont()
+void wxScrollBar::ChangeFont(bool keepOriginalSize)
 {
     // TODO
 }
diff --git a/src/motif/slider.cpp b/src/motif/slider.cpp
index a270c48241..0b09dd5e15 100644
--- a/src/motif/slider.cpp
+++ b/src/motif/slider.cpp
@@ -99,10 +99,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
 
     XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
 
+    m_windowFont = parent->GetFont();
+
+    ChangeFont(FALSE);
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -247,9 +249,9 @@ void wxSlider::Command (wxCommandEvent & event)
   ProcessCommand (event);
 }
 
-void wxSlider::ChangeFont()
+void wxSlider::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxSlider::ChangeBackgroundColour()
diff --git a/src/motif/spinbutt.cpp b/src/motif/spinbutt.cpp
index 0afe79ada0..6c7c4d4424 100644
--- a/src/motif/spinbutt.cpp
+++ b/src/motif/spinbutt.cpp
@@ -68,7 +68,7 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
 	// TODO
 }
 
-void wxSpinButton::ChangeFont()
+void wxSpinButton::ChangeFont(bool keepOriginalSize)
 {
     // TODO
 }
diff --git a/src/motif/statbmp.cpp b/src/motif/statbmp.cpp
index 223a5780d6..20d46299d5 100644
--- a/src/motif/statbmp.cpp
+++ b/src/motif/statbmp.cpp
@@ -66,11 +66,12 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
                     XmNlabelType, XmPIXMAP,
                     NULL);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
-
     ChangeBackgroundColour ();
 
     return TRUE;
@@ -119,9 +120,9 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
     }
 }
 
-void wxStaticBitmap::ChangeFont()
+void wxStaticBitmap::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxStaticBitmap::ChangeBackgroundColour()
diff --git a/src/motif/statbox.cpp b/src/motif/statbox.cpp
index 01a76c9157..7d9cbd0c8e 100644
--- a/src/motif/statbox.cpp
+++ b/src/motif/statbox.cpp
@@ -181,9 +181,9 @@ void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
     }
 }
 
-void wxStaticBox::ChangeFont()
+void wxStaticBox::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxStaticBox::ChangeBackgroundColour()
diff --git a/src/motif/stattext.cpp b/src/motif/stattext.cpp
index 621a403b87..c558bfe431 100644
--- a/src/motif/stattext.cpp
+++ b/src/motif/stattext.cpp
@@ -64,19 +64,20 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
 
     XmStringFree (text);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
-
     ChangeBackgroundColour ();
 
     return TRUE;
 }
 
-void wxStaticText::ChangeFont()
+void wxStaticText::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxStaticText::ChangeBackgroundColour()
diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp
index e645133fcf..ba5066934a 100644
--- a/src/motif/textctrl.cpp
+++ b/src/motif/textctrl.cpp
@@ -143,10 +143,12 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
 
     XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -636,9 +638,9 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
   }
 }
 
-void wxTextCtrl::ChangeFont()
+void wxTextCtrl::ChangeFont(bool keepOriginalSize)
 {
-    wxWindow::ChangeFont();
+    wxWindow::ChangeFont(keepOriginalSize);
 }
 
 void wxTextCtrl::ChangeBackgroundColour()
diff --git a/src/motif/toolbar.cpp b/src/motif/toolbar.cpp
index 163f7fd4cf..75c7b30d36 100644
--- a/src/motif/toolbar.cpp
+++ b/src/motif/toolbar.cpp
@@ -98,10 +98,12 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 
     m_mainWidget = (WXWidget) toolbar;
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
   
     return TRUE;
@@ -297,20 +299,22 @@ bool wxToolBar::CreateTools()
 
 void wxToolBar::SetToolBitmapSize(const wxSize& size)
 {
+    // TODO not necessary?
     m_defaultWidth = size.x; m_defaultHeight = size.y;
-    // TODO
 }
 
 wxSize wxToolBar::GetMaxSize() const
 {
-    // TODO
-    return wxSize(0, 0);
+    int w, h;
+    GetSize(& w, & h);
+
+    return wxSize(w, h);
 }
 
 // The button size is bigger than the bitmap size
 wxSize wxToolBar::GetToolSize() const
 {
-    // TODO
+    // TODO not necessary?
     return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
 }
 
diff --git a/src/motif/window.cpp b/src/motif/window.cpp
index 7f0cc41476..d29ed01e4a 100644
--- a/src/motif/window.cpp
+++ b/src/motif/window.cpp
@@ -3070,7 +3070,7 @@ void wxWindow::SetForegroundColour(const wxColour& col)
     ChangeForegroundColour();
 }
 
-void wxWindow::ChangeFont()
+void wxWindow::ChangeFont(bool keepOriginalSize)
 {
     // Note that this causes the widget to be resized back
     // to its original size! We therefore have to set the size
@@ -3086,7 +3086,7 @@ void wxWindow::ChangeFont()
 		   NULL);
 
         GetSize(& width1, & height1);
-        if (width != width1 || height != height1)
+        if (keepOriginalSize && (width != width1 || height != height1))
         {
             SetSize(-1, -1, width, height);
         }
diff --git a/src/stubs/app.cpp b/src/stubs/app.cpp
index 86438cf060..aac09eb02c 100644
--- a/src/stubs/app.cpp
+++ b/src/stubs/app.cpp
@@ -69,6 +69,8 @@ bool wxApp::Initialize()
 
   wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
   wxTheColourDatabase->Initialize();
+
+  wxInitializeStockLists();
   wxInitializeStockObjects();
 
 #if wxUSE_WX_RESOURCES
-- 
2.45.2

