From 81d66cf39f810503baed79213bc3122fda0ccc7b Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Mon, 27 Jul 1998 09:47:57 +0000
Subject: [PATCH] wxToolBar API changes; now frames manage their toolbar &
 statusbar properly; client area position is used in SetSize; changes for BC++
 & VC++ 1.5; wxWindow::GetUpdateRegion added; removed wxUpdateIterator; some
 missing functions added to process.cpp; bad navigation key event cast fixed;
 MDI and toolbar samples updated; new wxMSW wxRegion constructor (WXHRGN)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 distrib/msw/generic.rsp      |  97 ++++---
 docs/latex/wx/category.tex   |  18 +-
 docs/latex/wx/cmdevent.tex   |  16 +-
 docs/latex/wx/frame.tex      | 132 ++++++++-
 docs/latex/wx/manual.tex     |  12 +-
 docs/latex/wx/statusbr.tex   |   6 +-
 docs/latex/wx/texhelp.sty    |   6 +
 docs/latex/wx/toolbar.tex    | 537 ++++++++++++++---------------------
 docs/latex/wx/ttoolbar.tex   | 266 +++++++++++++----
 docs/latex/wx/wx.hpj         |   8 +-
 include/wx/config.h          |   9 +-
 include/wx/defs.h            |  17 +-
 include/wx/event.h           |   4 +-
 include/wx/msw/frame.h       |  30 +-
 include/wx/msw/private.h     |   8 +-
 include/wx/msw/region.h      |   1 +
 include/wx/msw/tbar95.h      |  32 +--
 include/wx/msw/tbarmsw.h     |  39 ++-
 include/wx/msw/window.h      |  23 ++
 include/wx/tbarbase.h        |  45 +--
 include/wx/tbarsmpl.h        |  28 +-
 include/wx/toolbar.h         |   4 +-
 samples/checklst/nosound.bmp | Bin 370 -> 370 bytes
 samples/mdi/mdi.cpp          |  88 ++----
 samples/mdi/mdi.h            |  18 +-
 samples/toolbar/test.cpp     |  22 +-
 samples/toolbar/test.h       |   2 +
 src/common/file.cpp          |   8 +
 src/common/log.cpp           |   3 +-
 src/common/process.cpp       |  10 +
 src/common/tbarbase.cpp      | 113 +-------
 src/common/tbarsmpl.cpp      | 106 ++++++-
 src/msw/button.cpp           |   2 +
 src/msw/checkbox.cpp         |   4 +
 src/msw/choice.cpp           |   2 +
 src/msw/dcclient.cpp         |   9 +-
 src/msw/frame.cpp            | 138 +++++++--
 src/msw/gauge95.cpp          |   2 +
 src/msw/gaugemsw.cpp         |   2 +
 src/msw/listbox.cpp          |   2 +
 src/msw/makefile.dos         |  23 +-
 src/msw/makefile.nt          |   2 +-
 src/msw/mdi.cpp              |  26 +-
 src/msw/penwin.cpp           |  20 +-
 src/msw/printwin.cpp         |   2 +-
 src/msw/radiobox.cpp         |  11 +
 src/msw/region.cpp           |   6 +
 src/msw/slider95.cpp         |  11 +
 src/msw/slidrmsw.cpp         |  11 +
 src/msw/statbmp.cpp          |   2 +
 src/msw/statbox.cpp          |   2 +
 src/msw/stattext.cpp         |   2 +
 src/msw/tbar95.cpp           |  27 +-
 src/msw/tbarmsw.cpp          | 122 +++++++-
 src/msw/textctrl.cpp         |   2 +
 src/msw/utils.cpp            |  10 +-
 src/msw/window.cpp           |  91 +++++-
 57 files changed, 1372 insertions(+), 867 deletions(-)

diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp
index ea48d1fe5f..c51eb89b53 100644
--- a/distrib/msw/generic.rsp
+++ b/distrib/msw/generic.rsp
@@ -84,6 +84,7 @@ utils/wxhelp/src/*.cpp
 utils/wxhelp/src/*.h
 utils/wxhelp/src/makefile.*
 utils/wxhelp/src/*.xbm
+utils/wxhelp/src/*.xpm
 utils/wxhelp/src/*.txt
 utils/wxhelp/src/*.ico
 utils/wxhelp/src/*.def
@@ -94,6 +95,7 @@ utils/tex2rtf/src/*.cpp
 utils/tex2rtf/src/*.h
 utils/tex2rtf/src/make*.*
 utils/tex2rtf/src/*.xbm
+utils/tex2rtf/src/*.xpm
 utils/tex2rtf/src/*.sty
 utils/tex2rtf/src/*.ini
 utils/tex2rtf/src/*.inf
@@ -111,6 +113,7 @@ utils/wxtree/src/*.cpp
 utils/wxtree/src/*.h
 utils/wxtree/src/makefile.*
 utils/wxtree/src/*.xbm
+utils/wxtree/src/*.xpm
 utils/wxtree/lib/dummy
 utils/wxtree/src/*.ico
 utils/wxtree/src/*.def
@@ -121,6 +124,7 @@ utils/wxgraph/src/*.c
 utils/wxgraph/src/*.h
 utils/wxgraph/src/makefile.*
 utils/wxgraph/src/*.xbm
+utils/wxgraph/src/*.xpm
 utils/wxgraph/lib/dummy
 utils/wxgraph/src/*.ico
 utils/wxgraph/src/*.def
@@ -143,6 +147,7 @@ utils/rcparser/src/*.c
 utils/rcparser/src/*.h
 utils/rcparser/src/makefile.*
 utils/rcparser/src/*.xbm
+utils/rcparser/src/*.xpm
 utils/rcparser/lib/dummy
 utils/rcparser/src/*.ico
 utils/rcparser/src/*.def
@@ -155,6 +160,7 @@ utils/colours/*.def
 utils/colours/*.rc
 utils/colours/makefile.*
 utils/colours/*.xbm
+utils/colours/*.xpm
 utils/colours/*.txt
 
 utils/wxprop/src/*.h
@@ -163,18 +169,21 @@ utils/wxprop/src/*.def
 utils/wxprop/src/*.rc
 utils/wxprop/src/makefile.*
 utils/wxprop/src/*.xbm
+utils/wxprop/src/*.xpm
 utils/wxprop/src/*.txt
 utils/wxprop/src/*.ico
 utils/wxprop/src/*.bmp
 utils/wxprop/lib/dummy
 
 utils/dialoged/src/bitmaps/*.xbm
+utils/dialoged/src/bitmaps/*.xpm
 utils/dialoged/src/*.h
 utils/dialoged/src/*.cpp
 utils/dialoged/src/*.def
 utils/dialoged/src/*.rc
 utils/dialoged/src/makefile.*
 utils/dialoged/src/*.xbm
+utils/dialoged/src/*.xpm
 utils/dialoged/src/*.txt
 utils/dialoged/src/*.inf
 utils/dialoged/test/*.h
@@ -200,6 +209,7 @@ samples/hello/*.h
 samples/hello/*.def
 samples/hello/makefile.*
 samples/hello/*.xbm
+samples/hello/*.xpm
 samples/hello/*.txt
 samples/hello/*.ico
 samples/hello/*.bmp
@@ -211,6 +221,7 @@ samples/dynamic/*.h
 samples/dynamic/*.def
 samples/dynamic/makefile.*
 samples/dynamic/*.xbm
+samples/dynamic/*.xpm
 samples/dynamic/*.txt
 samples/dynamic/*.ico
 samples/dynamic/*.bmp
@@ -222,6 +233,7 @@ samples/bombs/*.h
 samples/bombs/*.def
 samples/bombs/makefile.*
 samples/bombs/*.xbm
+samples/bombs/*.xpm
 samples/bombs/*.txt
 samples/bombs/*.ico
 samples/bombs/*.bmp
@@ -232,6 +244,7 @@ samples/ipc/*.h
 samples/ipc/*.def
 samples/ipc/makefile.*
 samples/ipc/*.xbm
+samples/ipc/*.xpm
 samples/ipc/*.ico
 samples/ipc/*.rc
 
@@ -242,6 +255,7 @@ samples/types/*.rc
 samples/types/*.txt
 samples/types/makefile.*
 samples/types/*.xbm
+samples/types/*.xpm
 samples/types/*.ico
 
 samples/resource/*.cpp
@@ -252,6 +266,7 @@ samples/resource/*.txt
 samples/resource/*.wxr
 samples/resource/makefile.*
 samples/resource/*.xbm
+samples/resource/*.xpm
 samples/resource/*.ico
 
 samples/animate/*.cpp
@@ -259,6 +274,7 @@ samples/animate/*.h
 samples/animate/*.def
 samples/animate/makefile.*
 samples/animate/*.xbm
+samples/animate/*.xpm
 samples/animate/*.ico
 samples/animate/*.rc
 
@@ -267,6 +283,7 @@ samples/mdi/*.h
 samples/mdi/*.def
 samples/mdi/makefile.*
 samples/mdi/*.xbm
+samples/mdi/*.xpm
 samples/mdi/*.ico
 samples/mdi/*.rc
 samples/mdi/bitmaps/*.bmp
@@ -277,6 +294,7 @@ samples/minimal/*.h
 samples/minimal/*.def
 samples/minimal/makefile.*
 samples/minimal/*.xbm
+samples/minimal/*.xpm
 samples/minimal/*.ico
 samples/minimal/*.rc
 
@@ -285,6 +303,7 @@ samples/controls/*.h
 samples/controls/*.def
 samples/controls/makefile.*
 samples/controls/*.xbm
+samples/controls/*.xpm
 samples/controls/*.ico
 samples/controls/*.bmp
 samples/controls/*.rc
@@ -294,6 +313,7 @@ samples/fractal/*.h
 samples/fractal/*.def
 samples/fractal/makefile.*
 samples/fractal/*.xbm
+samples/fractal/*.xpm
 samples/fractal/*.ico
 samples/fractal/*.rc
 
@@ -302,56 +322,36 @@ samples/layout/*.h
 samples/layout/*.def
 samples/layout/makefile.*
 samples/layout/*.xbm
+samples/layout/*.xpm
 samples/layout/*.ico
 samples/layout/*.rc
 samples/layout/*.bmp
-samples/layout/*.xpm
 
 samples/printing/*.cpp
 samples/printing/*.h
 samples/printing/*.def
 samples/printing/makefile.*
 samples/printing/*.xbm
+samples/printing/*.xpm
 samples/printing/*.txt
 samples/printing/*.ico
 samples/printing/*.bmp
 samples/printing/*.rc
-
-samples/tbarsmpl/*.cpp
-samples/tbarsmpl/*.h
-samples/tbarsmpl/*.def
-samples/tbarsmpl/makefile.*
-samples/tbarsmpl/*.txt
-samples/tbarsmpl/*.xbm
-samples/tbarsmpl/bitmaps/*.xbm
-samples/tbarsmpl/*.ico
-samples/tbarsmpl/*.bmp
-samples/tbarsmpl/*.rc
-samples/tbarsmpl/bitmaps/*.bmp
-
-samples/tbar95/*.cpp
-samples/tbar95/*.h
-samples/tbar95/*.def
-samples/tbar95/makefile.*
-samples/tbar95/*.txt
-samples/tbar95/*.xbm
-samples/tbar95/bitmaps/*.xbm
-samples/tbar95/*.ico
-samples/tbar95/*.bmp
-samples/tbar95/*.rc
-samples/tbar95/bitmaps/*.bmp
-
-samples/tbarmsw/*.cpp
-samples/tbarmsw/*.h
-samples/tbarmsw/*.def
-samples/tbarmsw/makefile.*
-samples/tbarmsw/*.txt
-samples/tbarmsw/*.xbm
-samples/tbarmsw/bitmaps/*.xbm
-samples/tbarmsw/*.ico
-samples/tbarmsw/*.bmp
-samples/tbarmsw/*.rc
-samples/tbarmsw/bitmaps/*.bmp
+samples/printing/*.afm
+
+samples/toolbar/*.cpp
+samples/toolbar/*.h
+samples/toolbar/*.def
+samples/toolbar/makefile.*
+samples/toolbar/*.txt
+samples/toolbar/*.xbm
+samples/toolbar/*.xpm
+samples/toolbar/bitmaps/*.xbm
+samples/toolbar/bitmaps/*.xpm
+samples/toolbar/*.ico
+samples/toolbar/*.bmp
+samples/toolbar/*.rc
+samples/toolbar/bitmaps/*.bmp
 
 samples/docview/*.h
 samples/docview/*.cpp
@@ -359,6 +359,7 @@ samples/docview/*.def
 samples/docview/*.rc
 samples/docview/makefile.*
 samples/docview/*.xbm
+samples/docview/*.xpm
 samples/docview/*.txt
 samples/docview/*.ico
 samples/docview/*.bmp
@@ -369,6 +370,7 @@ samples/memcheck/*.def
 samples/memcheck/*.rc
 samples/memcheck/makefile.*
 samples/memcheck/*.xbm
+samples/memcheck/*.xpm
 samples/memcheck/*.txt
 samples/memcheck/*.ico
 samples/memcheck/*.bmp
@@ -380,11 +382,11 @@ samples/odbc/*.rc
 samples/odbc/makefile.*
 samples/odbc/*.inf
 samples/odbc/*.xbm
+samples/odbc/*.xpm
 samples/odbc/*.ico
 samples/odbc/*.bmp
 samples/odbc/*.dbf
 samples/odbc/*.cdx
-samples/odbc/odbc32.lib
 
 samples/dialogs/*.h
 samples/dialogs/*.cpp
@@ -392,6 +394,7 @@ samples/dialogs/*.def
 samples/dialogs/*.rc
 samples/dialogs/makefile.*
 samples/dialogs/*.xbm
+samples/dialogs/*.xpm
 samples/dialogs/*.txt
 samples/dialogs/*.bmp
 samples/dialogs/*.ico
@@ -404,6 +407,7 @@ samples/wxpoem/*.inf
 samples/wxpoem/*.txt
 samples/wxpoem/makefile.*
 samples/wxpoem/*.xbm
+samples/wxpoem/*.xpm
 samples/wxpoem/*.ico
 samples/wxpoem/*.bmp
 samples/wxpoem/*.dat
@@ -417,6 +421,7 @@ samples/pressup/*.inf
 samples/pressup/*.txt
 samples/pressup/makefile.*
 samples/pressup/*.xbm
+samples/pressup/*.xpm
 samples/pressup/*.ico
 samples/pressup/*.bmp
 
@@ -428,6 +433,7 @@ samples/validate/*.inf
 samples/validate/*.txt
 samples/validate/makefile.*
 samples/validate/*.xbm
+samples/validate/*.xpm
 samples/validate/*.ico
 samples/validate/*.bmp
 
@@ -439,6 +445,7 @@ samples/events/*.inf
 samples/events/*.txt
 samples/events/makefile.*
 samples/events/*.xbm
+samples/events/*.xpm
 samples/events/*.ico
 samples/events/*.bmp
 
@@ -449,7 +456,9 @@ samples/treectrl/*.rc
 samples/treectrl/*.txt
 samples/treectrl/makefile.*
 samples/treectrl/*.xbm
+samples/treectrl/*.xpm
 samples/treectrl/bitmaps/*.xbm
+samples/treectrl/bitmaps/*.xpm
 samples/treectrl/*.ico
 samples/treectrl/*.bmp
 samples/treectrl/bitmaps/*.bmp
@@ -462,7 +471,9 @@ samples/listctrl/*.rc
 samples/listctrl/*.txt
 samples/listctrl/makefile.*
 samples/listctrl/*.xbm
+samples/listctrl/*.xpm
 samples/listctrl/bitmaps/*.xbm
+samples/listctrl/bitmaps/*.xpm
 samples/listctrl/*.ico
 samples/listctrl/*.bmp
 samples/listctrl/bitmaps/*.bmp
@@ -475,6 +486,7 @@ samples/splitter/*.rc
 samples/splitter/*.txt
 samples/splitter/makefile.*
 samples/splitter/*.xbm
+samples/splitter/*.xpm
 samples/splitter/*.ico
 samples/splitter/*.bmp
 
@@ -485,6 +497,7 @@ samples/grid/*.rc
 samples/grid/*.txt
 samples/grid/makefile.*
 samples/grid/*.xbm
+samples/grid/*.xpm
 samples/grid/*.ico
 samples/grid/*.bmp
 
@@ -495,6 +508,7 @@ samples/internat/*.rc
 samples/internat/*.txt
 samples/internat/makefile.*
 samples/internat/*.xbm
+samples/internat/*.xpm
 samples/internat/*.po
 samples/internat/*.ico
 samples/internat/*.bmp
@@ -507,6 +521,7 @@ samples/checklst/*.rc
 samples/checklst/*.txt
 samples/checklst/makefile.*
 samples/checklst/*.xbm
+samples/checklst/*.xpm
 samples/checklst/*.ico
 samples/checklst/*.bmp
 
@@ -516,6 +531,8 @@ samples/dnd/makefile.*
 samples/dnd/*.rc
 samples/dnd/*.def
 samples/dnd/*.bmp
+samples/dnd/*.xbm
+samples/dnd/*.xpm
 samples/dnd/*.ico
 samples/dnd/*.txt
 
@@ -525,6 +542,8 @@ samples/tab/makefile.*
 samples/tab/*.rc
 samples/tab/*.def
 samples/tab/*.bmp
+samples/tab/*.xbm
+samples/tab/*.xpm
 samples/tab/*.ico
 samples/tab/*.txt
 
@@ -534,6 +553,8 @@ samples/png/makefile.*
 samples/png/*.rc
 samples/png/*.def
 samples/png/*.bmp
+samples/png/*.xpm
+samples/png/*.xbm
 samples/png/*.ico
 samples/png/*.txt
 samples/png/*.png
diff --git a/docs/latex/wx/category.tex b/docs/latex/wx/category.tex
index 1072363653..efa5935318 100644
--- a/docs/latex/wx/category.tex
+++ b/docs/latex/wx/category.tex
@@ -32,21 +32,9 @@ The following are a variety of windows that are derived from wxWindow.
 \twocolitem{\helpref{wxScrolledWindow}{wxscrolledwindow}}{Window with automatically managed scrollbars}
 \twocolitem{\helpref{wxSplitterWindow}{wxsplitterwindow}}{Window which can be split vertically or horizontally}
 \twocolitem{\helpref{wxStatusBar}{wxstatusbar}}{Implements the status bar on a frame}
-\twocolitem{\helpref{wxStatusBar95}{wxstatusbar95}}{Implements a Windows 95 status bar on a frame}
-\twocolitem{\helpref{wxTabbedPanel}{wxtabbedpanel}}{Tabbed panel}
-\end{twocollist}
-
-{\large {\bf Toolbar classes}}
-
-\overview{Overview}{wxtoolbaroverview}
-
-These are the toolbar classes.
-
-\begin{twocollist}\itemsep=0pt
-\twocolitem{\helpref{wxToolBarBase}{wxtoolbarbase}}{Toolbar base class}
-\twocolitem{\helpref{wxToolBarSimple}{wxtoolbarsimple}}{A simple, cross-platform toolbar class}
-\twocolitem{\helpref{wxToolBarMSW}{wxtoolbarmsw}}{A Windows-only toolbar class}
-\twocolitem{\helpref{wxToolBar95}{wxtoolbar95}}{A Windows 95-only toolbar class}
+\twocolitem{\helpref{wxToolBar}{wxtoolbar}}{Toolbar class}
+\twocolitem{\helpref{wxTabbedPanel}{wxtabbedpanel}}{Tabbed panel (to be replaced with wxNotebook)}
+\twocolitem{\helpref{wxNotebook}{wxnotebook}}{Notebook class (undocumented)}
 \end{twocollist}
 
 {\large {\bf Common dialogs}}
diff --git a/docs/latex/wx/cmdevent.tex b/docs/latex/wx/cmdevent.tex
index 2baa07bf3e..649f0d5038 100644
--- a/docs/latex/wx/cmdevent.tex
+++ b/docs/latex/wx/cmdevent.tex
@@ -48,12 +48,16 @@ which is generated by a wxScrollBar control. This is provided for compatibility
 more specific scrollbar event macros should be used instead (see \helpref{wxScrollEvent}{wxscrollevent}).}
 \twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED command,
 which is generated by a wxComboBox control.}
-\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED command,
-which is generated by a toobar button.}
-\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED command,
-which is generated by a toobar button.}
-\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER command,
-which is generated by a toobar button.}
+\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
+(a synonym for wxEVT\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.}
+\twocolitem{{\bf EVT\_TOOL\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
+for a range id identifiers. Pass the ids of the tools.}
+\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event.
+Pass the id of the tool.}
+\twocolitem{{\bf EVT\_TOOL\_RCLICKED\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event
+for a range of ids. Pass the ids of the tools.}
+\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER event.
+Pass the id of the toolbar itself. The value of wxCommandEvent::GetSelection is the tool id, or -1 if the mouse cursor has moved off a tool.}
 \twocolitem{{\bf EVT\_COMMAND\_LEFT\_CLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_CLICK command,
 which is generated by a control (Windows 95 and NT only).}
 \twocolitem{{\bf EVT\_COMMAND\_LEFT\_DCLICK(id, func)}}{Process a wxEVT\_COMMAND\_LEFT\_DCLICK command,
diff --git a/docs/latex/wx/frame.tex b/docs/latex/wx/frame.tex
index a41ddd02f2..71f2df8904 100644
--- a/docs/latex/wx/frame.tex
+++ b/docs/latex/wx/frame.tex
@@ -4,6 +4,10 @@ A frame is a window whose size and position can (usually) be changed by the user
 thick borders and a title bar, and can optionally contain a menu bar, toolbar and
 status bar. A frame can contain any window that is not a frame or dialog.
 
+A frame that has a status bar and toolbar created via the CreateStatusBar/CreateToolBar functions
+manages these windows, and adjusts the value returned by GetClientSize to reflect
+the remaining size available to application windows.
+
 \wxheading{Derived from}
 
 \helpref{wxWindow}{wxwindow}\\
@@ -122,7 +126,9 @@ for further details.
 
 \membersection{wxFrame::CreateStatusBar}\label{wxframecreatestatusbar}
 
-\func{virtual bool}{CreateStatusBar}{\param{int}{ number = 1}}
+\func{virtual wxStatusBar*}{CreateStatusBar}{\param{int}{ number = 1},
+ \param{long}{ style = 0},
+ \param{wxWindowID}{ id = -1}, \param{const wxString\&}{ name = "statusBar"}}
 
 Creates a status bar at the bottom of the frame.
 
@@ -131,9 +137,17 @@ Creates a status bar at the bottom of the frame.
 \docparam{number}{The number of fields to create. Specify a
 value greater than 1 to create a multi-field status bar.}
 
+\docparam{style}{The status bar style. See \helpref{wxStatusBar}{wxstatusbar} for a list
+of valid styles.}
+
+\docparam{id}{The status bar window identifier. If -1, an identifier will be chosen by
+wxWindows.}
+
+\docparam{name}{The status bar window name.}
+
 \wxheading{Return value}
 
-TRUE if the status bar was created successfully.
+A pointer to the the status bar if it was created successfully, NULL otherwise.
 
 \wxheading{Remarks}
 
@@ -151,6 +165,45 @@ Note that you can put controls and other windows on the status bar if you wish.
 \helpref{wxFrame::OnCreateStatusBar}{wxframeoncreatestatusbar},\rtfsp
 \helpref{wxFrame::GetStatusBar}{wxframegetstatusbar}
 
+\membersection{wxFrame::CreateToolBar}\label{wxframecreatetoolbar}
+
+\func{virtual wxToolBar*}{CreateToolBar}{\param{long}{ style = wxNO\_BORDER \pipe wxTB\_HORIZONTAL},
+ \param{wxWindowID}{ id = -1}, \param{const wxString\&}{ name = "toolBar"}}
+
+Creates a toolbar at the top or left of the frame.
+
+\wxheading{Parameters}
+
+\docparam{style}{The toolbar style. See \helpref{wxToolBar}{wxtoolbar} for a list
+of valid styles.}
+
+\docparam{id}{The toolbar window identifier. If -1, an identifier will be chosen by
+wxWindows.}
+
+\docparam{name}{The toolbar window name.}
+
+\wxheading{Return value}
+
+A pointer to the the toolbar if it was created successfully, NULL otherwise.
+
+\wxheading{Remarks}
+
+By default, the toolbar is an instance of wxToolBar (which is defined to be
+a suitable toolbar class on each platform, such as wxToolBar95). To use a different class,
+override \helpref{wxFrame::OnCreateToolBar}{wxframeoncreatetoolbar}.
+
+When a toolbar has been created with this function, or made known to the frame
+with \helpref{wxFrame::SetToolBar}{wxframesettoolbar}, the frame will manage the toolbar
+position and adjust the return value from \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize} to
+reflect the available space for application windows.
+
+\wxheading{See also}
+
+\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar},\rtfsp
+\helpref{wxFrame::OnCreateToolBar}{wxframeoncreatetoolbar},\rtfsp
+\helpref{wxFrame::SetToolBar}{wxframesettoolbar},\rtfsp
+\helpref{wxFrame::GetToolBar}{wxframegettoolbar}
+
 \membersection{wxFrame::GetMenuBar}\label{wxframegetmenubar}
 
 \constfunc{wxMenuBar*}{GetMenuBar}{\void}
@@ -178,6 +231,17 @@ Returns a pointer to the status bar currently associated with the frame (if any)
 Gets a temporary pointer to the frame title. See
 \helpref{wxFrame::SetTitle}{wxframesettitle}.
 
+\membersection{wxFrame::GetToolBar}\label{wxframegettoolbar}
+
+\func{wxToolBar*}{GetToolBar}{\void}
+
+Returns a pointer to the toolbar currently associated with the frame (if any).
+
+\wxheading{See also}
+
+\helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}, \helpref{wxToolBar}{wxtoolbar},\rtfsp
+\helpref{wxFrame::SetToolBar}{wxframesettoolbar}
+
 \membersection{wxFrame::Iconize}\label{wxframeiconize}
 
 \func{void}{Iconize}{\param{const bool}{ iconize}}
@@ -269,7 +333,9 @@ If you call wxFrame::LoadAccelerators, you need to override this function e.g.
 
 \membersection{wxFrame::OnCreateStatusBar}\label{wxframeoncreatestatusbar}
 
-\func{virtual wxStatusBar*}{OnCreateStatusBar}{\param{int }{number}}
+\func{virtual wxStatusBar*}{OnCreateStatusBar}{\param{int }{number}
+ \param{long}{ style},
+ \param{wxWindowID}{ id}, \param{const wxString\&}{ name}}
 
 Virtual function called when a status bar is requested by \helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}.
 
@@ -277,6 +343,14 @@ Virtual function called when a status bar is requested by \helpref{wxFrame::Crea
 
 \docparam{number}{The number of fields to create.}
 
+\docparam{style}{The window style. See \helpref{wxStatusBar}{wxstatusbar} for a list
+of valid styles.}
+
+\docparam{id}{The window identifier. If -1, an identifier will be chosen by
+wxWindows.}
+
+\docparam{name}{The window name.}
+
 \wxheading{Return value}
 
 A status bar object.
@@ -290,6 +364,36 @@ implementation returns an instance of \helpref{wxStatusBar}{wxstatusbar}.
 
 \helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}, \helpref{wxStatusBar}{wxstatusbar}.
 
+\membersection{wxFrame::OnCreateToolBar}\label{wxframeoncreatetoolbar}
+
+\func{virtual wxToolBar*}{OnCreateToolBar}{\param{long}{ style},
+ \param{wxWindowID}{ id}, \param{const wxString\&}{ name}}
+
+Virtual function called when a toolbar is requested by \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
+
+\wxheading{Parameters}
+
+\docparam{style}{The toolbar style. See \helpref{wxToolBar}{wxtoolbar} for a list
+of valid styles.}
+
+\docparam{id}{The toolbar window identifier. If -1, an identifier will be chosen by
+wxWindows.}
+
+\docparam{name}{The toolbar window name.}
+
+\wxheading{Return value}
+
+A toolbar object.
+
+\wxheading{Remarks}
+
+An application can override this function to return a different kind of toolbar. The default
+implementation returns an instance of \helpref{wxToolBar}{wxtoolbar}.
+
+\wxheading{See also}
+
+\helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}, \helpref{wxToolBar}{wxtoolbar}.
+
 \membersection{wxFrame::OnMenuCommand}\label{wxframeonmenucommand}
 
 \func{void}{OnMenuCommand}{\param{wxCommandEvent\&}{ event}}
@@ -388,6 +492,17 @@ Note that it is not possible to call this function twice for the same frame obje
 
 \helpref{wxFrame::GetMenuBar}{wxframegetmenubar}, \helpref{wxMenuBar}{wxmenubar}, \helpref{wxMenu}{wxmenu}.
 
+\membersection{wxFrame::SetStatusBar}\label{wxframesetstatusbar}
+
+\func{void}{SetStatusBar}{\param{wxStatusBar*}{ statusBar}}
+
+Associates a status bar with the frame.
+
+\wxheading{See also}
+
+\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}, \helpref{wxStatusBar}{wxstatusbar},\rtfsp
+\helpref{wxFrame::GetStatusBar}{wxframegetstatusbar}
+
 \membersection{wxFrame::SetStatusText}\label{wxframesetstatustext}
 
 \func{virtual void}{SetStatusText}{\param{const wxString\& }{ text}, \param{int}{ number = 0}}
@@ -429,6 +544,17 @@ The widths of the variable fields are calculated from the total width of all fie
 minus the sum of widths of the non-variable fields, divided by the number of 
 variable fields.
 
+\membersection{wxFrame::SetToolBar}\label{wxframesettoolbar}
+
+\func{void}{SetToolBar}{\param{wxToolBar*}{ toolBar}}
+
+Associates a toolbar with the frame.
+
+\wxheading{See also}
+
+\helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}, \helpref{wxToolBar}{wxtoolbar},\rtfsp
+\helpref{wxFrame::GetToolBar}{wxframegettoolbar}
+
 \membersection{wxFrame::SetTitle}\label{wxframesettitle}
 
 \func{virtual void}{SetTitle}{\param{const wxString\& }{ title}}
diff --git a/docs/latex/wx/manual.tex b/docs/latex/wx/manual.tex
index 81fba91bef..cc4040b2c7 100644
--- a/docs/latex/wx/manual.tex
+++ b/docs/latex/wx/manual.tex
@@ -1,10 +1,12 @@
 \documentstyle[a4,11pt,makeidx,verbatim,texhelp,fancyheadings,palatino]{thesis}
+% JACS: doesn't make it through Tex2RTF, sorry.I'll put it into texhelp.sty
+% since Tex2RTF doesn't parse it.
 %KB:
-\addtolength{\textwidth}{1in}
-\addtolength{\oddsidemargin}{-0.5in}
-\addtolength{\topmargin}{-0.5in}
-\addtolength{\textheight}{1in}
-\sloppy 
+%\addtolength{\textwidth}{1in}
+%\addtolength{\oddsidemargin}{-0.5in}
+%\addtolength{\topmargin}{-0.5in}
+%\addtolength{\textheight}{1in}
+%\sloppy
 %end of my changes
 \newcommand{\indexit}[1]{#1\index{#1}}%
 \newcommand{\pipe}[0]{$\|$\ }%
diff --git a/docs/latex/wx/statusbr.tex b/docs/latex/wx/statusbr.tex
index 8e604b2367..965e30bc28 100644
--- a/docs/latex/wx/statusbr.tex
+++ b/docs/latex/wx/statusbr.tex
@@ -10,7 +10,11 @@ be variable length according to the size of the window.
 
 \wxheading{Window styles}
 
-There are no special styles for this window.
+\twocolwidtha{5cm}
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxSB\_SIZEGRIP}}{On Windows 95, displays a gripper at right-hand side of
+the status bar.}
+\end{twocollist}
 
 See also \helpref{window styles overview}{windowstyles}.
 
diff --git a/docs/latex/wx/texhelp.sty b/docs/latex/wx/texhelp.sty
index e52374f9f4..af91bd531d 100644
--- a/docs/latex/wx/texhelp.sty
+++ b/docs/latex/wx/texhelp.sty
@@ -290,3 +290,9 @@
 \newcommand{\constfunc}[3]{{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}
 \newcommand{\windowstyle}[1]{{\bf #1}\index{#1}}
 
+\addtolength{\textwidth}{1in}
+\addtolength{\oddsidemargin}{-0.5in}
+\addtolength{\topmargin}{-0.5in}
+\addtolength{\textheight}{1in}
+\sloppy
+
diff --git a/docs/latex/wx/toolbar.tex b/docs/latex/wx/toolbar.tex
index 365e810151..28468766b0 100644
--- a/docs/latex/wx/toolbar.tex
+++ b/docs/latex/wx/toolbar.tex
@@ -1,12 +1,23 @@
-\section{\class{wxToolBarBase}}\label{wxtoolbarbase}
+\section{\class{wxToolBar}}\label{wxtoolbar}
 
-{\bf wxToolBarBase} is the base class for a number of toolbar classes.  The most portable
-one of these is the generic \helpref{wxToolBarSimple}{wxtoolbarsimple} class. {\bf wxToolBarBase} defines
-automatic scrolling management functionality which is identical to \helpref{wxScrolledWindow}{wxscrolledwindow},
-so please refer to this class also.
+The name wxToolBar is defined to be a synonym for one of the following classes:
+
+\begin{itemize}\itemsep=0pt
+\item {\bf wxToolBar95} The native Windows 95 toolbar. Used on Windows 95, NT 4 and above.
+\item {\bf wxToolBarMSW} A Windows implementation. Used on 16-bit Windows.
+\item {\bf wxToolBarGTK} The GTK toolbar.
+\item {\bf wxToolBarSimple} A simple implementation, with scrolling.
+Used on platforms with no native toolbar control, or where scrolling is required.
+\end{itemize}
+
+Note that the base class {\bf wxToolBarBase} defines
+automatic scrolling management functionality which is identical
+to \helpref{wxScrolledWindow}{wxscrolledwindow}, so please refer to this class also.
+Not all toolbars support scrolling, but wxToolBarSimple does.
 
 \wxheading{Derived from}
 
+wxToolBarBase\\
 \helpref{wxControl}{wxcontrol}\\
 \helpref{wxWindow}{wxwindow}\\
 \helpref{wxEvtHandler}{wxevthandler}\\
@@ -14,58 +25,107 @@ so please refer to this class also.
 
 \wxheading{Remarks}
 
-Because there is a variety of toolbar classes, you may wish to choose which class
-is best for your application on each platform, and define {\bf wxToolBar} appropriately. For example:
-
-\begin{verbatim}
-#if WIN95
-class wxToolBar: public wxToolBar95
-#elif defined(wx_msw)
-class wxToolBar: public wxToolBarMSW
-#else
-class wxToolBar: public wxToolBarSimple
-#endif
-{
-};
-\end{verbatim}
-
-TODO: maybe change the confusing names: GetDefaultSize becomes GetToolBitmapSize, and
-GetDefaultButtonSize becomes GetToolSize. Document SetRows for wxToolBar95, and make it
-part of the base API?
+You may also create a toolbar that is managed by the frame, by
+calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
+
+{\bf wxToolBar95:} Note that this toolbar paints tools to reflect user-selected colours.
+The toolbar orientation must always be {\bf wxVERTICAL}.
+
+\wxheading{Window styles}
+
+\twocolwidtha{5cm}
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxTB\_FLAT}}{Gives the toolbar a flat look ('coolbar' or 'flatbar' style). Windows 95 only.}
+\twocolitem{\windowstyle{wxTB\_HORIZONTAL}}{Specifies horizontal layout.}
+\twocolitem{\windowstyle{wxTB\_VERTICAL}}{Specifies vertical layout (not available for the Windows 95
+toolbar).}
+\twocolitem{\windowstyle{wxTB\_3DBUTTONS}}{Gives wxToolBarSimple a mild 3D look to its buttons.}
+\end{twocollist}
+
+See also \helpref{window styles overview}{windowstyles}.
 
 \wxheading{Event handling}
 
-Derive a new class from an existing toolbar class, and override appropriate virtual functions.
+The toolbar class emits menu commands in the same was that a frame menubar does,
+so you can use one EVT\_MENU macro for both a menu item and a toolbar button.
+The event handler functions take a wxCommandEvent argument. For most event macros,
+the identifier of the tool is passed, but for EVT\_TOOL\_ENTER the toolbar
+window is passed and the tool id is retrieved from the wxCommandEvent.
+This is because the id may be -1 when the mouse moves off a tool, and -1 is not
+allowed as an identifier in the event system.
 
-TODO: make consistent with other event handling; have wxToolBarEvent and appropriate macros.
+\twocolwidtha{7cm}
+\begin{twocollist}\itemsep=0pt
+\twocolitem{{\bf EVT\_TOOL(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
+(a synonym for wxEVT\_COMMAND\_MENU\_SELECTED). Pass the id of the tool.}
+\twocolitem{{\bf EVT\_MENU(id, func)}}{The same as EVT\_TOOL.}
+\twocolitem{{\bf EVT\_TOOL\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_CLICKED event
+for a range id identifiers. Pass the ids of the tools.}
+\twocolitem{{\bf EVT\_MENU\_RANGE(id1, id2, func)}}{The same as EVT\_TOOL\_RANGE.}
+
+\twocolitem{{\bf EVT\_TOOL\_RCLICKED(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event.
+Pass the id of the tool.}
+\twocolitem{{\bf EVT\_TOOL\_RCLICKED\_RANGE(id1, id2, func)}}{Process a wxEVT\_COMMAND\_TOOL\_RCLICKED event
+for a range of ids. Pass the ids of the tools.}
+\twocolitem{{\bf EVT\_TOOL\_ENTER(id, func)}}{Process a wxEVT\_COMMAND\_TOOL\_ENTER event.
+Pass the id of the toolbar itself. The value of wxCommandEvent::GetSelection is the tool id, or -1 if the mouse cursor has moved off a tool.}
+\end{twocollist}
 
 \wxheading{See also}
 
 \overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
-\helpref{wxToolBarSimple}{wxtoolbarsimple},\rtfsp
-\helpref{wxToolBarMSW}{wxtoolbarmsw},\rtfsp
-\helpref{wxToolBar95}{wxtoolbar95},\rtfsp
 \helpref{wxScrolledWindow}{wxscrolledwindow}
 
 \latexignore{\rtfignore{\wxheading{Members}}}
 
-\membersection{wxToolBarBase::wxToolBarBase}\label{wxtoolbarbaseconstr}
+\membersection{wxToolBar::wxToolBar}\label{wxtoolbarconstr}
 
-\func{}{wxToolBarBase}{\void}
+\func{}{wxToolBar}{\void}
 
 Default constructor.
 
-%\wxheading{See also}
-%
-%\helpref{wxToolBarBase::Create}{wxtoolbarbasecreate}
-%
-\membersection{wxToolBarBase::\destruct{wxToolBarBase}}
+\func{}{wxToolBar}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},
+ \param{const wxPoint\& }{pos = wxDefaultPosition},
+ \param{const wxSize\& }{size = wxDefaultSize},
+ \param{long }{style = wxTB\_HORIZONTAL \pipe wxNO\_BORDER},
+ \param{const wxString\& }{name = wxPanelNameStr}}
+
+Constructs a toolbar.
+
+\wxheading{Parameters}
+
+\docparam{parent}{Pointer to a parent window.}
 
-\func{void}{\destruct{wxToolBarBase}}{\void}
+\docparam{id}{Window identifier. If -1, will automatically create an identifier.}
+
+\docparam{pos}{Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows
+should generate a default position for the window. If using the wxWindow class directly, supply
+an actual position.}
+
+\docparam{size}{Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows
+should generate a default size for the window.}
+
+\docparam{style}{Window style. See \helpref{wxToolBar}{wxtoolbar} for details.}
+
+\docparam{name}{Window name.}
+
+\wxheading{Remarks}
+
+After a toolbar is created, you use \helpref{wxToolBar::AddTool}{wxtoolbaraddtool} and
+perhaps \helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}, and then you
+must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} to construct and display the toolbar
+tools.
+
+You may also create a toolbar that is managed by the frame, by
+calling \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.
+
+\membersection{wxToolBar::\destruct{wxToolBar}}
+
+\func{void}{\destruct{wxToolBar}}{\void}
 
 Toolbar destructor.
 
-\membersection{wxToolBarBase::AddSeparator}\label{wxtoolbarbaseaddseparator}
+\membersection{wxToolBar::AddSeparator}\label{wxtoolbaraddseparator}
 
 \func{void}{AddSeparator}{\void}
 
@@ -73,14 +133,14 @@ Adds a separator for spacing groups of tools.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool}, \helpref{wxToolBarBase::SetToolSeparation}{wxtoolbarbasesettoolseparation}
+\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}, \helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
 
-\membersection{wxToolBarBase::AddTool}\label{wxtoolbarbaseaddtool}
+\membersection{wxToolBar::AddTool}\label{wxtoolbaraddtool}
 
-\func{wxToolBarBaseTool*}{AddTool}{\param{int}{ toolIndex}, \param{const wxBitmap\&}{ bitmap1},\rtfsp
-\param{const wxBitmap\&}{ bitmap2 = (wxBitmap *)NULL}, \param{const bool}{ isToggle = FALSE},\rtfsp
-\param{const float}{ xPos = -1}, \param{const float}{ yPos = -1},\rtfsp
-\param{wxObject *}{clientData = NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
+\func{wxToolBarTool*}{AddTool}{\param{int}{ toolIndex}, \param{const wxBitmap\&}{ bitmap1},\rtfsp
+\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = FALSE},\rtfsp
+\param{long}{ xPos = -1}, \param{long}{ yPos = -1},\rtfsp
+\param{wxObject* }{clientData = NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
 
 Adds a tool to the toolbar.
 
@@ -106,7 +166,7 @@ wxBitmap object.}
 \docparam{yPos}{Specifies the y position of the tool if automatic layout is not suitable.}
 
 \docparam{clientData}{An optional pointer to client data which can be
-retrieved later using \helpref{wxToolBarBase::GetToolClientData}{wxtoolbarbasegettoolclientdata}.}
+retrieved later using \helpref{wxToolBar::GetToolClientData}{wxtoolbargettoolclientdata}.}
 
 \docparam{shortHelpString}{Used for displaying a tooltip for the tool in the
 Windows 95 implementation of wxButtonBar. Pass the empty string if this is not required.}
@@ -114,29 +174,31 @@ Windows 95 implementation of wxButtonBar. Pass the empty string if this is not r
 \docparam{longHelpString}{Used to displayer longer help, such as status line help.
 Pass the empty string if this is not required.}
 
-\wxheading{See also}
+\wxheading{Remarks}
 
-\helpref{wxToolBarBase::AddSeparator}{wxtoolbarbaseaddseparator}
+After you have added tools to a toolbar, you must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} in
+order to have the tools appear.
 
-\membersection{wxToolBarBase::CreateTools}\label{wxtoolbarbasecreatetools}
+\wxheading{See also}
 
-\func{bool}{CreateTools}{\void}
+\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator},
+\helpref{wxToolBar::Realize}{wxtoolbarrealize},
 
-Call this function after all tools have been added to the toolbar, to actually
-create the tools.
+\membersection{wxToolBar::CreateTools}\label{wxtoolbarcreatetools}
 
-\wxheading{Remarks}
+\func{bool}{CreateTools}{\void}
 
-Strictly speaking, this is required only for the Windows 95 version of wxButtonBar,
-but for portability it should be called anyway.
+This function is implemented for some toolbar classes to create the tools and display them.
+The portable way of calling it is to call \helpref{wxToolBar::Realize}{wxtoolbarrealize} after
+you have added tools and separators.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool}
+\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}, \helpref{wxToolBar::Realize}{wxtoolbarrealize}
 
-\membersection{wxToolBarBase::DrawTool}\label{wxtoolbarbasedrawtool}
+\membersection{wxToolBar::DrawTool}\label{wxtoolbardrawtool}
 
-\func{void}{DrawTool}{\param{wxMemoryDC\& }{memDC}, \param{wxToolBarBaseTool* }{tool}}
+\func{void}{DrawTool}{\param{wxMemoryDC\& }{memDC}, \param{wxToolBarTool* }{tool}}
 
 Draws the specified tool onto the window using the given memory device context.
 
@@ -150,7 +212,7 @@ Draws the specified tool onto the window using the given memory device context.
 
 For internal use only.
 
-\membersection{wxToolBarBase::EnableTool}\label{wxtoolbarbaseenabletool}
+\membersection{wxToolBar::EnableTool}\label{wxtoolbarenabletool}
 
 \func{void}{EnableTool}{\param{int }{toolIndex}, \param{const bool}{ enable}}
 
@@ -169,13 +231,13 @@ will change the visible state of the tool to indicate that it is disabled.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetToolEnabled}{wxtoolbarbasegettoolenabled},\rtfsp
-%\helpref{wxToolBarBase::SetToolState}{wxtoolbarbasesettoolstate},\rtfsp
-\helpref{wxToolBarBase::ToggleTool}{wxtoolbarbasetoggletool}
+\helpref{wxToolBar::GetToolEnabled}{wxtoolbargettoolenabled},\rtfsp
+%\helpref{wxToolBar::SetToolState}{wxtoolbarsettoolstate},\rtfsp
+\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}
 
-\membersection{wxToolBarBase::FindToolForPosition}\label{wxtoolbarbasefindtoolforposition}
+\membersection{wxToolBar::FindToolForPosition}\label{wxtoolbarfindtoolforposition}
 
-\constfunc{wxToolBarBaseTool*}{FindToolForPosition}{\param{const float}{ x}, \param{const float}{ y}}
+\constfunc{wxToolBarTool*}{FindToolForPosition}{\param{const float}{ x}, \param{const float}{ y}}
 
 Finds a tool for the given mouse position.
 
@@ -193,35 +255,35 @@ A pointer to a tool if a tool is found, or NULL otherwise.
 
 Used internally, and should not need to be used by the programmer.
 
-\membersection{wxToolBarBase::GetDefaultButtonSize}\label{wxtoolbarbasegetdefaultbuttonsize}
+\membersection{wxToolBar::GetToolSize}\label{wxtoolbargettoolsize}
 
-\func{wxSize}{GetDefaultButtonSize}{\void}
+\func{wxSize}{GetToolSize}{\void}
 
 Returns the size of a whole button, which is usually larger than a tool bitmap because
 of added 3D effects.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::SetDefaultSize}{wxtoolbarbasesetdefaultsize},\rtfsp
-\helpref{wxToolBarBase::GetDefaultSize}{wxtoolbarbasegetdefaultsize}
+\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
+\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize}
 
-\membersection{wxToolBarBase::GetDefaultSize}\label{wxtoolbarbasegetdefaultsize}
+\membersection{wxToolBar::GetToolBitmapSize}\label{wxtoolbargettoolbitmapsize}
 
-\func{wxSize}{GetDefaultSize}{\void}
+\func{wxSize}{GetToolBitmapSize}{\void}
 
 Returns the size of bitmap that the toolbar expects to have. The default bitmap size is 16 by 15 pixels.
 
 \wxheading{Remarks}
 
-Note that this is the size of the bitmap you pass to \helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool},
+Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
 and not the eventual size of the tool button.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::SetDefaultSize}{wxtoolbarbasesetdefaultsize},\rtfsp
-\helpref{wxToolBarBase::GetDefaultButtonSize}{wxtoolbarbasegetdefaultbuttonsize}
+\helpref{wxToolBar::SetToolBitmapSize}{wxtoolbarsettoolbitmapsize},\rtfsp
+\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
 
-\membersection{wxToolBarBase::GetMargins}\label{wxtoolbarbasegetmargins}
+\membersection{wxToolBar::GetMargins}\label{wxtoolbargetmargins}
 
 \constfunc{wxSize}{GetMargins}{\void}
 
@@ -229,9 +291,9 @@ Returns the left/right and top/bottom margins, which are also used for inter-too
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::SetMargins}{wxtoolbarbasesetmargins}
+\helpref{wxToolBar::SetMargins}{wxtoolbarsetmargins}
 
-\membersection{wxToolBarBase::GetMaxSize}\label{wxtoolbarbasegetmaxsize}
+\membersection{wxToolBar::GetMaxSize}\label{wxtoolbargetmaxsize}
 
 \constfunc{void}{GetMaxSize}{\param{float*}{ w}, \param{float*}{ h}}
 
@@ -244,7 +306,7 @@ This can be used to size a frame around the toolbar window.
 
 \docparam{h}{Receives the maximum vertical size.}
 
-\membersection{wxToolBarBase::GetToolClientData}\label{wxtoolbarbasegettoolclientdata}
+\membersection{wxToolBar::GetToolClientData}\label{wxtoolbargettoolclientdata}
 
 \constfunc{wxObject*}{GetToolClientData}{\param{int }{toolIndex}}
 
@@ -252,13 +314,13 @@ Get any client data associated with the tool.
 
 \wxheading{Parameters}
 
-\docparam{toolIndex}{Index of the tool, as passed to \helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool}.}
+\docparam{toolIndex}{Index of the tool, as passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
 
 \wxheading{Return value}
 
 Client data, or NULL if there is none.
 
-\membersection{wxToolBarBase::GetToolEnabled}\label{wxtoolbarbasegettoolenabled}
+\membersection{wxToolBar::GetToolEnabled}\label{wxtoolbargettoolenabled}
 
 \constfunc{bool}{GetToolEnabled}{\param{int }{toolIndex}}
 
@@ -274,9 +336,9 @@ TRUE if the tool is enabled, FALSE otherwise.
 
 %\wxheading{See also}
 %
-%\helpref{wxToolBarBase::SetToolEnabled}{wxtoolbarbasesettoolenabled}
+%\helpref{wxToolBar::SetToolEnabled}{wxtoolbarsettoolenabled}
 %
-\membersection{wxToolBarBase::GetToolLongHelp}\label{wxtoolbarbasegettoollonghelp}
+\membersection{wxToolBar::GetToolLongHelp}\label{wxtoolbargettoollonghelp}
 
 \constfunc{wxString}{GetToolLongHelp}{\param{int }{toolIndex}}
 
@@ -288,10 +350,10 @@ Returns the long help for the given tool.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::SetToolLongHelp}{wxtoolbarbasesettoollonghelp},\rtfsp
-\helpref{wxToolBarBase::SetToolShortHelp}{wxtoolbarbasesettoolshorthelp}\rtfsp
+\helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp},\rtfsp
+\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
 
-\membersection{wxToolBarBase::GetToolPacking}\label{wxtoolbarbasegettoolpacking}
+\membersection{wxToolBar::GetToolPacking}\label{wxtoolbargettoolpacking}
 
 \constfunc{int}{GetToolPacking}{\void}
 
@@ -299,9 +361,9 @@ Returns the value used for packing tools.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::SetToolPacking}{wxtoolbarbasesettoolpacking}
+\helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}
 
-\membersection{wxToolBarBase::GetToolSeparation}\label{wxtoolbarbasegettoolseparation}
+\membersection{wxToolBar::GetToolSeparation}\label{wxtoolbargettoolseparation}
 
 \constfunc{int}{GetToolSeparation}{\void}
 
@@ -309,9 +371,9 @@ Returns the default separator size.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::SetToolSeparation}{wxtoolbarbasesettoolseparation}
+\helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}
 
-\membersection{wxToolBarBase::GetToolShortHelp}\label{wxtoolbarbasegettoolshorthelp}
+\membersection{wxToolBar::GetToolShortHelp}\label{wxtoolbargettoolshorthelp}
 
 \constfunc{wxString}{GetToolShortHelp}{\param{int }{toolIndex}}
 
@@ -325,10 +387,10 @@ Returns the long help for the given tool.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetToolLongHelp}{wxtoolbarbasegettoollonghelp},\rtfsp
-\helpref{wxToolBarBase::SetToolShortHelp}{wxtoolbarbasesettoolshorthelp}\rtfsp
+\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
+\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp
 
-\membersection{wxToolBarBase::GetToolState}\label{wxtoolbarbasegettoolstate}
+\membersection{wxToolBar::GetToolState}\label{wxtoolbargettoolstate}
 
 \constfunc{bool}{GetToolState}{\param{int }{toolIndex}}
 
@@ -344,9 +406,9 @@ TRUE if the tool is toggled on, FALSE otherwise.
 
 %\wxheading{See also}
 %
-%\helpref{wxToolBarBase::SetToolState}{wxtoolbarbasesettoolstate}
+%\helpref{wxToolBar::SetToolState}{wxtoolbarsettoolstate}
 %
-\membersection{wxToolBarBase::Layout}\label{wxtoolbarbaselayout}
+\membersection{wxToolBar::Layout}\label{wxtoolbarlayout}
 
 \func{void}{Layout}{\void}
 
@@ -354,16 +416,26 @@ Called by the application after the tools have been added to
 automatically lay the tools out on the window. If you have given
 absolute positions when adding the tools, do not call this.
 
-\membersection{wxToolBarBase::OnLeftClick}\label{wxtoolbarbaseonleftclick}
+This function is only implemented for some toolbar classes.
+The portable way of calling it is to call \helpref{wxToolBar::Realize}{wxtoolbarrealize} after
+you have added tools and separators.
+
+\wxheading{See also}
+
+\helpref{wxToolBar::AddTool}{wxtoolbaraddtool}, \helpref{wxToolBar::Realize}{wxtoolbarrealize}
+
+\membersection{wxToolBar::OnLeftClick}\label{wxtoolbaronleftclick}
 
 \func{bool}{OnLeftClick}{\param{int}{ toolIndex}, \param{bool}{ toggleDown}}
 
-Called when the user clicks on a tool with the left mouse button. The
-programmer should override this function to detect left tool clicks.
+Called when the user clicks on a tool with the left mouse button.
+
+This is the old way of detecting tool clicks; although it will still work,
+you should use the EVT\_MENU or EVT\_TOOL macro instead.
 
 \wxheading{Parameters}
 
-\docparam{toolIndex}{The identifier passed to \helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool}.}
+\docparam{toolIndex}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
 
 \docparam{toggleDown}{TRUE if the tool is a toggle and the toggle is down, otherwise is FALSE.}
 
@@ -375,16 +447,19 @@ specifying that toggle operations are not permitted in some circumstances.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::OnMouseEnter}{wxtoolbarbaseonmouseenter},\rtfsp
-\helpref{wxToolBarBase::OnRightClick}{wxtoolbarbaseonrightclick}
+\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
+\helpref{wxToolBar::OnRightClick}{wxtoolbaronrightclick}
 
-\membersection{wxToolBarBase::OnMouseEnter}\label{wxtoolbarbaseonmouseenter}
+\membersection{wxToolBar::OnMouseEnter}\label{wxtoolbaronmouseenter}
 
 \func{void}{OnMouseEnter}{\param{int}{ toolIndex}}
 
 This is called when the mouse cursor moves into a tool or out of
 the toolbar.
 
+This is the old way of detecting mouse enter events; although it will still work,
+you should use the EVT\_TOOL\_ENTER macro instead.
+
 \wxheading{Parameters}
 
 \docparam{toolIndex}{Greater than -1 if the mouse cursor has moved into the tool,
@@ -397,16 +472,19 @@ such as a short description on the status line.}
 With some derived toolbar classes, if the mouse moves quickly out of the toolbar, wxWindows may not be able to
 detect it. Therefore this function may not always be called when expected.
 
-\membersection{wxToolBarBase::OnRightClick}\label{wxtoolbarbaseonrightclick}
+\membersection{wxToolBar::OnRightClick}\label{wxtoolbaronrightclick}
 
 \func{void}{OnRightClick}{\param{int}{ toolIndex}, \param{float}{ x}, \param{float}{ y}}
 
 Called when the user clicks on a tool with the right mouse button. The
 programmer should override this function to detect right tool clicks.
 
+This is the old way of detecting tool right clicks; although it will still work,
+you should use the EVT\_TOOL\_RCLICKED macro instead.
+
 \wxheading{Parameters}
 
-\docparam{toolIndex}{The identifier passed to \helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool}.}
+\docparam{toolIndex}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}
 
 \docparam{x}{The x position of the mouse cursor.}
 
@@ -418,12 +496,24 @@ A typical use of this member might be to pop up a menu.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::OnMouseEnter}{wxtoolbarbaseonmouseenter},\rtfsp
-\helpref{wxToolBarBase::OnLeftClick}{wxtoolbarbaseonleftclick}
+\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp
+\helpref{wxToolBar::OnLeftClick}{wxtoolbaronleftclick}
+
+\membersection{wxToolBar::Realize}\label{wxtoolbarrealize}
+
+\func{bool}{Realize}{\void}
+
+This function should be called after you have added tools. It
+calls, according to the implementation,
+either \helpref{wxToolBar::CreateTools}{wxtoolbarcreatetools} or
+ \helpref{wxToolBar::Layout}{wxtoolbarlayout}.
+
+If you are using absolute positions for your tools when using a wxToolBarSimple object,
+do not call this function. You must call it at all other times.
 
-\membersection{wxToolBarBase::SetDefaultSize}\label{wxtoolbarbasesetdefaultsize}
+\membersection{wxToolBar::SetToolBitmapSize}\label{wxtoolbarsettoolbitmapsize}
 
-\func{void}{SetDefaultSize}{\param{const wxSize\&}{ size}}
+\func{void}{SetToolBitmapSize}{\param{const wxSize\&}{ size}}
 
 Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.
 
@@ -436,15 +526,15 @@ Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 p
 This should be called to tell the toolbar what the tool bitmap size is. Call
 it before you add tools.
 
-Note that this is the size of the bitmap you pass to \helpref{wxToolBarBase::AddTool}{wxtoolbarbaseaddtool},
+Note that this is the size of the bitmap you pass to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool},
 and not the eventual size of the tool button.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetDefaultSize}{wxtoolbarbasegetdefaultsize},\rtfsp
-\helpref{wxToolBarBase::GetDefaultButtonSize}{wxtoolbarbasegetdefaultbuttonsize}
+\helpref{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize},\rtfsp
+\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}
 
-\membersection{wxToolBarBase::SetMargins}\label{wxtoolbarbasesetmargins}
+\membersection{wxToolBar::SetMargins}\label{wxtoolbarsetmargins}
 
 \func{void}{SetMargins}{\param{const wxSize\&}{ size}}
 
@@ -467,9 +557,9 @@ default (zero-size) margins are to be overridden.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetMargins}{wxtoolbarbasegetmargins}, \helpref{wxSize}{wxsize}
+\helpref{wxToolBar::GetMargins}{wxtoolbargetmargins}, \helpref{wxSize}{wxsize}
 
-\membersection{wxToolBarBase::SetToolLongHelp}\label{wxtoolbarbasesettoollonghelp}
+\membersection{wxToolBar::SetToolLongHelp}\label{wxtoolbarsettoollonghelp}
 
 \func{void}{SetToolLongHelp}{\param{int }{toolIndex}, \param{const wxString\& }{helpString}}
 
@@ -487,10 +577,10 @@ You might use the long help for displaying the tool purpose on the status line.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetToolLongHelp}{wxtoolbarbasegettoollonghelp},\rtfsp
-\helpref{wxToolBarBase::SetToolShortHelp}{wxtoolbarbasesettoolshorthelp},\rtfsp
+\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp
+\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp},\rtfsp
 
-\membersection{wxToolBarBase::SetToolPacking}\label{wxtoolbarbasesettoolpacking}
+\membersection{wxToolBar::SetToolPacking}\label{wxtoolbarsettoolpacking}
 
 \func{void}{SetToolPacking}{\param{int}{ packing}}
 
@@ -507,9 +597,9 @@ and for spacing in the horizontal direction if the toolbar is vertical.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetToolPacking}{wxtoolbarbasegettoolpacking}
+\helpref{wxToolBar::GetToolPacking}{wxtoolbargettoolpacking}
 
-\membersection{wxToolBarBase::SetToolShortHelp}\label{wxtoolbarbasesettoolshorthelp}
+\membersection{wxToolBar::SetToolShortHelp}\label{wxtoolbarsettoolshorthelp}
 
 \func{void}{SetToolShortHelp}{\param{int }{toolIndex}, \param{const wxString\& }{helpString}}
 
@@ -527,9 +617,9 @@ An application might use short help for identifying the tool purpose in a toolti
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetToolShortHelp}{wxtoolbarbasegettoolshorthelp}, \helpref{wxToolBarBase::SetToolLongHelp}{wxtoolbarbasesettoollonghelp}
+\helpref{wxToolBar::GetToolShortHelp}{wxtoolbargettoolshorthelp}, \helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp}
 
-\membersection{wxToolBarBase::SetToolSeparation}\label{wxtoolbarbasesettoolseparation}
+\membersection{wxToolBar::SetToolSeparation}\label{wxtoolbarsettoolseparation}
 
 \func{void}{SetToolSeparation}{\param{int}{ separation}}
 
@@ -541,9 +631,9 @@ Sets the default separator size. The default value is 5.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::AddSeparator}{wxtoolbarbaseaddseparator}
+\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}
 
-\membersection{wxToolBarBase::ToggleTool}\label{wxtoolbarbasetoggletool}
+\membersection{wxToolBar::ToggleTool}\label{wxtoolbartoggletool}
 
 \func{void}{ToggleTool}{\param{int }{toolIndex}, \param{const bool}{ toggle}}
 
@@ -561,213 +651,6 @@ Only applies to a tool that has been specified as a toggle tool.
 
 \wxheading{See also}
 
-\helpref{wxToolBarBase::GetToolState}{wxtoolbarbasegettoolstate}
-
-\section{\class{wxToolBar95}}\label{wxtoolbar95}
-
-This class should be used when a 3D-effect toolbar is required under Windows 95.
-It uses the native toolbar control.
-
-\wxheading{Derived from}
-
-\helpref{wxToolBarBase}{wxtoolbarbase}\\
-\helpref{wxControl}{wxcontrol}\\
-\helpref{wxWindow}{wxwindow}\\
-\helpref{wxEvtHandler}{wxevthandler}\\
-\helpref{wxObject}{wxobject}
-
-\wxheading{Window styles}
-
-\twocolwidtha{5cm}
-\begin{twocollist}\itemsep=0pt
-\twocolitem{\windowstyle{wxTB\_FLAT}}{Gives the toolbar a flat look ('coolbar' or 'flatbar' style).}
-\end{twocollist}
-
-See also \helpref{window styles overview}{windowstyles}.
-
-\wxheading{Remarks}
-
-Note that this toolbar paints tools to reflect user-selected colours.
-The toolbar orientation must always be {\bf wxVERTICAL}.
-
-For member functions, see the documentation for \helpref{wxToolBarBase}{wxtoolbarbase}.
-
-\wxheading{See also}
-
-\overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
-\helpref{wxToolBarBase}{wxtoolbarbase},\rtfsp
-\helpref{wxToolBarSimple}{wxtoolbarsimple},\rtfsp
-\helpref{wxToolBarMSW}{wxtoolbarmsw}
-
-\latexignore{\rtfignore{\wxheading{Members}}}
-
-\membersection{wxToolBar95::wxToolBar95}\label{wxtoolbar95constr}
-
-\func{}{wxToolBar95}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},\rtfsp
-\param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
-\param{long }{style = 0}, \param{int }{orientation = wxVERTICAL},\rtfsp
-\param{int }{nRowsOrColumns = 1}, \param{const wxString\& }{name = ``toolBar"}}
-
-Constructs a toolbar.
-
-\wxheading{Parameters}
-
-\docparam{parent}{Parent window. Must not be NULL.}
-
-\docparam{id}{Window identifier. A value of -1 indicates a default value.}
-
-\docparam{pos}{Window position. If the position (-1, -1) is specified then a default position is chosen.}
-
-\docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.}
-
-\docparam{orientation}{Specifies a wxVERTICAL or wxHORIZONTAL orientation for laying out
-the toolbar.}
-
-\docparam{nRowsOrColumns}{Specifies the number of rows or
-columns, whose meaning depends on {\it orientation}.  If laid out
-vertically, {\it nRowsOrColumns} specifies the number of rows to draw
-before the next column is started; if horizontal, it refers to the
-number of columns to draw before the next row is started.}
-
-\docparam{style}{Window style. See \helpref{wxToolBar95}{wxtoolbar95}.}
-
-\docparam{name}{Window name.}
-
-\section{\class{wxToolBarMSW}}\label{wxtoolbarmsw}
-
-This class should be used when a 3D-effect toolbar is required for Windows versions earlier
-than Windows 95.
-
-\wxheading{Derived from}
-
-\helpref{wxToolBarBase}{wxtoolbarbase}\\
-\helpref{wxControl}{wxcontrol}\\
-\helpref{wxWindow}{wxwindow}\\
-\helpref{wxEvtHandler}{wxevthandler}\\
-\helpref{wxObject}{wxobject}
-
-\wxheading{Window styles}
-
-There are no specific styles for this class.
-
-See also \helpref{window styles overview}{windowstyles}.
-
-\wxheading{Remarks}
-
-Note that this toolbar does not paint tools to reflect user-selected colours: grey shading is used.
-
-For member functions, see the documentation for \helpref{wxToolBarBase}{wxtoolbarbase}.
-
-\wxheading{See also}
-
-\overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
-\helpref{wxToolBarBase}{wxtoolbarbase},\rtfsp
-\helpref{wxToolBarSimple}{wxtoolbarsimple},\rtfsp
-\helpref{wxToolBar95}{wxtoolbar95}
-
-\latexignore{\rtfignore{\wxheading{Members}}}
-
-\membersection{wxToolBarMSW::wxToolBarMSW}\label{wxtoolbarmswconstr}
-
-\func{}{wxToolBarMSW}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},\rtfsp
-\param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
-\param{long }{style = 0}, \param{int }{orientation = wxVERTICAL},\rtfsp
-\param{int }{nRowsOrColumns = 1}, \param{const wxString\& }{name = ``toolBar"}}
-
-Constructs a toolbar.
-
-\wxheading{Parameters}
-
-\docparam{parent}{Parent window. Must not be NULL.}
-
-\docparam{id}{Window identifier. A value of -1 indicates a default value.}
-
-\docparam{pos}{Window position. If the position (-1, -1) is specified then a default position is chosen.}
-
-\docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.}
-
-\docparam{orientation}{Specifies a wxVERTICAL or wxHORIZONTAL orientation for laying out
-the toolbar.}
-
-\docparam{nRowsOrColumns}{Specifies the number of rows or
-columns, whose meaning depends on {\it orientation}.  If laid out
-vertically, {\it nRowsOrColumns} specifies the number of rows to draw
-before the next column is started; if horizontal, it refers to the
-number of columns to draw before the next row is started.}
-
-\docparam{style}{Window style. See \helpref{wxToolBarMSW}{wxtoolbarmsw}.}
-
-\docparam{name}{Window name.}
-
-
-\section{\class{wxToolBarSimple}}\label{wxtoolbarsimple}
-
-This is the generic toolbar class which has an identical appearance
-on all platforms.
-
-\wxheading{Derived from}
-
-\helpref{wxToolBarBase}{wxtoolbarbase}\\
-\helpref{wxControl}{wxcontrol}\\
-\helpref{wxWindow}{wxwindow}\\
-\helpref{wxEvtHandler}{wxevthandler}\\
-\helpref{wxObject}{wxobject}
-
-\wxheading{Window styles}
-
-\twocolwidtha{5cm}
-\begin{twocollist}\itemsep=0pt
-\twocolitem{\windowstyle{wxTB\_3DBUTTONS}}{Gives the simple toolbar a mild 3D look to its buttons.}
-\end{twocollist}
-
-See also \helpref{window styles overview}{windowstyles}.
-
-\wxheading{Remarks}
-
-In this class, disabling a toolbar tool does not change its appearance.
-
-For member functions, see the documentation for \helpref{wxToolBarBase}{wxtoolbarbase}.
-
-\wxheading{See also}
-
-\overview{Toolbar overview}{wxtoolbaroverview},\rtfsp
-\helpref{wxToolBarBase}{wxtoolbarbase},\rtfsp
-\helpref{wxToolBarSimple}{wxtoolbarsimple},\rtfsp
-\helpref{wxToolBar95}{wxtoolbar95}
-
-\latexignore{\rtfignore{\wxheading{Members}}}
-
-\membersection{wxToolBarSimple::wxToolBarSimple}\label{wxtoolbarsimpleconstr}
-
-\func{}{wxToolBarSimple}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id},\rtfsp
-\param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
-\param{long }{style = 0}, \param{int }{orientation = wxVERTICAL},\rtfsp
-\param{int }{nRowsOrColumns = 1}, \param{const wxString\& }{name = ``toolBar"}}
-
-Constructs a toolbar.
-
-\wxheading{Parameters}
-
-\docparam{parent}{Parent window. Must not be NULL.}
-
-\docparam{id}{Window identifier. A value of -1 indicates a default value.}
-
-\docparam{pos}{Window position. If the position (-1, -1) is specified then a default position is chosen.}
-
-\docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.}
-
-\docparam{orientation}{Specifies a wxVERTICAL or wxHORIZONTAL orientation for laying out
-the toolbar.}
-
-\docparam{nRowsOrColumns}{Specifies the number of rows or
-columns, whose meaning depends on {\it orientation}.  If laid out
-vertically, {\it nRowsOrColumns} specifies the number of rows to draw
-before the next column is started; if horizontal, it refers to the
-number of columns to draw before the next row is started.}
-
-\docparam{style}{Window style. See \helpref{wxToolBarSimple}{wxtoolbarsimple}.}
-
-\docparam{name}{Window name.}
-
+\helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}
 
 
diff --git a/docs/latex/wx/ttoolbar.tex b/docs/latex/wx/ttoolbar.tex
index 10d3a6057d..d0d2fd0397 100644
--- a/docs/latex/wx/ttoolbar.tex
+++ b/docs/latex/wx/ttoolbar.tex
@@ -1,7 +1,6 @@
 \section{Toolbar overview}\label{wxtoolbaroverview}
 
-Classes: \helpref{wxToolBarBase}{wxtoolbarbase}, \helpref{wxToolBarSimple}{wxtoolbarsimple},\rtfsp
-\helpref{wxToolBarMSW}{wxtoolbarmsw}, \helpref{wxToolBar95}{wxtoolbar95}
+Classes: \helpref{wxToolBar}{wxtoolbar}
 
 The toolbar family of classes allows an application to use toolbars
 in a variety of configurations and styles.
@@ -16,21 +15,10 @@ out the classes. This is because there are a number of different toolbar
 styles that you may wish to use simultaneously, and also, future
 toolbar implementations will emerge (for example, using the
 new-style Windows `coolbar' as seen in Microsoft applications) which
-cannot be shoe-horned into the one class.
+cannot all be shoe-horned into the one class.
 
-This does mean that if you wish to use a more sophisticated toolbar
-on one platform (say, wxToolBar95) and a simple toolbar on another
-platform (wxToolBarSimple), then you will need some simple ifdefing, such as:
-
-\begin{verbatim}
-  #ifdef wx_msw
-  #  define wxToolBar wxToolBar95
-  #else
-  #  define wxToolBar wxToolBarSimple
-  #endif
-\end{verbatim}
-
-Fortunately, the APIs of the toolbar classes are virtually identical.
+For each platform, the symbol {\bf wxToolBar} is defined to be one of the
+specific toolbar classes.
 
 The following is a summary of the toolbar classes and their differences.
 
@@ -43,15 +31,15 @@ with the Windows look and feel. This toolbar can scroll, and you can have arbitr
 numbers of rows and columns.
 \item {\bf wxToolBarMSW.} This class implements an old-style Windows toolbar, only on
 Windows. There are small, three-dimensional buttons, which do not (currently) reflect
-the current Windows colour settings: the buttons are grey.
+the current Windows colour settings: the buttons are grey. This is the default wxToolBar
+on 16-bit windows.
 \item {\bf wxToolBar95.} Uses the native Windows 95 toolbar class. It dynamically adjusts its
 background and button colours according to user colour settings.
 CreateTools must be called after the tools have been added.
 No absolute positioning is supported but you can specify the number
-of rows, and add tool separators with {\bf AddSeparator}. {\bf Layout} does nothing.
-Tooltips are supported. {\bf OnRightClick} is not supported.
-For some reason, a wxToolBar95 control cannot be moved to any
-position other than the top-left of the frame.
+of rows, and add tool separators with {\bf AddSeparator}.
+Tooltips are supported. {\bf OnRightClick} is not supported. This is the default wxToolBar
+on Windows 95, Windows NT 4 and above.
 \end{itemize}
 
 A toolbar might appear as a single row of images under
@@ -73,56 +61,224 @@ as the demo shows, before adding tools to the button bar. Don't supply more than
 one bitmap for each tool, because the toolbar generates all three images (normal,
 depressed and checked) from the single bitmap you give it.
 
-Mouse click events for a given button are sent to a member called
-\rtfsp{\bf OnLeftClick}, and so an application must derive from wxToolBar in order
-to use it. The application can also handle {\bf OnMouseEnter} events for
-the tools, to give the user extra feedback about the tools as the mouse
-moves over them.
+To intercept
 
 \subsection{Using the toolbar library}
 
-Include one of the files {\tt tbarsmpl.h, tbar95.h, tbarmsw.h}.
+Include {\tt "wx/toolbar.h"}, or if using a class directly, one of:
 
-Example of toolbar use are given in the sample programs tbarsmpl,
-tbarmsw and tbar95.
+\begin{itemize}\itemsep=0pt
+\item {\tt "wx/msw/tbarmsw.h} for wxToolBarMSW
+\item {\tt "wx/msw/tbar95.h} for wxToolBar95
+\item {\tt "wx/tbarsmpl.h} for wxToolBarSimple
+\end{itemize}
+
+Example of toolbar use are given in the sample program ``toolbar''. The
+source is given below.
 
-Each sample creates a main window, and two toolbars: a floating toolbar
-with 24 tools, and a toolbar along the top of the main drawing window, divided into groups.
+{\small
+\begin{verbatim}
+/////////////////////////////////////////////////////////////////////////////
+// Name:        test.cpp
+// Purpose:     wxToolBar sample
+// Author:      Julian Smart
+// Modified by:
+// Created:     04/01/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:   	wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
 
-The test program defines a general-purpose derived frame called
-\rtfsp{\bf wxFrameWithToolBar} which can manage a frame with one main subwindow
-and one horizontal toolbar.
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
 
-Note that one of the bitmaps on the floating toolbar is a small version of the
-main graphic: this demonstrates how a memory device context can be used to
-draw into a bitmap. An application which allowed the user to build up a symbol
-library dynamically might create this kind of bitmap.
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
 
-Left clicks and movements over the toolbars are intercepted and information
-is displayed on the status line.
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
 
-The following fragment illustrates the essence of creating a toolbar.
+#include "wx/toolbar.h"
+#include "test.h"
 
-\begin{verbatim}
+IMPLEMENT_APP(MyApp)
+
+#ifdef __X__
+// TODO: include XBM or XPM icons for X apps
+#endif
+
+// The `main program' equivalent, creating the windows and returning the
+// main frame
+bool MyApp::OnInit(void)
+{
+  // Create the main frame window
+  MyFrame* frame = new MyFrame(NULL, -1, "wxToolBar Sample",
+     wxPoint(100, 100), wxSize(450, 300));
+
+  // Give it a status line
+  frame->CreateStatusBar();
+
+  // Give it an icon
+#ifdef __WXMSW__
+  frame->SetIcon(wxIcon("mondrian"));
+#endif
+#ifdef __X__
+  frame->SetIcon(wxIcon("mondrian.xbm"));
+#endif
+
+  // Make a menubar
+  wxMenu *fileMenu = new wxMenu;
+  fileMenu->Append(wxID_EXIT, "E&xit");
+
+  wxMenu *helpMenu = new wxMenu;
+  helpMenu->Append(wxID_HELP, "&About");
+
+  wxMenuBar* menuBar = new wxMenuBar;
+
+  menuBar->Append(fileMenu, "&File");
+  menuBar->Append(helpMenu, "&Help");
+
+  // Associate the menu bar with the frame
+  frame->SetMenuBar(menuBar);
+
+  // Create the toolbar
+  frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR);
+
+  InitToolbar(frame->GetToolBar());
+
+  // Force a resize. This should probably be replaced by a call to a wxFrame
+  // function that lays out default decorations and the remaining content window.
+  frame->OnSize(wxSizeEvent(wxSize(-1, -1), frame->GetId()));
+  frame->Show(TRUE);
+
+  frame->SetStatusText("Hello, wxWindows");
+  
+  SetTopWindow(frame);
+
+  return TRUE;
+}
+
+bool MyApp::InitToolbar(wxToolBar* toolBar)
+{
+  toolBar->SetMargins(5, 5);
+
+  // Set up toolbar
+  wxBitmap* toolBarBitmaps[8];
+
+#ifdef __WXMSW__
   toolBarBitmaps[0] = new wxBitmap("icon1");
   toolBarBitmaps[1] = new wxBitmap("icon2");
   toolBarBitmaps[2] = new wxBitmap("icon3");
-  ...
+  toolBarBitmaps[3] = new wxBitmap("icon4");
+  toolBarBitmaps[4] = new wxBitmap("icon5");
+  toolBarBitmaps[5] = new wxBitmap("icon6");
+  toolBarBitmaps[6] = new wxBitmap("icon7");
+  toolBarBitmaps[7] = new wxBitmap("icon8");
+#endif
+#ifdef __X__
+  // TODO
+  toolBarBitmaps[0] = new wxBitmap(...);
+  toolBarBitmaps[1] = new wxBitmap(...);
+  toolBarBitmaps[2] = new wxBitmap(...);
+  toolBarBitmaps[3] = new wxBitmap(...);
+  toolBarBitmaps[4] = new wxBitmap(...);
+  toolBarBitmaps[5] = new wxBitmap(...);
+  toolBarBitmaps[6] = new wxBitmap(...);
+  toolBarBitmaps[7] = new wxBitmap(...);
+#endif
+
+#ifdef __WXMSW__
+  int width = 24;
+#else
+  int width = 16;
+#endif
+  int offX = 5;
+  int currentX = 5;
+
+  toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "New file");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Open file");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Save file");
+  currentX += width + 5;
+  toolBar->AddSeparator();
+  toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Copy");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Cut");
+  currentX += width + 5;
+  toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Paste");
+  currentX += width + 5;
+  toolBar->AddSeparator();
+  toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "Print");
+  currentX += width + 5;
+  toolBar->AddSeparator();
+  toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, NULL, "Help");
+
+  toolBar->Realize();
+
+  // Can delete the bitmaps since they're reference counted
+  int i;
+  for (i = 0; i < 8; i++)
+    delete toolBarBitmaps[i];
+
+  return TRUE;
+}
+
+// wxID_HELP will be processed for the 'About' menu and the toolbar help button.
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+    EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
+    EVT_MENU(wxID_HELP, MyFrame::OnAbout)
+    EVT_CLOSE(MyFrame::OnCloseWindow)
+    EVT_TOOL_RANGE(wxID_OPEN, wxID_PASTE, MyFrame::OnToolLeftClick)
+    EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
+END_EVENT_TABLE()
+
+// Define my frame constructor
+MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
+        const wxSize& size, long style):
+  wxFrame(parent, id, title, pos, size, style)
+{
+  m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE);
+}
+
+void MyFrame::OnQuit(wxCommandEvent& event)
+{
+    Close(TRUE);
+}
 
-  toolBarFrame = new wxFrame(NULL, "Tools", -1, wxPoint(0, 0), wxSize(300, 200),
-    wxDEFAULT_FRAME_STYLE | wxSTAY_ON_TOP);
+void MyFrame::OnAbout(wxCommandEvent& event)
+{
+    (void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar");
+}
 
-  // 5 rows
-  toolBar = new TestToolBar(toolBarFrame, -1, wxPoint(10, 10), wxSize(-1, -1), 0, wxVERTICAL, 5);
-  toolBar->SetMargins(2, 2);
+// Define the behaviour for the frame closing
+// - must delete all frames except for the main one.
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+  Destroy();
+}
 
-  for (int i = 10; i < 25; i++)
-    toolBar->AddTool(i, toolBarBitmaps[i], NULL, TRUE);
+void MyFrame::OnToolLeftClick(wxCommandEvent& event)
+{
+  wxString str;
+  str.Printf("Clicked on tool %d", event.GetId());
+  SetStatusText(str);
+}
 
-  toolBar->Layout();
-  float maxWidth, maxHeight;
-  wxSize size(toolBar->GetMaxSize());
-  toolBarFrame->SetClientSize(maxSize.x, maxSize.y);
-  toolBarFrame->Show(TRUE);
+void MyFrame::OnToolEnter(wxCommandEvent& event)
+{
+  if (event.GetSelection() > -1)
+  {
+    wxString str;
+    str.Printf("This is tool number %d", event.GetSelection());
+    SetStatusText(str);
+  }
+  else
+    SetStatusText("");
+}
 \end{verbatim}
+}
 
diff --git a/docs/latex/wx/wx.hpj b/docs/latex/wx/wx.hpj
index 28b76b44ed..eabbd5b007 100644
--- a/docs/latex/wx/wx.hpj
+++ b/docs/latex/wx/wx.hpj
@@ -1,15 +1,9 @@
-; This file is maintained by HCW. Do not modify this file directly.
 
 [OPTIONS]
-HCW=0
-COMPRESS=60 Hall Zeck
-LCID=0x809 0x0 0x0 ;English (United Kingdom)
-REPORT=Yes
+COMPRESS=HIGH
 CONTENTS=Contents
 TITLE=wxWindows Manual
 BMROOT=..\..\..\..\wxwind~1\docs\latex\wx
-BMROOT=Assume that bitmaps are where the source is
-HLP=.\wx.hlp
 
 [FILES]
 wx.rtf
diff --git a/include/wx/config.h b/include/wx/config.h
index df24b8e873..00aaf1f233 100644
--- a/include/wx/config.h
+++ b/include/wx/config.h
@@ -161,7 +161,14 @@ public:
   void SetExpandEnvVars(bool bDoIt = TRUE) { m_bExpandEnvVars = bDoIt; }
     // does expansion only if needed
   wxString ExpandEnvVars(const wxString& str) const
-    { return IsExpandingEnvVars() ? wxExpandEnvVars(str) : str; }
+    {
+        wxString tmp; // Required for BC++
+        if (IsExpandingEnvVars())
+            tmp = wxExpandEnvVars(str);
+        else
+            tmp = str;
+        return tmp;
+    }
 
 protected:
   static bool IsImmutable(const char *szKey) 
diff --git a/include/wx/defs.h b/include/wx/defs.h
index fa02c39ec5..4dc564eae3 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -367,8 +367,10 @@ typedef void (*wxFunction) (wxObject&, wxEvent&);
  */
  
 #define wxTB_3DBUTTONS      0x8000
+#define wxTB_HORIZONTAL     0x0002
+#define wxTB_VERTICAL       0x0004
 // Flatbar/Coolbar under Win98
-#define wxTB_FLAT           0x0002
+#define wxTB_FLAT           0x0008
 
 /*
  * Apply to all panel items
@@ -665,16 +667,18 @@ typedef enum {
 // Possible SetSize flags
 
 // Use internally-calculated width if -1
-#define wxSIZE_AUTO_WIDTH       1
+#define wxSIZE_AUTO_WIDTH       0x0001
 // Use internally-calculated height if -1
-#define wxSIZE_AUTO_HEIGHT      2
+#define wxSIZE_AUTO_HEIGHT      0x0002
 // Use internally-calculated width and height if each is -1
-#define wxSIZE_AUTO             3
+#define wxSIZE_AUTO             (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT)
 // Ignore missing (-1) dimensions (use existing).
 // For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code.
-#define wxSIZE_USE_EXISTING     0
+#define wxSIZE_USE_EXISTING     0x0000
 // Allow -1 as a valid position
-#define wxSIZE_ALLOW_MINUS_ONE  4
+#define wxSIZE_ALLOW_MINUS_ONE  0x0004
+// Don't do parent client adjustments (for implementation only)
+#define wxSIZE_NO_ADJUSTMENTS   0x0008
 
 // Clipboard formats
 // Numbers as per winuser.h
@@ -858,7 +862,6 @@ typedef unsigned short  WXWORD;
 typedef unsigned int    WXWPARAM;
 typedef long            WXLPARAM;
 typedef unsigned long   WXCOLORREF;
-typedef void *          WXRGN;
 typedef void *          WXRGNDATA;
 typedef void *          WXMSG;
 typedef unsigned long   WXHCONV;
diff --git a/include/wx/event.h b/include/wx/event.h
index 134114c78c..9b3e84b87b 100644
--- a/include/wx/event.h
+++ b/include/wx/event.h
@@ -1047,6 +1047,7 @@ typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
 typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
 typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxShowEvent&);
 typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&);
+typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
 
 // N.B. In GNU-WIN32, you *have* to take the address of a member function
 // (use &) or the compiler crashes...
@@ -1097,7 +1098,7 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
 #define EVT_SHOW(func) { wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, NULL },
 #define EVT_MAXIMIZE(func) { wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, NULL },
 #define EVT_ICONIZE(func) { wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, NULL },
-#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & func, NULL },
+#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, NULL },
 
 // Mouse events
 #define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
@@ -1190,7 +1191,6 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
 #define EVT_TOOL_RCLICKED(id, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
 #define EVT_TOOL_RCLICKED_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
 #define EVT_TOOL_ENTER(id, fn) { wxEVT_COMMAND_TOOL_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
-#define EVT_TOOL_ENTER_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_ENTER, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
 #define EVT_CHECKLISTBOX(id, fn) { wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
 
 // Generic command events
diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h
index f2163fac02..30184810c2 100644
--- a/include/wx/msw/frame.h
+++ b/include/wx/msw/frame.h
@@ -17,8 +17,10 @@
 #endif
 
 #include "wx/window.h"
+#include "wx/toolbar.h"
 
 WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
+WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
 
 class WXDLLEXPORT wxMenuBar;
 class WXDLLEXPORT wxStatusBar;
@@ -58,10 +60,6 @@ public:
   void GetPosition(int *x, int *y) const ;
   void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
 
-  // Toolbar: if made known to the frame, the frame will manage it automatically.
-  virtual inline void SetToolBar(wxWindow *toolbar) { m_frameToolBar = toolbar; }
-  virtual inline wxWindow *GetToolBar(void) const { return m_frameToolBar; }
-
   virtual bool OnClose(void);
 
   void OnSize(wxSizeEvent& event);
@@ -90,8 +88,20 @@ public:
   virtual void SetIcon(const wxIcon& icon);
 
   // Create status line
-  virtual bool CreateStatusBar(int number=1);
+  virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
+    const wxString& name = "statusBar");
   inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
+  virtual void PositionStatusBar(void);
+  virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
+    const wxString& name);
+
+  // Create toolbar
+  virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
+  virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
+  // If made known to the frame, the frame will manage it automatically.
+  virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
+  virtual inline wxToolBar *GetToolBar(void) const { return m_frameToolBar; }
+  virtual void PositionToolBar(void);
 
   // Set status line text
   virtual void SetStatusText(const wxString& text, int number = 0);
@@ -118,8 +128,8 @@ public:
   virtual void Maximize(bool maximize);
   virtual bool LoadAccelerators(const wxString& table);
 
-  virtual void PositionStatusBar(void);
-  virtual wxStatusBar *OnCreateStatusBar(int number);
+  // Responds to colour changes
+  void OnSysColourChanged(wxSysColourChangedEvent& event);
 
   // Query app for menu item updates (called from OnIdle)
   void DoMenuUpdates(void);
@@ -127,8 +137,8 @@ public:
 
   WXHMENU GetWinMenu(void) const ;
 
-  // Responds to colour changes
-  void OnSysColourChanged(wxSysColourChangedEvent& event);
+  // Checks if there is a toolbar, and returns the first free client position
+  virtual wxPoint GetClientAreaOrigin() const;
 
   // Handlers
   bool MSWOnPaint(void);
@@ -148,7 +158,7 @@ protected:
   bool                  m_iconized;
   WXHICON               m_defaultIcon;
   static bool           m_useNativeStatusBar;
-  wxWindow *            m_frameToolBar ;
+  wxToolBar *           m_frameToolBar ;
 
   DECLARE_EVENT_TABLE()
 };
diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h
index 1a7f7cfd65..adaeb99ffc 100644
--- a/include/wx/msw/private.h
+++ b/include/wx/msw/private.h
@@ -43,8 +43,12 @@ wxFont WXDLLEXPORT wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNe
 #  ifdef __BORLANDC__
 #    define CASTWNDPROC
 #  else
-     typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long);
-#    define CASTWNDPROC (WndProcCast)
+#    ifdef __WIN32__
+       typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long);
+#      define CASTWNDPROC (WndProcCast)
+#    else
+#      define CASTWNDPROC
+#    endif
 #  endif
 #endif
 
diff --git a/include/wx/msw/region.h b/include/wx/msw/region.h
index c660a62f72..f0c9cfbcb2 100644
--- a/include/wx/msw/region.h
+++ b/include/wx/msw/region.h
@@ -42,6 +42,7 @@ public:
     wxRegion(long x, long y, long w, long h);
     wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
     wxRegion(const wxRect& rect);
+    wxRegion(WXHRGN hRegion); // Hangs on to this region
 
 	wxRegion(void);
 	~wxRegion(void);
diff --git a/include/wx/msw/tbar95.h b/include/wx/msw/tbar95.h
index 9e6c77877e..cf7473f1dd 100644
--- a/include/wx/msw/tbar95.h
+++ b/include/wx/msw/tbar95.h
@@ -21,12 +21,6 @@
 
 WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
 
-#define DEFAULTBITMAPX   16
-#define DEFAULTBITMAPY   15
-#define DEFAULTBUTTONX   24
-#define DEFAULTBUTTONY   24
-#define DEFAULTBARHEIGHT 27
-
 class WXDLLEXPORT wxToolBar95: public wxToolBarBase
 {
   DECLARE_DYNAMIC_CLASS(wxToolBar95)
@@ -37,25 +31,17 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
 
   wxToolBar95(void);
 
-#if WXWIN_COMPATIBILITY > 0
-  inline wxToolBar95(wxWindow *parent, int x, int y, int w, int h,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 2,
-            const char *name = wxToolBarNameStr)
-  {
-    Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
-  }
-#endif
   inline wxToolBar95(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL,
-            int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr)
+            long style = wxNO_BORDER|wxTB_HORIZONTAL,
+            const wxString& name = wxToolBarNameStr)
   {
-    Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
+    Create(parent, id, pos, size, style, name);
   }
   ~wxToolBar95(void);
 
   bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL,
-            int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
+            long style = wxNO_BORDER|wxTB_HORIZONTAL,
+            const wxString& name = wxToolBarNameStr);
 
   // Call default behaviour
   void OnPaint(wxPaintEvent& event) { Default() ; }
@@ -72,15 +58,14 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
                bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL,
                const wxString& helpString1 = "", const wxString& helpString2 = "");
 
-  // New members
   // Set default bitmap size
-  void SetDefaultSize(const wxSize& size);
+  void SetToolBitmapSize(const wxSize& size);
   void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
   void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
   void ClearTools(void);
 
   // The button size is bigger than the bitmap size
-  wxSize GetDefaultButtonSize(void) const;
+  wxSize GetToolSize(void) const;
 
   wxSize GetMaxSize(void) const;
   void GetSize(int *w, int *y) const;
@@ -90,6 +75,9 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
   virtual void SetRows(int nRows);
   virtual void Layout(void) {}
 
+  // The post-tool-addition call
+  bool Realize() { return CreateTools(); };
+
   // IMPLEMENTATION
   bool MSWCommand(WXUINT param, WXWORD id);
   bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
diff --git a/include/wx/msw/tbarmsw.h b/include/wx/msw/tbarmsw.h
index 5d18fb450c..82201b78d8 100644
--- a/include/wx/msw/tbarmsw.h
+++ b/include/wx/msw/tbarmsw.h
@@ -21,6 +21,8 @@
 
 WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr;
 
+class WXDLLEXPORT wxMemoryDC;
+
 // Non-Win95 (WIN32, WIN16, UNIX) version
 
 class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase
@@ -32,23 +34,13 @@ public:
    */
   wxToolBarMSW(void);
 
-#if WXWIN_COMPATIBILITY > 0
-  inline wxToolBarMSW(wxWindow *parent, int x, int y, int w, int h,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 2,
-            const char *name = wxButtonBarNameStr)
-  {
-    Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
-  }
-#endif
   inline wxToolBarMSW(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL,
-            int RowsOrColumns = 2, const wxString& name = wxButtonBarNameStr)
+            long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr)
   {
-    Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
+    Create(parent, id, pos, size, style, name);
   }
   bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL,
-            int RowsOrColumns = 2, const wxString& name = wxButtonBarNameStr);
+            long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr);
 
   ~wxToolBarMSW(void);
 
@@ -66,13 +58,18 @@ public:
 
   void DrawTool(wxDC& dc, wxMemoryDC& memDc, wxToolBarTool *tool);
 
-  // New members
   // Set default bitmap size
-  virtual void SetDefaultSize(const wxSize& size);
+  virtual void SetToolBitmapSize(const wxSize& size);
   void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
 
   // The button size is bigger than the bitmap size
-  wxSize GetDefaultButtonSize(void) const;
+  wxSize GetToolSize(void) const;
+
+  void Layout(void);
+
+  // The post-tool-addition call
+  bool Realize() { Layout(); return TRUE; };
+
  protected:
   void DrawTool(wxDC& dc, wxToolBarTool *tool, int state);
 
@@ -89,7 +86,9 @@ public:
   WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo);
   WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap);
 
- protected:
+protected:
+  int               m_currentRowsOrColumns;
+  long              m_lastX, m_lastY;
 
   WXHBRUSH          m_hbrDither;
   WXDWORD           m_rgbFace;
@@ -110,12 +109,6 @@ public:
 DECLARE_EVENT_TABLE()
 };
 
-#define DEFAULTBITMAPX   16
-#define DEFAULTBITMAPY   15
-#define DEFAULTBUTTONX   24
-#define DEFAULTBUTTONY   22
-#define DEFAULTBARHEIGHT 27
-
 //
 // States (not all of them currently used)
 //
diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h
index b383926a46..c1cb243339 100644
--- a/include/wx/msw/window.h
+++ b/include/wx/msw/window.h
@@ -25,6 +25,7 @@
 #include "wx/event.h"
 #include "wx/string.h"
 #include "wx/list.h"
+#include "wx/region.h"
 
 #define wxKEY_SHIFT     1
 #define wxKEY_CTRL      2
@@ -202,6 +203,12 @@ public:
   // Accept files for dragging
   virtual void DragAcceptFiles(bool accept);
 
+  // Update region access
+  virtual wxRegion GetUpdateRegion() const;
+  virtual bool IsExposed(int x, int y, int w, int h) const;
+  virtual bool IsExposed(const wxPoint& pt) const;
+  virtual bool IsExposed(const wxRect& rect) const;
+
   // Set/get the window title
   virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
   inline virtual wxString GetTitle(void) const { return wxString(""); };
@@ -398,6 +405,14 @@ public:
   ////////////////////////////////////////////////////////////////////////
   //// IMPLEMENTATION
   
+  // For implementation purposes - sometimes decorations make the client area
+  // smaller
+  virtual wxPoint GetClientAreaOrigin() const;
+
+  // Makes an adjustment to the window position (for example, a frame that has
+  // a toolbar that it manages itself).
+  virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
+
   // Windows subclassing
   void SubclassWin(WXHWND hWnd);
   void UnsubclassWin(void);
@@ -639,10 +654,15 @@ public:
   WXUINT                m_lastMsg;
   WXWPARAM              m_lastWParam;
   WXLPARAM              m_lastLParam;
+
+  wxRegion              m_updateRegion;
+/*
   wxRectangle           m_updateRect;             // Bounding box for screen damage area
 #ifdef __WIN32__
   WXHRGN                m_updateRgn;                  // NT allows access to the rectangle list
 #endif
+*/
+
   WXHANDLE              m_acceleratorTable;
   WXHMENU               m_hMenu; // Menu, if any
   wxList *              m_children;                           // Window's children
@@ -706,6 +726,8 @@ inline bool wxWindow::IsBeingDeleted(void) { return m_isBeingDeleted; }
 // Window specific (so far)
 wxWindow* WXDLLEXPORT wxGetActiveWindow(void);
 
+// OBSOLETE
+#if 0
 // Allows iteration through damaged rectangles in OnPaint
 class WXDLLEXPORT wxUpdateIterator
 {
@@ -728,6 +750,7 @@ class WXDLLEXPORT wxUpdateIterator
   int GetW();
   int GetH();
 };
+#endif
 
 WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
 
diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h
index c1b0ce3ad0..78d0ab10fd 100644
--- a/include/wx/tbarbase.h
+++ b/include/wx/tbarbase.h
@@ -47,10 +47,10 @@ public:
   int                   m_toolStyle;
   wxObject *            m_clientData;
   int                   m_index;
-  long                 m_x;
-  long                 m_y;
-  long                 m_width;
-  long                 m_height;
+  long                  m_x;
+  long                  m_y;
+  long                  m_width;
+  long                  m_height;
   bool                  m_toggleState;
   bool                  m_isToggle;
   bool                  m_deleteSecondBitmap;
@@ -64,7 +64,7 @@ public:
 
 class WXDLLEXPORT wxToolBarBase : public wxControl
 {
-  DECLARE_DYNAMIC_CLASS(wxToolBarBase)
+  DECLARE_ABSTRACT_CLASS(wxToolBarBase)
  public:
 
   wxToolBarBase(void);
@@ -114,7 +114,7 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
   virtual wxString GetToolLongHelp(int toolIndex) const;
 
   virtual void SetMargins(int x, int y);
-  inline void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }
+  inline void SetMargins(const wxSize& size) { SetMargins((int) size.x, (int) size.y); }
   virtual void SetToolPacking(int packing);
   virtual void SetToolSeparation(int separation);
 
@@ -122,29 +122,35 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
   inline virtual int GetToolPacking(void) { return m_toolPacking; }
   inline virtual int GetToolSeparation(void) { return m_toolSeparation; }
 
-  virtual void SetDefaultSize(const wxSize& size) { m_defaultWidth = size.x; m_defaultHeight = size.y; };
-  virtual wxSize GetDefaultSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); }
+  virtual void SetToolBitmapSize(const wxSize& size) { m_defaultWidth = size.x; m_defaultHeight = size.y; };
+  virtual wxSize GetToolBitmapSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); }
 
   // The button size (in some implementations) is bigger than the bitmap size: this returns
   // the total button size.
-  virtual wxSize GetDefaultButtonSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); } ;
+  virtual wxSize GetToolSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); } ;
 
   // Compatibility
 #if WXWIN_COMPATIBILITY
   inline void SetDefaultSize(int w, int h) { SetDefaultSize(wxSize(w, h)); }
   inline long GetDefaultWidth(void) const { return m_defaultWidth; }
   inline long GetDefaultHeight(void) const { return m_defaultHeight; }
-  inline int GetDefaultButtonWidth(void) const { return GetDefaultButtonSize().x; };
-  inline int GetDefaultButtonHeight(void) const { return GetDefaultButtonSize().y; };
+  inline int GetDefaultButtonWidth(void) const { return (int) GetDefaultButtonSize().x; };
+  inline int GetDefaultButtonHeight(void) const { return (int) GetDefaultButtonSize().y; };
+  virtual void SetDefaultSize(const wxSize& size) { SetToolBitmapSize(size); }
+  virtual wxSize GetDefaultSize(void) const { return GetToolBitmapSize(); }
+  virtual wxSize GetDefaultButtonSize(void) const { return GetToolSize(); }
 #endif
 
   // Lay the tools out
   virtual void Layout(void);
   
   // Add all the buttons: required for Win95.
-  // TODO: unify API so there's no ambiguity
   virtual bool CreateTools(void) { return TRUE; }
 
+  // Calls the appropriate function after tools have been created.
+  // E.g. Layout, or CreateTools.
+  virtual bool Realize() = 0;
+
   void Command(wxCommandEvent& event);
 
   // SCROLLING: this has to be copied from wxScrolledWindow since wxToolBarBase
@@ -178,10 +184,9 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
   // Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
   virtual void DoToolbarUpdates(void);
 
-/*
-  virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const ;
-  virtual void CalcUnscrolledPosition(int x, int y, long *xx, long *yy) const ;
-*/
+  inline void SetMaxRowsCols(int rows, int cols) { m_maxRows = rows; m_maxCols = cols; }
+  inline int GetMaxRows() const { return m_maxRows; }
+  inline int GetMaxCols() const { return m_maxCols; }
 
   void OnScroll(wxScrollEvent& event);
   void OnSize(wxSizeEvent& event);
@@ -194,10 +199,10 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
 
  protected:
   wxList                m_tools;
-  int                   m_tilingDirection;
-  int                   m_rowsOrColumns;
-  int                   m_currentRowsOrColumns;
-  long                  m_lastX, m_lastY;
+//  int                   m_tilingDirection;
+//  int                   m_rowsOrColumns;
+  int                   m_maxRows;
+  int                   m_maxCols;
   long                  m_maxWidth, m_maxHeight;
   int                   m_currentTool; // Tool where mouse currently is
   int                   m_pressedTool; // Tool where mouse pressed
diff --git a/include/wx/tbarsmpl.h b/include/wx/tbarsmpl.h
index 6b8d8941f8..7b44d3f109 100644
--- a/include/wx/tbarsmpl.h
+++ b/include/wx/tbarsmpl.h
@@ -37,24 +37,16 @@ class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
  public:
 
   wxToolBarSimple(void);
-#if WXWIN_COMPATIBILITY > 0
-  inline wxToolBarSimple(wxWindow *parent, int x, int y, int w, int h,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 1,
-            const char *name = wxToolBarNameStr)
-  {
-    Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
-  }
-#endif
   inline wxToolBarSimple(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL,
-            int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr)
+            long style = wxNO_BORDER|wxTB_HORIZONTAL,
+            const wxString& name = wxToolBarNameStr)
   {
-    Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
+    Create(parent, id, pos, size, style, name);
   }
   ~wxToolBarSimple(void);
 
   bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
-            long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
+            long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxToolBarNameStr);
 
   void OnPaint(wxPaintEvent& event);
   void OnSize(wxSizeEvent& event);
@@ -68,7 +60,17 @@ class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
 
   virtual void SpringUpButton(int index);
 
-  DECLARE_EVENT_TABLE()
+  void Layout(void);
+
+  // The post-tool-addition call
+  bool Realize() { Layout(); return TRUE; };
+
+protected:
+  int                   m_currentRowsOrColumns;
+  long                  m_lastX, m_lastY;
+
+DECLARE_EVENT_TABLE()
+
 };
 
 #endif // USE_TOOLBAR
diff --git a/include/wx/toolbar.h b/include/wx/toolbar.h
index 8aee3e80ca..e8ab833439 100644
--- a/include/wx/toolbar.h
+++ b/include/wx/toolbar.h
@@ -4,11 +4,11 @@
 // the application code should use only wxToolBar which is #define'd to be the
 // native implementation for each platform
 #if defined(__WXMSW__) && defined(__WIN95__)
-#   include "wx/tbar95.h"
+#   include "wx/msw/tbar95.h"
 #   define wxToolBar wxToolBar95
 #   define classwxToolBar classwxToolBar95
 #elif defined(__WXMSW__)
-#   include "wx/tbarmsw.h"
+#   include "wx/msw/tbarmsw.h"
 #   define wxToolBar wxToolBarMSW
 #   define classwxToolBar classwxToolBarMSW
 #elif defined(__WXGTK__)
diff --git a/samples/checklst/nosound.bmp b/samples/checklst/nosound.bmp
index 722e2e4ced920128980723aaab87529acc7f78dc..51da0811ecc25a5987db4cddc7bd84515fd6ad31 100644
GIT binary patch
delta 16
Xcmeyw^oePL9;*NY1B1XuV|zvbDog|L

delta 16
Vcmeyw^oePL9xDR~Y&5oK1OO>)1JD2f

diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp
index 7d9ac5bc79..24d2650b56 100644
--- a/samples/mdi/mdi.cpp
+++ b/samples/mdi/mdi.cpp
@@ -98,8 +98,8 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
         wxTE_MULTILINE|wxSUNKEN_BORDER);
     textWindow->SetValue("A help window");
 
-    toolBar = new TestRibbon(this, 0, 0, 100, 30, wxNO_BORDER, wxVERTICAL, 1);
-    SetToolBar(toolBar);
+    CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL);
+    InitToolBar(GetToolBar());
 }
 
 void MyFrame::OnQuit(wxCommandEvent& event)
@@ -248,15 +248,8 @@ void MyFrame::OnSize(wxSizeEvent& event)
     int tw = 0;
     int th = 0;
     
-    wxWindow* tbar = GetToolBar();
-    if (tbar)
-    {
-        tbar->GetSize(&tw, &th);
-        tbar->SetSize(w, th);
-    }
-
-    textWindow->SetSize(0, th, 200, h-th);
-    GetClientWindow()->SetSize(200, th, w - 200, h-th);
+    textWindow->SetSize(0, 0, 200, h);
+    GetClientWindow()->SetSize(200, 0, w - 200, h);
 }
 
 // Note that MDI_NEW_WINDOW and MDI_ABOUT commands get passed
@@ -264,7 +257,6 @@ void MyFrame::OnSize(wxSizeEvent& event)
 // duplicate event handlers here.
 
 BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
-  EVT_SIZE( MyChild::OnSize)
   EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
 END_EVENT_TABLE()
 
@@ -281,14 +273,6 @@ MyChild::~MyChild(void)
   my_children.DeleteObject(this);
 }
 
-void MyChild::OnSize(wxSizeEvent& WXUNUSED(event))
-{
-  int x = 0;
-  int y = 0;
-  GetClientSize( &x, &y );
-  if (canvas) canvas->SetSize( x, y );
-}
-
 void MyChild::OnQuit(wxCommandEvent& WXUNUSED(event))
 {
       Close(TRUE);
@@ -305,13 +289,7 @@ bool MyChild::OnClose(void)
   return TRUE;
 }
 
-BEGIN_EVENT_TABLE(TestRibbon, wxToolBar)
-    EVT_PAINT(TestRibbon::OnPaint)
-END_EVENT_TABLE()
-
-TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h,
-            long style, int direction, int RowsOrColumns):
-  wxToolBar(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns)
+void MyFrame::InitToolBar(wxToolBar* toolBar)
 {
     wxBitmap* bitmaps[8];
 
@@ -343,61 +321,29 @@ TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h,
   int offX = 5;
   int currentX = 5;
 
-  AddTool(0, *bitmaps[0], wxNullBitmap, FALSE, currentX, -1, NULL, "New file");
+  toolBar->AddTool(0, *bitmaps[0], wxNullBitmap, FALSE, currentX, -1, NULL, "New file");
   currentX += width + 5;
-  AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, NULL, "Open file");
+  toolBar->AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, NULL, "Open file");
   currentX += width + 5;
-  AddTool(2, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, NULL, "Save file");
+  toolBar->AddTool(2, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, NULL, "Save file");
   currentX += width + 5;
-  AddSeparator();
-  AddTool(3, *bitmaps[3], wxNullBitmap, FALSE, currentX, -1, NULL, "Copy");
+  toolBar->AddSeparator();
+  toolBar->AddTool(3, *bitmaps[3], wxNullBitmap, FALSE, currentX, -1, NULL, "Copy");
   currentX += width + 5;
-  AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, NULL, "Cut");
+  toolBar->AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, NULL, "Cut");
   currentX += width + 5;
-  AddTool(5, *bitmaps[5], wxNullBitmap, FALSE, currentX, -1, NULL, "Paste");
+  toolBar->AddTool(5, *bitmaps[5], wxNullBitmap, FALSE, currentX, -1, NULL, "Paste");
   currentX += width + 5;
-  AddSeparator();
-  AddTool(6, *bitmaps[6], wxNullBitmap, FALSE, currentX, -1, NULL, "Print");
+  toolBar->AddSeparator();
+  toolBar->AddTool(6, *bitmaps[6], wxNullBitmap, FALSE, currentX, -1, NULL, "Print");
   currentX += width + 5;
-  AddSeparator();
-  AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help");
+  toolBar->AddSeparator();
+  toolBar->AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, NULL, "Help");
 
-  CreateTools();
+  toolBar->Realize();
 
   int i;
   for (i = 0; i < 8; i++)
     delete bitmaps[i];
 }
 
-bool TestRibbon::OnLeftClick(int toolIndex, bool toggled)
-{
-  char buf[200];
-  sprintf(buf, "Clicked on tool %d", toolIndex);
-  frame->SetStatusText(buf);
-  return TRUE;
-}
-
-void TestRibbon::OnMouseEnter(int toolIndex)
-{
-  char buf[200];
-  if (toolIndex > -1)
-  {
-    sprintf(buf, "This is tool number %d", toolIndex);
-    frame->SetStatusText(buf);
-  }
-  else frame->SetStatusText("");
-}
-
-void TestRibbon::OnPaint(wxPaintEvent& event)
-{
-  wxToolBar::OnPaint(event);
-
-  wxPaintDC dc(this);
-  
-  int w, h;
-  GetSize(&w, &h);
-  dc.SetPen(*wxBLACK_PEN);
-  dc.SetBrush(*wxTRANSPARENT_BRUSH);
-  dc.DrawLine(0, h-1, w, h-1);
-}
-
diff --git a/samples/mdi/mdi.h b/samples/mdi/mdi.h
index e8dbb63c06..7415c60585 100644
--- a/samples/mdi/mdi.h
+++ b/samples/mdi/mdi.h
@@ -28,27 +28,16 @@ class MyCanvas: public wxScrolledWindow
     DECLARE_EVENT_TABLE()
 };
 
-class TestRibbon: public wxToolBar
-{
-  public:
-  TestRibbon(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1,
-            long style = wxNO_BORDER, int direction = wxVERTICAL, int RowsOrColumns = 2);
-  bool OnLeftClick(int toolIndex, bool toggled);
-  void OnMouseEnter(int toolIndex);
-  void OnPaint(wxPaintEvent& event);
-  
-  DECLARE_EVENT_TABLE()
-};
-
 // Define a new frame
 class MyFrame: public wxMDIParentFrame
 {
   public:
     wxTextCtrl *textWindow;
     
-    TestRibbon* toolBar;
-
     MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
+
+    void InitToolBar(wxToolBar* toolBar);
+
     bool OnClose(void);
     void OnSize(wxSizeEvent& event);
     void OnAbout(wxCommandEvent& event);
@@ -65,7 +54,6 @@ class MyChild: public wxMDIChildFrame
     MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
     ~MyChild(void);
     bool OnClose(void);
-    void OnSize(wxSizeEvent& event);
     void OnActivate(wxActivateEvent& event);
     void OnQuit(wxCommandEvent& event);
 
diff --git a/samples/toolbar/test.cpp b/samples/toolbar/test.cpp
index 5d3bb86212..c4b1ea21e2 100644
--- a/samples/toolbar/test.cpp
+++ b/samples/toolbar/test.cpp
@@ -34,7 +34,8 @@ IMPLEMENT_APP(MyApp)
 bool MyApp::OnInit(void)
 {
   // Create the main frame window
-  MyFrame* frame = new MyFrame(NULL, -1, "wxToolBar Sample", wxPoint(100, 100), wxSize(450, 300));
+  MyFrame* frame = new MyFrame(NULL, -1, "wxToolBar Sample",
+     wxPoint(100, 100), wxSize(450, 300));
 
   // Give it a status line
   frame->CreateStatusBar();
@@ -63,14 +64,9 @@ bool MyApp::OnInit(void)
   frame->SetMenuBar(menuBar);
 
   // Create the toolbar
-  wxToolBar* toolBar = new wxToolBar(frame, -1, wxPoint(0, 0), wxSize(100, 30),
-    wxNO_BORDER|wxTB_FLAT, wxVERTICAL, 1);
-  toolBar->SetMargins(5, 5);
-
-  InitToolbar(toolBar);
+  frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR);
 
-  // Tell the frame about it
-  frame->SetToolBar(toolBar);
+  InitToolbar(frame->GetToolBar());
 
   // Force a resize. This should probably be replaced by a call to a wxFrame
   // function that lays out default decorations and the remaining content window.
@@ -86,6 +82,8 @@ bool MyApp::OnInit(void)
 
 bool MyApp::InitToolbar(wxToolBar* toolBar)
 {
+  toolBar->SetMargins(5, 5);
+
   // Set up toolbar
   wxBitmap* toolBarBitmaps[8];
 
@@ -138,7 +136,7 @@ bool MyApp::InitToolbar(wxToolBar* toolBar)
   toolBar->AddSeparator();
   toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, NULL, "Help");
 
-  toolBar->CreateTools();
+  toolBar->Realize();
 
   // Can delete the bitmaps since they're reference counted
   int i;
@@ -155,7 +153,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_MENU(wxID_HELP, MyFrame::OnAbout)
     EVT_CLOSE(MyFrame::OnCloseWindow)
     EVT_TOOL_RANGE(wxID_OPEN, wxID_PASTE, MyFrame::OnToolLeftClick)
-    EVT_TOOL_ENTER_RANGE(wxID_OPEN, wxID_PASTE, MyFrame::OnToolEnter)
+    EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
 END_EVENT_TABLE()
 
 // Define my frame constructor
@@ -192,10 +190,10 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event)
 
 void MyFrame::OnToolEnter(wxCommandEvent& event)
 {
-  if (event.GetId() > -1)
+  if (event.GetSelection() > -1)
   {
     wxString str;
-    str.Printf("This is tool number %d", event.GetId());
+    str.Printf("This is tool number %d", event.GetSelection());
     SetStatusText(str);
   }
   else
diff --git a/samples/toolbar/test.h b/samples/toolbar/test.h
index ac9dea8d1b..4f2a12bb79 100644
--- a/samples/toolbar/test.h
+++ b/samples/toolbar/test.h
@@ -37,3 +37,5 @@ private:
 DECLARE_EVENT_TABLE()
 };
 
+#define ID_TOOLBAR  500
+
diff --git a/src/common/file.cpp b/src/common/file.cpp
index 75fa377b7c..1e3734b5d6 100644
--- a/src/common/file.cpp
+++ b/src/common/file.cpp
@@ -102,6 +102,9 @@
 #include  <wx/file.h>
 #include  <wx/log.h>
 
+#ifndef MAX_PATH
+#define MAX_PATH 512
+#endif
 
 // ============================================================================
 // implementation of wxFile
@@ -401,7 +404,12 @@ bool wxTempFile::Open(const wxString& strName)
     wxSplitPath(strName, &strPath, NULL, NULL);
     if ( strPath.IsEmpty() )
       strPath = '.';  // GetTempFileName will fail if we give it empty string
+#ifdef __WIN32__
     if ( !GetTempFileName(strPath, "wx_",0, m_strTemp.GetWriteBuf(MAX_PATH)) )
+#else
+    // Not sure why MSVC++ 1.5 header defines first param as BYTE - bug?
+    if ( !GetTempFileName((BYTE) (const char*) strPath, "wx_",0, m_strTemp.GetWriteBuf(MAX_PATH)) )
+#endif
       wxLogLastError("GetTempFileName");
     m_strTemp.UngetWriteBuf();
   #endif  // Windows/Unix
diff --git a/src/common/log.cpp b/src/common/log.cpp
index cbcaf76630..7c2552317c 100644
--- a/src/common/log.cpp
+++ b/src/common/log.cpp
@@ -40,6 +40,7 @@
 
 #include  <wx/file.h>
 #include  <wx/textfile.h>
+#include  <wx/utils.h>
 #include  <wx/log.h>
 
 // other standard headers
@@ -786,7 +787,7 @@ const char *wxSysErrorMsg(unsigned long nErrCode)
       LocalFree(lpMsgBuf);
 
       // returned string is capitalized and ended with '\r\n' - bad
-      s_szBuf[0] = (char)tolower(s_szBuf[0]);
+      s_szBuf[0] = (char)wxToLower(s_szBuf[0]);
       size_t len = strlen(s_szBuf);
       if ( len > 0 ) {
         // truncate string
diff --git a/src/common/process.cpp b/src/common/process.cpp
index f0e30ba9ad..d1c255ac95 100644
--- a/src/common/process.cpp
+++ b/src/common/process.cpp
@@ -39,9 +39,19 @@ wxProcess::wxProcess(wxEvtHandler *parent, int id)
   m_id = id;
 }
 
+wxProcess::~wxProcess()
+{
+}
+
 void wxProcess::OnTerminate(int pid)
 {
   wxProcessEvent event(m_id, pid);
 
   ProcessEvent(event);
 }
+
+wxProcessEvent::wxProcessEvent(int id, int pid):
+  wxEvent(id), m_pid(pid)
+{
+}
+
diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp
index cf70cbf42d..f63cc1c4da 100644
--- a/src/common/tbarbase.cpp
+++ b/src/common/tbarbase.cpp
@@ -34,7 +34,7 @@
 #include "wx/tbarbase.h"
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl)
+IMPLEMENT_ABSTRACT_CLASS(wxToolBarBase, wxControl)
 IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject)
 
 BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
@@ -88,8 +88,8 @@ wxToolBarBase::wxToolBarBase(void) : m_tools(wxKEY_INTEGER)
 {
   gs_ToolBars.Append(this);
 
-  m_tilingDirection = wxVERTICAL;
-  m_rowsOrColumns = 0;
+  m_maxRows = 1;
+  m_maxCols = 32000;
   m_maxWidth = 0;
   m_maxHeight = 0;
   m_defaultWidth = 16;
@@ -148,9 +148,12 @@ void wxToolBarBase::OnRightClick(int toolIndex, long x, long y)
 
 // Called when the mouse cursor enters a tool bitmap (no button pressed).
 // Argument is -1 if mouse is exiting the toolbar.
+// Note that for this event, the id of the window is used,
+// and the integer parameter of wxCommandEvent is used to retrieve
+// the tool id.
 void wxToolBarBase::OnMouseEnter ( int toolIndex )
 {
-    wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
+    wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, GetId());
     event.SetEventObject(this);
     event.SetInt(toolIndex);
 
@@ -369,94 +372,6 @@ void wxToolBarBase::Command(wxCommandEvent& event)
 
 void wxToolBarBase::Layout(void)
 {
-  m_currentRowsOrColumns = 0;
-  m_lastX = m_xMargin;
-  m_lastY = m_yMargin;
-  int maxToolWidth = 0;
-  int maxToolHeight = 0;
-  m_maxWidth = 0;
-  m_maxHeight = 0;
-
-  // Find the maximum tool width and height
-  wxNode *node = m_tools.First();
-  while (node)
-  {
-    wxToolBarTool *tool = (wxToolBarTool *)node->Data();
-    if (tool->GetWidth() > maxToolWidth)
-      maxToolWidth = (int)tool->GetWidth();
-    if (tool->GetHeight() > maxToolHeight)
-      maxToolHeight = (int)tool->GetHeight();
-    node = node->Next();
-  }
-
-  int separatorSize = m_toolSeparation;
-
-  node = m_tools.First();
-  while (node)
-  {
-    wxToolBarTool *tool = (wxToolBarTool *)node->Data();
-    if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
-    {
-      if (m_tilingDirection == wxHORIZONTAL)
-      {
-        if (m_currentRowsOrColumns >= m_rowsOrColumns)
-          m_lastY += separatorSize;
-        else
-          m_lastX += separatorSize;
-      }
-      else
-      {
-        if (m_currentRowsOrColumns >= m_rowsOrColumns)
-          m_lastX += separatorSize;
-        else
-          m_lastY += separatorSize;
-      }
-    }
-    else if (tool->m_toolStyle == wxTOOL_STYLE_BUTTON)
-    {
-      if (m_tilingDirection == wxHORIZONTAL)
-      {
-        if (m_currentRowsOrColumns >= m_rowsOrColumns)
-        {
-          m_currentRowsOrColumns = 0;
-          m_lastX = m_xMargin;
-          m_lastY += maxToolHeight + m_toolPacking;
-        }
-        tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
-        tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
-  
-        m_lastX += maxToolWidth + m_toolPacking;
-      }
-      else
-      {
-        if (m_currentRowsOrColumns >= m_rowsOrColumns)
-        {
-          m_currentRowsOrColumns = 0;
-          m_lastX += (maxToolWidth + m_toolPacking);
-          m_lastY = m_yMargin;
-        }
-        tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
-        tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
-  
-        m_lastY += maxToolHeight + m_toolPacking;
-      }
-      m_currentRowsOrColumns ++;
-    }
-    
-    if (m_lastX > m_maxWidth)
-      m_maxWidth = m_lastX;
-    if (m_lastY > m_maxHeight)
-      m_maxHeight = m_lastY;
-
-    node = node->Next();
-  }
-  if (m_tilingDirection == wxVERTICAL)
-    m_maxWidth += maxToolWidth;
-  else
-    m_maxHeight += maxToolHeight;
-
-  m_maxWidth += m_xMargin;
-  m_maxHeight += m_yMargin;
 }
 
 
@@ -781,20 +696,6 @@ void wxToolBarBase::ViewStart (int *x, int *y) const
   *y = m_yScrollPosition;
 }
 
-/*
-void wxToolBarBase::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
-{
-  *xx = (m_calcScrolledOffset ? (x - m_xScrollPosition * m_xScrollPixelsPerLine) : x);
-  *yy = (m_calcScrolledOffset ? (y - m_yScrollPosition * m_yScrollPixelsPerLine) : y);
-}
-
-void wxToolBarBase::CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const
-{
-  *xx = (float)(m_calcScrolledOffset ? (x + m_xScrollPosition * m_xScrollPixelsPerLine) : x);
-  *yy = (float)(m_calcScrolledOffset ? (y + m_yScrollPosition * m_yScrollPixelsPerLine) : y);
-}
-*/
-
 void wxToolBarBase::OnIdle(wxIdleEvent& event)
 {
     wxWindow::OnIdle(event);
diff --git a/src/common/tbarsmpl.cpp b/src/common/tbarsmpl.cpp
index 229cb6fe23..a75de10e3b 100644
--- a/src/common/tbarsmpl.cpp
+++ b/src/common/tbarsmpl.cpp
@@ -47,10 +47,13 @@ static wxPen * white_pen = NULL,
 
 wxToolBarSimple::wxToolBarSimple(void)
 {
+    m_currentRowsOrColumns = 0;
+    m_lastX = 0;
+    m_lastY = 0;
 }
 
 bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
-  int direction, int RowsOrColumns, const wxString& name )
+  const wxString& name )
 {
 	if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
 		return FALSE;
@@ -79,12 +82,10 @@ bool wxToolBarSimple::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos
   {
     thick_black_pen = new wxPen("BLACK", 3, wxSOLID);
   }
-  m_tilingDirection = direction;
-  m_rowsOrColumns = RowsOrColumns;
-  if ( m_tilingDirection == wxVERTICAL )
-    { m_lastX = 3; m_lastY = 7; }
-  else
+  if ( GetWindowStyleFlag() & wxTB_VERTICAL )
     { m_lastX = 7; m_lastY = 3; }
+  else
+    { m_lastX = 3; m_lastY = 7; }
   m_maxWidth = m_maxHeight = 0;
   m_pressedTool = m_currentTool = -1;
   m_xMargin = 0;
@@ -356,4 +357,97 @@ void wxToolBarSimple::SpringUpButton(int index)
   }
 }
 
+void wxToolBarSimple::Layout(void)
+{
+  m_currentRowsOrColumns = 0;
+  m_lastX = m_xMargin;
+  m_lastY = m_yMargin;
+  int maxToolWidth = 0;
+  int maxToolHeight = 0;
+  m_maxWidth = 0;
+  m_maxHeight = 0;
+
+  // Find the maximum tool width and height
+  wxNode *node = m_tools.First();
+  while (node)
+  {
+    wxToolBarTool *tool = (wxToolBarTool *)node->Data();
+    if (tool->GetWidth() > maxToolWidth)
+      maxToolWidth = (int)tool->GetWidth();
+    if (tool->GetHeight() > maxToolHeight)
+      maxToolHeight = (int)tool->GetHeight();
+    node = node->Next();
+  }
+
+  int separatorSize = m_toolSeparation;
+
+  node = m_tools.First();
+  while (node)
+  {
+    wxToolBarTool *tool = (wxToolBarTool *)node->Data();
+    if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
+    {
+      if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+      {
+        if (m_currentRowsOrColumns >= m_maxCols)
+          m_lastY += separatorSize;
+        else
+          m_lastX += separatorSize;
+      }
+      else
+      {
+        if (m_currentRowsOrColumns >= m_maxRows)
+          m_lastX += separatorSize;
+        else
+          m_lastY += separatorSize;
+      }
+    }
+    else if (tool->m_toolStyle == wxTOOL_STYLE_BUTTON)
+    {
+      if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+      {
+        if (m_currentRowsOrColumns >= m_maxCols)
+        {
+          m_currentRowsOrColumns = 0;
+          m_lastX = m_xMargin;
+          m_lastY += maxToolHeight + m_toolPacking;
+        }
+        tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
+        tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
+  
+        m_lastX += maxToolWidth + m_toolPacking;
+      }
+      else
+      {
+        if (m_currentRowsOrColumns >= m_maxRows)
+        {
+          m_currentRowsOrColumns = 0;
+          m_lastX += (maxToolWidth + m_toolPacking);
+          m_lastY = m_yMargin;
+        }
+        tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
+        tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
+  
+        m_lastY += maxToolHeight + m_toolPacking;
+      }
+      m_currentRowsOrColumns ++;
+    }
+    
+    if (m_lastX > m_maxWidth)
+      m_maxWidth = m_lastX;
+    if (m_lastY > m_maxHeight)
+      m_maxHeight = m_lastY;
+
+    node = node->Next();
+  }
+  if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+    m_maxWidth += maxToolWidth;
+  else
+    m_maxHeight += maxToolHeight;
+
+  m_maxWidth += m_xMargin;
+  m_maxHeight += m_yMargin;
+}
+
+
 #endif
diff --git a/src/msw/button.cpp b/src/msw/button.cpp
index 13f671d53b..83928e90f5 100644
--- a/src/msw/button.cpp
+++ b/src/msw/button.cpp
@@ -106,6 +106,8 @@ void wxButton::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   int actualWidth = width;
   int actualHeight = height;
   int ww, hh;
diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp
index 76cf03fe34..ebaaec67d5 100644
--- a/src/msw/checkbox.cpp
+++ b/src/msw/checkbox.cpp
@@ -130,6 +130,8 @@ void wxCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   char buf[300];
 
   int current_width, cyf;
@@ -280,6 +282,8 @@ void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlag
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   HWND button = (HWND) GetHWND();
 /*
     if (w1<0)
diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp
index bc0ab64e18..c1d7f28406 100644
--- a/src/msw/choice.cpp
+++ b/src/msw/choice.cpp
@@ -192,6 +192,8 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   // If we're prepared to use the existing size, then...
   if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
   {
diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp
index 3288e3641b..9132057314 100644
--- a/src/msw/dcclient.cpp
+++ b/src/msw/dcclient.cpp
@@ -117,12 +117,6 @@ wxPaintDC::wxPaintDC(wxWindow *the_canvas)
     }
 
   m_canvas = the_canvas;
-  RECT updateRect1 = g_paintStruct.rcPaint;
-  m_canvas->m_updateRect.x = updateRect1.left;
-  m_canvas->m_updateRect.y = updateRect1.top;
-  m_canvas->m_updateRect.width = updateRect1.right - updateRect1.left;
-  m_canvas->m_updateRect.height = updateRect1.bottom - updateRect1.top;
-//  m_canvas->m_paintHDC = m_staticPaintHDC ;
 }
 
 wxPaintDC::~wxPaintDC(void)
@@ -131,8 +125,6 @@ wxPaintDC::~wxPaintDC(void)
 
 	if (m_staticPaintCount == 0)
 	{
-//  		m_canvas->m_paintHDC = 0;
-
 		if ( m_hDC && m_canvas)
 		{
   			::EndPaint((HWND) m_canvas->GetHWND(), &g_paintStruct);
@@ -149,3 +141,4 @@ wxPaintDC::~wxPaintDC(void)
         wxDebugMsg("~wxPaintDC: Did not release HDC\n");
     }
 }
+
diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp
index 090d681cac..a616ad14a1 100644
--- a/src/msw/frame.cpp
+++ b/src/msw/frame.cpp
@@ -33,6 +33,7 @@
 
 #include "wx/msw/private.h"
 #include "wx/statusbr.h"
+#include "wx/toolbar.h"
 #include "wx/menuitem.h"
 
 #ifdef LoadAccelerators
@@ -154,19 +155,23 @@ WXHMENU wxFrame::GetWinMenu(void) const
   return m_hMenu;
 }
 
-// Get size *available for subwindows* i.e. excluding menu bar etc.
-// For XView, this is the same as GetSize
+// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
 void wxFrame::GetClientSize(int *x, int *y) const
 {
   RECT rect;
   GetClientRect((HWND) GetHWND(), &rect);
 
-  if ( m_frameStatusBar )
+  if ( GetStatusBar() )
   {
-  int statusX, statusY;
-  m_frameStatusBar->GetClientSize(&statusX, &statusY);
-  rect.bottom -= statusY;
+    int statusX, statusY;
+    GetStatusBar()->GetClientSize(&statusX, &statusY);
+    rect.bottom -= statusY;
   }
+
+  wxPoint pt(GetClientAreaOrigin());
+  rect.bottom -= pt.y;
+  rect.right -= pt.x;
+
   *x = rect.right;
   *y = rect.bottom;
 }
@@ -189,13 +194,17 @@ void wxFrame::SetClientSize(int width, int height)
   int actual_width = rect2.right - rect2.left - rect.right + width;
   int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
 
-  if ( m_frameStatusBar )
+  if ( GetStatusBar() )
   {
-  int statusX, statusY;
-  m_frameStatusBar->GetClientSize(&statusX, &statusY);
-  actual_height += statusY;
+    int statusX, statusY;
+    GetStatusBar()->GetClientSize(&statusX, &statusY);
+    actual_height += statusY;
   }
 
+  wxPoint pt(GetClientAreaOrigin());
+  actual_width += pt.y;
+  actual_height += pt.x;
+
   POINT point;
   point.x = rect2.left;
   point.y = rect2.top;
@@ -339,19 +348,21 @@ void wxFrame::SetIcon(const wxIcon& icon)
 #endif
 }
 
-wxStatusBar *wxFrame::OnCreateStatusBar(int number)
+wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
+    const wxString& name)
 {
     wxStatusBar *statusBar = NULL;
 
 #if USE_NATIVE_STATUSBAR
     if (UsesNativeStatusBar())
     {
-        statusBar = new wxStatusBar95(this);
+        statusBar = new wxStatusBar95(this, id, style);
     }
     else
 #endif
     {
-        statusBar = new wxStatusBar(this, -1, wxPoint(0, 0), wxSize(100, 20));
+        statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20),
+            style, name);
 
         // Set the height according to the font and the border size
         wxClientDC dc(statusBar);
@@ -369,20 +380,22 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number)
   return statusBar;
 }
 
-bool wxFrame::CreateStatusBar(int number)
+wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
+    const wxString& name)
 {
   // VZ: calling CreateStatusBar twice is an error - why anyone would do it?
   wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, 
                "recreating status bar in wxFrame" );
 
-  m_frameStatusBar = OnCreateStatusBar(number);
+  m_frameStatusBar = OnCreateStatusBar(number, style, id,
+    name);
   if ( m_frameStatusBar )
   {
     PositionStatusBar();
-    return TRUE;
+    return m_frameStatusBar;
   }
   else
-    return FALSE;
+    return NULL;
 }
 
 void wxFrame::SetStatusText(const wxString& text, int number)
@@ -413,6 +426,9 @@ void wxFrame::PositionStatusBar(void)
       GetClientSize(&w, &h);
       int sw, sh;
       m_frameStatusBar->GetSize(&sw, &sh);
+
+      // Since we wish the status bar to be directly under the client area,
+      // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
       m_frameStatusBar->SetSize(0, h, w, sh);
   }
 }
@@ -683,6 +699,8 @@ void wxFrame::MSWOnSize(int x, int y, WXUINT id)
 #endif
 
   PositionStatusBar();
+  PositionToolBar();
+
   wxSizeEvent event(wxSize(x, y), m_windowId);
   event.SetEventObject( this );
   if (!GetEventHandler()->ProcessEvent(event))
@@ -783,16 +801,6 @@ void wxFrame::OnSize(wxSizeEvent& event)
     int x = 0;
     int y = 0;
 
-    // Manage the toolbar if there is one
-    if ( GetToolBar() )
-    {
-        int wt, ht;
-        GetToolBar()->GetSize(&wt, &ht);
-        clientH -= ht;
-        y += ht;
-        GetToolBar()->SetSize(0, 0, clientW, ht);
-    }
-
     child->SetSize(x, y, clientW, clientH);
   }
 }
@@ -907,3 +915,79 @@ void wxFrame::ProcessCommand(int id)
   GetEventHandler()->ProcessEvent(commandEvent);
 }
 
+// Checks if there is a toolbar, and returns the first free client position
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+    wxPoint pt(0, 0);
+    if (GetToolBar())
+    {
+        int w, h;
+        GetToolBar()->GetSize(& w, & h);
+
+        if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
+        {
+            pt.x += w;
+        }
+        else
+        {
+            pt.y += h;
+        }
+    }
+    return pt;
+}
+
+wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
+{
+    wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
+               "recreating toolbar in wxFrame" );
+
+    wxToolBar* toolBar = OnCreateToolBar(style, id, name);
+    if (toolBar)
+    {
+        SetToolBar(toolBar);
+        PositionToolBar();
+        return toolBar;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
+wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
+{
+    return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
+}
+
+void wxFrame::PositionToolBar(void)
+{
+    int cw, ch;
+
+    RECT rect;
+    ::GetClientRect((HWND) GetHWND(), &rect);
+
+    if ( GetStatusBar() )
+    {
+      int statusX, statusY;
+      GetStatusBar()->GetClientSize(&statusX, &statusY);
+      rect.bottom -= statusY;
+    }
+
+    if (GetToolBar())
+    {
+        int tw, th;
+        GetToolBar()->GetSize(& tw, & th);
+
+        if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
+        {
+            // Use the 'real' MSW position
+            GetToolBar()->SetSize(0, 0, tw, rect.bottom, wxSIZE_NO_ADJUSTMENTS);
+        }
+        else
+        {
+            // Use the 'real' MSW position
+            GetToolBar()->SetSize(0, 0, rect.right, th, wxSIZE_NO_ADJUSTMENTS);
+        }
+    }
+}
+
diff --git a/src/msw/gauge95.cpp b/src/msw/gauge95.cpp
index 7fbe861c1d..285d0581c1 100644
--- a/src/msw/gauge95.cpp
+++ b/src/msw/gauge95.cpp
@@ -107,6 +107,8 @@ void wxGauge95::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   // If we're prepared to use the existing size, then...
   if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
   {
diff --git a/src/msw/gaugemsw.cpp b/src/msw/gaugemsw.cpp
index 65a4018239..38f5192969 100644
--- a/src/msw/gaugemsw.cpp
+++ b/src/msw/gaugemsw.cpp
@@ -154,6 +154,8 @@ void wxGaugeMSW::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   // If we're prepared to use the existing size, then...
   if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
   {
diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp
index 074548dcc7..8eac8338fa 100644
--- a/src/msw/listbox.cpp
+++ b/src/msw/listbox.cpp
@@ -484,6 +484,8 @@ void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   // If we're prepared to use the existing size, then...
   if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
   {
diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos
index 756daa6c5a..b5eeeb21e0 100644
--- a/src/msw/makefile.dos
+++ b/src/msw/makefile.dos
@@ -78,7 +78,6 @@ COMMONOBJS = \
   $(COMMDIR)\event.obj \
   $(COMMDIR)\file.obj \
   $(COMMDIR)\filefn.obj \
-  $(COMMDIR)\fileconf.obj \
   $(COMMDIR)\framecmn.obj \
   $(COMMDIR)\gdicmn.obj \
   $(COMMDIR)\intl.obj \
@@ -116,6 +115,8 @@ COMMONOBJS = \
   $(COMMDIR)\extended.obj \
   $(COMMDIR)\wincmn.obj
 
+#  $(COMMDIR)\fileconf.obj # Doens't compile (nested classes)
+
 MSWOBJS = \
   $(MSWDIR)\app.obj \
   $(MSWDIR)\bitmap.obj \
@@ -829,6 +830,26 @@ $(COMMDIR)/time.obj:     $*.$(SRCSUFF)
 $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
 <<
 
+$(COMMDIR)/stream.obj:     $*.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
+$(COMMDIR)/fstream.obj:     $*.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
+$(COMMDIR)/mstream.obj:     $*.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
+$(COMMDIR)/zstream.obj:     $*.$(SRCSUFF)
+        cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
 $(COMMDIR)/datstrm.obj:     $*.$(SRCSUFF)
         cl @<<
 $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
diff --git a/src/msw/makefile.nt b/src/msw/makefile.nt
index fec3ce4ca1..7419e32be2 100644
--- a/src/msw/makefile.nt
+++ b/src/msw/makefile.nt
@@ -114,9 +114,9 @@ COMMONOBJS = \
   $(COMMDIR)\mstream.obj \
   $(COMMDIR)\zstream.obj \
   $(COMMDIR)\stream.obj \
+  $(COMMDIR)\datstrm.obj \
   $(COMMDIR)\wincmn.obj
 
-#  $(COMMDIR)\datstrm.obj
 
 MSWOBJS = \
   $(MSWDIR)\app.obj \
diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp
index f893117e5f..55998c1240 100644
--- a/src/msw/mdi.cpp
+++ b/src/msw/mdi.cpp
@@ -174,14 +174,7 @@ void wxMDIParentFrame::GetClientSize(int *x, int *y) const
 
   int cwidth = rect.right;
   int cheight = rect.bottom;
-/*
-  if (m_frameToolBar)
-  {
-    int tw, th;
-    m_frameToolBar->GetSize(&tw, &th);
-    cheight -= th;
-  }
-*/
+
   if ( GetStatusBar() )
   {
 	int sw, sh;
@@ -189,6 +182,10 @@ void wxMDIParentFrame::GetClientSize(int *x, int *y) const
 	cheight -= sh;
   }
 
+  wxPoint pt(GetClientAreaOrigin());
+  cheight -= pt.y;
+  cwidth -= pt.x;
+
   *x = cwidth;
   *y = cheight;
 }
@@ -276,23 +273,18 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
     int y = 0;
     int width, height;
     GetClientSize(&width, &height);
-    if ( GetToolBar() )
-    {
-        int wt, ht;
-        GetToolBar()->GetSize(&wt, &ht);
-        height -= ht;
-        y += ht;
-        GetToolBar()->SetSize(0, 0, width, ht);
-    }
 
     if ( GetClientWindow() )
         GetClientWindow()->SetSize(x, y, width, height);
 
+/* Already done in MSWOnSize
   // forward WM_SIZE to status bar control
 #if USE_NATIVE_STATUSBAR
   if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
     ((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
 #endif
+*/
+
 }
 
 void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
@@ -461,6 +453,7 @@ void wxMDIParentFrame::MSWOnSize(int x, int y, WXUINT id)
 #endif
 
 	PositionStatusBar();
+    PositionToolBar();
 
     wxSizeEvent event(wxSize(x, y), m_windowId);
     event.SetEventObject( this );
@@ -914,6 +907,7 @@ void wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
 #endif
 
     PositionStatusBar();
+    PositionToolBar();
 
     wxWindow::MSWOnSize(x, y, id);
   }
diff --git a/src/msw/penwin.cpp b/src/msw/penwin.cpp
index 6fca0c5cda..db4e427e9f 100644
--- a/src/msw/penwin.cpp
+++ b/src/msw/penwin.cpp
@@ -35,7 +35,7 @@
 #include <penwin.h>
 #endif
 
-HANDLE s_hPenWin = (HANDLE)NULL;
+HANDLE g_hPenWin = (HANDLE)NULL;
 typedef void (CALLBACK * PENREGPROC)(WORD,BOOL);
 
 // The routine below allows Windows applications (binaries) to
@@ -56,17 +56,17 @@ void wxEnablePenAppHooks (bool hook)
 #ifndef __WIN32__
   if (hook)
     {
-      if (s_hPenWin)
+      if (g_hPenWin)
 	return;
 
       ///////////////////////////////////////////////////////////////////////
       // If running on a Pen Windows system, register this app so all
       // EDIT controls in dialogs are replaced by HEDIT controls.
-      if ((s_hPenWin = (HANDLE)GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
+      if ((g_hPenWin = (HANDLE)GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
 	{
 	  // We do this fancy GetProcAddress simply because we don't
 	  // know if we're running Pen Windows.
-	  if ((RegPenApp = (PENREGPROC)GetProcAddress (s_hPenWin, "RegisterPenApp")) != NULL)
+	  if ((RegPenApp = (PENREGPROC)GetProcAddress (g_hPenWin, "RegisterPenApp")) != NULL)
 	    (*RegPenApp) (RPA_DEFAULT, TRUE);
 	}
     }
@@ -74,12 +74,12 @@ void wxEnablePenAppHooks (bool hook)
     {
       ///////////////////////////////////////////////////////////////////////
       // If running on a Pen Windows system, unregister
-      if (s_hPenWin)
+      if (g_hPenWin)
 	{
 	  // Unregister this app 
 	  if (RegPenApp != NULL)
 	    (*RegPenApp) (RPA_DEFAULT, FALSE);
-	  s_hPenWin = (HANDLE) NULL;
+	  g_hPenWin = (HANDLE) NULL;
 	}
     }
 #endif	/* ! Windows-NT */
@@ -97,10 +97,10 @@ void wxRegisterPenWin(void)
 // (Notice the CONTROL statement in the RC file is "EDIT",
 // RegisterPenApp will automatically change that control to
 // an HEDIT.
-  if ((s_hPenWin = (HANDLE)GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
+  if ((g_hPenWin = (HANDLE)GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
     // We do this fancy GetProcAddress simply because we don't
     // know if we're running Pen Windows.
-   if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(s_hPenWin, "RegisterPenApp"))!= NULL)
+   if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL)
      (*RegPenApp)(RPA_DEFAULT, TRUE);
   }
 ///////////////////////////////////////////////////////////////////////
@@ -110,8 +110,8 @@ void wxRegisterPenWin(void)
 void wxCleanUpPenWin(void)
 {
 #if USE_PENWINDOWS
-  if (s_hPenWin) {
-    // Unregister this app 
+  if (g_hPenWin) {
+    // Unregister this app
     if (RegPenApp != NULL)
 	(*RegPenApp)(RPA_DEFAULT, FALSE);
   }
diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp
index 3e1097e3fb..609a04235c 100644
--- a/src/msw/printwin.cpp
+++ b/src/msw/printwin.cpp
@@ -172,7 +172,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
   wxWindow *win = CreateAbortWindow(parent, printout);
   wxYield();
 
-#if defined(__BORLANDC__) || defined(__GNUWIN32__)
+#if defined(__BORLANDC__) || defined(__GNUWIN32__) || !defined(__WIN32__)
   ::SetAbortProc((HDC) dc->GetHDC(), (FARPROC) lpAbortProc);
 #else
   ::SetAbortProc((HDC) dc->GetHDC(), (int (_stdcall *)
diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp
index 5d50a6c2f0..dcd27cbba2 100644
--- a/src/msw/radiobox.cpp
+++ b/src/msw/radiobox.cpp
@@ -410,6 +410,8 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     yy = currentY;
 
+  AdjustForParentClientOrigin(xx, yy, sizeFlags);
+
   char buf[400];
 
   int y_offset = yy;
@@ -576,6 +578,15 @@ void wxRadioBox::GetPosition(int *x, int *y) const
   {
     ::ScreenToClient((HWND) parent->GetHWND(), &point);
   }
+  // We may be faking the client origin.
+  // So a window that's really at (0, 30) may appear
+  // (to wxWin apps) to be at (0, 0).
+  if (GetParent())
+  {
+    wxPoint pt(GetParent()->GetClientAreaOrigin());
+    point.x -= pt.x;
+    point.y -= pt.y;
+  }
 
   *x = point.x;
   *y = point.y;
diff --git a/src/msw/region.cpp b/src/msw/region.cpp
index b5e7227e1a..1e59e6b0b9 100644
--- a/src/msw/region.cpp
+++ b/src/msw/region.cpp
@@ -77,6 +77,12 @@ wxRegion::wxRegion(void)
     M_REGION = ::CreateRectRgn(0, 0, 0, 0);
 }
 
+wxRegion::wxRegion(WXHRGN hRegion)
+{
+    m_refData = new wxRegionRefData;
+    M_REGION = (HRGN) hRegion;
+}
+
 wxRegion::wxRegion(long x, long y, long w, long h)
 {
     m_refData = new wxRegionRefData;
diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp
index f3f1e696b9..883951314d 100644
--- a/src/msw/slider95.cpp
+++ b/src/msw/slider95.cpp
@@ -328,6 +328,15 @@ void wxSlider95::GetPosition(int *x, int *y) const
   if (parent)
     ::ScreenToClient((HWND) parent->GetHWND(), &point);
 
+  // We may be faking the client origin.
+  // So a window that's really at (0, 30) may appear
+  // (to wxWin apps) to be at (0, 0).
+  if (GetParent())
+  {
+    wxPoint pt(GetParent()->GetClientAreaOrigin());
+    point.x -= pt.x;
+    point.y -= pt.y;
+  }
   *x = point.x;
   *y = point.y;
 }
@@ -346,6 +355,8 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   char buf[300];
 
   int x_offset = x;
diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp
index 63d743e66c..f8a6f33e2a 100644
--- a/src/msw/slidrmsw.cpp
+++ b/src/msw/slidrmsw.cpp
@@ -302,6 +302,15 @@ void wxSliderMSW::GetPosition(int *x, int *y) const
   if (parent)
     ::ScreenToClient((HWND) parent->GetHWND(), &point);
 
+  // We may be faking the client origin.
+  // So a window that's really at (0, 30) may appear
+  // (to wxWin apps) to be at (0, 0).
+  if (GetParent())
+  {
+    wxPoint pt(GetParent()->GetClientAreaOrigin());
+    point.x -= pt.x;
+    point.y -= pt.y;
+  }
   *x = point.x;
   *y = point.y;
 }
@@ -320,6 +329,8 @@ void wxSliderMSW::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   char buf[300];
 
   int x_offset = x;
diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp
index 14b4f94c9b..943b95b7f5 100644
--- a/src/msw/statbmp.cpp
+++ b/src/msw/statbmp.cpp
@@ -93,6 +93,8 @@ void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   int actualWidth = width;
   int actualHeight = height;
 
diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp
index ae58e8f769..b99a5a9bee 100644
--- a/src/msw/statbox.cpp
+++ b/src/msw/statbox.cpp
@@ -117,6 +117,8 @@ void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   // If we're prepared to use the existing size, then...
   if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
   {
diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp
index e7b5004deb..e203b5ebd7 100644
--- a/src/msw/stattext.cpp
+++ b/src/msw/stattext.cpp
@@ -104,6 +104,8 @@ void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   int actualWidth = width;
   int actualHeight = height;
 
diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp
index 66a1aa5937..21d8624e2a 100644
--- a/src/msw/tbar95.cpp
+++ b/src/msw/tbar95.cpp
@@ -64,6 +64,12 @@ Set the TBSTYLE_CUSTOMERASE style, then handle the
 NM_CUSTOMDRAW message and do your custom drawing.
 */
 
+#define DEFAULTBITMAPX   16
+#define DEFAULTBITMAPY   15
+#define DEFAULTBUTTONX   24
+#define DEFAULTBUTTONY   24
+#define DEFAULTBARHEIGHT 27
+
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
 
@@ -80,9 +86,6 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height);
 
 wxToolBar95::wxToolBar95(void)
 {
-  m_tilingDirection = wxVERTICAL ;
-  m_rowsOrColumns = 0;
-  m_currentRowsOrColumns = 0;
   m_maxWidth = -1;
   m_maxHeight = -1;
   m_hBitmap = 0;
@@ -91,8 +94,7 @@ wxToolBar95::wxToolBar95(void)
 }
 
 bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
-            long style, int orientation,
-            int RowsOrColumns, const wxString& name)
+            long style, const wxString& name)
 {
   m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
   	GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
@@ -102,11 +104,8 @@ bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, co
   m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
   	GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
 
-  m_tilingDirection = orientation;
-  if (m_tilingDirection == wxHORIZONTAL)
-    wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports vertical tiling.\nPass the number of rows.", "wxToolBar95 usage", wxOK);
-  m_rowsOrColumns = RowsOrColumns;
-  m_currentRowsOrColumns = 0;
+  if (style & wxTB_VERTICAL)
+    wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports vertical tiling.", "wxToolBar95 usage", wxOK);
   m_maxWidth = -1;
   m_maxHeight = -1;
   
@@ -305,7 +304,7 @@ bool wxToolBar95::CreateTools(void)
   ans = (int)::SendMessage((HWND) GetHWND(), TB_AUTOSIZE, (WPARAM)0, (LPARAM) 0);
 
   RECT rect;
-  ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_rowsOrColumns, TRUE), (LPARAM) & rect);
+  ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect);
   m_maxWidth = (rect.right - rect.left + 2);
   m_maxHeight = (rect.bottom - rect.top + 2);
 
@@ -368,7 +367,7 @@ bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
   return TRUE;
 }
 
-void wxToolBar95::SetDefaultSize(const wxSize& size)
+void wxToolBar95::SetToolBitmapSize(const wxSize& size)
 {
   m_defaultWidth = size.x; m_defaultHeight = size.y;
   ::SendMessage((HWND) GetHWND(), TB_SETBITMAPSIZE, 0, (LPARAM) MAKELONG ((int)size.x, (int)size.y));
@@ -387,7 +386,7 @@ wxSize wxToolBar95::GetMaxSize(void) const
   if (m_maxWidth == -1 | m_maxHeight == -1)
   {
     RECT rect;
-    ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_rowsOrColumns, TRUE), (LPARAM) & rect);
+    ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect);
     ((wxToolBar95 *)this)->m_maxWidth = (rect.right - rect.left + 2); // ???
     ((wxToolBar95 *)this)->m_maxHeight = (rect.bottom - rect.top + 2); // ???
   }
@@ -403,7 +402,7 @@ void wxToolBar95::GetSize(int *w, int *h) const
 }
 
 // The button size is bigger than the bitmap size
-wxSize wxToolBar95::GetDefaultButtonSize(void) const
+wxSize wxToolBar95::GetToolSize(void) const
 {
   return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
 }
diff --git a/src/msw/tbarmsw.cpp b/src/msw/tbarmsw.cpp
index 697df07d12..e891c5e436 100644
--- a/src/msw/tbarmsw.cpp
+++ b/src/msw/tbarmsw.cpp
@@ -38,6 +38,12 @@
 #include "wx/msw/private.h"
 #include "wx/msw/dib.h"
 
+#define DEFAULTBITMAPX   16
+#define DEFAULTBITMAPY   15
+#define DEFAULTBUTTONX   24
+#define DEFAULTBUTTONY   22
+#define DEFAULTBARHEIGHT 27
+
 /////// Non-Windows 95 implementation
 
 #if !USE_IMAGE_LOADING_IN_MSW
@@ -69,15 +75,12 @@ wxToolBarMSW::wxToolBarMSW(void)
 }
 
 bool wxToolBarMSW::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
-            long style, int orientation,
-            int RowsOrColumns, const wxString& name)
+            long style, const wxString& name)
 {
 	if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
 		return FALSE;
 
-  m_tilingDirection = orientation;
-  m_rowsOrColumns = RowsOrColumns;
-  if ( m_tilingDirection == wxVERTICAL )
+  if ( style & wxTB_HORIZONTAL )
     { m_lastX = 3; m_lastY = 7; }
   else
     { m_lastX = 7; m_lastY = 3; }
@@ -112,7 +115,7 @@ wxToolBarMSW::~wxToolBarMSW(void)
   FreeGlobalObjects();
 }
 
-void wxToolBarMSW::SetDefaultSize(const wxSize& size)
+void wxToolBarMSW::SetToolBitmapSize(const wxSize& size)
 {
   m_defaultWidth = size.x; m_defaultHeight = size.y;
   FreeGlobalObjects();
@@ -120,7 +123,7 @@ void wxToolBarMSW::SetDefaultSize(const wxSize& size)
 }
 
 // The button size is bigger than the bitmap size
-wxSize wxToolBarMSW::GetDefaultButtonSize(void) const
+wxSize wxToolBarMSW::GetToolSize(void) const
 {
   return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
 }
@@ -361,7 +364,7 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx
     tool->m_y = m_yMargin;
 
   tool->m_deleteSecondBitmap = TRUE;
-  tool->SetSize(GetDefaultButtonWidth(), GetDefaultButtonHeight());
+  tool->SetSize(GetToolSize().x, GetToolSize().y);
   
   // Calculate reasonable max size in case Layout() not called
   if ((tool->m_x + bitmap.GetWidth() + m_xMargin) > m_maxWidth)
@@ -374,6 +377,99 @@ wxToolBarTool *wxToolBarMSW::AddTool(int index, const wxBitmap& bitmap, const wx
   return tool;
 }
 
+void wxToolBarMSW::Layout(void)
+{
+  m_currentRowsOrColumns = 0;
+  m_lastX = m_xMargin;
+  m_lastY = m_yMargin;
+  int maxToolWidth = 0;
+  int maxToolHeight = 0;
+  m_maxWidth = 0;
+  m_maxHeight = 0;
+
+  // Find the maximum tool width and height
+  wxNode *node = m_tools.First();
+  while (node)
+  {
+    wxToolBarTool *tool = (wxToolBarTool *)node->Data();
+    if (tool->GetWidth() > maxToolWidth)
+      maxToolWidth = (int)tool->GetWidth();
+    if (tool->GetHeight() > maxToolHeight)
+      maxToolHeight = (int)tool->GetHeight();
+    node = node->Next();
+  }
+
+  int separatorSize = m_toolSeparation;
+
+  node = m_tools.First();
+  while (node)
+  {
+    wxToolBarTool *tool = (wxToolBarTool *)node->Data();
+    if (tool->m_toolStyle == wxTOOL_STYLE_SEPARATOR)
+    {
+      if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+      {
+        if (m_currentRowsOrColumns >= m_maxCols)
+          m_lastY += separatorSize;
+        else
+          m_lastX += separatorSize;
+      }
+      else
+      {
+        if (m_currentRowsOrColumns >= m_maxRows)
+          m_lastX += separatorSize;
+        else
+          m_lastY += separatorSize;
+      }
+    }
+    else if (tool->m_toolStyle == wxTOOL_STYLE_BUTTON)
+    {
+      if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+      {
+        if (m_currentRowsOrColumns >= m_maxCols)
+        {
+          m_currentRowsOrColumns = 0;
+          m_lastX = m_xMargin;
+          m_lastY += maxToolHeight + m_toolPacking;
+        }
+        tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
+        tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
+  
+        m_lastX += maxToolWidth + m_toolPacking;
+      }
+      else
+      {
+        if (m_currentRowsOrColumns >= m_maxRows)
+        {
+          m_currentRowsOrColumns = 0;
+          m_lastX += (maxToolWidth + m_toolPacking);
+          m_lastY = m_yMargin;
+        }
+        tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
+        tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
+  
+        m_lastY += maxToolHeight + m_toolPacking;
+      }
+      m_currentRowsOrColumns ++;
+    }
+    
+    if (m_lastX > m_maxWidth)
+      m_maxWidth = m_lastX;
+    if (m_lastY > m_maxHeight)
+      m_maxHeight = m_lastY;
+
+    node = node->Next();
+  }
+  if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+    m_maxWidth += maxToolWidth;
+  else
+    m_maxHeight += maxToolHeight;
+
+  m_maxWidth += m_xMargin;
+  m_maxHeight += m_yMargin;
+}
+
+
 bool wxToolBarMSW::InitGlobalObjects(void)
 {
   GetSysColors();      
@@ -384,7 +480,7 @@ bool wxToolBarMSW::InitGlobalObjects(void)
   if (!m_hdcMono)
       return FALSE;
 
-  m_hbmMono = (WXHBITMAP) CreateBitmap((int)GetDefaultButtonWidth(), (int)GetDefaultButtonHeight(), 1, 1, NULL);
+  m_hbmMono = (WXHBITMAP) CreateBitmap((int)GetToolSize().x, (int)GetToolSize().y, 1, 1, NULL);
   if (!m_hbmMono)
       return FALSE;
 
@@ -448,12 +544,12 @@ void wxToolBarMSW::CreateMask(WXHDC hdc, int xoffset, int yoffset, int dx, int d
     // create mask based on color bitmap
     // convert this to 1's
     SetBkColor(hdcGlyphs, m_rgbFace);
-    BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetDefaultWidth(), (int)GetDefaultHeight(),
+    BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetToolBitmapSize().x, (int)GetToolBitmapSize().y,
         hdcGlyphs, 0, 0, SRCCOPY);
     // convert this to 1's
     SetBkColor(hdcGlyphs, m_rgbHilight);
     // OR in the new 1's
-    BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetDefaultWidth(), (int)GetDefaultHeight(),
+    BitBlt((HDC) m_hdcMono, xoffset, yoffset, (int)GetToolBitmapSize().x, (int)GetToolBitmapSize().y,
         hdcGlyphs, 0, 0, SRCPAINT);
 
     SelectObject(hdcGlyphs, bitmapOld);
@@ -538,7 +634,7 @@ void wxToolBarMSW::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBar
     // calculate offset of face from (x,y).  y is always from the top,
     // so the offset is easy.  x needs to be centered in face.
     yOffset = 1;
-    xCenterOffset = (dxFace - (int)GetDefaultWidth())/2;
+    xCenterOffset = (dxFace - (int)GetToolBitmapSize().x)/2;
     if (state & (wxTBSTATE_PRESSED | wxTBSTATE_CHECKED))
     {
 	// pressed state moves down and to the right
@@ -549,7 +645,7 @@ void wxToolBarMSW::DrawButton(WXHDC hdc, int x, int y, int dx, int dy, wxToolBar
     // now put on the face
     if (state & wxTBSTATE_ENABLED) {
         // regular version
-        BitBlt((HDC) hdc, x+xCenterOffset, y + yOffset, (int)GetDefaultWidth(), (int)GetDefaultHeight(),
+        BitBlt((HDC) hdc, x+xCenterOffset, y + yOffset, (int)GetToolBitmapSize().x, (int)GetToolBitmapSize().y,
             hdcGlyphs, 0, 0, SRCCOPY);
     } else {
         // disabled version (or indeterminate)
diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp
index 723c594aea..363741f2b3 100644
--- a/src/msw/textctrl.cpp
+++ b/src/msw/textctrl.cpp
@@ -314,6 +314,8 @@ void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     y1 = currentY;
 
+  AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
   int cx; // button font dimensions
   int cy;
 
diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp
index aaf7054033..b97c5f8575 100644
--- a/src/msw/utils.cpp
+++ b/src/msw/utils.cpp
@@ -189,8 +189,8 @@ bool wxGetUserName(char *buf, int maxSize)
 //  }
 #else
 #if !defined(__WATCOMC__) && !defined(__GNUWIN32__) && USE_PENWINDOWS
-  extern HANDLE hPenWin; // PenWindows Running?
-  if (hPenWin)
+  extern HANDLE g_hPenWin; // PenWindows Running?
+  if (g_hPenWin)
   {
     // PenWindows Does have a user concept!
     // Get the current owner of the recognizer
@@ -365,9 +365,9 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
 #  ifdef __WINDOWS_386__
   retValue = wxWIN386;
 #  else
-#    if !defined(__WATCOMC__) && !defined(GNUWIN32)
-  extern HANDLE hPenWin;
-  retValue = hPenWin ? wxPENWINDOWS : wxWINDOWS ;
+#    if !defined(__WATCOMC__) && !defined(GNUWIN32) && USE_PENWINDOWS
+  extern HANDLE g_hPenWin;
+  retValue = g_hPenWin ? wxPENWINDOWS : wxWINDOWS ;
 #    endif
 #  endif
   // @@@@ To be completed. I don't have the manual here...
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
index 38fb38c0ef..fabef0910d 100644
--- a/src/msw/window.cpp
+++ b/src/msw/window.cpp
@@ -621,6 +621,16 @@ void wxWindow::GetPosition(int *x, int *y) const
   {
     ::ScreenToClient(hParentWnd, &point);
   }
+
+  // We may be faking the client origin.
+  // So a window that's really at (0, 30) may appear
+  // (to wxWin apps) to be at (0, 0).
+  if (GetParent())
+  {
+    wxPoint pt(GetParent()->GetClientAreaOrigin());
+    point.x -= pt.x;
+    point.y -= pt.y;
+  }
   *x = point.x;
   *y = point.y;
 }
@@ -633,6 +643,15 @@ void wxWindow::ScreenToClient(int *x, int *y) const
   pt.y = *y;
   ::ScreenToClient(hWnd, &pt);
 
+  // We may be faking the client origin.
+  // So a window that's really at (0, 30) may appear
+  // (to wxWin apps) to be at (0, 0).
+  if (GetParent())
+  {
+    wxPoint pt1(GetParent()->GetClientAreaOrigin());
+    pt.x -= pt1.x;
+    pt.y -= pt1.y;
+  }
   *x = pt.x;
   *y = pt.y;
 }
@@ -643,6 +662,17 @@ void wxWindow::ClientToScreen(int *x, int *y) const
   POINT pt;
   pt.x = *x;
   pt.y = *y;
+
+  // We may be faking the client origin.
+  // So a window that's really at (0, 30) may appear
+  // (to wxWin apps) to be at (0, 0).
+  if (GetParent())
+  {
+    wxPoint pt1(GetParent()->GetClientAreaOrigin());
+    pt.x += pt1.x;
+    pt.y += pt1.y;
+  }
+
   ::ClientToScreen(hWnd, &pt);
 
   *x = pt.x;
@@ -674,7 +704,6 @@ void wxWindow::SetCursor(const wxCursor& cursor)
 
 
 // Get size *available for subwindows* i.e. excluding menu bar etc.
-// For XView, this is the same as GetSize
 void wxWindow::GetClientSize(int *x, int *y) const
 {
   HWND hWnd = (HWND) GetHWND();
@@ -697,6 +726,8 @@ void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
   if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
     actualY = currentY;
 
+  AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
+
   int currentW,currentH;
   GetSize(&currentW, &currentH);
   if (width == -1)
@@ -745,6 +776,24 @@ void wxWindow::SetClientSize(int width, int height)
   GetEventHandler()->ProcessEvent(event);
 }
 
+// For implementation purposes - sometimes decorations make the client area
+// smaller
+wxPoint wxWindow::GetClientAreaOrigin() const
+{
+    return wxPoint(0, 0);
+}
+
+// Makes an adjustment to the window position (for example, a frame that has
+// a toolbar that it manages itself).
+void wxWindow::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags)
+{
+    if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
+    {
+        wxPoint pt(GetParent()->GetClientAreaOrigin());
+        x += pt.x; y += pt.y;
+    }
+}
+
 bool wxWindow::Show(bool show)
 {
   HWND hWnd = (HWND) GetHWND();
@@ -1956,6 +2005,19 @@ void wxWindow::MSWDetachWindowMenu(void)
 
 bool wxWindow::MSWOnPaint(void)
 {
+#ifdef __WIN32__
+  HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
+  ::GetUpdateRgn((HWND) GetHWND(), hRegion, FALSE);
+
+  m_updateRegion = wxRegion((WXHRGN) hRegion);
+#else
+  RECT updateRect;
+  ::GetUpdateRect((HWND) GetHWND(), & updateRect, FALSE);
+
+  m_updateRegion = wxRegion(updateRect.left, updateRect.top,
+      updateRect.right - updateRect.left, updateRect.bottom - updateRect.top);
+#endif
+
   wxPaintEvent event(m_windowId);
   event.SetEventObject(this);
   if (!GetEventHandler()->ProcessEvent(event))
@@ -2866,6 +2928,9 @@ void wxWindow::GetCaretPos(int *x, int *y) const
   *y = point.y;
 }
 
+// OBSOLETE: use GetUpdateRegion instead.
+
+#if 0
 /*
  * Update iterator. Use from within OnPaint.
  */
@@ -2952,6 +3017,7 @@ int wxUpdateIterator::GetH()
 {
   return ((RECT *)rp)[current].bottom-GetY();
 }
+#endif
 
 wxWindow *wxGetActiveWindow(void)
 {
@@ -4470,6 +4536,29 @@ bool wxWindow::AcceptsFocus() const
   return IsShown() && IsEnabled();
 }
 
+// Update region access
+wxRegion wxWindow::GetUpdateRegion() const
+{
+    return m_updateRegion;
+}
+
+bool wxWindow::IsExposed(int x, int y, int w, int h) const
+{
+    return (m_updateRegion.Contains(x, y, w, h) != wxOutRegion);
+}
+
+bool wxWindow::IsExposed(const wxPoint& pt) const
+{
+    return (m_updateRegion.Contains(pt) != wxOutRegion);
+}
+
+bool wxWindow::IsExposed(const wxRect& rect) const
+{
+    return (m_updateRegion.Contains(rect) != wxOutRegion);
+}
+
+
+
 #ifdef __WXDEBUG__
 static const char *GetMessageName(int message)
 {
-- 
2.45.2

