added update UI event code to toolbar, could
someone test this git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,6 +45,7 @@ extern const wxChar *wxToolBarNameStr;
|
|||||||
|
|
||||||
class wxToolBar: public wxControl
|
class wxToolBar: public wxControl
|
||||||
{
|
{
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -102,6 +103,8 @@ class wxToolBar: public wxControl
|
|||||||
|
|
||||||
virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
|
virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
|
||||||
virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
|
virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
|
||||||
|
|
||||||
|
void OnIdle( wxIdleEvent &ievent );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -45,6 +45,7 @@ extern const wxChar *wxToolBarNameStr;
|
|||||||
|
|
||||||
class wxToolBar: public wxControl
|
class wxToolBar: public wxControl
|
||||||
{
|
{
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -102,6 +103,8 @@ class wxToolBar: public wxControl
|
|||||||
|
|
||||||
virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
|
virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
|
||||||
virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
|
virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
|
||||||
|
|
||||||
|
void OnIdle( wxIdleEvent &ievent );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -87,6 +87,10 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
|
||||||
|
EVT_IDLE(wxToolBar::OnIdle)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxToolBar::wxToolBar()
|
wxToolBar::wxToolBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -482,4 +486,31 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::OnIdle( wxIdleEvent &WXUNUSED(ievent) )
|
||||||
|
{
|
||||||
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
|
|
||||||
|
wxNode* node = m_tools.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = (wxToolBarTool*) node->Data();
|
||||||
|
|
||||||
|
wxUpdateUIEvent event( tool->m_index );
|
||||||
|
event.SetEventObject(this);
|
||||||
|
|
||||||
|
if (evtHandler->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
if (event.GetSetEnabled())
|
||||||
|
EnableTool(tool->m_index, event.GetEnabled());
|
||||||
|
if (event.GetSetChecked())
|
||||||
|
ToggleTool(tool->m_index, event.GetChecked());
|
||||||
|
/*
|
||||||
|
if (event.GetSetText())
|
||||||
|
// Set tooltip?
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -87,6 +87,10 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
|
||||||
|
EVT_IDLE(wxToolBar::OnIdle)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxToolBar::wxToolBar()
|
wxToolBar::wxToolBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -482,4 +486,31 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::OnIdle( wxIdleEvent &WXUNUSED(ievent) )
|
||||||
|
{
|
||||||
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
|
|
||||||
|
wxNode* node = m_tools.First();
|
||||||
|
while (node)
|
||||||
|
{
|
||||||
|
wxToolBarTool* tool = (wxToolBarTool*) node->Data();
|
||||||
|
|
||||||
|
wxUpdateUIEvent event( tool->m_index );
|
||||||
|
event.SetEventObject(this);
|
||||||
|
|
||||||
|
if (evtHandler->ProcessEvent( event ))
|
||||||
|
{
|
||||||
|
if (event.GetSetEnabled())
|
||||||
|
EnableTool(tool->m_index, event.GetEnabled());
|
||||||
|
if (event.GetSetChecked())
|
||||||
|
ToggleTool(tool->m_index, event.GetChecked());
|
||||||
|
/*
|
||||||
|
if (event.GetSetText())
|
||||||
|
// Set tooltip?
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
node = node->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user