[gtkmm-documentation] Remove Gtk::EventBox example



commit c1ba3efedcd230d225021e98ac8ee996184905bd
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Aug 6 16:18:29 2017 +0200

    Remove Gtk::EventBox example
    
    and remove all mentioning of add_events() and set_events().
    Both Gtk::EventBox, Gtk::Widget::add_events() and Gtk::Widget::set_events()
    have been removed from gtkmm.
    Remove EventBox from other example programs. All widgets can now receive
    events.

 docs/tutorial/C/figures/eventbox.png             |  Bin 3815 -> 0 bytes
 docs/tutorial/C/index-in.docbook                 |  112 +---------------------
 docs/tutorial/Makefile.am                        |    1 -
 examples/Makefile.am                             |    6 -
 examples/book/eventbox/examplewindow.cc          |   49 ----------
 examples/book/eventbox/examplewindow.h           |   37 -------
 examples/book/eventbox/main.cc                   |   28 ------
 examples/book/menus/popup/examplewindow.cc       |    8 +-
 examples/book/menus/popup/examplewindow.h        |    1 -
 examples/others/cellrenderercustom/popupentry.cc |   16 +---
 examples/others/cellrenderercustom/popupentry.h  |    4 +-
 11 files changed, 10 insertions(+), 252 deletions(-)
---
diff --git a/docs/tutorial/C/index-in.docbook b/docs/tutorial/C/index-in.docbook
index 9edc203..2b0c8f4 100644
--- a/docs/tutorial/C/index-in.docbook
+++ b/docs/tutorial/C/index-in.docbook
@@ -3063,9 +3063,6 @@ entering text. To be notified of these events, connect to the
 <programlisting>Gtk::Entry* entry = m_Combo.get_entry();
 if (entry)
 {
-  // The Entry shall receive focus-out events.
-  entry->add_events(Gdk::FOCUS_CHANGE_MASK);
-
   // Alternatively you can connect to m_Combo.signal_changed().
   entry->signal_changed().connect(sigc::mem_fun(*this,
     &amp;ExampleWindow::on_entry_changed) );
@@ -3906,103 +3903,6 @@ writing a new type of range widget.
 
 </chapter>
 
-<chapter id="chapter-widgets-without-xwindows">
-<title>Widgets Without X-Windows</title>
-
-<para>
-Some Widgets do not have an associated X-Window, so they therefore do not
-receive X events. This means that the signals described in the  <link
-    linkend="sec-xeventsignals">X event signals</link> section will not be
-emitted. If you want to capture events for these widgets you can use a special
-container called <classname>Gtk::EventBox</classname>, which is described in
-the <link linkend="sec-eventbox">EventBox</link> section.
-</para>
-
-<para>
-Here is a list of some of these Widgets:
-</para>
-<programlisting>Gtk::AspectFrame
-Gtk::Bin
-Gtk::Box
-Gtk::Button
-Gtk::CheckButton
-Gtk::Fixed
-Gtk::Frame
-Gtk::Grid
-Gtk::Image
-Gtk::Label
-Gtk::MenuItem
-Gtk::Notebook
-Gtk::Paned
-Gtk::RadioButton
-Gtk::Range
-Gtk::ScrolledWindow
-Gtk::Separator
-Gtk::Toolbar</programlisting>
-
-<para>
-These widgets are mainly used for decoration or layout, so you won't often need
-to capture events on them. They are intended to have no X-Window in order to improve performance.
-</para>
-
-<sect1 id="sec-eventbox">
-<title>EventBox</title>
-
-<para>
-Some &gtkmm; widgets don't have associated X windows; they draw on
-their parents' windows. Because of this, they cannot receive events.
-Also, if they are incorrectly sized, they don't clip, so you can get
-messy overwriting etc. To receive events on one of these widgets, you can place it
-inside an <classname>EventBox</classname> widget and then call
-<methodname>Gtk::Widget::set_events()</methodname> on the EventBox before showing it.</para>
-
-<para>Although the name
-<classname>EventBox</classname> emphasises the event-handling method, the
-widget can also be used for clipping (and more; see the example below).
-</para>
-<!--
-<para>TODO: Why don't they have X Windows - explain clipping.
-Also, how does this affect platform such as Windows and MacOS that don't use X.
-</para>
--->
-
-<para>
-The constructor for <classname>Gtk::EventBox</classname> is:
-</para>
-
-<programlisting>Gtk::EventBox();</programlisting>
-
-<para>
-A child widget can be added to the <classname>EventBox</classname> using:
-</para>
-
-<programlisting>event_box.add(child_widget);</programlisting>
-
-<para><ulink url="&url_refdocs_base_gtk;EventBox.html">Reference</ulink></para>
-
-<sect2 id="eventbox-example">
-<title>Example</title>
-<para>
-The following example demonstrates both uses of an
-<classname>EventBox</classname> - a label is created that is clipped to a small
-box, and set up so that a mouse-click on the label causes the program to exit.
-Resizing the window reveals varying amounts of the label.
-</para>
-
-<figure id="figure-eventbox">
-  <title>EventBox</title>
-  <screenshot>
-    <graphic format="PNG" fileref="&url_figures_base;eventbox.png"/>
-  </screenshot>
-</figure>
-
-<para><ulink url="&url_examples_base;eventbox">Source Code</ulink></para>
-</sect2>
-
-</sect1>
-
-</chapter>
-
 <chapter id="chapter-dialogs">
 <title>Dialogs</title>
 
@@ -5769,9 +5669,7 @@ if (info)
       a signal handler to handle such events.
     </para>
     <para>
-      To receive the keyboard events, you must first call the
-      <methodname>Gtk::Widget::add_events()</methodname> function with a bit
-      mask of the events you're interested in. The event signal handler will
+      The event signal handler will
       receive an argument that depends on the type of event. For keyboard
       events it's a <type>GdkEventKey*</type>. As discribed in the
       <link linkend="sec-xeventsignals">appendix</link>, the event signal handler
@@ -5806,7 +5704,6 @@ Gtk::Entry m_entry; // in a class definition
 // in the class constructor
 m_entry.signal_key_press_event().connect( sigc::ptr_fun(&amp;on_key_press_or_release_event) );
 m_entry.signal_key_release_event().connect( sigc::ptr_fun(&amp;on_key_press_or_release_event) );
-m_entry.add_events(Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
 </programlisting>
     </para>
 
@@ -8696,13 +8593,6 @@ Handling an X event doesn't affect the Widget's other signals. If you handle
 <literal>clicked</literal> signal. They are emitted at (nearly) the same time.
 </para>
 
-<para>Note also that not all widgets receive all X events by default. To receive additional
-X events, you can use <methodname>Gtk::Widget::set_events()</methodname> before showing the
-widget, or <methodname>Gtk::Widget::add_events()</methodname> after showing the widget. However,
-some widgets must first be placed inside an <classname>EventBox</classname> widget. See
-the <link linkend="chapter-widgets-without-xwindows">Widgets Without X-Windows</link> chapter.
-</para>
-
 <para>
 Here's a simple example:
 <programlisting>
diff --git a/docs/tutorial/Makefile.am b/docs/tutorial/Makefile.am
index 33b625e..1948b1d 100644
--- a/docs/tutorial/Makefile.am
+++ b/docs/tutorial/Makefile.am
@@ -70,7 +70,6 @@ HELP_MEDIA =                                  \
        figures/entry_completion.png            \
        figures/entry_icon.png          \
        figures/entry_progress.png              \
-       figures/eventbox.png                    \
        figures/expander.png                    \
        figures/filechooserbutton.png           \
        figures/frame.png                       \
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 6e2a89f..f58b10a 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -55,7 +55,6 @@ check_PROGRAMS =                                      \
        book/entry/icon/example                         \
        book/entry/progress/example                     \
        book/entry/simple/example                       \
-       book/eventbox/example                           \
        book/expander/example                           \
        book/flowbox/example                            \
        book/frame/example                              \
@@ -395,11 +394,6 @@ book_entry_simple_example_SOURCES =                \
        book/entry/simple/examplewindow.h       \
        book/entry/simple/main.cc
 
-book_eventbox_example_SOURCES =                \
-       book/eventbox/examplewindow.cc  \
-       book/eventbox/examplewindow.h   \
-       book/eventbox/main.cc
-
 book_expander_example_SOURCES =                \
        book/expander/examplewindow.cc  \
        book/expander/examplewindow.h   \
diff --git a/examples/book/menus/popup/examplewindow.cc b/examples/book/menus/popup/examplewindow.cc
index 0ca6b30..4334709 100644
--- a/examples/book/menus/popup/examplewindow.cc
+++ b/examples/book/menus/popup/examplewindow.cc
@@ -27,13 +27,11 @@ ExampleWindow::ExampleWindow()
 
   add(m_Box);
 
-  //Add an event box that can catch button_press events:
-  m_Box.pack_start(m_EventBox, Gtk::PackOptions::EXPAND_WIDGET);
-  m_EventBox.signal_button_press_event().connect(sigc::mem_fun(*this,
+  // Catch button_press events:
+  m_Box.pack_start(m_Label, Gtk::PackOptions::EXPAND_WIDGET);
+  m_Label.signal_button_press_event().connect(sigc::mem_fun(*this,
               &ExampleWindow::on_button_press_event), true);
 
-  m_EventBox.add(m_Label);
-
   //Create actions:
 
   //Fill menu:
diff --git a/examples/book/menus/popup/examplewindow.h b/examples/book/menus/popup/examplewindow.h
index 032a827..bd4faec 100644
--- a/examples/book/menus/popup/examplewindow.h
+++ b/examples/book/menus/popup/examplewindow.h
@@ -33,7 +33,6 @@ protected:
 
   //Child widgets:
   Gtk::Box m_Box;
-  Gtk::EventBox m_EventBox;
   Gtk::Label m_Label;
 
   Glib::RefPtr<Gtk::Builder> m_refBuilder;
diff --git a/examples/others/cellrenderercustom/popupentry.cc 
b/examples/others/cellrenderercustom/popupentry.cc
index 2a0dec6..f8cb767 100644
--- a/examples/others/cellrenderercustom/popupentry.cc
+++ b/examples/others/cellrenderercustom/popupentry.cc
@@ -19,30 +19,22 @@
 
 #include <gdk/gdkkeysyms.h>
 
-// 2014-09-06: The pan-[up,down,start,end]-symbolic icons are new.
-// See https://bugzilla.gnome.org/show_bug.cgi?id=729565
-// If they are not available in your selected icon theme, perhaps you can
-// use the go-[up,down,previous,next]-symbolic icons.
-
 PopupEntry::PopupEntry(const Glib::ustring& path)
 :
   Glib::ObjectBase  (typeid(PopupEntry)),
   Gtk::CellEditable (),
-  Gtk::EventBox     (),
+  Gtk::Box          (Gtk::Orientation::HORIZONTAL),
   path_             (path),
   button_           (nullptr),
   entry_            (nullptr),
   editing_canceled_ (false)
 {
-  Gtk::Box *const hbox = new Gtk::Box(Gtk::Orientation::HORIZONTAL);
-  add(*Gtk::manage(hbox));
-
   entry_ = new Gtk::Entry();
-  hbox->pack_start(*Gtk::manage(entry_), Gtk::PackOptions::EXPAND_WIDGET);
+  pack_start(*Gtk::manage(entry_), Gtk::PackOptions::EXPAND_WIDGET);
   entry_->set_has_frame(false);
 
   button_ = new Gtk::Button();
-  hbox->pack_start(*Gtk::manage(button_), Gtk::PackOptions::SHRINK);
+  pack_start(*Gtk::manage(button_), Gtk::PackOptions::SHRINK);
   button_->set_image_from_icon_name("pan-down-symbolic", Gtk::BuiltinIconSize::BUTTON, true);
 
   set_can_focus();
@@ -129,7 +121,7 @@ bool PopupEntry::on_key_press_event(Gdk::EventKey& key_event)
 
   entry_->event(synth_event);
 
-  return Gtk::EventBox::on_key_press_event(key_event);
+  return Gtk::Box::on_key_press_event(key_event);
 }
 
 void PopupEntry::start_editing_vfunc(Gdk::Event&)
diff --git a/examples/others/cellrenderercustom/popupentry.h b/examples/others/cellrenderercustom/popupentry.h
index 633f68f..17b0294 100644
--- a/examples/others/cellrenderercustom/popupentry.h
+++ b/examples/others/cellrenderercustom/popupentry.h
@@ -18,10 +18,10 @@
 #include <gtkmm/celleditable.h>
 #include <gtkmm/editable.h>
 #include <gtkmm/entry.h>
-#include <gtkmm/eventbox.h>
+#include <gtkmm/box.h>
 
 
-class PopupEntry : public Gtk::CellEditable, public Gtk::EventBox
+class PopupEntry : public Gtk::CellEditable, public Gtk::Box
 {
 public:
   explicit PopupEntry(const Glib::ustring& path);


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