[glom/gtkmm4v4] gtkmm4: Remove use of (now unnecessary) Gtk::EventBox.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/gtkmm4v4] gtkmm4: Remove use of (now unnecessary) Gtk::EventBox.
- Date: Wed, 1 Nov 2017 19:07:35 +0000 (UTC)
commit f4ba6c27b7a92fc1981e095bc1bf5eeafa020cdd
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Nov 1 16:21:47 2017 +0100
gtkmm4: Remove use of (now unnecessary) Gtk::EventBox.
glom/mode_data/datawidget/datawidget.cc | 2 +-
glom/mode_data/datawidget/datawidget.h | 3 +-
glom/mode_data/datawidget/label.cc | 2 +-
glom/mode_data/datawidget/label.h | 3 +-
glom/mode_data/flowtablewithfields.cc | 60 ++++++-----------------------
glom/mode_data/flowtablewithfields.h | 4 --
glom/utility_widgets/flowtable.cc | 7 ---
glom/utility_widgets/imageglom.cc | 6 +-
glom/utility_widgets/imageglom.h | 3 +-
glom/utility_widgets/notebooklabelglom.cc | 3 +-
glom/utility_widgets/notebooklabelglom.h | 3 +-
11 files changed, 22 insertions(+), 74 deletions(-)
---
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index 81ff212..bda1222 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -438,7 +438,7 @@ bool DataWidget::on_button_press_event(Gdk::EventButton& button_event)
}
}
- return Gtk::EventBox::on_button_press_event(button_event);
+ return Gtk::Bin::on_button_press_event(button_event);
}
std::shared_ptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& table_name)
diff --git a/glom/mode_data/datawidget/datawidget.h b/glom/mode_data/datawidget/datawidget.h
index e8494ee..c79025c 100644
--- a/glom/mode_data/datawidget/datawidget.h
+++ b/glom/mode_data/datawidget/datawidget.h
@@ -30,7 +30,6 @@
#include <libglom/document/view.h>
#include <libglom/data_structure/layout/layoutitem_field.h>
#include <glom/mode_design/layout/treestore_layout.h> //Forthe enum.
-#include <gtkmm/eventbox.h>
#include <gtkmm/button.h>
namespace Glom
@@ -39,7 +38,7 @@ namespace Glom
class AppWindow;
class DataWidget
- : public Gtk::EventBox,
+ : public Gtk::Bin,
public LayoutWidgetMenu,
public View_Composite_Glom
{
diff --git a/glom/mode_data/datawidget/label.cc b/glom/mode_data/datawidget/label.cc
index 63d6750..1e80746 100644
--- a/glom/mode_data/datawidget/label.cc
+++ b/glom/mode_data/datawidget/label.cc
@@ -104,7 +104,7 @@ bool Label::on_button_press_event(Gdk::EventButton& button_event)
return true;
}
- return Gtk::EventBox::on_button_press_event(button_event);
+ return Gtk::Bin::on_button_press_event(button_event);
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/datawidget/label.h b/glom/mode_data/datawidget/label.h
index f0798ce..04ee730 100644
--- a/glom/mode_data/datawidget/label.h
+++ b/glom/mode_data/datawidget/label.h
@@ -21,7 +21,6 @@
#ifndef GLOM_UTILITY_WIDGETS_LABEL_GLOM_H
#define GLOM_UTILITY_WIDGETS_LABEL_GLOM_H
-#include <gtkmm/eventbox.h>
#include <gtkmm/label.h>
#include <glom/utility_widgets/layoutwidgetbase.h>
#include <glom/utility_widgets/layoutwidgetutils.h>
@@ -37,7 +36,7 @@ namespace DataWidgetChildren
{
class Label
-: public Gtk::EventBox,
+: public Gtk::Bin, /* TODO: Derive directly from Label? */
public LayoutWidgetUtils
{
public:
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 016a52f..3e83945 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -44,7 +44,6 @@ namespace Glom
FlowTableWithFields::Info::Info()
: m_first(nullptr),
- m_first_eventbox(nullptr),
m_second(nullptr),
m_checkbutton(nullptr)
{
@@ -189,16 +188,7 @@ void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& g
flow_table->set_vertical_spacing(get_vertical_spacing());
flow_table->show();
- auto event_box = Gtk::manage( new Gtk::EventBox() ); //TODO_Leak: Valgrind says this is possibly leaked.
- event_box->add(*flow_table);
- event_box->set_visible_window(false);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
- event_box->signal_button_press_event().connect_notify(sigc::mem_fun (*flow_table,
- &FlowTableWithFields::on_event_box_button_press_event));
-#endif
- event_box->show();
-
- frame->add(*event_box);
+ frame->add(*flow_table);
if(!group_title.empty()) //Don't indent if it has no title, to allow use of groups just for positioning.
{
@@ -207,15 +197,15 @@ void FlowTableWithFields::add_layout_group(const std::shared_ptr<LayoutGroup>& g
const int BASE_INDENT = 3;
//std::cout << "title= " << group_title << ", with_indent=" << with_indent << std::endl;
- event_box->set_margin_top(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
+ flow_table->set_margin_top(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
if(with_indent)
{
- event_box->set_margin_start(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL) + BASE_INDENT);
+ flow_table->set_margin_start(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL) + BASE_INDENT);
}
else
{
- event_box->set_margin_start(BASE_INDENT);
+ flow_table->set_margin_start(BASE_INDENT);
}
}
@@ -396,24 +386,15 @@ void FlowTableWithFields::add_layout_notebook(const std::shared_ptr<LayoutItem_N
flow_table->set_vertical_spacing(get_vertical_spacing());
flow_table->show();
- // Put the new flowtable in an event box to catch events
- auto event_box = Gtk::manage( new Gtk::EventBox() ); //TODO_Leak: Valgrind says this is possibly
leaked.
- event_box->add(*flow_table);
- event_box->set_visible_window(false);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
- event_box->signal_button_press_event().connect_notify(sigc::mem_fun (*flow_table,
&FlowTableWithFields::on_event_box_button_press_event));
-#endif
- event_box->show();
-
//Put some space between the page child and the page edges.
//This doesn't work (probably because we haven't implemented it in our custom container),
//so we use GtkWidget margins instead. TODO: What's the difference.
- event_box->set_margin_start(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
- event_box->set_margin_end(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
- event_box->set_margin_top(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
- event_box->set_margin_bottom(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
+ flow_table->set_margin_start(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
+ flow_table->set_margin_end(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
+ flow_table->set_margin_top(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
+ flow_table->set_margin_bottom(Utils::to_utype(Glom::UiUtils::DefaultSpacings::SMALL));
- notebook_widget->append_page(*event_box, *tab_label);
+ notebook_widget->append_page(*flow_table, *tab_label);
//Add child items:
for(const auto& child_item : group->get_items())
@@ -493,15 +474,8 @@ void FlowTableWithFields::add_field(const std::shared_ptr<LayoutItem_Field>& lay
label->set_valign(Gtk::Align::START); //Center is neater next to entries, but center is silly next to
large images.
}
- auto eventbox = Gtk::manage(new Gtk::EventBox());
- if(info.m_first)
- eventbox->add(*info.m_first);
-
- eventbox->set_halign(Gtk::Align::START);
- info.m_first_eventbox = eventbox; //Remember it so we can retrieve the column number later from FlowTable.
- eventbox->set_visible_window(false);
-
- add_widgets(*eventbox, *(info.m_second), true);
+ info.m_first->set_halign(Gtk::Align::START);
+ add_widgets(*(info.m_first), *(info.m_second), true);
info.m_second->signal_edited().connect( sigc::bind(sigc::mem_fun(*this,
&FlowTableWithFields::on_entry_edited), layoutitem_field) );
info.m_second->signal_choices_changed().connect( sigc::bind(sigc::mem_fun(*this,
&FlowTableWithFields::on_entry_choices_changed), layoutitem_field) );
@@ -1192,15 +1166,11 @@ void FlowTableWithFields::apply_size_groups_to_labels(const type_vec_sizegroups&
if(!label)
continue;
- auto label_parent = info.m_first_eventbox;
- if(!label_parent)
- continue;
-
//Only align labels in the first column, because items in separate columns
//couldn't be aligned vertically anyway, and this would cause extra space.
//TODO: Use a different SizeGroup for items in 2nd columns?
guint column = 0;
- const auto ready = get_column_for_first_widget(*label_parent, column);
+ const auto ready = get_column_for_first_widget(*label, column);
if(!ready)
continue;
@@ -1304,12 +1274,6 @@ void FlowTableWithFields::on_menu_delete_activate()
}
}
-void FlowTableWithFields::on_event_box_button_press_event(Gdk::EventButton& button_event)
-{
- // Re-use the handler for the parent FlowTableWithFields:
- on_button_press_event(button_event);
-}
-
bool FlowTableWithFields::on_button_press_event(Gdk::EventButton& button_event)
{
auto pApp = AppWindow::get_appwindow();
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index 591f26a..031d173 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -41,7 +41,6 @@
#include <glom/mode_design/layout/treestore_layout.h> //Forthe enum.
#include <gtkmm/checkbutton.h>
#include <gtkmm/sizegroup.h>
-#include <gtkmm/eventbox.h>
#include <gtkmm/box.h>
#include <unordered_map>
#include <vector>
@@ -221,7 +220,6 @@ private:
std::shared_ptr<const LayoutItem_Field> m_field; //Store the field information so we know the title, ID,
and type.
Gtk::Widget* m_first;
- Gtk::EventBox* m_first_eventbox; //The label is often inside an eventbox.
Glib::RefPtr<Gtk::SizeGroup> m_first_in_sizegroup; //Just to avoid a warning when removing a widget not
in a group.
DataWidget* m_second;
@@ -285,8 +283,6 @@ 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(Gdk::EventButton& event) override;
-
- void on_event_box_button_press_event(Gdk::EventButton& event);
#endif // !GLOM_ENABLE_CLIENT_ONLY
};
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 5f496c4..6f51b54 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -21,7 +21,6 @@
#include "flowtable.h"
#include <libglom/algorithms_utils.h>
#include <iostream>
-#include <gtkmm/eventbox.h>
#include <gdkmm/window.h>
#include <glom/utils_ui.h>
@@ -233,12 +232,6 @@ bool FlowTable::get_column_for_first_widget(const Gtk::Widget& first, guint& col
child->measure(Gtk::Orientation::HORIZONTAL, width, width_min, width_natural, baseline_min,
baseline_natural);
//std::cout << G_STRFUNC << ": Calling get_child_line() with child=" << child << ", for first=" << &first
<< std::endl;
- //Get the internal parent GtkEventBox, if any,
- //though we need a derived get_child_line() to do this automatically:
- const auto parent = child->get_parent();
- if(dynamic_cast<const Gtk::EventBox*>(parent))
- child = parent;
-
column = get_child_line(*child, width_natural);
return true;
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index eba26b5..a115e1c 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -56,7 +56,7 @@ ImageGlom::ImageGlom()
}
ImageGlom::ImageGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
-: Gtk::EventBox(cobject) /*,
+: Gtk::Bin(cobject) /*,
m_ev_view(nullptr),
m_ev_document_model(nullptr) */
{
@@ -213,7 +213,7 @@ bool ImageGlom::on_button_press_event(Gdk::EventButton& button_event)
}
}
- return Gtk::EventBox::on_button_press_event(button_event);
+ return Gtk::Bin::on_button_press_event(button_event);
}
AppWindow* ImageGlom::get_appwindow() const
@@ -247,7 +247,7 @@ Gnome::Gda::Value ImageGlom::get_value() const
void ImageGlom::on_size_allocate(const Gtk::Allocation& allocation, int baseline, Gtk::Allocation& out_clip)
{
- Gtk::EventBox::on_size_allocate(allocation, baseline, out_clip);
+ Gtk::Bin::on_size_allocate(allocation, baseline, out_clip);
//Resize the GtkImage if necessary:
if(m_pixbuf_original)
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index 623f3fc..38e3de7 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -21,7 +21,6 @@
#ifndef GLOM_UTILITY_WIDGETS_IMAGE_GLOM_H
#define GLOM_UTILITY_WIDGETS_IMAGE_GLOM_H
-#include <gtkmm/eventbox.h>
#include <gtkmm/image.h>
#include <gtkmm/menu.h>
#include <libglom/data_structure/field.h>
@@ -39,7 +38,7 @@ namespace Glom
class AppWindow;
class ImageGlom
-: public Gtk::EventBox,
+: public Gtk::Bin,
public LayoutWidgetField
{
public:
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index 5b88021..37b7d81 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -47,7 +47,6 @@ void NotebookLabel::init()
{
add(m_label);
m_label.show();
- set_visible_window (false);
setup_menu(this);
}
@@ -130,7 +129,7 @@ bool NotebookLabel::on_button_press_event(Gdk::EventButton& button_event)
return true; //handled.
}
- return Gtk::EventBox::on_button_press_event(button_event);
+ return Gtk::Bin::on_button_press_event(button_event);
}
} //namespace Glom
diff --git a/glom/utility_widgets/notebooklabelglom.h b/glom/utility_widgets/notebooklabelglom.h
index c6294c2..37e897e 100644
--- a/glom/utility_widgets/notebooklabelglom.h
+++ b/glom/utility_widgets/notebooklabelglom.h
@@ -22,7 +22,6 @@
#define GLOM_UTILITY_WIDGETS_NOTEBOOK_LABEL_GLOM_H
#include "notebookglom.h"
-#include <gtkmm/eventbox.h>
#include <gtkmm/label.h>
#include <gtkmm/menu.h>
#include <giomm/simpleactiongroup.h>
@@ -33,7 +32,7 @@ namespace Glom
class AppWindow;
class NotebookLabel
-: public Gtk::EventBox
+: public Gtk::Bin
{
public:
explicit NotebookLabel(NotebookGlom* notebook);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]