[gtkmm-documentation] Update the description of Box to gtkmm3 status.



commit 9fb377e5fb2521b7d89a5aacbfb6e704e0fd2791
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Nov 22 10:35:52 2012 +0100

    Update the description of Box to gtkmm3 status.
    
    * docs/tutorial/C/gtkmm-tutorial-in.xml: Update the description of the Box
    constructor. Mention set_homogeneous().
    * docs/tutorial/C/figures/box_packing[1|2|3].png:
    * examples/book/box/examplewindow.[h|cc]: Show set_homogeneous(true|false)
    in the windows.
    * examples/book/box/packbox.[h|cc]: Use Glib::ustring::format() instead of
    sprintf().

 ChangeLog                                |   12 ++++++++++++
 docs/tutorial/C/figures/box_packing1.png |  Bin 9388 -> 28153 bytes
 docs/tutorial/C/figures/box_packing2.png |  Bin 7688 -> 24333 bytes
 docs/tutorial/C/figures/box_packing3.png |  Bin 4489 -> 9397 bytes
 docs/tutorial/C/gtkmm-tutorial-in.xml    |   17 ++++++++++-------
 examples/book/box/examplewindow.cc       |   28 ++++++++++++++--------------
 examples/book/box/examplewindow.h        |    3 +--
 examples/book/box/packbox.cc             |    5 +----
 examples/book/box/packbox.h              |    4 +---
 9 files changed, 39 insertions(+), 30 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 38bce30..5d6433d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-11-22  Kjell Ahlstedt <kjell ahlstedt bredband net>
+
+	Update the description of Box to gtkmm3 status.
+
+	* docs/tutorial/C/gtkmm-tutorial-in.xml: Update the description of the Box
+	constructor. Mention set_homogeneous().
+	* docs/tutorial/C/figures/box_packing[1|2|3].png:
+	* examples/book/box/examplewindow.[h|cc]: Show set_homogeneous(true|false)
+	in the windows.
+	* examples/book/box/packbox.[h|cc]: Use Glib::ustring::format() instead of
+	sprintf().
+
 2012-11-20  Kjell Ahlstedt <kjell ahlstedt bredband net>
 
 	Fix the book/box example.
diff --git a/docs/tutorial/C/figures/box_packing1.png b/docs/tutorial/C/figures/box_packing1.png
index 38575cf..1af334b 100644
Binary files a/docs/tutorial/C/figures/box_packing1.png and b/docs/tutorial/C/figures/box_packing1.png differ
diff --git a/docs/tutorial/C/figures/box_packing2.png b/docs/tutorial/C/figures/box_packing2.png
index 0bee73b..1783b12 100644
Binary files a/docs/tutorial/C/figures/box_packing2.png and b/docs/tutorial/C/figures/box_packing2.png differ
diff --git a/docs/tutorial/C/figures/box_packing3.png b/docs/tutorial/C/figures/box_packing3.png
index a7b31ab..b8f655b 100644
Binary files a/docs/tutorial/C/figures/box_packing3.png and b/docs/tutorial/C/figures/box_packing3.png differ
diff --git a/docs/tutorial/C/gtkmm-tutorial-in.xml b/docs/tutorial/C/gtkmm-tutorial-in.xml
index f62526e..d75047d 100644
--- a/docs/tutorial/C/gtkmm-tutorial-in.xml
+++ b/docs/tutorial/C/gtkmm-tutorial-in.xml
@@ -2047,7 +2047,7 @@ several buttons. Each of the buttons on a line is packed into the
 This is the declaration of the <methodname>pack_start()</methodname> method:
 </para>
 <programlisting>void pack_start(Gtk::Widget&amp; child,
-                PackOptions options = PACK_EXPAND_WIDGET,
+                Gtk::PackOptions options = Gtk::PACK_EXPAND_WIDGET,
                 guint padding = 0);</programlisting>
 
 <para>
@@ -2057,9 +2057,9 @@ The first argument is the widget you're packing. In our example these are all <c
 <para>
 The <parameter>options</parameter> argument can take one of these three options:
 <itemizedlist>
-<listitem><para><literal>PACK_SHRINK</literal>: Space is contracted to the child widget size. The widget will take up just-enough space and never expand.</para></listitem>
-<listitem><para><literal>PACK_EXPAND_PADDING</literal>: Extra space is filled with padding. The widgets will be spaced out evenly, but their sizes won't change - there will be empty space between the widgets instead. </para></listitem>
-<listitem><para><literal>PACK_EXPAND_WIDGET</literal>: Extra space is taken up by increasing the child widget size, without changing the amount of space between widgets.</para></listitem>
+<listitem><para><literal>Gtk::PACK_SHRINK</literal>: Space is contracted to the child widget size. The widget will take up just-enough space and never expand.</para></listitem>
+<listitem><para><literal>Gtk::PACK_EXPAND_PADDING</literal>: Extra space is filled with padding. The widgets will be spaced out evenly, but their sizes won't change - there will be empty space between the widgets instead. </para></listitem>
+<listitem><para><literal>Gtk::PACK_EXPAND_WIDGET</literal>: Extra space is taken up by increasing the child widget size, without changing the amount of space between widgets.</para></listitem>
 </itemizedlist>
 </para>
 
@@ -2074,9 +2074,12 @@ border area to leave around the packed widget.
 
 <sect4 id="per-container-packing-options"><title>Per-container packing options</title>
 <para>
-Here's the constructor for the box widgets:
-<programlisting>Gtk::Box(bool homogeneous = false, int spacing = 0);</programlisting>
-Passing <literal>true</literal> for <parameter>homogeneous</parameter> will
+Here's the constructor for the <classname>Box</classname> widget,
+and methods that set per-container packing options:
+<programlisting>Gtk::Box(Gtk::Orientation orientation = Gtk::ORIENTATION_HORIZONTAL, int spacing = 0);
+void set_spacing(int spacing);
+void set_homogeneous(bool homogeneous = true);</programlisting>
+Passing <literal>true</literal> to <methodname>set_homogeneous()</methodname> will
 cause all of the contained widgets to be the same size.
 <parameter>spacing</parameter> is a (minimum) number of pixels to leave between
 each widget.
diff --git a/examples/book/box/examplewindow.cc b/examples/book/box/examplewindow.cc
index 79a497c..cc64367 100644
--- a/examples/book/box/examplewindow.cc
+++ b/examples/book/box/examplewindow.cc
@@ -18,6 +18,7 @@
 
 #include <iostream>
 #include "examplewindow.h"
+#include "packbox.h"
 
 ExampleWindow::ExampleWindow(int which)
 : m_box1(Gtk::ORIENTATION_VERTICAL),
@@ -31,7 +32,7 @@ ExampleWindow::ExampleWindow(int which)
   {
     case 1:
     {
-      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0);");
+      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(false);");
 
       // Align the label to the left side.  We'll discuss this function and
       // others in the section on Widget Attributes.
@@ -60,10 +61,10 @@ ExampleWindow::ExampleWindow(int which)
       // pack the separator into the vbox.  Remember each of these
       // widgets are being packed into a vbox, so they'll be stacked
       // vertically.
-      m_box1.pack_start(m_seperator1, Gtk::PACK_SHRINK, 5);
+      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);
 
       // create another new label, and show it.
-      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0);");
+      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(true);");
       m_Label2.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
       m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);
 
@@ -75,7 +76,7 @@ ExampleWindow::ExampleWindow(int which)
       pPackBox5 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_WIDGET));
       m_box1.pack_start(*pPackBox5, Gtk::PACK_SHRINK);
 
-      m_box1.pack_start(m_seperator2, Gtk::PACK_SHRINK, 5);
+      m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);
 
       break;
     }
@@ -83,7 +84,7 @@ ExampleWindow::ExampleWindow(int which)
     case 2:
     {
 
-      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10);");
+      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); set_homogeneous(false);");
       m_Label1.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
       m_box1.pack_start(m_Label1, Gtk::PACK_SHRINK);
 
@@ -93,10 +94,9 @@ ExampleWindow::ExampleWindow(int which)
       pPackBox2 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_WIDGET));
       m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);
 
-      m_box1.pack_start(m_seperator1, Gtk::PACK_SHRINK, 5);
+      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);
 
-
-      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0);");
+      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(false);");
       m_Label2.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
       m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);
 
@@ -106,7 +106,7 @@ ExampleWindow::ExampleWindow(int which)
       pPackBox4 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET, 10));
       m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);
 
-      m_box1.pack_start(m_seperator2, Gtk::PACK_SHRINK, 5);
+      m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);
 
       break;
     }
@@ -126,15 +126,15 @@ ExampleWindow::ExampleWindow(int which)
 
       m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);
 
-      // this explicitly sets the separator to 400 pixels wide by 5 pixels
-      // high.  This is so the hbox we created will also be 400 pixels wide,
+      // this explicitly sets the separator to 500 pixels wide by 5 pixels
+      // high.  This is so the hbox we created will also be 500 pixels wide,
       // and the "end" label will be separated from the other labels in the
       // hbox.  Otherwise, all the widgets in the hbox would be packed as
       // close together as possible.
-      m_seperator1.set_size_request(400, 5);
+      m_separator1.set_size_request(500, 5);
 
-      // pack the separator into ourselves
-      m_box1.pack_start(m_seperator1, Gtk::PACK_SHRINK, 5);
+      // pack the separator into the vbox.
+      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);
 
       break;
     }
diff --git a/examples/book/box/examplewindow.h b/examples/book/box/examplewindow.h
index 75b13ed..a4961c8 100644
--- a/examples/book/box/examplewindow.h
+++ b/examples/book/box/examplewindow.h
@@ -20,7 +20,6 @@
 #define GTKMM_EXAMPLEWINDOW_H
 
 #include <gtkmm.h>
-#include "packbox.h"
 
 class ExampleWindow : public Gtk::Window
 {
@@ -40,7 +39,7 @@ protected:
 
   Gtk::Label m_Label1, m_Label2;
 
-  Gtk::Separator m_seperator1, m_seperator2, m_seperator3, m_seperator4, m_seperator5;
+  Gtk::Separator m_separator1, m_separator2;
 };
 
 #endif //GTKMM_EXAMPLEWINDOW_H
diff --git a/examples/book/box/packbox.cc b/examples/book/box/packbox.cc
index 755cc9c..9fde9d2 100644
--- a/examples/book/box/packbox.cc
+++ b/examples/book/box/packbox.cc
@@ -17,7 +17,6 @@
  */
 
 #include "packbox.h"
-#include <cstdio> //For sprintf().
 
 PackBox::PackBox(bool homogeneous, int spacing, Gtk::PackOptions options,
         int padding)
@@ -34,9 +33,7 @@ PackBox::PackBox(bool homogeneous, int spacing, Gtk::PackOptions options,
   pack_start(m_button2, options, padding);
   pack_start(m_button3, options, padding);
 
-  sprintf(padstr, "%d);", padding);
-
-  m_pbutton4 = new Gtk::Button(padstr);
+  m_pbutton4 = new Gtk::Button(Glib::ustring::format(padding) + ");");
   pack_start(*m_pbutton4, options, padding);
 }
 
diff --git a/examples/book/box/packbox.h b/examples/book/box/packbox.h
index aad3136..59f4ac3 100644
--- a/examples/book/box/packbox.h
+++ b/examples/book/box/packbox.h
@@ -24,14 +24,12 @@
 class PackBox : public Gtk::Box
 {
 public:
-  PackBox(bool homogeneous, int spacing, Gtk::PackOptions, int padding = 0);
+  PackBox(bool homogeneous, int spacing, Gtk::PackOptions options, int padding = 0);
   virtual ~PackBox();
 
 protected:
   Gtk::Button m_button1, m_button2, m_button3;
   Gtk::Button* m_pbutton4;
-
-  char padstr[80];
 };
 
 #endif //GTKMM_EXAMPLE_PACKBOX_H



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