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
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
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
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
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
utils/colours/*.rc
utils/colours/makefile.*
utils/colours/*.xbm
+utils/colours/*.xpm
utils/colours/*.txt
utils/wxprop/src/*.h
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
samples/hello/*.def
samples/hello/makefile.*
samples/hello/*.xbm
+samples/hello/*.xpm
samples/hello/*.txt
samples/hello/*.ico
samples/hello/*.bmp
samples/dynamic/*.def
samples/dynamic/makefile.*
samples/dynamic/*.xbm
+samples/dynamic/*.xpm
samples/dynamic/*.txt
samples/dynamic/*.ico
samples/dynamic/*.bmp
samples/bombs/*.def
samples/bombs/makefile.*
samples/bombs/*.xbm
+samples/bombs/*.xpm
samples/bombs/*.txt
samples/bombs/*.ico
samples/bombs/*.bmp
samples/ipc/*.def
samples/ipc/makefile.*
samples/ipc/*.xbm
+samples/ipc/*.xpm
samples/ipc/*.ico
samples/ipc/*.rc
samples/types/*.txt
samples/types/makefile.*
samples/types/*.xbm
+samples/types/*.xpm
samples/types/*.ico
samples/resource/*.cpp
samples/resource/*.wxr
samples/resource/makefile.*
samples/resource/*.xbm
+samples/resource/*.xpm
samples/resource/*.ico
samples/animate/*.cpp
samples/animate/*.def
samples/animate/makefile.*
samples/animate/*.xbm
+samples/animate/*.xpm
samples/animate/*.ico
samples/animate/*.rc
samples/mdi/*.def
samples/mdi/makefile.*
samples/mdi/*.xbm
+samples/mdi/*.xpm
samples/mdi/*.ico
samples/mdi/*.rc
samples/mdi/bitmaps/*.bmp
samples/minimal/*.def
samples/minimal/makefile.*
samples/minimal/*.xbm
+samples/minimal/*.xpm
samples/minimal/*.ico
samples/minimal/*.rc
samples/controls/*.def
samples/controls/makefile.*
samples/controls/*.xbm
+samples/controls/*.xpm
samples/controls/*.ico
samples/controls/*.bmp
samples/controls/*.rc
samples/fractal/*.def
samples/fractal/makefile.*
samples/fractal/*.xbm
+samples/fractal/*.xpm
samples/fractal/*.ico
samples/fractal/*.rc
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
samples/docview/*.rc
samples/docview/makefile.*
samples/docview/*.xbm
+samples/docview/*.xpm
samples/docview/*.txt
samples/docview/*.ico
samples/docview/*.bmp
samples/memcheck/*.rc
samples/memcheck/makefile.*
samples/memcheck/*.xbm
+samples/memcheck/*.xpm
samples/memcheck/*.txt
samples/memcheck/*.ico
samples/memcheck/*.bmp
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
samples/dialogs/*.rc
samples/dialogs/makefile.*
samples/dialogs/*.xbm
+samples/dialogs/*.xpm
samples/dialogs/*.txt
samples/dialogs/*.bmp
samples/dialogs/*.ico
samples/wxpoem/*.txt
samples/wxpoem/makefile.*
samples/wxpoem/*.xbm
+samples/wxpoem/*.xpm
samples/wxpoem/*.ico
samples/wxpoem/*.bmp
samples/wxpoem/*.dat
samples/pressup/*.txt
samples/pressup/makefile.*
samples/pressup/*.xbm
+samples/pressup/*.xpm
samples/pressup/*.ico
samples/pressup/*.bmp
samples/validate/*.txt
samples/validate/makefile.*
samples/validate/*.xbm
+samples/validate/*.xpm
samples/validate/*.ico
samples/validate/*.bmp
samples/events/*.txt
samples/events/makefile.*
samples/events/*.xbm
+samples/events/*.xpm
samples/events/*.ico
samples/events/*.bmp
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
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
samples/splitter/*.txt
samples/splitter/makefile.*
samples/splitter/*.xbm
+samples/splitter/*.xpm
samples/splitter/*.ico
samples/splitter/*.bmp
samples/grid/*.txt
samples/grid/makefile.*
samples/grid/*.xbm
+samples/grid/*.xpm
samples/grid/*.ico
samples/grid/*.bmp
samples/internat/*.txt
samples/internat/makefile.*
samples/internat/*.xbm
+samples/internat/*.xpm
samples/internat/*.po
samples/internat/*.ico
samples/internat/*.bmp
samples/checklst/*.txt
samples/checklst/makefile.*
samples/checklst/*.xbm
+samples/checklst/*.xpm
samples/checklst/*.ico
samples/checklst/*.bmp
samples/dnd/*.rc
samples/dnd/*.def
samples/dnd/*.bmp
+samples/dnd/*.xbm
+samples/dnd/*.xpm
samples/dnd/*.ico
samples/dnd/*.txt
samples/tab/*.rc
samples/tab/*.def
samples/tab/*.bmp
+samples/tab/*.xbm
+samples/tab/*.xpm
samples/tab/*.ico
samples/tab/*.txt
samples/png/*.rc
samples/png/*.def
samples/png/*.bmp
+samples/png/*.xpm
+samples/png/*.xbm
samples/png/*.ico
samples/png/*.txt
samples/png/*.png
\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}}
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,
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}\\
\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.
\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}
\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}
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}}
\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}.
\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.
\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}}
\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}}
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}}
\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]{$\|$\ }%
\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}.
\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
+
-\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}\\
\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}
\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.
\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.}
\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.
For internal use only.
-\membersection{wxToolBarBase::EnableTool}\label{wxtoolbarbaseenabletool}
+\membersection{wxToolBar::EnableTool}\label{wxtoolbarenabletool}
\func{void}{EnableTool}{\param{int }{toolIndex}, \param{const bool}{ enable}}
\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.
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}
\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}}
\docparam{h}{Receives the maximum vertical size.}
-\membersection{wxToolBarBase::GetToolClientData}\label{wxtoolbarbasegettoolclientdata}
+\membersection{wxToolBar::GetToolClientData}\label{wxtoolbargettoolclientdata}
\constfunc{wxObject*}{GetToolClientData}{\param{int }{toolIndex}}
\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}}
%\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}}
\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}
\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}
\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}}
\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}}
%\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}
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.}
\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,
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.}
\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.
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}}
\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}}
\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}}
\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}}
\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}}
\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}}
\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}
\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.
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.
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
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}
+}
-; 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
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)
*/
#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
// 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
typedef unsigned int WXWPARAM;
typedef long WXLPARAM;
typedef unsigned long WXCOLORREF;
-typedef void * WXRGN;
typedef void * WXRGNDATA;
typedef void * WXMSG;
typedef unsigned long WXHCONV;
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...
#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 },
#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
#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;
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);
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);
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);
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);
bool m_iconized;
WXHICON m_defaultIcon;
static bool m_useNativeStatusBar;
- wxWindow * m_frameToolBar ;
+ wxToolBar * m_frameToolBar ;
DECLARE_EVENT_TABLE()
};
# 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
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);
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)
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() ; }
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;
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);
WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr;
+class WXDLLEXPORT wxMemoryDC;
+
// Non-Win95 (WIN32, WIN16, UNIX) version
class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase
*/
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);
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);
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;
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)
//
#include "wx/event.h"
#include "wx/string.h"
#include "wx/list.h"
+#include "wx/region.h"
#define wxKEY_SHIFT 1
#define wxKEY_CTRL 2
// 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(""); };
////////////////////////////////////////////////////////////////////////
//// 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);
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
// Window specific (so far)
wxWindow* WXDLLEXPORT wxGetActiveWindow(void);
+// OBSOLETE
+#if 0
// Allows iteration through damaged rectangles in OnPaint
class WXDLLEXPORT wxUpdateIterator
{
int GetW();
int GetH();
};
+#endif
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
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;
class WXDLLEXPORT wxToolBarBase : public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxToolBarBase)
+ DECLARE_ABSTRACT_CLASS(wxToolBarBase)
public:
wxToolBarBase(void);
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);
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
// 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);
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
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);
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
// 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__)
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)
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
// duplicate event handlers here.
BEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
- EVT_SIZE( MyChild::OnSize)
EVT_MENU(MDI_CHILD_QUIT, MyChild::OnQuit)
END_EVENT_TABLE()
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);
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];
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);
-}
-
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);
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);
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();
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.
bool MyApp::InitToolbar(wxToolBar* toolBar)
{
+ toolBar->SetMargins(5, 5);
+
// Set up toolbar
wxBitmap* toolBarBitmaps[8];
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;
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
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
DECLARE_EVENT_TABLE()
};
+#define ID_TOOLBAR 500
+
#include <wx/file.h>
#include <wx/log.h>
+#ifndef MAX_PATH
+#define MAX_PATH 512
+#endif
// ============================================================================
// implementation of wxFile
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
#include <wx/file.h>
#include <wx/textfile.h>
+#include <wx/utils.h>
#include <wx/log.h>
// other standard headers
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
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)
+{
+}
+
#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)
{
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;
// 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);
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;
}
*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);
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;
{
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;
}
}
+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
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
int actualWidth = width;
int actualHeight = height;
int ww, hh;
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
char buf[300];
int current_width, cyf;
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
HWND button = (HWND) GetHWND();
/*
if (w1<0)
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))
{
}
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)
if (m_staticPaintCount == 0)
{
-// m_canvas->m_paintHDC = 0;
-
if ( m_hDC && m_canvas)
{
::EndPaint((HWND) m_canvas->GetHWND(), &g_paintStruct);
wxDebugMsg("~wxPaintDC: Did not release HDC\n");
}
}
+
#include "wx/msw/private.h"
#include "wx/statusbr.h"
+#include "wx/toolbar.h"
#include "wx/menuitem.h"
#ifdef LoadAccelerators
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;
}
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;
#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);
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)
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);
}
}
#endif
PositionStatusBar();
+ PositionToolBar();
+
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(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);
}
}
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);
+ }
+ }
+}
+
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))
{
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))
{
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))
{
$(COMMDIR)\event.obj \
$(COMMDIR)\file.obj \
$(COMMDIR)\filefn.obj \
- $(COMMDIR)\fileconf.obj \
$(COMMDIR)\framecmn.obj \
$(COMMDIR)\gdicmn.obj \
$(COMMDIR)\intl.obj \
$(COMMDIR)\extended.obj \
$(COMMDIR)\wincmn.obj
+# $(COMMDIR)\fileconf.obj # Doens't compile (nested classes)
+
MSWOBJS = \
$(MSWDIR)\app.obj \
$(MSWDIR)\bitmap.obj \
$(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)
$(COMMDIR)\mstream.obj \
$(COMMDIR)\zstream.obj \
$(COMMDIR)\stream.obj \
+ $(COMMDIR)\datstrm.obj \
$(COMMDIR)\wincmn.obj
-# $(COMMDIR)\datstrm.obj
MSWOBJS = \
$(MSWDIR)\app.obj \
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;
cheight -= sh;
}
+ wxPoint pt(GetClientAreaOrigin());
+ cheight -= pt.y;
+ cwidth -= pt.x;
+
*x = cwidth;
*y = cheight;
}
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)
#endif
PositionStatusBar();
+ PositionToolBar();
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
#endif
PositionStatusBar();
+ PositionToolBar();
wxWindow::MSWOnSize(x, y, id);
}
#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
#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);
}
}
{
///////////////////////////////////////////////////////////////////////
// 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 */
// (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);
}
///////////////////////////////////////////////////////////////////////
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);
}
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 *)
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
yy = currentY;
+ AdjustForParentClientOrigin(xx, yy, sizeFlags);
+
char buf[400];
int y_offset = yy;
{
::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;
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;
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;
}
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
char buf[300];
int x_offset = x;
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;
}
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
char buf[300];
int x_offset = x;
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
int actualWidth = width;
int actualHeight = height;
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))
{
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
int actualWidth = width;
int actualHeight = height;
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)
wxToolBar95::wxToolBar95(void)
{
- m_tilingDirection = wxVERTICAL ;
- m_rowsOrColumns = 0;
- m_currentRowsOrColumns = 0;
m_maxWidth = -1;
m_maxHeight = -1;
m_hBitmap = 0;
}
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)));
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;
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);
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));
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); // ???
}
}
// 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);
}
#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
}
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; }
FreeGlobalObjects();
}
-void wxToolBarMSW::SetDefaultSize(const wxSize& size)
+void wxToolBarMSW::SetToolBitmapSize(const wxSize& size)
{
m_defaultWidth = size.x; m_defaultHeight = size.y;
FreeGlobalObjects();
}
// 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);
}
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)
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();
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;
// 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);
// 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
// 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)
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
y1 = currentY;
+ AdjustForParentClientOrigin(x1, y1, sizeFlags);
+
int cx; // button font dimensions
int cy;
// }
#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
# 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...
{
::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;
}
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;
}
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;
// 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();
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
actualY = currentY;
+ AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
+
int currentW,currentH;
GetSize(¤tW, ¤tH);
if (width == -1)
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();
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))
*y = point.y;
}
+// OBSOLETE: use GetUpdateRegion instead.
+
+#if 0
/*
* Update iterator. Use from within OnPaint.
*/
{
return ((RECT *)rp)[current].bottom-GetY();
}
+#endif
wxWindow *wxGetActiveWindow(void)
{
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)
{