]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 689188 ] adds wxToolBar::GetToolPos
authorJulian Smart <julian@anthemion.co.uk>
Wed, 21 May 2003 15:27:39 +0000 (15:27 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 21 May 2003 15:27:39 +0000 (15:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/toolbar.tex
include/wx/gdicmn.h
include/wx/tbarbase.h
src/common/tbarbase.cpp

index 162d9018adb500e32380651ab47afa20953ff438..48de0b04a738558d390f6c8ed4cf6f2c76d87640 100644 (file)
@@ -447,6 +447,12 @@ Returns the value used for packing tools.
 
 \helpref{wxToolBar::SetToolPacking}{wxtoolbarsettoolpacking}
 
 
 \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}
 \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}
 \wxheading{See also}
 
 \helpref{wxToolBar::GetToolState}{wxtoolbargettoolstate}
-
-
index a823b7662575fdc3241d507ed93f49f9cd2ea45e..2df4124c47bdad9ab69194728bdb7af6568be4b8 100644 (file)
@@ -199,9 +199,7 @@ enum wxStockCursor
 class WXDLLEXPORT wxSize
 {
 public:
 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
     int x, y;
 
     // constructors
index 20883df2cd43789a374b6e35c95d95fc08474513..794859e2154a6633c3f1c12aab51798af55c556b 100644 (file)
@@ -370,6 +370,9 @@ public:
     virtual wxObject *GetToolClientData(int toolid) const;
     virtual void SetToolClientData(int toolid, wxObject *clientData);
 
     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;
 
     // return TRUE if the tool is toggled
     virtual bool GetToolState(int toolid) const;
 
index 82cc3bd9a3cc8b420ae8058b29a262eb0bd7a009..020171d8f4bc1d5b21d23cbeb56792f1c5ae7196 100644 (file)
@@ -458,6 +458,22 @@ void wxToolBarBase::SetToolClientData(int id, wxObject *clientData)
     tool->SetClientData(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);
 bool wxToolBarBase::GetToolState(int id) const
 {
     wxToolBarToolBase *tool = FindById(id);