[gtkmm-documentation] Remove Table and other deprecated classes.
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Remove Table and other deprecated classes.
- Date: Thu, 26 Jan 2012 09:01:26 +0000 (UTC)
commit 3464d7e149c7035db8eb86610a8f6684ccc77c63
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Jan 26 09:57:26 2012 +0100
Remove Table and other deprecated classes.
* docs/tutorial/C/gtkmm-tutorial-in.xml: Remove the description of Table.
Replace Table by Grid. Replace the deprecated HX and VX classes (HBox etc.)
by the corresponding X classes (Box etc.).
* docs/tutorial/C/figures/table.png: Deleted screenshot
* docs/tutorial/Makefile.am: Don't mention the deleted file.
* examples/book/assistant/examplewindow.[h|cc]:
* examples/book/clipboard/ideal/examplewindow.[h|cc]:
* examples/book/clipboard/simple/examplewindow.[h|cc]:
* examples/book/printing/advanced/examplewindow.[h|cc]:
* examples/book/printing/simple/examplewindow.[h|cc]:
* examples/book/progressbar/examplewindow.[h|cc]:
* examples/book/scrolledwindow/examplewindow.[h|cc]:
* examples/others/arrow/direction.cc:
* examples/others/dnd/dndwindow.[h|cc]:
* examples/others/tictactoe/tictactoe.cc: Replace Table by Grid.
* examples/book/drawingarea/joins/myarea.cc: Remove unused variable.
* examples/others/cellrenderercustom/cellrenderertoggle.cc: Use all variables.
* examples/book/table: Delete directory and all files in it.
* examples/Makefile.am: Don't mention the deleted files.
ChangeLog | 24 ++
docs/tutorial/C/figures/table.png | Bin 4755 -> 0 bytes
docs/tutorial/C/gtkmm-tutorial-in.xml | 229 +++-----------------
docs/tutorial/Makefile.am | 1 -
examples/Makefile.am | 6 -
examples/book/assistant/examplewindow.cc | 25 ++-
examples/book/assistant/examplewindow.h | 2 +-
examples/book/clipboard/ideal/examplewindow.cc | 17 +-
examples/book/clipboard/ideal/examplewindow.h | 2 +-
examples/book/clipboard/simple/examplewindow.cc | 17 +-
examples/book/clipboard/simple/examplewindow.h | 2 +-
examples/book/drawingarea/joins/myarea.cc | 8 +-
examples/book/printing/advanced/examplewindow.cc | 28 ++--
examples/book/printing/advanced/examplewindow.h | 6 +-
examples/book/printing/simple/examplewindow.cc | 23 ++-
examples/book/printing/simple/examplewindow.h | 6 +-
examples/book/progressbar/examplewindow.cc | 16 +-
examples/book/progressbar/examplewindow.h | 2 +-
examples/book/scrolledwindow/examplewindow.cc | 15 +-
examples/book/scrolledwindow/examplewindow.h | 2 +-
examples/book/table/examplewindow.cc | 64 ------
examples/book/table/examplewindow.h | 41 ----
examples/book/table/main.cc | 31 ---
examples/others/arrow/direction.cc | 29 ++--
.../cellrenderercustom/cellrenderertoggle.cc | 2 +
examples/others/dnd/dndwindow.cc | 41 ++--
examples/others/dnd/dndwindow.h | 2 +-
examples/others/tictactoe/tictactoe.cc | 12 +-
28 files changed, 187 insertions(+), 466 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7ef8b4c..8d7be6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2012-01-26 Kjell Ahlstedt <kjell ahlstedt bredband net>
+
+ Remove Table and other deprecated classes.
+
+ * docs/tutorial/C/gtkmm-tutorial-in.xml: Remove the description of Table.
+ Replace Table by Grid. Replace the deprecated HX and VX classes (HBox etc.)
+ by the corresponding X classes (Box etc.).
+ * docs/tutorial/C/figures/table.png: Deleted screenshot
+ * docs/tutorial/Makefile.am: Don't mention the deleted file.
+ * examples/book/assistant/examplewindow.[h|cc]:
+ * examples/book/clipboard/ideal/examplewindow.[h|cc]:
+ * examples/book/clipboard/simple/examplewindow.[h|cc]:
+ * examples/book/printing/advanced/examplewindow.[h|cc]:
+ * examples/book/printing/simple/examplewindow.[h|cc]:
+ * examples/book/progressbar/examplewindow.[h|cc]:
+ * examples/book/scrolledwindow/examplewindow.[h|cc]:
+ * examples/others/arrow/direction.cc:
+ * examples/others/dnd/dndwindow.[h|cc]:
+ * examples/others/tictactoe/tictactoe.cc: Replace Table by Grid.
+ * examples/book/drawingarea/joins/myarea.cc: Remove unused variable.
+ * examples/others/cellrenderercustom/cellrenderertoggle.cc: Use all variables.
+ * examples/book/table: Delete directory and all files in it.
+ * examples/Makefile.am: Don't mention the deleted files.
+
2011-11-22 Murray Cumming <murrayc murrayc com>
Add back use of Gtk::Application, though it is not ready yet.
diff --git a/docs/tutorial/C/gtkmm-tutorial-in.xml b/docs/tutorial/C/gtkmm-tutorial-in.xml
index f0d396c..00216a9 100644
--- a/docs/tutorial/C/gtkmm-tutorial-in.xml
+++ b/docs/tutorial/C/gtkmm-tutorial-in.xml
@@ -389,10 +389,10 @@ Openismus has more <ulink url="http://www.openismus.com/documents/linux/automake
<sect1 id="sec-widgets-overview">
<title>Widgets</title>
<para>>kmm; applications consist of windows containing widgets, such as buttons and text boxes. In some other systems, widgets are called "controls". For each widget in your application's windows, there is a C++ object in your application's code. So you just need to call a method of the widget's class to affect the visible widget.</para>
- <para>Widgets are arranged inside container widgets such as frames and notebooks, in a hierarchy of widgets within widgets. Some of these container widgets, such as <classname>Gtk::Grid</classname>, are not visible - they exist only to arrange other widgets. Here is some example code that adds 2 <classname>Gtk::Button</classname> widgets to a <classname>Gtk::VBox</classname> container widgets:
+ <para>Widgets are arranged inside container widgets such as frames and notebooks, in a hierarchy of widgets within widgets. Some of these container widgets, such as <classname>Gtk::Grid</classname>, are not visible - they exist only to arrange other widgets. Here is some example code that adds 2 <classname>Gtk::Button</classname> widgets to a <classname>Gtk::Box</classname> container widget:
<programlisting>m_box.pack_start(m_Button1);
m_box.pack_start(m_Button2);</programlisting>
-and here is how to add the <classname>Gtk::VBox</classname>, containing those buttons, to a <classname>Gtk::Frame</classname>, which has a visible frame and title:
+and here is how to add the <classname>Gtk::Box</classname>, containing those buttons, to a <classname>Gtk::Frame</classname>, which has a visible frame and title:
<programlisting>m_frame.add(m_box);</programlisting>
</para>
<para>
@@ -626,7 +626,7 @@ takes no arguments, but it isn't visible yet. When we call Gtk::Main::run(), giv
<listitem><simpara><classname>Gtk::Adjustment</classname> and <classname>IconSet</classname> and <classname>Gdk::Cursor</classname> are now used via <classname>Glib::RefPtr</classname>.</simpara></listitem>
-<listitem><simpara><classname>Gtk::Box</classname>, <classname>Gtk::ButtonBox</classname>, <classname>Gtk::IconView</classname>, <classname>Gtk::Paned</classname>, <classname>Gtk::ProgressBar</classname>, <classname>Gtk::ScaleButton</classname>, <classname>Gtk::ScrollBar</classname> and <classname>Gtk::Separator</classname> now derive from <classname>Gtk::Orientable</classname>, allowing their
+<listitem><simpara><classname>Gtk::Box</classname>, <classname>Gtk::ButtonBox</classname>, <classname>Gtk::IconView</classname>, <classname>Gtk::Paned</classname>, <classname>Gtk::ProgressBar</classname>, <classname>Gtk::ScaleButton</classname>, <classname>Gtk::Scrollbar</classname> and <classname>Gtk::Separator</classname> now derive from <classname>Gtk::Orientable</classname>, allowing their
orientation (vertical or horizontal) to be specified without requiring the use of a derived class such as <classname>Gtk::HBox</classname>.</simpara></listitem>
<listitem><simpara><classname>Gtk::IconView</classname>, <classname>Gtk::TextView</classname>, <classname>Gtk::TreeView</classname> and other widgets derive from Scrollable instead of having their own methods such as <methodname>get_vadjustment()</methodname> and instead of having their won set_scroll_adjustments signal.</simpara></listitem>
@@ -1025,9 +1025,8 @@ widget, such as, a <classname>Gtk::Entry</classname>, or a
</para>
<para>
-There are horizontal and vertical scrollbar classes -
-<classname>Gtk::HScrollbar</classname> and
-<classname>Gtk::VScrollbar</classname>.
+The orientation of a <classname>Gtk::Scrollbar</classname> can be either
+horizontal or vertical.
</para>
<para><ulink url="&url_refdocs_base_gtk;Scrollbar.html">Reference</ulink></para>
@@ -1047,9 +1046,8 @@ inactivity before a screensaver takes over the screen.
</para>
<para>
-As with <classname>Scrollbar</classname>s, there are separate widget types for
-horizontal and vertical widgets - <classname>Gtk::HScale</classname> and
-<classname>Gtk::VScale</classname>. The default constructors create an
+As with <classname>Scrollbar</classname>s, the orientation can be either
+horizontal or vertical. The default constructor creates an
<classname>Adjustment</classname> with all of its values set to
<literal>0.0</literal>. This isn't useful so you will need to set some
<classname>Adjustment</classname> details to get meaningful behaviour.
@@ -1631,7 +1629,7 @@ such as showing an image as well as text.
<para>
All container widgets derive from <classname>Gtk::Container</classname>, not
always directly. Some container widgets, such as
-<classname>Gtk::Table</classname> can hold many child widgets, so these
+<classname>Gtk::Grid</classname> can hold many child widgets, so these
typically have more complex interfaces. Others, such as
<classname>Gtk::Frame</classname> contain only one child widget.
</para>
@@ -1685,14 +1683,13 @@ title. For instance, you might place a group of
<title>Paned</title>
<para>
-Panes divide a widget into two halves, separated by a moveable divider. There
-are two such widgets: <classname>Gtk::HPaned</classname> adds a horizontal
-divider, and <classname>Gtk::VPaned</classname> adds a vertical one. Other
-than the names and the orientations, there's no difference between the two.
+Panes divide a widget into two halves, separated by a moveable divider.
+The two halves (panes) can be oriented either horizontally (side by side) or
+vertically (one above the other).
</para>
<para>
-Unlike the other widgets in this chapter, pane widgets contain not one but two
+Unlike the other widgets in this section, pane widgets contain not one but two
child widgets, one in each pane. Therefore, you should use
<methodname>add1()</methodname> and <methodname>add2()</methodname> instead of the
<methodname>add()</methodname> method.
@@ -1911,8 +1908,7 @@ in >kmm; are descendants of <classname>Gtk::Bin</classname>, including
Yes, that's correct: a Window can contain at most one widget. How, then, can
we use a window for anything useful? By placing a multiple-child container in
the window. The most useful container widgets are
-<classname>Gtk:Grid</classname>, <classname>Gtk:VBox</classname>,
-<classname>Gtk::HBox</classname>, and <classname>Gtk::Table</classname>.
+<classname>Gtk:Grid</classname> and <classname>Gtk:Box</classname>.
</para>
@@ -1929,20 +1925,12 @@ insert child widgets.
<listitem>
<para>
-<classname>Gtk::VBox</classname> and <classname>Gtk::HBox</classname> arrange
-their child widgets vertically and horizontally, respectively. Use
+<classname>Gtk::Box</classname> arranges its child widgets vertically or horizontally. Use
<methodname>pack_start()</methodname> and <methodname>pack_end()</methodname> to insert
child widgets.
</para>
</listitem>
-<listitem>
-<para>
-<classname>Gtk::Table</classname> arranges its widgets in a grid. Use
-<methodname>attach()</methodname> to insert widgets.
-</para>
-</listitem>
-
</itemizedlist>
<para>
@@ -2003,11 +1991,10 @@ boxes to create the desired effect.
The <methodname>pack_start()</methodname> and
<methodname>pack_end()</methodname> methods place widgets inside these
containers. The <methodname>pack_start()</methodname> method will start at
-the top and work its way down in a <classname>VBox</classname>, or pack left to
-right in an <classname>HBox</classname>.
-<methodname>pack_end()</methodname> will do the opposite, packing from
-bottom to top in a <classname>VBox</classname>, or right to left in an
-<classname>HBox</classname>. Using these methods allows us to right justify or
+the top and work its way down in a <classname>Box</classname> with vertical
+orientation, or pack left to right in a <classname>Box</classname> with horizontal
+orientation. <methodname>pack_end()</methodname> will do the opposite, packing from
+bottom to top or from right to left. Using these methods allows us to right justify or
left justify our widgets. We will use <methodname>pack_start()</methodname>
in most of our examples.
</para>
@@ -2033,9 +2020,9 @@ different styles, as shown in this picture:
</figure>
<para>
-Each line contains one horizontal box (<classname>HBox</classname>) with
+Each line contains one horizontal <classname>Box</classname> with
several buttons. Each of the buttons on a line is packed into the
-<classname>HBox</classname> with the same arguments to the
+<classname>Box</classname> with the same arguments to the
<methodname>pack_start()</methodname> method).
</para>
@@ -2109,10 +2096,8 @@ Here is the source code for the example that produced the screenshots above. Whe
<title>ButtonBoxes</title>
<para>
-Button boxes are a convenient way to quickly arrange a group of buttons. They
-come in both horizontal (<classname>Gtk::HButtonBox</classname>) and vertical
-(<classname>Gtk::VButtonBox</classname>) flavours. They are exactly alike,
-except in name and orientation.
+Button boxes are a convenient way to quickly arrange a group of buttons. Their
+orientation can be either horizontal or vertical.
</para>
<para>
@@ -2195,159 +2180,13 @@ spanning two columns.
<title>Table</title>
<para>
-Tables allows us to place widgets in a grid, similar to <classname>Gtk::Grid</classname>.
-</para>
-
-<sect3 id="table-constructor"><title>Constructor</title>
-<para>
-The grid's dimensions need to be specified in the constructor:
-</para>
-<programlisting>Gtk::Table(int rows = 1, int columns = 1, bool homogeneous = false);</programlisting>
-
-<para>
-The first argument is the number of rows to make in the table, while the
-second, obviously, is the number of columns. If
-<parameter>homogeneous</parameter> is <literal>true</literal>, the table cells
-will all be the same size (the size of the largest widget in the table).
-</para>
-
-<para>
-The rows and columns are indexed starting at 0. If you specify
-<parameter>rows</parameter> = 2 and <parameter>columns</parameter> = 2, the
-layout would look something like this:
-</para>
-
-<programlisting>
- 0 1 2
-0+----------+----------+
- | | |
-1+----------+----------+
- | | |
-2+----------+----------+
-</programlisting>
-
-<para>
-Note that the coordinate system starts in the upper left hand corner.
-</para>
-</sect3>
-
-<sect3 id="table-adding-widgets"><title>Adding widgets</title>
-<para>
-To place a widget into a box, use the following method:
-</para>
-<programlisting>void Gtk::Table::attach(Gtk::Widget& child,
- guint left_attach, guint right_attach,
- guint top_attach, guint bottom_attach,
- guint xoptions = Gtk::FILL | Gtk::EXPAND,
- guint yoptions = Gtk::FILL | Gtk::EXPAND,
- guint xpadding = 0, guint ypadding = 0);</programlisting>
-<para>
-The first argument is the widget you wish to place in the table.
-</para>
-
-<para>
-The <parameter>left_attach</parameter> and
-<parameter>right_attach</parameter> arguments specify where to place the
-widget, and how many boxes to use. For example, if you want a button in the
-lower-right cell of a 2 x 2 table, and want it to occupy that cell
-<emphasis>only</emphasis>, then <parameter>left_attach</parameter> would
-be 1, <parameter>right_attach</parameter> 2,
-<parameter>top_attach</parameter> 1, and
-<parameter>bottom_attach</parameter> 2. If, on the other hand, you
-wanted a widget to take up the entire top row of our 2 x 2 table, you'd set
-<parameter>left_attach</parameter> = 0,
-<parameter>right_attach</parameter> = 2,
-<parameter>top_attach</parameter> = 0, and
-<parameter>bottom_attach</parameter> = 1.
-</para>
-
-<para>
-<parameter>xoptions</parameter> and <parameter>yoptions</parameter> are used to
-specify packing options and may be bitwise ORed together to allow multiple
-options. These options are:
-</para>
-
-<para>
-<variablelist>
-
-<varlistentry>
-<term><literal>Gtk::FILL</literal></term>
-<listitem>
-<para>
-If the table box is larger than the widget, and
-<literal>Gtk::FILL</literal> is specified, the widget will expand to use all the room available.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><literal>Gtk::SHRINK</literal></term>
-<listitem>
-<para>
-If the table widget is allocated less
-space than it requested (because the user resized the window),
-then the widgets will normally just disappear off the bottom of the
-window. If <literal>Gtk::SHRINK</literal> is specified, the widgets
-will shrink with the table.
+<classname>Gtk::Table</classname> allows us to place widgets in a grid,
+similar to <classname>Gtk::Grid</classname>.
</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><literal>Gtk::EXPAND</literal></term>
-<listitem>
-<para>This will cause the table to expand to use up anyremaining space in the window.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-</para>
-
<para>
-The padding arguments work just as they do for
-<methodname>pack_start()</methodname>.
+<classname>Gtk::Table</classname> is deprecated from >kmm; version 3.4 and should
+not be used in newly-written code. Use <classname>Gtk::Grid</classname> instead.
</para>
-</sect3>
-
-<sect3 id="table-other-methods"><title>Other methods</title>
-
-<para>
-<methodname>set_row_spacing()</methodname> and
-<methodname>set_col_spacing()</methodname> set the spacing between
-the rows at the specified row or column. Note that for columns, the space goes
-to the right of the column, and for rows, the space goes below the row.
-</para>
-
-<para>
-You can also set a consistent spacing for all rows and/or columns with
-<methodname>set_row_spacings()</methodname> and
-<methodname>set_col_spacings()</methodname>. Note that with these calls, the last
-row and last column do not get any spacing.
-</para>
-
-<para><ulink url="&url_refdocs_base_gtk;Table.html">Reference</ulink></para>
-
-</sect3>
-
-<sect3 id="table-example"><title>Example</title>
-<para>
-In the following example, we make a window with three buttons in a 2 x 2
-table. The first two buttons will be placed in the upper row. A
-third button is placed in the lower row, spanning both columns.
-</para>
-
-<figure id="figure-table">
- <title>Table</title>
- <screenshot>
- <graphic format="PNG" fileref="&url_figures_base;table.png"/>
- </screenshot>
-</figure>
-
-<para><ulink url="&url_examples_base;table">Source Code</ulink></para>
-
-</sect3>
-
</sect2>
<sect2 id="sec-notebook">
@@ -3786,9 +3625,9 @@ arbitrary numbers.
</para>
<para>
The group which treats the values as arbitrary numbers includes the
-<classname>Range</classname> widgets (<classname>Scrollbars</classname> and
-<classname>Scales</classname>, the <classname>Progressbar</classname> widget,
-and the <classname>SpinButton</classname> widget). These widgets are typically
+<classname>Range</classname> widgets (<classname>Scrollbar</classname> and
+<classname>Scale</classname>), the <classname>ScaleButton</classname> widget,
+and the <classname>SpinButton</classname> widget. These widgets are typically
"adjusted" directly by the user with the mouse or keyboard. They will treat the
<parameter>lower</parameter> and <parameter>upper</parameter> values of an
adjustment as a range within which the user can manipulate the adjustment's
@@ -3813,7 +3652,7 @@ widget. You can set it up like this:
<programlisting>// creates its own adjustments
Gtk::TextView textview;
// uses the newly-created adjustment for the scrollbar as well
-Gtk::VScrollbar vscrollbar (*(textview.get_vadjustment()));</programlisting>
+Gtk::Scrollbar vscrollbar (textview.get_vadjustment(), Gtk::ORIENTATION_VERTICAL);</programlisting>
</sect1>
@@ -3912,7 +3751,7 @@ Gtk::RadioButton
Gtk::Range
Gtk::ScrolledWindow
Gtk::Separator
-Gtk::Table
+Gtk::Table (deprecated from >kmm; version 3.4)
Gtk::Toolbar</programlisting>
<para>
@@ -4840,7 +4679,7 @@ the drop was successful.
<para><ulink url="&url_examples_base;drag_and_drop">Source Code</ulink></para>
<para>
-There is a more complex example in examples/dnd.
+There is a more complex example in examples/others/dnd.
</para>
</sect1>
@@ -5319,7 +5158,7 @@ Gtk::Widget* CustomPrintOperation::on_create_custom_widget()
{
set_custom_tab_label("My custom tab");
- Gtk::HBox* hbox = new Gtk::HBox(false, 8);
+ Gtk::Box* hbox = new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 8);
hbox->set_border_width(6);
Gtk::Label* label = Gtk::manage(new Gtk::Label("Enter some text: "));
@@ -7165,7 +7004,7 @@ instance, you cannot use the copyright sign (©).
<para>This example implements a container with two child widgets, one above
the other. Of course, in this case it would be far simpler just to use
- a <classname>Gtk::VBox</classname>.</para>
+ a vertical <classname>Gtk::Box</classname>.</para>
<figure id="figure-custom-container">
<title>Custom Container</title>
diff --git a/docs/tutorial/Makefile.am b/docs/tutorial/Makefile.am
index 679864c..814c9ab 100644
--- a/docs/tutorial/Makefile.am
+++ b/docs/tutorial/Makefile.am
@@ -81,7 +81,6 @@ DOC_FIGURES = \
figures/socket-fail.png \
figures/socket.png \
figures/spinbutton.png \
- figures/table.png \
figures/textview.png \
figures/toolbar.png \
figures/toolpalette.png \
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 640b630..4649746 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -84,7 +84,6 @@ check_PROGRAMS = \
book/socket/socket \
book/spinbutton/example \
book/statusicon/example \
- book/table/example \
book/textview/example \
book/timeout/timeout \
book/toolbar/example \
@@ -526,11 +525,6 @@ book_spinbutton_example_SOURCES = \
book_statusicon_example_SOURCES = \
book/statusicon/main.cc
-book_table_example_SOURCES = \
- book/table/examplewindow.cc \
- book/table/examplewindow.h \
- book/table/main.cc
-
book_textview_example_SOURCES = \
book/textview/examplewindow.cc \
book/textview/examplewindow.h \
diff --git a/examples/book/assistant/examplewindow.cc b/examples/book/assistant/examplewindow.cc
index f26bdc2..80883c7 100644
--- a/examples/book/assistant/examplewindow.cc
+++ b/examples/book/assistant/examplewindow.cc
@@ -18,24 +18,33 @@
#include "exampleassistant.h"
ExampleWindow::ExampleWindow()
-: m_table(3, 2),
- m_button("Show the assistant"),
+: m_button("Show the assistant"),
m_label1("State of assistant checkbutton:"),
m_label2("Contents of assistant entry:")
{
set_title("Gtk::Assistant example");
set_border_width(12);
- m_table.attach(m_button, 0, 2, 0, 1, Gtk::FILL, Gtk::EXPAND);
- m_table.attach(m_label1, 0, 1, 1, 2, Gtk::FILL, Gtk::EXPAND);
- m_table.attach(m_label2, 0, 1, 2, 3, Gtk::FILL, Gtk::EXPAND);
- m_table.attach(m_check, 1, 2, 1, 2);
- m_table.attach(m_entry, 1, 2, 2, 3);
- add(m_table);
+ m_grid.set_row_homogeneous(true);
+ m_grid.attach(m_button, 0, 0, 2, 1);
+ m_button.set_hexpand(true);
+ m_button.set_valign(Gtk::ALIGN_CENTER);
+
+ m_grid.attach(m_label1, 0, 1, 1, 1);
m_label1.set_alignment(0.0, 0.5);
+
+ m_grid.attach(m_label2, 0, 2, 1, 1);
m_label2.set_alignment(0.0, 0.5);
+ m_grid.attach(m_check, 1, 1, 1, 1);
+ m_check.set_halign(Gtk::ALIGN_START);
+
+ m_grid.attach(m_entry, 1, 2, 1, 1);
+ m_entry.set_hexpand(true);
+
+ add(m_grid);
+
m_button.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_button_clicked));
m_assistant.signal_apply().connect(sigc::mem_fun(*this,
diff --git a/examples/book/assistant/examplewindow.h b/examples/book/assistant/examplewindow.h
index 7724221..63be91c 100644
--- a/examples/book/assistant/examplewindow.h
+++ b/examples/book/assistant/examplewindow.h
@@ -32,7 +32,7 @@ private:
void on_assistant_apply();
// Child widgets:
- Gtk::Table m_table;
+ Gtk::Grid m_grid;
Gtk::Button m_button;
Gtk::Label m_label1, m_label2;
Gtk::CheckButton m_check;
diff --git a/examples/book/clipboard/ideal/examplewindow.cc b/examples/book/clipboard/ideal/examplewindow.cc
index 0df2c6a..348d972 100644
--- a/examples/book/clipboard/ideal/examplewindow.cc
+++ b/examples/book/clipboard/ideal/examplewindow.cc
@@ -31,10 +31,9 @@ const char example_target_text[] = "UTF8_STRING";
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Label("Select cells in the table, click Copy, then open a second instance "
+ m_Label("Select cells in the grid, click Copy, then open a second instance "
"of this example to try pasting the copied data.\nOr try pasting the "
"text representation into gedit."),
- m_Table(2, 2, true),
m_ButtonA1("A1"), m_ButtonA2("A2"), m_ButtonB1("B1"), m_ButtonB2("B2"),
m_Button_Copy(Gtk::Stock::COPY), m_Button_Paste(Gtk::Stock::PASTE)
{
@@ -45,12 +44,14 @@ ExampleWindow::ExampleWindow()
m_VBox.pack_start(m_Label, Gtk::PACK_SHRINK);
- //Fill Table:
- m_VBox.pack_start(m_Table);
- m_Table.attach(m_ButtonA1, 0, 1, 0, 1);
- m_Table.attach(m_ButtonA2, 1, 2, 0, 1);
- m_Table.attach(m_ButtonB1, 0, 1, 1, 2);
- m_Table.attach(m_ButtonB2, 1, 2, 1, 2);
+ //Fill Grid:
+ m_VBox.pack_start(m_Grid);
+ m_Grid.set_row_homogeneous(true);
+ m_Grid.set_column_homogeneous(true);
+ m_Grid.attach(m_ButtonA1, 0, 0, 1, 1);
+ m_Grid.attach(m_ButtonA2, 1, 0, 1, 1);
+ m_Grid.attach(m_ButtonB1, 0, 1, 1, 1);
+ m_Grid.attach(m_ButtonB2, 1, 1, 1, 1);
//Add ButtonBox to bottom:
m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
diff --git a/examples/book/clipboard/ideal/examplewindow.h b/examples/book/clipboard/ideal/examplewindow.h
index 9575711..aa5e339 100644
--- a/examples/book/clipboard/ideal/examplewindow.h
+++ b/examples/book/clipboard/ideal/examplewindow.h
@@ -46,7 +46,7 @@ protected:
Gtk::Label m_Label;
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::ToggleButton m_ButtonA1, m_ButtonA2, m_ButtonB1, m_ButtonB2;
Gtk::ButtonBox m_ButtonBox;
diff --git a/examples/book/clipboard/simple/examplewindow.cc b/examples/book/clipboard/simple/examplewindow.cc
index 431d61d..ee12dfc 100644
--- a/examples/book/clipboard/simple/examplewindow.cc
+++ b/examples/book/clipboard/simple/examplewindow.cc
@@ -20,9 +20,8 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Label("Select cells in the table, click Copy, then open a second "
+ m_Label("Select cells in the grid, click Copy, then open a second "
"instance of this example to try pasting the copied data."),
- m_Table(2, 2, true),
m_ButtonA1("A1"), m_ButtonA2("A2"), m_ButtonB1("B1"), m_ButtonB2("B2"),
m_Button_Copy(Gtk::Stock::COPY), m_Button_Paste(Gtk::Stock::PASTE)
{
@@ -33,12 +32,14 @@ ExampleWindow::ExampleWindow()
m_VBox.pack_start(m_Label, Gtk::PACK_SHRINK);
- //Fill Table:
- m_VBox.pack_start(m_Table);
- m_Table.attach(m_ButtonA1, 0, 1, 0, 1);
- m_Table.attach(m_ButtonA2, 1, 2, 0, 1);
- m_Table.attach(m_ButtonB1, 0, 1, 1, 2);
- m_Table.attach(m_ButtonB2, 1, 2, 1, 2);
+ //Fill Grid:
+ m_VBox.pack_start(m_Grid);
+ m_Grid.set_row_homogeneous(true);
+ m_Grid.set_column_homogeneous(true);
+ m_Grid.attach(m_ButtonA1, 0, 0, 1, 1);
+ m_Grid.attach(m_ButtonA2, 1, 0, 1, 1);
+ m_Grid.attach(m_ButtonB1, 0, 1, 1, 1);
+ m_Grid.attach(m_ButtonB2, 1, 1, 1, 1);
//Add ButtonBox to bottom:
m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);
diff --git a/examples/book/clipboard/simple/examplewindow.h b/examples/book/clipboard/simple/examplewindow.h
index 8a31ed8..9d1a867 100644
--- a/examples/book/clipboard/simple/examplewindow.h
+++ b/examples/book/clipboard/simple/examplewindow.h
@@ -38,7 +38,7 @@ protected:
Gtk::Label m_Label;
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::ToggleButton m_ButtonA1, m_ButtonA2, m_ButtonB1, m_ButtonB2;
Gtk::ButtonBox m_ButtonBox;
diff --git a/examples/book/drawingarea/joins/myarea.cc b/examples/book/drawingarea/joins/myarea.cc
index bc4d43f..086cb09 100644
--- a/examples/book/drawingarea/joins/myarea.cc
+++ b/examples/book/drawingarea/joins/myarea.cc
@@ -37,13 +37,9 @@ bool MyArea::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
const int width = allocation.get_width();
const int height = allocation.get_height();
- // coordinates for the center of the window
- int xc, yc;
- xc = width / 2;
- yc = height / 2;
-
cr->set_line_width(10.0);
+ // Scale to unit square
cr->scale(width, height);
cr->save();
cr->set_source_rgb(1, 1, 1);
@@ -53,7 +49,7 @@ bool MyArea::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
cr->move_to(0.3, 0.3);
cr->rel_line_to(0.2, -0.2);
cr->rel_line_to(0.2, 0.2);
- cr->set_line_join(Cairo::LINE_JOIN_MITER); /* def ault */
+ cr->set_line_join(Cairo::LINE_JOIN_MITER); /* default */
cr->stroke();
cr->move_to(0.3, 0.6);
cr->rel_line_to(0.2, -0.2);
diff --git a/examples/book/printing/advanced/examplewindow.cc b/examples/book/printing/advanced/examplewindow.cc
index af1f2fa..7708790 100644
--- a/examples/book/printing/advanced/examplewindow.cc
+++ b/examples/book/printing/advanced/examplewindow.cc
@@ -15,19 +15,15 @@
*/
#include "examplewindow.h"
-#include "previewdialog.h"
#include "printformoperation.h"
-
+#include "previewdialog.h"
#include <iostream>
-#include <pangomm.h>
-
const Glib::ustring app_title = "gtkmm Printing Example";
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Table(3, 2),
m_NameLabel("Name"),
m_SurnameLabel("Surname"),
m_CommentsLabel("Comments")
@@ -44,23 +40,27 @@ ExampleWindow::ExampleWindow()
build_main_menu();
- m_VBox.pack_start(m_Table);
+ m_VBox.pack_start(m_Grid);
- //Arrange the widgets inside the table:
- m_Table.attach(m_NameLabel, 0, 1, 0, 1);
- m_Table.attach(m_NameEntry, 1, 2, 0, 1);
+ //Arrange the widgets inside the grid:
+ m_Grid.set_row_spacing(5);
+ m_Grid.set_column_spacing(5);
+ m_Grid.attach(m_NameLabel, 0, 0, 1, 1);
+ m_Grid.attach(m_NameEntry, 1, 0, 1, 1);
- m_Table.attach(m_SurnameLabel, 0, 1, 1, 2, Gtk::SHRINK);
- m_Table.attach(m_SurnameEntry, 1, 2, 1, 2);
+ m_Grid.attach(m_SurnameLabel, 0, 1, 1, 1);
+ m_Grid.attach(m_SurnameEntry, 1, 1, 1, 1);
- //Add the TreeView, inside a ScrolledWindow:
+ //Add the TextView, inside a ScrolledWindow:
m_ScrolledWindow.add(m_TextView);
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- m_Table.attach(m_CommentsLabel, 0, 1, 2, 3, Gtk::SHRINK);
- m_Table.attach(m_ScrolledWindow, 1, 2, 2, 3);
+ m_Grid.attach(m_CommentsLabel, 0, 2, 1, 1);
+ m_Grid.attach(m_ScrolledWindow, 1, 2, 1, 1);
+ m_ScrolledWindow.set_hexpand(true);
+ m_ScrolledWindow.set_vexpand(true);
m_refTextBuffer = Gtk::TextBuffer::create();
m_TextView.set_buffer(m_refTextBuffer);
diff --git a/examples/book/printing/advanced/examplewindow.h b/examples/book/printing/advanced/examplewindow.h
index 9d7f7b7..43e343d 100644
--- a/examples/book/printing/advanced/examplewindow.h
+++ b/examples/book/printing/advanced/examplewindow.h
@@ -17,10 +17,6 @@
#ifndef GTKMM_EXAMPLEWINDOW_H
#define GTKMM_EXAMPLEWINDOW_H
-#include <memory>
-#include <vector>
-
-#include <pangomm.h>
#include <gtkmm.h>
class PrintFormOperation;
@@ -57,7 +53,7 @@ protected:
//Child widgets:
Gtk::Box m_VBox;
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::Label m_NameLabel;
Gtk::Entry m_NameEntry;
diff --git a/examples/book/printing/simple/examplewindow.cc b/examples/book/printing/simple/examplewindow.cc
index 2dcd09f..f784d3f 100644
--- a/examples/book/printing/simple/examplewindow.cc
+++ b/examples/book/printing/simple/examplewindow.cc
@@ -25,7 +25,6 @@ const Glib::ustring app_title = "gtkmm Printing Example";
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL),
- m_Table(3, 2),
m_NameLabel("Name"),
m_SurnameLabel("Surname"),
m_CommentsLabel("Comments")
@@ -42,23 +41,27 @@ ExampleWindow::ExampleWindow()
build_main_menu();
- m_VBox.pack_start(m_Table);
+ m_VBox.pack_start(m_Grid);
- //Arrange the widgets inside the table:
- m_Table.attach(m_NameLabel, 0, 1, 0, 1);
- m_Table.attach(m_NameEntry, 1, 2, 0, 1);
+ //Arrange the widgets inside the grid:
+ m_Grid.set_row_spacing(5);
+ m_Grid.set_column_spacing(5);
+ m_Grid.attach(m_NameLabel, 0, 0, 1, 1);
+ m_Grid.attach(m_NameEntry, 1, 0, 1, 1);
- m_Table.attach(m_SurnameLabel, 0, 1, 1, 2, Gtk::SHRINK);
- m_Table.attach(m_SurnameEntry, 1, 2, 1, 2);
+ m_Grid.attach(m_SurnameLabel, 0, 1, 1, 1);
+ m_Grid.attach(m_SurnameEntry, 1, 1, 1, 1);
- //Add the TreeView, inside a ScrolledWindow:
+ //Add the TextView, inside a ScrolledWindow:
m_ScrolledWindow.add(m_TextView);
//Only show the scrollbars when they are necessary:
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- m_Table.attach(m_CommentsLabel, 0, 1, 2, 3, Gtk::SHRINK);
- m_Table.attach(m_ScrolledWindow, 1, 2, 2, 3);
+ m_Grid.attach(m_CommentsLabel, 0, 2, 1, 1);
+ m_Grid.attach(m_ScrolledWindow, 1, 2, 1, 1);
+ m_ScrolledWindow.set_hexpand(true);
+ m_ScrolledWindow.set_vexpand(true);
m_refTextBuffer = Gtk::TextBuffer::create();
m_TextView.set_buffer(m_refTextBuffer);
diff --git a/examples/book/printing/simple/examplewindow.h b/examples/book/printing/simple/examplewindow.h
index a320e16..ce80a18 100644
--- a/examples/book/printing/simple/examplewindow.h
+++ b/examples/book/printing/simple/examplewindow.h
@@ -17,10 +17,6 @@
#ifndef GTKMM_EXAMPLEWINDOW_H
#define GTKMM_EXAMPLEWINDOW_H
-#include <memory>
-#include <vector>
-
-#include <pangomm.h>
#include <gtkmm.h>
class PrintFormOperation;
@@ -58,7 +54,7 @@ protected:
//Child widgets:
Gtk::Box m_VBox;
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::Label m_NameLabel;
Gtk::Entry m_NameEntry;
diff --git a/examples/book/progressbar/examplewindow.cc b/examples/book/progressbar/examplewindow.cc
index 028b8c4..fce1d4b 100644
--- a/examples/book/progressbar/examplewindow.cc
+++ b/examples/book/progressbar/examplewindow.cc
@@ -22,7 +22,6 @@
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL, 5),
m_Alignment(0.5, 0.5, 0, 0),
- m_Table(2, 2, true),
m_CheckButton_Text("Show text"),
m_CheckButton_Activity("Activity mode"),
m_CheckButton_Inverted("Right to Left"),
@@ -45,23 +44,24 @@ ExampleWindow::ExampleWindow()
&ExampleWindow::on_timeout), 50 );
m_VBox.pack_start(m_Separator, Gtk::PACK_SHRINK);
- m_VBox.pack_start(m_Table);
+ m_VBox.pack_start(m_Grid);
+ m_Grid.set_row_homogeneous(true);
//Add a check button to select displaying of the trough text:
- m_Table.attach(m_CheckButton_Text, 0, 1, 0, 1, Gtk::EXPAND | Gtk::FILL,
- Gtk::EXPAND | Gtk::FILL, 5, 5);
+ m_Grid.attach(m_CheckButton_Text, 0, 0, 1, 1);
+ m_CheckButton_Text.property_margin() = 5;
m_CheckButton_Text.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_text) );
//Add a check button to toggle activity mode:
- m_Table.attach(m_CheckButton_Activity, 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL,
- Gtk::EXPAND | Gtk::FILL, 5, 5);
+ m_Grid.attach(m_CheckButton_Activity, 0, 1, 1, 1);
+ m_CheckButton_Activity.property_margin() = 5;
m_CheckButton_Activity.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_activity) );
//Add a check button to select growth from left to right or from right to left:
- m_Table.attach(m_CheckButton_Inverted, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL,
- Gtk::EXPAND | Gtk::FILL, 5, 5);
+ m_Grid.attach(m_CheckButton_Inverted, 0, 2, 1, 1);
+ m_CheckButton_Inverted.property_margin() = 5;
m_CheckButton_Inverted.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_inverted) );
diff --git a/examples/book/progressbar/examplewindow.h b/examples/book/progressbar/examplewindow.h
index 6f20526..649ff88 100644
--- a/examples/book/progressbar/examplewindow.h
+++ b/examples/book/progressbar/examplewindow.h
@@ -38,7 +38,7 @@ protected:
//Child widgets:
Gtk::Box m_VBox;
Gtk::Alignment m_Alignment;
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::ProgressBar m_ProgressBar;
Gtk::Separator m_Separator;
Gtk::CheckButton m_CheckButton_Text, m_CheckButton_Activity, m_CheckButton_Inverted;
diff --git a/examples/book/scrolledwindow/examplewindow.cc b/examples/book/scrolledwindow/examplewindow.cc
index ac1f047..76334ad 100644
--- a/examples/book/scrolledwindow/examplewindow.cc
+++ b/examples/book/scrolledwindow/examplewindow.cc
@@ -20,8 +20,7 @@
#include <cstdio>
ExampleWindow::ExampleWindow()
-: m_Table(10, 10),
- m_Button_Close("Close")
+: m_Button_Close("Close")
{
set_title("Gtk::ScrolledWindow example");
set_border_width(0);
@@ -39,13 +38,13 @@ ExampleWindow::ExampleWindow()
get_content_area()->pack_start(m_ScrolledWindow);
/* set the spacing to 10 on x and 10 on y */
- m_Table.set_row_spacings(10);
- m_Table.set_col_spacings(10);
+ m_Grid.set_row_spacing(10);
+ m_Grid.set_column_spacing(10);
- /* pack the table into the scrolled window */
- m_ScrolledWindow.add(m_Table);
+ /* pack the grid into the scrolled window */
+ m_ScrolledWindow.add(m_Grid);
- /* this simply creates a grid of toggle buttons on the table
+ /* this simply creates a grid of toggle buttons
* to demonstrate the scrolled window. */
for(int i = 0; i < 10; i++)
{
@@ -54,7 +53,7 @@ ExampleWindow::ExampleWindow()
char buffer[32];
sprintf(buffer, "button (%d,%d)\n", i, j);
Gtk::Button* pButton = Gtk::manage(new Gtk::ToggleButton(buffer));
- m_Table.attach(*pButton, i, i + 1, j, j + 1);
+ m_Grid.attach(*pButton, i, j, 1, 1);
}
}
diff --git a/examples/book/scrolledwindow/examplewindow.h b/examples/book/scrolledwindow/examplewindow.h
index eb1d699..3e0e7e3 100644
--- a/examples/book/scrolledwindow/examplewindow.h
+++ b/examples/book/scrolledwindow/examplewindow.h
@@ -33,7 +33,7 @@ protected:
//Child widgets:
Gtk::ScrolledWindow m_ScrolledWindow;
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::Button m_Button_Close;
};
diff --git a/examples/others/arrow/direction.cc b/examples/others/arrow/direction.cc
index 9d37051..2d4a64b 100644
--- a/examples/others/arrow/direction.cc
+++ b/examples/others/arrow/direction.cc
@@ -1,7 +1,7 @@
/* example-start arrow arrow.c */
#include <gtkmm/arrow.h>
-#include <gtkmm/table.h>
+#include <gtkmm/grid.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/main.h>
@@ -36,37 +36,36 @@ public:
AppWindow::AppWindow()
{
ArrowButton* button = 0;
- Gtk::Table* table = 0;
+ Gtk::Grid* grid = 0;
set_title ("Arrow Buttons");
/* Sets the border width of the window. */
set_border_width (10);
- /* Create a box to hold the arrows/buttons */
- table= Gtk::manage (new Gtk::Table (3, 3, true));
- table->set_border_width (2);
+ /* Create a grid to hold the arrows/buttons */
+ grid = Gtk::manage (new Gtk::Grid ());
+ grid->set_row_homogeneous(true);
+ grid->set_column_homogeneous(true);
+ grid->set_border_width (2);
/* Pack and show all our widgets */
button = Gtk::manage (new ArrowButton (Gtk::ARROW_UP, Gtk::SHADOW_ETCHED_IN));
- table->attach (*button, 1, 2, 0, 1);
+ grid->attach (*button, 1, 0, 1, 1);
button = Gtk::manage (new ArrowButton (Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_IN));
- table->attach (*button, 0, 1, 1, 2);
+ grid->attach (*button, 0, 1, 1, 1);
button = Gtk::manage (new ArrowButton (Gtk::ARROW_RIGHT, Gtk::SHADOW_ETCHED_IN));
- table->attach (*button, 2, 3, 1, 2);
+ grid->attach (*button, 2, 1, 1, 1);
button = Gtk::manage (new ArrowButton (Gtk::ARROW_DOWN, Gtk::SHADOW_ETCHED_IN));
- table->attach (*button, 1, 2, 2, 3);
+ grid->attach (*button, 1, 2, 1, 1);
- table->set_row_spacing(0, 5);
- table->set_row_spacing(1, 5);
-
- table->set_col_spacing(0, 5);
- table->set_col_spacing(1, 5);
+ grid->set_row_spacing(5);
+ grid->set_column_spacing(5);
- add (*table);
+ add (*grid);
show_all ();
}
diff --git a/examples/others/cellrenderercustom/cellrenderertoggle.cc b/examples/others/cellrenderercustom/cellrenderertoggle.cc
index dea68db..4a22047 100644
--- a/examples/others/cellrenderercustom/cellrenderertoggle.cc
+++ b/examples/others/cellrenderercustom/cellrenderertoggle.cc
@@ -198,6 +198,8 @@ void MyCellRendererToggle::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
if((flags & Gtk::CELL_RENDERER_SELECTED) != 0)
state = (widget.has_focus()) ? Gtk::STATE_FLAG_SELECTED : Gtk::STATE_FLAG_ACTIVE;
+ widget.get_style_context()->set_state(state);
+
if(property_radio_)
{
widget.get_style_context()->render_option(
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index de29274..8f4691a 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -22,8 +22,7 @@
#include <iostream>
DnDWindow::DnDWindow()
-: m_Table(2, 2),
- m_Label_Drop("Drop here\n"), m_Label_Popup("Popup\n"),
+: m_Label_Drop("Drop here\n"), m_Label_Popup("Popup\n"),
m_Button("Drag Here\n"),
m_have_drag(false),
m_PopupWindow(Gtk::WINDOW_POPUP)
@@ -31,7 +30,7 @@ DnDWindow::DnDWindow()
m_popped_up = false;
m_in_popup = false;
- add(m_Table);
+ add(m_Grid);
m_drag_icon = Gdk::Pixbuf::create_from_xpm_data(drag_icon_xpm);
m_trashcan_open = Gdk::Pixbuf::create_from_xpm_data(trashcan_open_xpm);
@@ -49,15 +48,15 @@ DnDWindow::DnDWindow()
m_Label_Drop.signal_drag_data_received().connect( sigc::mem_fun(*this, &DnDWindow::on_label_drop_drag_data_received) );
- m_Table.attach(m_Label_Drop, 0, 1, 0, 1,
- Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
- 0, 0);
+ m_Grid.attach(m_Label_Drop, 0, 0, 1, 1);
+ m_Label_Drop.set_hexpand(true);
+ m_Label_Drop.set_vexpand(true);
m_Label_Popup.drag_dest_set(m_listTargetsNoRoot, Gtk::DEST_DEFAULT_ALL, Gdk::DragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
- m_Table.attach(m_Label_Popup, 1, 2, 1, 2,
- Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
- 0, 0);
+ m_Grid.attach(m_Label_Popup, 1, 1, 1, 1);
+ m_Label_Popup.set_hexpand(true);
+ m_Label_Popup.set_vexpand(true);
m_Label_Popup.signal_drag_motion().connect( sigc::mem_fun(*this, &DnDWindow::on_label_popup_drag_motion) );
m_Label_Popup.signal_drag_leave().connect( sigc::mem_fun(*this, &DnDWindow::on_label_popup_drag_leave) );
@@ -65,9 +64,9 @@ DnDWindow::DnDWindow()
m_Image.set(m_trashcan_closed);
m_Image.drag_dest_set();
- m_Table.attach(m_Image, 1, 2, 0, 1,
- Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
- 0, 0);
+ m_Grid.attach(m_Image, 1, 0, 1, 1);
+ m_Image.set_hexpand(true);
+ m_Image.set_vexpand(true);
m_Image.signal_drag_leave().connect( sigc::mem_fun(*this, &DnDWindow::on_image_drag_leave) );
m_Image.signal_drag_motion().connect( sigc::mem_fun(*this, &DnDWindow::on_image_drag_motion) );
@@ -81,9 +80,9 @@ DnDWindow::DnDWindow()
m_Button.drag_source_set_icon(m_drag_icon);
- m_Table.attach(m_Button, 0, 1, 1, 2,
- Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
- 0, 0);
+ m_Grid.attach(m_Button, 0, 1, 1, 1);
+ m_Button.set_hexpand(true);
+ m_Button.set_vexpand(true);
m_Button.signal_drag_data_get().connect( sigc::mem_fun(*this, &DnDWindow::on_button_drag_data_get));
m_Button.signal_drag_data_delete().connect( sigc::mem_fun(*this, &DnDWindow::on_button_drag_data_delete));
@@ -238,8 +237,8 @@ void DnDWindow::create_popup()
{
m_PopupWindow.set_position(Gtk::WIN_POS_MOUSE);
- //Create Table and fill it:
- Gtk::Table* pTable = Gtk::manage(new Gtk::Table(3, 3, false));
+ //Create Grid and fill it:
+ Gtk::Grid* pGrid = Gtk::manage(new Gtk::Grid());
for(int i = 0; i < 3; i++)
{
@@ -248,17 +247,15 @@ void DnDWindow::create_popup()
char buffer[128];
g_snprintf(buffer, sizeof(buffer), "%d,%d", i, j);
Gtk::Button* pButton = Gtk::manage(new Gtk::Button(buffer));
- pTable->attach(*pButton, i, i+1, j, j+1,
- Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL,
- 0, 0);
+ pGrid->attach(*pButton, i, j, 1, 1);
pButton->drag_dest_set(m_listTargetsNoRoot, Gtk::DEST_DEFAULT_ALL, Gdk::DragAction(GDK_ACTION_COPY | GDK_ACTION_MOVE));
pButton->signal_drag_motion().connect( sigc::mem_fun(*this, &DnDWindow::on_popup_button_drag_motion) ); pButton->signal_drag_leave().connect( sigc::mem_fun(*this, &DnDWindow::on_popup_button_drag_leave) );
}
}
- pTable->show_all();
- m_PopupWindow.add(*pTable);
+ pGrid->show_all();
+ m_PopupWindow.add(*pGrid);
}
bool DnDWindow::on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>&, int, int, guint)
diff --git a/examples/others/dnd/dndwindow.h b/examples/others/dnd/dndwindow.h
index 7e5ee98..43807de 100644
--- a/examples/others/dnd/dndwindow.h
+++ b/examples/others/dnd/dndwindow.h
@@ -53,7 +53,7 @@ protected:
//Member widgets:
- Gtk::Table m_Table;
+ Gtk::Grid m_Grid;
Gtk::Label m_Label_Drop, m_Label_Popup;
Gtk::Image m_Image;
Gtk::Button m_Button;
diff --git a/examples/others/tictactoe/tictactoe.cc b/examples/others/tictactoe/tictactoe.cc
index 40a1419..886434b 100644
--- a/examples/others/tictactoe/tictactoe.cc
+++ b/examples/others/tictactoe/tictactoe.cc
@@ -19,15 +19,17 @@
* Boston, MA 02111-1307, USA.
*/
#include <gtkmm.h>
-#include <gtkmm/table.h>
+#include <gtkmm/grid.h>
#include <gtkmm/togglebutton.h>
#include "tictactoe.h"
TicTacToe::TicTacToe()
: Gtk::Box(Gtk::ORIENTATION_VERTICAL)
{
- Gtk::Table* table = Gtk::manage( new Gtk::Table(3, 3, true) );
- add( *table);
+ Gtk::Grid* grid = Gtk::manage( new Gtk::Grid() );
+ grid->set_row_homogeneous(true);
+ grid->set_column_homogeneous(true);
+ add( *grid);
for(int i=0;i<3; i++)
{
@@ -35,7 +37,7 @@ TicTacToe::TicTacToe()
{
Gtk::ToggleButton* button = 0;
buttons[i][j] = button = Gtk::manage( new Gtk::ToggleButton());
- table->attach(*button, i, i+1, j, j+1);
+ grid->attach(*button, i, j, 1, 1);
button->signal_toggled().connect( sigc::bind(
sigc::mem_fun(*this, &TicTacToe::toggle),
button));
@@ -43,7 +45,7 @@ TicTacToe::TicTacToe()
}
}
- table->show_all();
+ grid->show_all();
}
TicTacToe::~TicTacToe()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]