[glom/gtkmm4v4] FlowTableWithFields: Have separate signal handler for EventBoxes.



commit 4a2792f97430f66ba147b8292eb1d43ef0bf780a
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Apr 25 17:09:04 2017 +0200

    FlowTableWithFields: Have separate signal handler for EventBoxes.
    
    To make the code clearer.

 glom/mode_data/flowtablewithfields.cc |   10 ++++++++--
 glom/mode_data/flowtablewithfields.h  |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index ca3b373..4c9fa03 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -194,7 +194,7 @@ void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& g
     event_box->set_visible_window(false);
 #ifndef GLOM_ENABLE_CLIENT_ONLY
     event_box->signal_button_press_event().connect (sigc::mem_fun (*flow_table,
-      &FlowTableWithFields::on_button_press_event), true /* connect after */);
+      &FlowTableWithFields::on_event_box_button_press_event), true /* connect after */);
 #endif
     event_box->show();
 
@@ -401,7 +401,7 @@ void FlowTableWithFields::add_layout_notebook(const std::shared_ptr<LayoutItem_N
         event_box->add(*flow_table);
         event_box->set_visible_window(false);
 #ifndef GLOM_ENABLE_CLIENT_ONLY
-        event_box->signal_button_press_event().connect (sigc::mem_fun (*flow_table, 
&FlowTableWithFields::on_button_press_event),
+        event_box->signal_button_press_event().connect (sigc::mem_fun (*flow_table, 
&FlowTableWithFields::on_event_box_button_press_event),
           true /* connect after */);
 #endif
         event_box->show();
@@ -1306,6 +1306,12 @@ void FlowTableWithFields::on_menu_delete_activate()
   }
 }
 
+bool FlowTableWithFields::on_event_box_button_press_event(GdkEventButton *button_event)
+{
+  // Re-use the handler for the parent FlowTableWithFields:
+  return on_button_press_event(button_event);
+}
+
 bool FlowTableWithFields::on_button_press_event(GdkEventButton *button_event)
 {
   auto pApp = AppWindow::get_appwindow();
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index a24615e..d7b44fd 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -285,6 +285,8 @@ private:
   void on_menu_properties_activate() override;
   void on_menu_delete_activate() override; // override this to add a dialog box
   bool on_button_press_event(GdkEventButton *event) override;
+
+  bool on_event_box_button_press_event(GdkEventButton *event);
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]