📄 toolbar.tex
字号:
Get any client data associated with the tool.\wxheading{Parameters}\docparam{toolId}{Id of the tool, as passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}\wxheading{Return value}Client data, or \NULL if there is none.\membersection{wxToolBar::GetToolEnabled}\label{wxtoolbargettoolenabled}\constfunc{bool}{GetToolEnabled}{\param{int }{toolId}}Called to determine whether a tool is enabled (responds to user input).\wxheading{Parameters}\docparam{toolId}{Id of the tool in question.}\wxheading{Return value}true if the tool is enabled, false otherwise.\wxheading{See also}\helpref{wxToolBar::EnableTool}{wxtoolbarenabletool}\membersection{wxToolBar::GetToolLongHelp}\label{wxtoolbargettoollonghelp}\constfunc{wxString}{GetToolLongHelp}{\param{int }{toolId}}Returns the long help for the given tool.\wxheading{Parameters}\docparam{toolId}{The tool in question.}\wxheading{See also}\helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp},\rtfsp\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp\membersection{wxToolBar::GetToolPacking}\label{wxtoolbargettoolpacking}\constfunc{int}{GetToolPacking}{\void}Returns the value used for packing tools.\wxheading{See also}\helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}\membersection{wxToolBar::GetToolPos}\label{wxtoolbargettoolpos}\constfunc{int}{GetToolPos}{\param{int }{toolId}}Returns the tool position in the toolbar, or {\tt wxNOT\_FOUND} if the tool is not found.\membersection{wxToolBar::GetToolSeparation}\label{wxtoolbargettoolseparation}\constfunc{int}{GetToolSeparation}{\void}Returns the default separator size.\wxheading{See also}\helpref{wxToolBar::SetToolSeparation}{wxtoolbarsettoolseparation}\membersection{wxToolBar::GetToolShortHelp}\label{wxtoolbargettoolshorthelp}\constfunc{wxString}{GetToolShortHelp}{\param{int }{toolId}}Returns the short help for the given tool.\wxheading{Parameters}\docparam{toolId}{The tool in question.}\wxheading{See also}\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp}\rtfsp\membersection{wxToolBar::GetToolState}\label{wxtoolbargettoolstate}\constfunc{bool}{GetToolState}{\param{int }{toolId}}Gets the on/off state of a toggle tool.\wxheading{Parameters}\docparam{toolId}{The tool in question.}\wxheading{Return value}true if the tool is toggled on, false otherwise.\wxheading{See also}\helpref{wxToolBar::ToggleTool}{wxtoolbartoggletool}\membersection{wxToolBar::InsertControl}\label{wxtoolbarinsertcontrol}\func{wxToolBarToolBase *}{InsertControl}{\param{size\_t }{pos}, \param{wxControl *}{control}}Inserts the control into the toolbar at the given position.You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.\wxheading{See also}\helpref{AddControl}{wxtoolbaraddcontrol},\\\helpref{InsertTool}{wxtoolbarinserttool}\membersection{wxToolBar::InsertSeparator}\label{wxtoolbarinsertseparator}\func{wxToolBarToolBase *}{InsertSeparator}{\param{size\_t }{pos}}Inserts the separator into the toolbar at the given position.You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.\wxheading{See also}\helpref{AddSeparator}{wxtoolbaraddseparator},\\\helpref{InsertTool}{wxtoolbarinserttool}\membersection{wxToolBar::InsertTool}\label{wxtoolbarinserttool}\func{wxToolBarToolBase *}{InsertTool}{\param{size\_t }{pos},\rtfsp\param{int}{ toolId}, \param{const wxBitmap\&}{ bitmap1},\rtfsp\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = false},\rtfsp\param{wxObject* }{clientData = \NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}\func{wxToolBarToolBase *}{InsertTool}{\param{size\_t }{pos},\rtfsp\param{wxToolBarToolBase* }{tool}}Inserts the tool with the specified attributes into the toolbar at the givenposition.You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.\wxheading{See also}\helpref{AddTool}{wxtoolbaraddtool},\\\helpref{InsertControl}{wxtoolbarinsertcontrol},\\\helpref{InsertSeparator}{wxtoolbarinsertseparator}\membersection{wxToolBar::OnLeftClick}\label{wxtoolbaronleftclick}\func{bool}{OnLeftClick}{\param{int}{ toolId}, \param{bool}{ toggleDown}}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{toolId}{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{Return value}If the tool is a toggle and this function returns false, the toggletoggle state (internal and visual) will not be changed. This provides a way ofspecifying that toggle operations are not permitted in some circumstances.\wxheading{See also}\helpref{wxToolBar::OnMouseEnter}{wxtoolbaronmouseenter},\rtfsp\helpref{wxToolBar::OnRightClick}{wxtoolbaronrightclick}\membersection{wxToolBar::OnMouseEnter}\label{wxtoolbaronmouseenter}\func{void}{OnMouseEnter}{\param{int}{ toolId}}This is called when the mouse cursor moves into a tool or out ofthe 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{toolId}{Greater than -1 if the mouse cursor has moved into the tool,or -1 if the mouse cursor has moved. Theprogrammer can override this to provide extra information about the tool,such as a short description on the status line.}\wxheading{Remarks}With some derived toolbar classes, if the mouse moves quickly out of the toolbar, wxWidgets may not be able todetect it. Therefore this function may not always be called when expected.\membersection{wxToolBar::OnRightClick}\label{wxtoolbaronrightclick}\func{void}{OnRightClick}{\param{int}{ toolId}, \param{float}{ x}, \param{float}{ y}}Called when the user clicks on a tool with the right mouse button. Theprogrammer 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{toolId}{The identifier passed to \helpref{wxToolBar::AddTool}{wxtoolbaraddtool}.}\docparam{x}{The x position of the mouse cursor.}\docparam{y}{The y position of the mouse cursor.}\wxheading{Remarks}A typical use of this member might be to pop up a menu.\wxheading{See also}\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.\membersection{wxToolBar::RemoveTool}\label{wxtoolbarremovetool}\func{wxToolBarToolBase *}{RemoveTool}{\param{int }{id}}Removes the given tool from the toolbar but doesn't delete it. This allows toinsert/add this tool back to this (or another) toolbar later.Note that it is unnecessary to call \helpref{Realize}{wxtoolbarrealize} for thechange to take place, it will happen immediately.\wxheading{See also}\helpref{DeleteTool}{wxtoolbardeletetool}\membersection{wxToolBar::SetBitmapResource}\label{wxtoolbarsetbitmapresource}\func{void}{SetBitmapResource}{\param{int }{resourceId}}Sets the bitmap resource identifier for specifying tool bitmaps as indicesinto a custom bitmap. Windows CE only.\membersection{wxToolBar::SetMargins}\label{wxtoolbarsetmargins}\func{void}{SetMargins}{\param{const wxSize\&}{ size}}\func{void}{SetMargins}{\param{int}{ x}, \param{int}{ y}}Set the values to be used as margins for the toolbar.\wxheading{Parameters}\docparam{size}{Margin size.}\docparam{x}{Left margin, right margin and inter-tool separation value.}\docparam{y}{Top margin, bottom margin and inter-tool separation value.}\wxheading{Remarks}This must be called before the tools are added if absolute positioning is to be used, and thedefault (zero-size) margins are to be overridden.\wxheading{See also}\helpref{wxToolBar::GetMargins}{wxtoolbargetmargins}, \helpref{wxSize}{wxsize}\membersection{wxToolBar::SetToolBitmapSize}\label{wxtoolbarsettoolbitmapsize}\func{void}{SetToolBitmapSize}{\param{const wxSize\&}{ size}}Sets the default size of each tool bitmap. The default bitmap size is 16 by 15 pixels.\wxheading{Parameters}\docparam{size}{The size of the bitmaps in the toolbar.}\wxheading{Remarks}This should be called to tell the toolbar what the tool bitmap size is. Callit before you add tools.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{wxToolBar::GetToolBitmapSize}{wxtoolbargettoolbitmapsize},\rtfsp\helpref{wxToolBar::GetToolSize}{wxtoolbargettoolsize}\membersection{wxToolBar::SetToolClientData}\label{wxtoolbarsettoolclientdata}\func{void}{SetToolClientData}{\param{int }{id}, \param{wxObject* }{clientData}}Sets the client data associated with the tool.\membersection{wxToolBar::SetToolLongHelp}\label{wxtoolbarsettoollonghelp}\func{void}{SetToolLongHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}Sets the long help for the given tool.\wxheading{Parameters}\docparam{toolId}{The tool in question.}\docparam{helpString}{A string for the long help.}\wxheading{Remarks}You might use the long help for displaying the tool purpose on the status line.\wxheading{See also}\helpref{wxToolBar::GetToolLongHelp}{wxtoolbargettoollonghelp},\rtfsp\helpref{wxToolBar::SetToolShortHelp}{wxtoolbarsettoolshorthelp},\rtfsp\membersection{wxToolBar::SetToolPacking}\label{wxtoolbarsettoolpacking}\func{void}{SetToolPacking}{\param{int}{ packing}}Sets the value used for spacing tools. The default value is 1.\wxheading{Parameters}\docparam{packing}{The value for packing.}\wxheading{Remarks}The packing is used for spacing in the vertical direction if the toolbar is horizontal,and for spacing in the horizontal direction if the toolbar is vertical.\wxheading{See also}\helpref{wxToolBar::GetToolPacking}{wxtoolbargettoolpacking}\membersection{wxToolBar::SetToolShortHelp}\label{wxtoolbarsettoolshorthelp}\func{void}{SetToolShortHelp}{\param{int }{toolId}, \param{const wxString\& }{helpString}}Sets the short help for the given tool.\wxheading{Parameters}\docparam{toolId}{The tool in question.}\docparam{helpString}{The string for the short help.}\wxheading{Remarks}An application might use short help for identifying the tool purpose in a tooltip.\wxheading{See also}\helpref{wxToolBar::GetToolShortHelp}{wxtoolbargettoolshorthelp}, \helpref{wxToolBar::SetToolLongHelp}{wxtoolbarsettoollonghelp}\membersection{wxToolBar::SetToolSeparation}\label{wxtoolbarsettoolseparation}\func{void}{SetToolSeparation}{\param{int}{ separation}}Sets the default separator size. The default value is 5.\wxheading{Parameters}\docparam{separation}{The separator size.}\wxheading{See also}\helpref{wxToolBar::AddSeparator}{wxtoolbaraddseparator}\membersection{wxToolBar::ToggleTool}\label{wxtoolbartoggletool}\func{void}{ToggleTool}{\param{int }{toolId}, \param{const bool}{ toggle}}Toggles a tool on or off. This does not cause any event to get emitted.\wxheading{Parameters}\docparam{toolId}{Tool in question.}\docparam{toggle}{If true, toggles the tool on, otherwise toggles it off.}\wxheading{Remarks}Only applies to a tool that has been specified as a toggle tool.\wxheading{See also}\helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -