2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: toolbar.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxToolBar
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-03-09 19:01:00 -05:00
|
|
|
enum wxToolBarToolStyle
|
|
|
|
{
|
|
|
|
wxTOOL_STYLE_BUTTON = 1,
|
|
|
|
wxTOOL_STYLE_SEPARATOR = 2,
|
|
|
|
wxTOOL_STYLE_CONTROL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** wxToolBar style flags */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/** lay out the toolbar horizontally */
|
2013-03-30 21:12:27 -04:00
|
|
|
wxTB_HORIZONTAL = wxHORIZONTAL,
|
|
|
|
wxTB_TOP = wxTB_HORIZONTAL,
|
2012-03-09 19:01:00 -05:00
|
|
|
|
|
|
|
/** lay out the toolbar vertically */
|
2013-03-30 21:12:27 -04:00
|
|
|
wxTB_VERTICAL = wxVERTICAL,
|
|
|
|
wxTB_LEFT = wxTB_VERTICAL,
|
2012-03-09 19:01:00 -05:00
|
|
|
|
|
|
|
/** "flat" buttons (Win32/GTK only) */
|
|
|
|
wxTB_FLAT,
|
|
|
|
|
|
|
|
/** dockable toolbar (GTK only) */
|
|
|
|
wxTB_DOCKABLE,
|
|
|
|
|
|
|
|
/** don't show the icons (they're shown by default) */
|
|
|
|
wxTB_NOICONS,
|
|
|
|
|
|
|
|
/** show the text (not shown by default) */
|
|
|
|
wxTB_TEXT,
|
|
|
|
|
|
|
|
/** don't show the divider between toolbar and the window (Win32 only) */
|
|
|
|
wxTB_NODIVIDER,
|
|
|
|
|
|
|
|
/** no automatic alignment (Win32 only, useless) */
|
|
|
|
wxTB_NOALIGN,
|
|
|
|
|
|
|
|
/** show the text and the icons alongside, not vertically stacked (Win32/GTK) */
|
|
|
|
wxTB_HORZ_LAYOUT,
|
2013-03-30 21:12:27 -04:00
|
|
|
wxTB_HORZ_TEXT = wxTB_HORZ_LAYOUT | wxTB_TEXT,
|
2012-03-09 19:01:00 -05:00
|
|
|
|
|
|
|
/** don't show the toolbar short help tooltips */
|
|
|
|
wxTB_NO_TOOLTIPS,
|
|
|
|
|
|
|
|
/** lay out toolbar at the bottom of the window */
|
|
|
|
wxTB_BOTTOM,
|
|
|
|
|
|
|
|
/** lay out toolbar at the right edge of the window */
|
2013-03-30 21:12:27 -04:00
|
|
|
wxTB_RIGHT,
|
|
|
|
|
|
|
|
/** flags that are closest to the native look*/
|
2014-11-07 09:59:27 -05:00
|
|
|
wxTB_DEFAULT_STYLE = wxTB_HORIZONTAL
|
2012-03-09 19:01:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxToolBarToolBase
|
|
|
|
|
|
|
|
A toolbar tool represents one item on the toolbar.
|
|
|
|
|
|
|
|
It has a unique id (except for the separators), the style (telling whether
|
|
|
|
it is a normal button, separator or a control), the state (toggled or not,
|
|
|
|
enabled or not) and short and long help strings. The default
|
|
|
|
implementations use the short help string for the tooltip text which is
|
|
|
|
popped up when the mouse pointer enters the tool and the long help string
|
|
|
|
for the applications status bar.
|
2015-05-12 11:05:58 -04:00
|
|
|
|
|
|
|
Notice that the toolbar can @e not be modified by changing its tools via
|
|
|
|
the (intentionally undocumented here) setter methods of this class, all the
|
|
|
|
modifications must be done using the methods of wxToolBar itself.
|
2012-03-09 19:01:00 -05:00
|
|
|
*/
|
|
|
|
class wxToolBarToolBase : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxToolBarToolBase(wxToolBarBase *tbar = NULL,
|
|
|
|
int toolid = wxID_SEPARATOR,
|
|
|
|
const wxString& label = wxEmptyString,
|
|
|
|
const wxBitmap& bmpNormal = wxNullBitmap,
|
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
|
|
|
wxObject *clientData = NULL,
|
|
|
|
const wxString& shortHelpString = wxEmptyString,
|
|
|
|
const wxString& longHelpString = wxEmptyString);
|
|
|
|
|
|
|
|
wxToolBarToolBase(wxToolBarBase *tbar,
|
|
|
|
wxControl *control,
|
|
|
|
const wxString& label);
|
|
|
|
|
|
|
|
int GetId() const;
|
|
|
|
|
|
|
|
wxControl *GetControl() const;
|
|
|
|
wxToolBarBase *GetToolBar() const;
|
|
|
|
|
|
|
|
bool IsStretchable() const;
|
|
|
|
bool IsButton() const;
|
|
|
|
bool IsControl() const;
|
|
|
|
bool IsSeparator() const;
|
|
|
|
bool IsStretchableSpace() const;
|
|
|
|
int GetStyle() const;
|
|
|
|
wxItemKind GetKind() const;
|
2018-02-09 17:40:41 -05:00
|
|
|
void MakeStretchable();
|
2012-03-09 19:01:00 -05:00
|
|
|
|
|
|
|
bool IsEnabled() const;
|
|
|
|
bool IsToggled() const;
|
|
|
|
bool CanBeToggled() const;
|
|
|
|
|
|
|
|
const wxBitmap& GetNormalBitmap() const;
|
|
|
|
const wxBitmap& GetDisabledBitmap() const;
|
|
|
|
|
|
|
|
const wxBitmap& GetBitmap() const;
|
|
|
|
const wxString& GetLabel() const;
|
|
|
|
|
|
|
|
const wxString& GetShortHelp() const;
|
|
|
|
const wxString& GetLongHelp() const;
|
|
|
|
|
|
|
|
wxObject *GetClientData() const;
|
|
|
|
|
2018-02-10 18:13:01 -05:00
|
|
|
bool Enable(bool enable);
|
|
|
|
bool Toggle(bool toggle);
|
|
|
|
bool SetToggle(bool toggle);
|
|
|
|
bool SetShortHelp(const wxString& help);
|
|
|
|
bool SetLongHelp(const wxString& help);
|
2018-02-09 17:40:41 -05:00
|
|
|
void Toggle();
|
2018-02-10 18:13:01 -05:00
|
|
|
void SetNormalBitmap(const wxBitmap& bmp);
|
|
|
|
void SetDisabledBitmap(const wxBitmap& bmp);
|
|
|
|
void SetLabel(const wxString& label);
|
2018-02-09 17:40:41 -05:00
|
|
|
void SetClientData(wxObject *clientData);
|
2012-03-09 19:01:00 -05:00
|
|
|
|
2018-02-10 18:13:01 -05:00
|
|
|
void Detach();
|
|
|
|
void Attach(wxToolBarBase *tbar);
|
|
|
|
|
|
|
|
void SetDropdownMenu(wxMenu *menu);
|
2012-03-09 19:01:15 -05:00
|
|
|
wxMenu *GetDropdownMenu() const;
|
2012-03-09 19:01:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxToolBar
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-11-21 19:21:10 -05:00
|
|
|
A toolbar is a bar of buttons and/or other controls usually placed below
|
|
|
|
the menu bar in a wxFrame.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
2008-11-22 10:53:10 -05:00
|
|
|
You may create a toolbar that is managed by a frame calling
|
2008-05-20 03:48:30 -04:00
|
|
|
wxFrame::CreateToolBar(). Under Pocket PC, you should always use this
|
|
|
|
function for creating the toolbar to be managed by the frame, so that
|
|
|
|
wxWidgets can use a combined menubar and toolbar. Where you manage your
|
2008-11-22 10:53:10 -05:00
|
|
|
own toolbars, create wxToolBar as usual.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
2008-11-22 10:53:10 -05:00
|
|
|
There are several different types of tools you can add to a toolbar.
|
|
|
|
These types are controlled by the ::wxItemKind enumeration.
|
|
|
|
|
|
|
|
Note that many methods in wxToolBar such as wxToolBar::AddTool return a
|
|
|
|
@c wxToolBarToolBase* object.
|
|
|
|
This should be regarded as an opaque handle representing the newly added
|
|
|
|
toolbar item, providing access to its id and position within the toolbar.
|
|
|
|
Changes to the item's state should be made through calls to wxToolBar methods,
|
|
|
|
for example wxToolBar::EnableTool.
|
|
|
|
Calls to @c wxToolBarToolBase methods (undocumented by purpose) will not change
|
2011-03-22 10:17:38 -04:00
|
|
|
the visible state of the item within the tool bar.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
2018-04-18 03:58:22 -04:00
|
|
|
After you have added all the tools you need, you must call Realize() to
|
|
|
|
effectively construct and display the toolbar.
|
|
|
|
|
2008-11-21 19:21:10 -05:00
|
|
|
<b>wxMSW note</b>: Note that under wxMSW toolbar paints tools to reflect
|
|
|
|
system-wide colours. If you use more than 16 colours in your tool bitmaps,
|
|
|
|
you may wish to suppress this behaviour, otherwise system colours in your
|
|
|
|
bitmaps will inadvertently be mapped to system colours.
|
2008-05-20 03:48:30 -04:00
|
|
|
To do this, set the msw.remap system option before creating the toolbar:
|
|
|
|
@code
|
2009-01-18 16:46:46 -05:00
|
|
|
wxSystemOptions::SetOption("msw.remap", 0);
|
2008-05-20 03:48:30 -04:00
|
|
|
@endcode
|
|
|
|
If you wish to use 32-bit images (which include an alpha channel for
|
|
|
|
transparency) use:
|
|
|
|
@code
|
2009-01-18 16:46:46 -05:00
|
|
|
wxSystemOptions::SetOption("msw.remap", 2);
|
2008-05-20 03:48:30 -04:00
|
|
|
@endcode
|
|
|
|
Then colour remapping is switched off, and a transparent background
|
|
|
|
used. But only use this option under Windows XP with true colour:
|
|
|
|
@code
|
|
|
|
if (wxTheApp->GetComCtl32Version() >= 600 && ::wxDisplayDepth() >= 32)
|
|
|
|
@endcode
|
2008-11-08 10:17:16 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_FLAT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Gives the toolbar a flat look (Windows and GTK only).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_DOCKABLE}
|
2008-05-20 03:48:30 -04:00
|
|
|
Makes the toolbar floatable and dockable (GTK only).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_HORIZONTAL}
|
2008-05-20 03:48:30 -04:00
|
|
|
Specifies horizontal layout (default).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_VERTICAL}
|
2008-05-20 03:48:30 -04:00
|
|
|
Specifies vertical layout.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_TEXT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Shows the text in the toolbar buttons; by default only icons are shown.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_NOICONS}
|
2008-05-20 03:48:30 -04:00
|
|
|
Specifies no icons in the toolbar buttons; by default they are shown.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_NODIVIDER}
|
2008-05-20 03:48:30 -04:00
|
|
|
Specifies no divider (border) above the toolbar (Windows only)
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_NOALIGN}
|
2008-05-20 03:48:30 -04:00
|
|
|
Specifies no alignment with the parent window (Windows only, not very
|
|
|
|
useful).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_HORZ_LAYOUT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Shows the text and the icons alongside, not vertically stacked (Windows
|
|
|
|
and GTK 2 only). This style must be used with @c wxTB_TEXT.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_HORZ_TEXT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Combination of @c wxTB_HORZ_LAYOUT and @c wxTB_TEXT.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_NO_TOOLTIPS}
|
2008-05-20 03:48:30 -04:00
|
|
|
Don't show the short help tooltips for the tools when the mouse hovers
|
|
|
|
over them.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_BOTTOM}
|
2008-05-20 03:48:30 -04:00
|
|
|
Align the toolbar at the bottom of parent window.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTB_RIGHT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Align the toolbar at the right side of parent window.
|
2013-03-30 21:12:27 -04:00
|
|
|
@style{wxTB_DEFAULT_STYLE}
|
|
|
|
Combination of @c wxTB_HORIZONTAL and @c wxTB_FLAT. This style is new
|
|
|
|
since wxWidgets 2.9.5.
|
2008-03-08 08:52:38 -05:00
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-11-22 10:53:10 -05:00
|
|
|
See also @ref overview_windowstyles. Note that the wxMSW native toolbar
|
2008-05-20 03:48:30 -04:00
|
|
|
ignores @c wxTB_NOICONS style. Also, toggling the @c wxTB_TEXT works only
|
|
|
|
if the style was initially on.
|
|
|
|
|
2009-02-18 12:58:51 -05:00
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TOOL(id, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_TOOL event (a synonym for @c
|
|
|
|
wxEVT_MENU). Pass the id of the tool.
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_MENU(id, func)}
|
|
|
|
The same as EVT_TOOL().
|
|
|
|
@event{EVT_TOOL_RANGE(id1, id2, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_TOOL event for a range of
|
2008-05-20 03:48:30 -04:00
|
|
|
identifiers. Pass the ids of the tools.
|
|
|
|
@event{EVT_MENU_RANGE(id1, id2, func)}
|
|
|
|
The same as EVT_TOOL_RANGE().
|
|
|
|
@event{EVT_TOOL_RCLICKED(id, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_TOOL_RCLICKED event. Pass the id of the
|
2009-09-24 05:41:39 -04:00
|
|
|
tool. (Not available on wxOSX.)
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TOOL_RCLICKED_RANGE(id1, id2, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_TOOL_RCLICKED event for a range of ids. Pass
|
2009-09-24 05:41:39 -04:00
|
|
|
the ids of the tools. (Not available on wxOSX.)
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TOOL_ENTER(id, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_TOOL_ENTER event. Pass the id of the toolbar
|
2008-05-20 03:48:30 -04:00
|
|
|
itself. The value of wxCommandEvent::GetSelection() is the tool id, or
|
2009-09-24 05:41:39 -04:00
|
|
|
-1 if the mouse cursor has moved off a tool. (Not available on wxOSX.)
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TOOL_DROPDOWN(id, func)}
|
2013-04-25 06:11:03 -04:00
|
|
|
Process a @c wxEVT_TOOL_DROPDOWN event. If unhandled,
|
2008-05-20 03:48:30 -04:00
|
|
|
displays the default dropdown menu set using
|
|
|
|
wxToolBar::SetDropdownMenu().
|
|
|
|
@endEventTable
|
2008-11-08 10:17:16 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
The toolbar class emits menu commands in the same way 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 identifier is passed and the tool identifier is retrieved
|
2008-11-22 10:53:10 -05:00
|
|
|
from the wxCommandEvent. This is because the identifier may be @c wxID_ANY when the
|
|
|
|
mouse moves off a tool, and @c wxID_ANY is not allowed as an identifier in the event
|
2008-05-20 03:48:30 -04:00
|
|
|
system.
|
|
|
|
|
|
|
|
@library{wxcore}
|
2008-03-08 08:52:38 -05:00
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-17 03:06:20 -04:00
|
|
|
@see @ref overview_toolbar
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxToolBar : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2008-05-20 03:48:30 -04:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxToolBar();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructs a toolbar.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Pointer to a parent window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Window identifier. If -1, will automatically create an identifier.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-11-22 10:53:10 -05:00
|
|
|
Window position. ::wxDefaultPosition indicates that wxWidgets should
|
|
|
|
generate a default position for the window.
|
|
|
|
If using the wxWindow class directly, supply an actual position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-11-22 10:53:10 -05:00
|
|
|
Window size. ::wxDefaultSize indicates that wxWidgets should generate
|
|
|
|
a default size for the window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-11-22 10:53:10 -05:00
|
|
|
Window style. See wxToolBar initial description for details.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@remarks After a toolbar is created, you use AddTool() and perhaps
|
2008-11-22 10:53:10 -05:00
|
|
|
AddSeparator(), and then you must call Realize() to construct
|
|
|
|
and display the toolbar tools.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxToolBar(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2009-01-08 11:33:08 -05:00
|
|
|
long style = wxTB_HORIZONTAL,
|
2008-11-08 10:17:16 -05:00
|
|
|
const wxString& name = wxToolBarNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Toolbar destructor.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxToolBar();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Adds a new check (or toggle) tool to the toolbar. The parameters are the
|
|
|
|
same as in AddTool().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
wxToolBarToolBase* AddCheckTool(int toolId, const wxString& label,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxBitmap& bitmap1,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
const wxString& longHelp = wxEmptyString,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxObject* clientData = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2012-11-30 19:14:07 -05:00
|
|
|
Adds any control to the toolbar, typically e.g.\ a wxComboBox.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param control
|
2008-03-09 08:33:59 -04:00
|
|
|
The control to be added.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
Text to be displayed near the control.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@remarks
|
|
|
|
wxMac: labels are only displayed if wxWidgets is built with @c
|
|
|
|
wxMAC_USE_NATIVE_TOOLBAR set to 1
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual wxToolBarToolBase* AddControl(wxControl* control,
|
|
|
|
const wxString& label = wxEmptyString);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Adds a new radio tool to the toolbar. Consecutive radio tools form a
|
|
|
|
radio group such that exactly one button in the group is pressed at any
|
|
|
|
moment, in other words whenever a button in the group is pressed the
|
|
|
|
previously pressed button is automatically released. You should avoid
|
|
|
|
having the radio groups of only one element as it would be impossible
|
|
|
|
for the user to use such button.
|
2008-11-08 10:17:16 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
By default, the first button in the radio group is initially pressed,
|
|
|
|
the others are not.
|
|
|
|
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
wxToolBarToolBase* AddRadioTool(int toolId, const wxString& label,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxBitmap& bitmap1,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
const wxString& longHelp = wxEmptyString,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxObject* clientData = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Adds a separator for spacing groups of tools.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-09-05 08:29:32 -04:00
|
|
|
Notice that the separator uses the look appropriate for the current
|
|
|
|
platform so it can be a vertical line (MSW, some versions of GTK) or
|
|
|
|
just an empty space or something else.
|
2008-11-22 10:53:10 -05:00
|
|
|
|
2009-12-09 22:04:19 -05:00
|
|
|
@see AddTool(), SetToolSeparation(), AddStretchableSpace()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual wxToolBarToolBase* AddSeparator();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-12-09 22:04:19 -05:00
|
|
|
/**
|
|
|
|
Adds a stretchable space to the toolbar.
|
|
|
|
|
|
|
|
Any space not taken up by the fixed items (all items except for
|
|
|
|
stretchable spaces) is distributed in equal measure between the
|
|
|
|
stretchable spaces in the toolbar. The most common use for this method
|
|
|
|
is to add a single stretchable space before the items which should be
|
|
|
|
right-aligned in the toolbar, but more exotic possibilities are
|
|
|
|
possible, e.g. a stretchable space may be added in the beginning and
|
|
|
|
the end of the toolbar to centre all toolbar items.
|
|
|
|
|
|
|
|
@see AddTool(), AddSeparator(), InsertStretchableSpace()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxToolBarToolBase *AddStretchableSpace();
|
|
|
|
|
2008-11-23 12:45:16 -05:00
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-06-27 02:31:46 -04:00
|
|
|
Adds a tool to the toolbar.
|
|
|
|
|
|
|
|
@param tool
|
|
|
|
The tool to be added.
|
|
|
|
|
|
|
|
@remarks After you have added tools to a toolbar, you must call
|
2009-12-20 10:07:08 -05:00
|
|
|
Realize() in order to have the tools appear.
|
2008-06-27 02:31:46 -04:00
|
|
|
|
|
|
|
@see AddSeparator(), AddCheckTool(), AddRadioTool(),
|
|
|
|
InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxToolBarToolBase* AddTool(wxToolBarToolBase* tool);
|
2008-06-27 02:31:46 -04:00
|
|
|
|
|
|
|
/**
|
2008-11-08 10:17:16 -05:00
|
|
|
Adds a tool to the toolbar. This most commonly used version has fewer
|
2008-06-27 02:31:46 -04:00
|
|
|
parameters than the full version below which specifies the more rarely
|
|
|
|
used button features.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2008-05-20 03:48:30 -04:00
|
|
|
An integer by which the tool may be identified in subsequent
|
|
|
|
operations.
|
2008-11-08 10:17:16 -05:00
|
|
|
@param label
|
2015-10-23 13:00:17 -04:00
|
|
|
The string to be displayed with the tool. This string may include
|
|
|
|
mnemonics, i.e. characters prefixed by an ampersand ("&"), but they
|
|
|
|
are stripped from it and not actually shown in the toolbar as tools
|
|
|
|
can't be activated from keyboard.
|
2008-06-27 02:31:46 -04:00
|
|
|
@param bitmap
|
|
|
|
The primary tool bitmap.
|
|
|
|
@param shortHelp
|
|
|
|
This string is used for the tools tooltip.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param kind
|
2008-05-20 03:48:30 -04:00
|
|
|
May be ::wxITEM_NORMAL for a normal button (default), ::wxITEM_CHECK
|
|
|
|
for a checkable tool (such tool stays pressed after it had been
|
|
|
|
toggled) or ::wxITEM_RADIO for a checkable tool which makes part of
|
2008-11-08 10:17:16 -05:00
|
|
|
a radio group of tools each of which is automatically unchecked
|
2008-05-21 03:34:47 -04:00
|
|
|
whenever another button in the group is checked. ::wxITEM_DROPDOWN
|
|
|
|
specifies that a drop-down menu button will appear next to the
|
|
|
|
tool button (only GTK+ and MSW). Call SetDropdownMenu() afterwards.
|
2008-06-27 02:31:46 -04:00
|
|
|
|
|
|
|
@remarks After you have added tools to a toolbar, you must call
|
|
|
|
Realize() in order to have the tools appear.
|
|
|
|
|
|
|
|
@see AddSeparator(), AddCheckTool(), AddRadioTool(),
|
|
|
|
InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
|
|
|
|
*/
|
|
|
|
wxToolBarToolBase* AddTool(int toolId, const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
wxItemKind kind = wxITEM_NORMAL);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Adds a tool to the toolbar.
|
|
|
|
|
|
|
|
@param toolId
|
|
|
|
An integer by which the tool may be identified in subsequent
|
|
|
|
operations.
|
2008-11-08 10:17:16 -05:00
|
|
|
@param label
|
2008-06-27 02:31:46 -04:00
|
|
|
The string to be displayed with the tool.
|
|
|
|
@param bitmap
|
2008-03-09 08:33:59 -04:00
|
|
|
The primary tool bitmap.
|
2008-06-27 02:31:46 -04:00
|
|
|
@param bmpDisabled
|
2008-03-09 08:33:59 -04:00
|
|
|
The bitmap used when the tool is disabled. If it is equal to
|
2008-11-08 10:17:16 -05:00
|
|
|
::wxNullBitmap (default), the disabled bitmap is automatically
|
2008-06-27 02:31:46 -04:00
|
|
|
generated by greying the normal one.
|
|
|
|
@param kind
|
|
|
|
May be ::wxITEM_NORMAL for a normal button (default), ::wxITEM_CHECK
|
|
|
|
for a checkable tool (such tool stays pressed after it had been
|
|
|
|
toggled) or ::wxITEM_RADIO for a checkable tool which makes part of
|
2008-11-08 10:17:16 -05:00
|
|
|
a radio group of tools each of which is automatically unchecked
|
2008-06-27 02:31:46 -04:00
|
|
|
whenever another button in the group is checked. ::wxITEM_DROPDOWN
|
|
|
|
specifies that a drop-down menu button will appear next to the
|
|
|
|
tool button (only GTK+ and MSW). Call SetDropdownMenu() afterwards.
|
2010-05-11 15:44:16 -04:00
|
|
|
@param shortHelpString
|
|
|
|
This string is used for the tools tooltip.
|
|
|
|
@param longHelpString
|
|
|
|
This string is shown in the statusbar (if any) of the parent frame
|
|
|
|
when the mouse pointer is inside the tool.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param clientData
|
2008-05-20 03:48:30 -04:00
|
|
|
An optional pointer to client data which can be retrieved later
|
|
|
|
using GetToolClientData().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks After you have added tools to a toolbar, you must call
|
2008-05-20 03:48:30 -04:00
|
|
|
Realize() in order to have the tools appear.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddSeparator(), AddCheckTool(), AddRadioTool(),
|
2008-05-21 03:34:47 -04:00
|
|
|
InsertTool(), DeleteTool(), Realize(), SetDropdownMenu()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxToolBarToolBase* AddTool(int toolId, const wxString& label,
|
2008-06-27 02:31:46 -04:00
|
|
|
const wxBitmap& bitmap,
|
2012-03-09 19:01:00 -05:00
|
|
|
const wxBitmap& bmpDisabled,
|
2008-03-08 09:43:31 -05:00
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
2008-06-27 02:31:46 -04:00
|
|
|
const wxString& shortHelpString = wxEmptyString,
|
|
|
|
const wxString& longHelpString = wxEmptyString,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxObject* clientData = NULL);
|
2008-11-23 12:45:16 -05:00
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes all the tools in the toolbar.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void ClearTools();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Removes the specified tool from the toolbar and deletes it. If you don't
|
|
|
|
want to delete the tool, but just to remove it from the toolbar (to
|
|
|
|
possibly add it back later), you may use RemoveTool() instead.
|
|
|
|
|
|
|
|
@note It is unnecessary to call Realize() for the change to take
|
|
|
|
place, it will happen immediately.
|
|
|
|
|
|
|
|
@returns @true if the tool was deleted, @false otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see DeleteToolByPos()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool DeleteTool(int toolId);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
This function behaves like DeleteTool() but it deletes the tool at the
|
|
|
|
specified position and not the one with the given id.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool DeleteToolByPos(size_t pos);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Enables or disables the tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool to enable or disable, as passed to AddTool().
|
2008-03-08 09:43:31 -05:00
|
|
|
@param enable
|
2008-03-09 08:33:59 -04:00
|
|
|
If @true, enables the tool, otherwise disables it.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks Some implementations will change the visible state of the tool
|
2008-05-20 03:48:30 -04:00
|
|
|
to indicate that it is disabled.
|
|
|
|
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetToolEnabled(), ToggleTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void EnableTool(int toolId, bool enable);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns a pointer to the tool identified by @a id or @NULL if no
|
|
|
|
corresponding tool is found.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
wxToolBarToolBase* FindById(int id) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns a pointer to the control identified by @a id or @NULL if no
|
|
|
|
corresponding control is found.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxControl* FindControl(int id);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Finds a tool for the given mouse position.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
X position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
Y position.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return A pointer to a tool if a tool is found, or @NULL otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@remarks Currently not implemented in wxGTK (always returns @NULL
|
|
|
|
there).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxToolBarToolBase* FindToolForPosition(wxCoord x, wxCoord y) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the left/right and top/bottom margins, which are also used for
|
|
|
|
inter-toolspacing.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetMargins()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxSize GetMargins() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2009-02-04 07:19:45 -05:00
|
|
|
Returns the size of bitmap that the toolbar expects to have.
|
|
|
|
|
|
|
|
The default bitmap size is platform-dependent: for example, it is 16*15
|
|
|
|
for MSW and 24*24 for GTK. This size does @em not necessarily indicate
|
|
|
|
the best size to use for the toolbars on the given platform, for this
|
|
|
|
you should use @c wxArtProvider::GetNativeSizeHint(wxART_TOOLBAR) but
|
|
|
|
in any case, as the bitmap size is deduced automatically from the size
|
|
|
|
of the bitmaps associated with the tools added to the toolbar, it is
|
|
|
|
usually unnecessary to call SetToolBitmapSize() explicitly.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@remarks Note that this is the size of the bitmap you pass to AddTool(),
|
|
|
|
and not the eventual size of the tool button.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetToolBitmapSize(), GetToolSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxSize GetToolBitmapSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2010-04-16 16:52:53 -04:00
|
|
|
/**
|
|
|
|
Returns a pointer to the tool at ordinal position @a pos.
|
|
|
|
|
|
|
|
Don't confuse this with FindToolForPosition().
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
|
|
|
|
@see GetToolsCount()
|
|
|
|
*/
|
2017-11-25 13:57:23 -05:00
|
|
|
wxToolBarToolBase *GetToolByPos(int pos);
|
|
|
|
|
2010-04-16 16:52:53 -04:00
|
|
|
const wxToolBarToolBase *GetToolByPos(int pos) const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Get any client data associated with the tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return Client data, or @NULL if there is none.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxObject* GetToolClientData(int toolId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Called to determine whether a tool is enabled (responds to user input).
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if the tool is enabled, @false otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see EnableTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool GetToolEnabled(int toolId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the long help for the given tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetToolLongHelp(), SetToolShortHelp()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetToolLongHelp(int toolId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the value used for packing tools.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetToolPacking()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetToolPacking() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the tool position in the toolbar, or @c wxNOT_FOUND if the tool
|
|
|
|
is not found.
|
2010-10-21 15:44:23 -04:00
|
|
|
|
|
|
|
@param toolId
|
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetToolPos(int toolId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the default separator size.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetToolSeparation()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetToolSeparation() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the short help for the given tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetToolLongHelp(), SetToolShortHelp()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetToolShortHelp(int toolId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the size of a whole button, which is usually larger than a tool
|
|
|
|
bitmap because of added 3D effects.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetToolBitmapSize(), GetToolBitmapSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxSize GetToolSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the on/off state of a toggle tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if the tool is toggled on, @false otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see ToggleTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool GetToolState(int toolId) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of tools in the toolbar.
|
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
size_t GetToolsCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Inserts the control into the toolbar at the given position. You must
|
|
|
|
call Realize() for the change to take place.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddControl(), InsertTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual wxToolBarToolBase* InsertControl(size_t pos, wxControl* control,
|
|
|
|
const wxString& label = wxEmptyString);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Inserts the separator into the toolbar at the given position. You must
|
|
|
|
call Realize() for the change to take place.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddSeparator(), InsertTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxToolBarToolBase* InsertSeparator(size_t pos);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-12-09 22:04:19 -05:00
|
|
|
/**
|
|
|
|
Inserts a stretchable space at the given position.
|
|
|
|
|
|
|
|
See AddStretchableSpace() for details about stretchable spaces.
|
|
|
|
|
|
|
|
@see InsertTool(), InsertSeparator()
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
wxToolBarToolBase *InsertStretchableSpace(size_t pos);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
//@{
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Inserts the tool with the specified attributes into the toolbar at the
|
|
|
|
given position.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
You must call Realize() for the change to take place.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddTool(), InsertControl(), InsertSeparator()
|
2009-12-09 21:59:02 -05:00
|
|
|
|
|
|
|
@return The newly inserted tool or @NULL on failure. Notice that with
|
|
|
|
the overload taking @a tool parameter the caller is responsible for
|
|
|
|
deleting the tool in the latter case.
|
2008-03-09 08:33:59 -04:00
|
|
|
*/
|
2012-03-09 19:01:15 -05:00
|
|
|
wxToolBarToolBase* InsertTool( size_t pos,
|
|
|
|
int toolId,
|
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bitmap,
|
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
const wxString& longHelp = wxEmptyString,
|
|
|
|
wxObject *clientData = NULL);
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxToolBarToolBase* InsertTool(size_t pos,
|
|
|
|
wxToolBarToolBase* tool);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2008-03-09 08:33:59 -04:00
|
|
|
The identifier passed to AddTool().
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toggleDown
|
2008-05-20 03:48:30 -04:00
|
|
|
@true if the tool is a toggle and the toggle is down, otherwise is
|
|
|
|
@false.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return If the tool is a toggle and this function returns @false, the
|
2008-05-20 03:48:30 -04:00
|
|
|
toggle state (internal and visual) will not be changed. This
|
|
|
|
provides a way of specifying that toggle operations are not
|
|
|
|
permitted in some circumstances.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see OnMouseEnter(), OnRightClick()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool OnLeftClick(int toolId, bool toggleDown);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
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.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2008-05-20 03:48:30 -04:00
|
|
|
Greater than -1 if the mouse cursor has moved into the tool, or -1
|
|
|
|
if the mouse cursor has moved. The programmer can override this to
|
|
|
|
provide extra information about the tool, such as a short
|
|
|
|
description on the status line.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks With some derived toolbar classes, if the mouse moves quickly
|
2008-05-20 03:48:30 -04:00
|
|
|
out of the toolbar, wxWidgets may not be able to detect it.
|
|
|
|
Therefore this function may not always be called when expected.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void OnMouseEnter(int toolId);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
@deprecated This is the old way of detecting tool right clicks;
|
|
|
|
although it will still work, you should use the
|
|
|
|
EVT_TOOL_RCLICKED() macro instead.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Called when the user clicks on a tool with the right mouse button. The
|
|
|
|
programmer should override this function to detect right tool clicks.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2008-03-09 08:33:59 -04:00
|
|
|
The identifier passed to AddTool().
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
The x position of the mouse cursor.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
The y position of the mouse cursor.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks A typical use of this member might be to pop up a menu.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see OnMouseEnter(), OnLeftClick()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void OnRightClick(int toolId, long x, long y);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
This function should be called after you have added tools.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool Realize();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Removes the given tool from the toolbar but doesn't delete it. This
|
2019-01-25 21:14:20 -05:00
|
|
|
allows inserting/adding this tool back to this (or another) toolbar later.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
@note It is unnecessary to call Realize() for the change to take place,
|
|
|
|
it will happen immediately.
|
|
|
|
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see DeleteTool()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxToolBarToolBase* RemoveTool(int id);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the dropdown menu for the tool given by its @e id. The tool itself
|
2008-05-21 03:34:47 -04:00
|
|
|
will delete the menu when it's no longer needed. Only supported under
|
|
|
|
GTK+ und MSW.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
If you define a EVT_TOOL_DROPDOWN() handler in your program, you must
|
|
|
|
call wxEvent::Skip() from it or the menu won't be displayed.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool SetDropdownMenu(int id, wxMenu* menu);
|
|
|
|
|
2008-11-23 12:45:16 -05:00
|
|
|
//@{
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Set the values to be used as margins for the toolbar.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param x
|
2008-03-09 08:33:59 -04:00
|
|
|
Left margin, right margin and inter-tool separation value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param y
|
2008-03-09 08:33:59 -04:00
|
|
|
Top margin, bottom margin and inter-tool separation value.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks This must be called before the tools are added if absolute
|
2008-05-20 03:48:30 -04:00
|
|
|
positioning is to be used, and the default (zero-size) margins are
|
|
|
|
to be overridden.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-06-27 02:31:46 -04:00
|
|
|
@see GetMargins()
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetMargins(int x, int y);
|
2008-06-27 02:31:46 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the margins for the toolbar.
|
|
|
|
|
|
|
|
@param size
|
|
|
|
Margin size.
|
|
|
|
|
|
|
|
@remarks This must be called before the tools are added if absolute
|
|
|
|
positioning is to be used, and the default (zero-size) margins are
|
|
|
|
to be overridden.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetMargins(), wxSize
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetMargins(const wxSize& size);
|
2008-11-23 12:45:16 -05:00
|
|
|
//@}
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the default size of each tool bitmap. The default bitmap size is 16
|
|
|
|
by 15 pixels.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
The size of the bitmaps in the toolbar.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks This should be called to tell the toolbar what the tool bitmap
|
2008-05-20 03:48:30 -04:00
|
|
|
size is. Call it before you add tools.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetToolBitmapSize(), GetToolSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolBitmapSize(const wxSize& size);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the client data associated with the tool.
|
2010-10-21 15:44:23 -04:00
|
|
|
|
|
|
|
@param id
|
|
|
|
ID of the tool in question, as passed to AddTool().
|
2013-08-21 11:26:34 -04:00
|
|
|
@param clientData
|
|
|
|
The client data to use.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolClientData(int id, wxObject* clientData);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the bitmap to be used by the tool with the given ID when the tool
|
2008-05-20 03:48:30 -04:00
|
|
|
is in a disabled state. This can only be used on Button tools, not
|
|
|
|
controls.
|
|
|
|
|
2010-10-21 15:44:23 -04:00
|
|
|
@param id
|
|
|
|
ID of the tool in question, as passed to AddTool().
|
2013-08-21 11:26:34 -04:00
|
|
|
@param bitmap
|
|
|
|
Bitmap to use for disabled tools.
|
2010-10-21 15:44:23 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@note The native toolbar classes on the main platforms all synthesize
|
|
|
|
the disabled bitmap from the normal bitmap, so this function will
|
|
|
|
have no effect on those platforms.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the long help for the given tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-08 09:43:31 -05:00
|
|
|
@param helpString
|
2008-03-09 08:33:59 -04:00
|
|
|
A string for the long help.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks You might use the long help for displaying the tool purpose on
|
2008-05-20 03:48:30 -04:00
|
|
|
the status line.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetToolLongHelp(), SetToolShortHelp(),
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolLongHelp(int toolId, const wxString& helpString);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the bitmap to be used by the tool with the given ID. This can only
|
|
|
|
be used on Button tools, not controls.
|
2010-10-21 15:44:23 -04:00
|
|
|
|
|
|
|
@param id
|
|
|
|
ID of the tool in question, as passed to AddTool().
|
2013-08-21 11:26:34 -04:00
|
|
|
@param bitmap
|
|
|
|
Bitmap to use for normals tools.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the value used for spacing tools. The default value is 1.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param packing
|
2008-03-09 08:33:59 -04:00
|
|
|
The value for packing.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-11-08 10:17:16 -05:00
|
|
|
@remarks The packing is used for spacing in the vertical direction if
|
2008-05-20 03:48:30 -04:00
|
|
|
the toolbar is horizontal, and for spacing in the horizontal
|
|
|
|
direction if the toolbar is vertical.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetToolPacking()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolPacking(int packing);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the default separator size. The default value is 5.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param separation
|
2008-03-09 08:33:59 -04:00
|
|
|
The separator size.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see AddSeparator()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolSeparation(int separation);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the short help for the given tool.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-08 09:43:31 -05:00
|
|
|
@param helpString
|
2008-03-09 08:33:59 -04:00
|
|
|
The string for the short help.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks An application might use short help for identifying the tool
|
2008-05-20 03:48:30 -04:00
|
|
|
purpose in a tooltip.
|
|
|
|
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetToolShortHelp(), SetToolLongHelp()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetToolShortHelp(int toolId, const wxString& helpString);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Toggles a tool on or off. This does not cause any event to get emitted.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toolId
|
2010-10-21 15:44:23 -04:00
|
|
|
ID of the tool in question, as passed to AddTool().
|
2008-03-08 09:43:31 -05:00
|
|
|
@param toggle
|
2008-03-09 08:33:59 -04:00
|
|
|
If @true, toggles the tool on, otherwise toggles it off.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@remarks Only applies to a tool that has been specified as a toggle
|
|
|
|
tool.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void ToggleTool(int toolId, bool toggle);
|
2012-03-09 19:01:09 -05:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Factory function to create a new toolbar tool.
|
|
|
|
*/
|
2012-03-09 19:01:15 -05:00
|
|
|
virtual wxToolBarToolBase *CreateTool(int toolId,
|
2012-03-09 19:01:09 -05:00
|
|
|
const wxString& label,
|
|
|
|
const wxBitmap& bmpNormal,
|
|
|
|
const wxBitmap& bmpDisabled = wxNullBitmap,
|
|
|
|
wxItemKind kind = wxITEM_NORMAL,
|
|
|
|
wxObject *clientData = NULL,
|
|
|
|
const wxString& shortHelp = wxEmptyString,
|
|
|
|
const wxString& longHelp = wxEmptyString);
|
|
|
|
/**
|
|
|
|
Factory function to create a new control toolbar tool.
|
|
|
|
*/
|
|
|
|
virtual wxToolBarToolBase *CreateTool(wxControl *control,
|
|
|
|
const wxString& label);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Factory function to create a new separator toolbar tool.
|
|
|
|
*/
|
2019-10-20 05:52:26 -04:00
|
|
|
wxToolBarToolBase *CreateSeparator();
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|