added Add/InsertTool() (patch 672032)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,8 @@ All GUI ports:
|
|||||||
- fixed handling of URLs and filenames in wxFileSystem
|
- fixed handling of URLs and filenames in wxFileSystem
|
||||||
- implemented alignment for wxGrid bool editor and renderer
|
- implemented alignment for wxGrid bool editor and renderer
|
||||||
- support wxListCtrl columns alignment for all platforms and not just MSW
|
- support wxListCtrl columns alignment for all platforms and not just MSW
|
||||||
|
- added wxToolBar Add/InsertTool(tool) (Janusz Piwowarski)
|
||||||
|
|
||||||
- Changed to type-safe wxSizerItemList for wxSizer child items.
|
- Changed to type-safe wxSizerItemList for wxSizer child items.
|
||||||
|
|
||||||
Deprecated:
|
Deprecated:
|
||||||
|
@@ -186,9 +186,12 @@ Adds a separator for spacing groups of tools.
|
|||||||
\param{const wxString\& }{longHelpString = ""},\rtfsp
|
\param{const wxString\& }{longHelpString = ""},\rtfsp
|
||||||
\param{wxObject* }{clientData = NULL}}
|
\param{wxObject* }{clientData = NULL}}
|
||||||
|
|
||||||
|
\func{wxToolBarTool*}{AddTool}{\param{wxToolBarTool* }{tool}}
|
||||||
|
|
||||||
Adds a tool to the toolbar. The first (short and most commonly used) version
|
Adds a tool to the toolbar. The first (short and most commonly used) version
|
||||||
has fewer parameters than the full version at the price of not being able to
|
has fewer parameters than the full version at the price of not being able to
|
||||||
specify some of the more rarely used button features.
|
specify some of the more rarely used button features. The last version allows
|
||||||
|
to add an existing tool.
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
@@ -217,6 +220,8 @@ parent frame when the mouse pointer is inside the tool}
|
|||||||
\docparam{clientData}{An optional pointer to client data which can be
|
\docparam{clientData}{An optional pointer to client data which can be
|
||||||
retrieved later using \helpref{wxToolBar::GetToolClientData}{wxtoolbargettoolclientdata}.}
|
retrieved later using \helpref{wxToolBar::GetToolClientData}{wxtoolbargettoolclientdata}.}
|
||||||
|
|
||||||
|
\docparam{tool}{The tool to be added.}
|
||||||
|
|
||||||
\wxheading{Remarks}
|
\wxheading{Remarks}
|
||||||
|
|
||||||
After you have added tools to a toolbar, you must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} in
|
After you have added tools to a toolbar, you must call \helpref{wxToolBar::Realize}{wxtoolbarrealize} in
|
||||||
@@ -518,6 +523,9 @@ You must call \helpref{Realize}{wxtoolbarrealize} for the change to take place.
|
|||||||
\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = false},\rtfsp
|
\param{const wxBitmap\&}{ bitmap2 = wxNullBitmap}, \param{bool}{ isToggle = false},\rtfsp
|
||||||
\param{wxObject* }{clientData = NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
|
\param{wxObject* }{clientData = NULL}, \param{const wxString\& }{shortHelpString = ""}, \param{const wxString\& }{longHelpString = ""}}
|
||||||
|
|
||||||
|
\func{wxToolBarTool *}{InsertTool}{\param{size\_t }{pos},\rtfsp
|
||||||
|
\param{wxToolBarTool* }{tool}}
|
||||||
|
|
||||||
Inserts the tool with the specified attributes into the toolbar at the given
|
Inserts the tool with the specified attributes into the toolbar at the given
|
||||||
position.
|
position.
|
||||||
|
|
||||||
|
@@ -324,6 +324,9 @@ public:
|
|||||||
wxObject *clientData = NULL
|
wxObject *clientData = NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool);
|
||||||
|
virtual wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool);
|
||||||
|
|
||||||
// add an arbitrary control to the toolbar, return TRUE if ok (notice that
|
// add an arbitrary control to the toolbar, return TRUE if ok (notice that
|
||||||
// the control will be deleted by the toolbar and that it will also adjust
|
// the control will be deleted by the toolbar and that it will also adjust
|
||||||
// its position/size)
|
// its position/size)
|
||||||
|
@@ -164,13 +164,32 @@ wxToolBarToolBase *wxToolBarBase::InsertTool(size_t pos,
|
|||||||
wxToolBarToolBase *tool = CreateTool(id, label, bitmap, bmpDisabled, kind,
|
wxToolBarToolBase *tool = CreateTool(id, label, bitmap, bmpDisabled, kind,
|
||||||
clientData, shortHelp, longHelp);
|
clientData, shortHelp, longHelp);
|
||||||
|
|
||||||
if ( !tool || !DoInsertTool(pos, tool) )
|
if ( !InsertTool(pos, tool) )
|
||||||
{
|
{
|
||||||
delete tool;
|
delete tool;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxToolBarToolBase *wxToolBarBase::AddTool(wxToolBarToolBase *tool)
|
||||||
|
{
|
||||||
|
return InsertTool(GetToolsCount(), tool);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxToolBarToolBase *
|
||||||
|
wxToolBarBase::InsertTool(size_t pos, wxToolBarToolBase *tool)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( pos <= GetToolsCount(), (wxToolBarToolBase *)NULL,
|
||||||
|
_T("invalid position in wxToolBar::InsertTool()") );
|
||||||
|
|
||||||
|
if ( !tool || !DoInsertTool(pos, tool) )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
m_tools.Insert(pos, tool);
|
m_tools.Insert(pos, tool);
|
||||||
|
|
||||||
return tool;
|
return tool;
|
||||||
@@ -194,15 +213,13 @@ wxToolBarToolBase *wxToolBarBase::InsertControl(size_t pos, wxControl *control)
|
|||||||
|
|
||||||
wxToolBarToolBase *tool = CreateTool(control);
|
wxToolBarToolBase *tool = CreateTool(control);
|
||||||
|
|
||||||
if ( !tool || !DoInsertTool(pos, tool) )
|
if ( !InsertTool(pos, tool) )
|
||||||
{
|
{
|
||||||
delete tool;
|
delete tool;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_tools.Insert(pos, tool);
|
|
||||||
|
|
||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +230,7 @@ wxControl *wxToolBarBase::FindControl( int id )
|
|||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
wxControl *control = node->GetData()->GetControl();
|
wxControl *control = node->GetData()->GetControl();
|
||||||
|
|
||||||
if (control)
|
if (control)
|
||||||
{
|
{
|
||||||
if (control->GetId() == id)
|
if (control->GetId() == id)
|
||||||
|
Reference in New Issue
Block a user