]> git.saurik.com Git - wxWidgets.git/commitdiff
added update UI event code to toolbar, could
authorRobert Roebling <robert@roebling.de>
Thu, 15 Apr 1999 12:08:59 +0000 (12:08 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 15 Apr 1999 12:08:59 +0000 (12:08 +0000)
   someone test this

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/tbargtk.h
include/wx/gtk1/tbargtk.h
src/gtk/tbargtk.cpp
src/gtk1/tbargtk.cpp

index 131ce1b7c78430484a8f2306378e5c4a3bcf5f6c..39545eb984255743e3dda278ee51534246a29b36 100644 (file)
@@ -45,6 +45,7 @@ extern const wxChar *wxToolBarNameStr;
 
 class wxToolBar: public wxControl
 {
+  DECLARE_EVENT_TABLE()
   DECLARE_DYNAMIC_CLASS(wxToolBar)
   
   public:
@@ -102,6 +103,8 @@ class wxToolBar: public wxControl
     
     virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
     virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
+    
+    void OnIdle( wxIdleEvent &ievent );
 
   // implementation
   
index 131ce1b7c78430484a8f2306378e5c4a3bcf5f6c..39545eb984255743e3dda278ee51534246a29b36 100644 (file)
@@ -45,6 +45,7 @@ extern const wxChar *wxToolBarNameStr;
 
 class wxToolBar: public wxControl
 {
+  DECLARE_EVENT_TABLE()
   DECLARE_DYNAMIC_CLASS(wxToolBar)
   
   public:
@@ -102,6 +103,8 @@ class wxToolBar: public wxControl
     
     virtual void SetToolLongHelp(int toolIndex, const wxString& helpString);
     virtual void SetToolShortHelp(int toolIndex, const wxString& helpString);
+    
+    void OnIdle( wxIdleEvent &ievent );
 
   // implementation
   
index 7f7d9cbc8b20df49a486f3d6312a7d7ea5139cc5..6cfe891c2d3b3552be432335097a95e973c9556f 100644 (file)
@@ -87,6 +87,10 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
 
 IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
 
+BEGIN_EVENT_TABLE(wxToolBar, wxControl)
+  EVT_IDLE(wxToolBar::OnIdle)
+END_EVENT_TABLE()
+
 wxToolBar::wxToolBar()
 {
 }
@@ -482,4 +486,31 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
     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();
+    }
+}
 
index 7f7d9cbc8b20df49a486f3d6312a7d7ea5139cc5..6cfe891c2d3b3552be432335097a95e973c9556f 100644 (file)
@@ -87,6 +87,10 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
 
 IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
 
+BEGIN_EVENT_TABLE(wxToolBar, wxControl)
+  EVT_IDLE(wxToolBar::OnIdle)
+END_EVENT_TABLE()
+
 wxToolBar::wxToolBar()
 {
 }
@@ -482,4 +486,31 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
     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();
+    }
+}