Applied patch [ 689188 ] adds wxToolBar::GetToolPos

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2003-05-21 15:27:39 +00:00
parent b5db27fe1e
commit e6c96a7ca4
4 changed files with 26 additions and 5 deletions

View File

@ -447,6 +447,12 @@ Returns the value used for packing tools.
\helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}
\membersection{wxToolBar::GetToolPos}\label{wxtoolbargettoolpos}
\constfunc{int}{GetToolPos}{\param{int }{toolId}}
Returns the tool position in the toolbar, or wxNOT\_FOUND if the tool is not found.
\membersection{wxToolBar::GetToolSeparation}\label{wxtoolbargettoolseparation}
\constfunc{int}{GetToolSeparation}{\void}
@ -782,5 +788,3 @@ Only applies to a tool that has been specified as a toggle tool.
\wxheading{See also}
\helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}

View File

@ -199,9 +199,7 @@ enum wxStockCursor
class WXDLLEXPORT wxSize
{
public:
// members are public for compatibility (don't use them directly,
// especially that there names were chosen very unfortunately - they should
// have been called width and height)
// members are public for compatibility, don't use them directly.
int x, y;
// constructors

View File

@ -370,6 +370,9 @@ public:
virtual wxObject *GetToolClientData(int toolid) const;
virtual void SetToolClientData(int toolid, wxObject *clientData);
// returns tool pos, or wxNOT_FOUND if tool isn't found
virtual int GetToolPos(int id) const;
// return TRUE if the tool is toggled
virtual bool GetToolState(int toolid) const;

View File

@ -458,6 +458,22 @@ void wxToolBarBase::SetToolClientData(int id, wxObject *clientData)
tool->SetClientData(clientData);
}
int wxToolBarBase::GetToolPos(int id) const
{
size_t pos = 0;
wxToolBarToolsList::Node *node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
if ( node->GetData()->GetId() == id )
return pos;
pos++;
}
return wxNOT_FOUND;
}
bool wxToolBarBase::GetToolState(int id) const
{
wxToolBarToolBase *tool = FindById(id);