[gtkmm] Demos: Fix calls to Gtk::Grid::attach().



commit be3cc6c5a5424244e9ff066ef6ee3094b6aead00
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Wed Jul 3 16:42:10 2013 +0200

    Demos: Fix calls to Gtk::Grid::attach().
    
    * demos/gtk-demo/example_appwindow.cc:
    * demos/gtk-demo/example_dialog.cc:
    * demos/gtk-demo/example_panes.cc:
    * demos/gtk-demo/example_sizegroup.cc: Fix all calls to Grid::attach().
    Those calls were not modified properly when Table was replaced by Grid.

 ChangeLog                           |   10 ++++++++++
 demos/gtk-demo/example_appwindow.cc |   27 ++++++++++-----------------
 demos/gtk-demo/example_dialog.cc    |   32 ++++++++++++++++----------------
 demos/gtk-demo/example_panes.cc     |   16 ++++++++--------
 demos/gtk-demo/example_sizegroup.cc |   34 +++++++++++++++++-----------------
 5 files changed, 61 insertions(+), 58 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 99ee1b4..410bfcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2013-07-03  Kjell Ahlstedt  <kjell ahlstedt bredband net>
 
+       Demos: Fix calls to Gtk::Grid::attach().
+
+       * demos/gtk-demo/example_appwindow.cc:
+       * demos/gtk-demo/example_dialog.cc:
+       * demos/gtk-demo/example_panes.cc:
+       * demos/gtk-demo/example_sizegroup.cc: Fix all calls to Grid::attach().
+       Those calls were not modified properly when Table was replaced by Grid.
+
+2013-07-03  Kjell Ahlstedt  <kjell ahlstedt bredband net>
+
        Fix 'make check' after the massive deprecations.
 
        * demos/Makefile.am:
diff --git a/demos/gtk-demo/example_appwindow.cc b/demos/gtk-demo/example_appwindow.cc
index 3b1aedc..1fdcd42 100644
--- a/demos/gtk-demo/example_appwindow.cc
+++ b/demos/gtk-demo/example_appwindow.cc
@@ -22,8 +22,8 @@ protected:
   Gtk::Menu m_Menubar;
   Gtk::Toolbar m_Toolbar;
   Gtk::ScrolledWindow m_ScrolledWindow;
-  Gtk::TextView m_TextView;
   Gtk::Statusbar m_Statusbar;
+  Gtk::TextView m_TextView;
 };
 
 
@@ -91,28 +91,23 @@ Example_AppWindow::Example_AppWindow()
     list_bar.push_front(MenuElem("_File", *pMenuFile));
 
     //Add the menu bar to the Grid:
-    m_Grid.attach(m_Menubar,
-                    // X direction             Y direction
-                    0, 1,                      0, 1,
-                    Gtk::FILL|Gtk::EXPAND, Gtk::AttachOptions(0)
-                    );
+    //                       left  top  width  height
+    m_Grid.attach(m_Menubar, 0,    0,   1,     1);
   } //menu
 
 */
   //Toolbar:
   {
     m_Toolbar.set_hexpand();
-    m_Grid.attach(m_Toolbar,
-                   /* X direction */       /* Y direction */
-                   0, 1,                   1, 2);
+    //                       left  top  width  height
+    m_Grid.attach(m_Toolbar, 0,    1,   1,     1);
   }
 
 
   m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   m_ScrolledWindow.set_shadow_type(Gtk::SHADOW_IN);
-  m_Grid.attach(m_ScrolledWindow,
-                 /* X direction */       /* Y direction */
-                 0, 1,                   2, 3);
+  //                              left  top  width  height
+  m_Grid.attach(m_ScrolledWindow, 0,    2,   1,     1);
 
   set_default_size(200, 200);
 
@@ -120,11 +115,9 @@ Example_AppWindow::Example_AppWindow()
 
 
   /* Create statusbar */
-   m_Statusbar.set_hexpand();
-  m_Grid.attach(m_Statusbar,
-                 /* X direction */       /* Y direction */
-                 0, 1,                   3, 4);
-
+  m_Statusbar.set_hexpand();
+  //                         left  top  width  height
+  m_Grid.attach(m_Statusbar, 0,    3,   1,     1);
 
   /* Show text widget info in the statusbar */
   Glib::RefPtr<Gtk::TextBuffer> refTextBuffer = m_TextView.get_buffer();
diff --git a/demos/gtk-demo/example_dialog.cc b/demos/gtk-demo/example_dialog.cc
index 01eca20..5240277 100644
--- a/demos/gtk-demo/example_dialog.cc
+++ b/demos/gtk-demo/example_dialog.cc
@@ -23,7 +23,7 @@ protected:
   Gtk::Box m_VBox, m_VBox2;
   Gtk::Box m_HBox, m_HBox2;
   Gtk::Button m_Button_Message, m_Button_Interactive;
-  Gtk::Grid m_Table;
+  Gtk::Grid m_Grid;
   Gtk::Label m_Label1, m_Label2;
   Gtk::Entry m_Entry1, m_Entry2;
 
@@ -42,7 +42,7 @@ public:
 protected:
   //Member widgets:
   Gtk::Box m_HBox;
-  Gtk::Grid m_Table;
+  Gtk::Grid m_Grid;
   Gtk::Label m_Label1, m_Label2;
   Gtk::Entry m_Entry1, m_Entry2;
   Gtk::Image m_Image;
@@ -88,16 +88,16 @@ Example_Dialog::Example_Dialog()
   m_VBox2.pack_start(m_Button_Interactive, Gtk::PACK_SHRINK);
 
 
-  m_Table.set_row_spacing(4);
-  m_Table.set_column_spacing(4);
-  m_HBox2.pack_start(m_Table, Gtk::PACK_SHRINK);
+  m_Grid.set_row_spacing(4);
+  m_Grid.set_column_spacing(4);
+  m_HBox2.pack_start(m_Grid, Gtk::PACK_SHRINK);
 
-  m_Table.attach(m_Label1, 0, 1, 0, 1);
-  m_Table.attach(m_Entry1, 1, 2, 0, 1);
+  m_Grid.attach(m_Label1, 0, 0, 1, 1);
+  m_Grid.attach(m_Entry1, 1, 0, 1, 1);
   m_Label1.set_mnemonic_widget(m_Entry1);
 
-  m_Table.attach(m_Label2, 0, 1, 1, 2);
-  m_Table.attach(m_Entry2, 1, 2, 1, 2);
+  m_Grid.attach(m_Label2, 0, 1, 1, 1);
+  m_Grid.attach(m_Entry2, 1, 1, 1, 1);
   m_Label2.set_mnemonic_widget(m_Entry2);
 
   show_all();
@@ -145,18 +145,18 @@ Dialog_Interactive::Dialog_Interactive(Gtk::Window& parent, const Glib::ustring&
   get_content_area()->pack_start(m_HBox, Gtk::PACK_SHRINK);
   m_HBox.pack_start(m_Image, Gtk::PACK_SHRINK);
 
-  m_Table.set_row_spacing(4);
-  m_Table.set_column_spacing(4);
-  m_HBox.pack_start(m_Table);
+  m_Grid.set_row_spacing(4);
+  m_Grid.set_column_spacing(4);
+  m_HBox.pack_start(m_Grid);
 
-  m_Table.attach(m_Label1, 0, 1, 0, 1);
+  m_Grid.attach(m_Label1, 0, 0, 1, 1);
   m_Entry1.set_text(entry1);
-  m_Table.attach(m_Entry1, 1, 2, 0, 1);
+  m_Grid.attach(m_Entry1, 1, 0, 1, 1);
   m_Label1.set_mnemonic_widget(m_Entry1);
 
-  m_Table.attach(m_Label2, 0, 1, 1, 2);
+  m_Grid.attach(m_Label2, 0, 1, 1, 1);
   m_Entry2.set_text(entry2);
-  m_Table.attach(m_Entry2,  1, 2, 1, 2);
+  m_Grid.attach(m_Entry2, 1, 1, 1, 1);
   m_Label2.set_mnemonic_widget(m_Entry2);
 
   show_all();
diff --git a/demos/gtk-demo/example_panes.cc b/demos/gtk-demo/example_panes.cc
index feb58a8..7403998 100644
--- a/demos/gtk-demo/example_panes.cc
+++ b/demos/gtk-demo/example_panes.cc
@@ -98,16 +98,16 @@ PaneOptions::PaneOptions(Gtk::Paned& paned, const Glib::ustring& frame_label,
 {
   set_border_width(4);
 
-  Gtk::Grid *const pTable = new Gtk::Grid();
-  add(*Gtk::manage(pTable));
+  Gtk::Grid *const pGrid = new Gtk::Grid();
+  add(*Gtk::manage(pGrid));
 
-  pTable->attach(*Gtk::manage(new Gtk::Label(label1)), 0, 1, 0, 1);
-  pTable->attach(*Gtk::manage(new Gtk::Label(label2)), 1, 2, 0, 1);
+  pGrid->attach(*Gtk::manage(new Gtk::Label(label1)), 0, 0, 1, 1);
+  pGrid->attach(*Gtk::manage(new Gtk::Label(label2)), 1, 0, 1, 1);
 
-  pTable->attach(m_CheckButton_resize1, 0, 1, 1, 2);
-  pTable->attach(m_CheckButton_shrink1, 0, 1, 2, 3);
-  pTable->attach(m_CheckButton_resize2, 1, 2, 1, 2);
-  pTable->attach(m_CheckButton_shrink2, 1, 2, 2, 3);
+  pGrid->attach(m_CheckButton_resize1, 0, 1, 1, 1);
+  pGrid->attach(m_CheckButton_shrink1, 0, 2, 1, 1);
+  pGrid->attach(m_CheckButton_resize2, 1, 1, 1, 1);
+  pGrid->attach(m_CheckButton_shrink2, 1, 2, 1, 1);
 
   m_CheckButton_resize1.set_active(false);
   m_CheckButton_shrink1.set_active(true);
diff --git a/demos/gtk-demo/example_sizegroup.cc b/demos/gtk-demo/example_sizegroup.cc
index 7c88168..4d4e11f 100644
--- a/demos/gtk-demo/example_sizegroup.cc
+++ b/demos/gtk-demo/example_sizegroup.cc
@@ -27,7 +27,7 @@ protected:
   virtual void on_checkbutton_toggled();
 
   typedef std::list<Glib::ustring> type_listStrings;
-  virtual void add_row(Gtk::Grid& table, int row, const Glib::RefPtr<Gtk::SizeGroup>& size_group, const 
Glib::ustring& label_text, const std::list<Glib::ustring>& options);
+  virtual void add_row(Gtk::Grid& grid, int row, const Glib::RefPtr<Gtk::SizeGroup>& size_group, const 
Glib::ustring& label_text, const std::list<Glib::ustring>& options);
   virtual Gtk::ComboBoxText* create_combobox(const std::list<Glib::ustring>& strings);
 
   virtual void on_response(int response_id);
@@ -37,7 +37,7 @@ protected:
   Gtk::Box m_VBox;
   Gtk::Box m_HBox;
   Glib::RefPtr<Gtk::SizeGroup> m_refSizeGroup;
-  Gtk::Grid m_Table_Color, m_Table_Line;
+  Gtk::Grid m_Grid_Color, m_Grid_Line;
   Gtk::CheckButton m_CheckButton;
 };
 
@@ -67,27 +67,27 @@ Example_SizeGroup::Example_SizeGroup()
    */
   m_VBox.pack_start(m_Frame_Color);
 
-  m_Table_Color.set_border_width(5);
-  m_Table_Color.set_row_spacing(5);
-  m_Table_Color.set_column_spacing(10);
-  m_Frame_Color.add(m_Table_Color);
+  m_Grid_Color.set_border_width(5);
+  m_Grid_Color.set_row_spacing(5);
+  m_Grid_Color.set_column_spacing(10);
+  m_Frame_Color.add(m_Grid_Color);
 
   type_listStrings color_options;
   color_options.push_back("Red");
   color_options.push_back("Green");
   color_options.push_back("Blue");
 
-  add_row(m_Table_Color, 0, m_refSizeGroup, "_Foreground", color_options);
-  add_row(m_Table_Color, 1, m_refSizeGroup, "_Background", color_options);
+  add_row(m_Grid_Color, 0, m_refSizeGroup, "_Foreground", color_options);
+  add_row(m_Grid_Color, 1, m_refSizeGroup, "_Background", color_options);
 
   /* And another frame holding line style options
    */
   m_VBox.pack_start(m_Frame_Line, Gtk::PACK_SHRINK);
 
-  m_Table_Line.set_border_width(5);
-  m_Table_Line.set_row_spacing(5);
-  m_Table_Line.set_column_spacing(10);
-  m_Frame_Line.add(m_Table_Line);
+  m_Grid_Line.set_border_width(5);
+  m_Grid_Line.set_row_spacing(5);
+  m_Grid_Line.set_column_spacing(10);
+  m_Frame_Line.add(m_Grid_Line);
 
 
   type_listStrings dash_options;
@@ -95,14 +95,14 @@ Example_SizeGroup::Example_SizeGroup()
   dash_options.push_back("Dashed");
   dash_options.push_back("Dotted");
 
-  add_row(m_Table_Line, 0, m_refSizeGroup, "_Dashing", dash_options);
+  add_row(m_Grid_Line, 0, m_refSizeGroup, "_Dashing", dash_options);
 
   type_listStrings end_options;
   end_options.push_back("Square");
   end_options.push_back("Round");
   end_options.push_back("Arrow");
 
-  add_row(m_Table_Line, 1, m_refSizeGroup, "_Line ends", end_options);
+  add_row(m_Grid_Line, 1, m_refSizeGroup, "_Line ends", end_options);
 
   /* And a check button to turn grouping on and off */
   m_VBox.pack_start(m_CheckButton, Gtk::PACK_SHRINK);
@@ -128,7 +128,7 @@ void Example_SizeGroup::on_checkbutton_toggled()
   m_refSizeGroup->set_mode(new_mode);
 }
 
-void Example_SizeGroup::add_row(Gtk::Grid& table, int row,
+void Example_SizeGroup::add_row(Gtk::Grid& grid, int row,
                                 const Glib::RefPtr<Gtk::SizeGroup>& size_group,
                                 const Glib::ustring& label_text,
                                 const std::list<Glib::ustring>& options)
@@ -136,14 +136,14 @@ void Example_SizeGroup::add_row(Gtk::Grid& table, int row,
   Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(label_text, true));
   pLabel->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_END);
 
-  table.attach(*pLabel, 0, 1, row, row + 1);
+  grid.attach(*pLabel, 0, row, 1, 1);
   pLabel->set_hexpand();
 
   Gtk::ComboBoxText* pComboBoxText = create_combobox(options);
   pLabel->set_mnemonic_widget(*pComboBoxText);
   size_group->add_widget(*pComboBoxText);
 
-  table.attach(*pComboBoxText, 1, 2, row, row + 1);
+  grid.attach(*pComboBoxText, 1, row, 1, 1);
 }
 
 /* Convenience function to create an option menu holding a number of strings


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