Define more wxToolBar::SetToolXXX() methods in wxQt

Provide a stub for SetToolShortHelp() and really implement
SetTool{Normal,Disabled}Bitmap().
This commit is contained in:
Scott Furry
2017-07-14 16:53:11 +02:00
committed by Vadim Zeitlin
parent 2ea9548ffb
commit f8c14d1176
2 changed files with 41 additions and 2 deletions

View File

@@ -43,6 +43,11 @@ public:
virtual QToolBar *GetQToolBar() const { return m_qtToolBar; }
virtual void SetWindowStyleFlag( long style ) wxOVERRIDE;
virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE;
virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE;
virtual bool Realize() wxOVERRIDE;
virtual wxToolBarToolBase *CreateTool(int toolid,
@@ -59,7 +64,6 @@ public:
QWidget *GetHandle() const wxOVERRIDE;
protected:
QActionGroup* GetActionGroup(size_t pos);
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE;
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE;

View File

@@ -185,6 +185,41 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
return NULL;
}
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
(void)tool->SetShortHelp(helpString);
//TODO - other qt actions for tool tip string
// if (tool->m_item)
// {}
}
}
void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
tool->SetNormalBitmap(bitmap);
tool->SetIcon();
}
}
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
tool->SetDisabledBitmap(bitmap);
}
}
void wxToolBar::SetWindowStyleFlag( long style )
{
wxToolBarBase::SetWindowStyleFlag(style);
@@ -249,7 +284,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
QAction *before = NULL;
if (pos >= 0 && pos < (size_t)m_qtToolBar->actions().size())
if (pos < (size_t)m_qtToolBar->actions().size())
before = m_qtToolBar->actions().at(pos);
QAction *action;