From e6c96a7ca418179cee6b1418bd9c59be641d5456 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 21 May 2003 15:27:39 +0000 Subject: [PATCH] Applied patch [ 689188 ] adds wxToolBar::GetToolPos git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/toolbar.tex | 8 ++++++-- include/wx/gdicmn.h | 4 +--- include/wx/tbarbase.h | 3 +++ src/common/tbarbase.cpp | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/docs/latex/wx/toolbar.tex b/docs/latex/wx/toolbar.tex index 162d9018ad..48de0b04a7 100644 --- a/docs/latex/wx/toolbar.tex +++ b/docs/latex/wx/toolbar.tex @@ -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} - - diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index a823b76625..2df4124c47 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -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 diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h index 20883df2cd..794859e215 100644 --- a/include/wx/tbarbase.h +++ b/include/wx/tbarbase.h @@ -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; diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 82cc3bd9a3..020171d8f4 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -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); -- 2.45.2