[glom/spread-table] Details: Use of GtkSpreadTable: Use specified alignement again.



commit ec5e22eabac55218a25d7fcc554985e265c4dfb7
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Oct 11 16:20:47 2010 +0200

    Details: Use of GtkSpreadTable: Use specified alignement again.
    
    * glom/mode_data/flowtablewithfields.cc:
    * glom/utility_widgets/flowtable.[h|cc]: FlowTableItem: Remove the
      m_expand_first_full and m_expand_second members, because we no longer need
      to remember that information.
      add(): Use set_halign() to specify fill/left depending on the expand
      choice.

 ChangeLog                             |   11 +++++++++++
 glom/mode_data/flowtablewithfields.cc |    2 +-
 glom/utility_widgets/flowtable.cc     |   32 +++++++++++++++-----------------
 glom/utility_widgets/flowtable.h      |    4 +---
 4 files changed, 28 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0f285c9..f86f08f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2010-10-11  Murray Cumming  <murrayc murrayc com>
 
+	Details: Use of GtkSpreadTable: Use specified alignement again.
+
+	* glom/mode_data/flowtablewithfields.cc:
+	* glom/utility_widgets/flowtable.[h|cc]: FlowTableItem: Remove the
+  m_expand_first_full and m_expand_second members, because we no longer need
+  to remember that information.
+  add(): Use set_halign() to specify fill/left depending on the expand
+  choice.
+
+2010-10-11  Murray Cumming  <murrayc murrayc com>
+
 	Details: Use of GtkSpreadTable: Align widgets again.
 
 	* glom/mode_data/flowtablewithfields.cc: apply_size_groups_to_labels():
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index b830850..2011bc2 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -614,7 +614,7 @@ void FlowTableWithFields::add_button_at_position(const sharedptr<LayoutItem_Butt
 
   Gtk::Widget* widget = dynamic_cast<Gtk::Widget*>(*add_before);
   if(widget)
-    insert_before (*widget_to_add, *widget, expand);
+    insert_before(*widget_to_add, *widget, expand);
   else
     add(*widget_to_add, expand);
 
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 3001e88..b45ffb6 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -30,9 +30,7 @@ namespace Glom
 FlowTable::FlowTableItem::FlowTableItem(Gtk::Widget* first, FlowTable* /* flowtable */)
 : m_hbox(0),
   m_first(first),
-  m_second(0),
-  m_expand_first_full(false),
-  m_expand_second(false)
+  m_second(0)
 {
 
 }
@@ -40,9 +38,7 @@ FlowTable::FlowTableItem::FlowTableItem(Gtk::Widget* first, FlowTable* /* flowta
 FlowTable::FlowTableItem::FlowTableItem(Gtk::Widget* first, Gtk::Widget* second, FlowTable* /* flowtable */)
 : m_hbox(0),
   m_first(first),
-  m_second(second),
-  m_expand_first_full(false),
-  m_expand_second(false)
+  m_second(second)
 {
 
 }
@@ -71,8 +67,6 @@ void FlowTable::add(Gtk::Widget& first, Gtk::Widget& second, bool expand_second)
 
   Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, get_horizontal_spacing()));
   item.m_hbox = hbox;
-
-  item.m_expand_second = expand_second; //Expand to fill the width for all of the second item.
   m_children.push_back(item);
 
   hbox->pack_start(first, Gtk::PACK_SHRINK);
@@ -87,28 +81,25 @@ void FlowTable::add(Gtk::Widget& first, bool expand)
 {
   FlowTableItem item(&first, this);
 
-  item.m_expand_first_full = expand; //Expand to fill the width for first and second.
   m_children.push_back(item);
 
-  first.set_halign(Gtk::ALIGN_FILL);
-  append_child(first); //TODO: expand
+  first.set_halign(expand ? Gtk::ALIGN_FILL : Gtk::ALIGN_START);
+  append_child(first);
 }
 
 void FlowTable::insert_before(Gtk::Widget& first, Gtk::Widget& before, bool expand)
 {
   FlowTableItem item(&first, this);
-  item.m_expand_first_full = expand;
-  insert_before(item, before);
+  insert_before(item, before, expand);
 }
 
 void FlowTable::insert_before(Gtk::Widget& first, Gtk::Widget& second, Gtk::Widget& before, bool expand_second)
 {
   FlowTableItem item(&first, &second, this);
-  item.m_expand_second = expand_second;
-  insert_before(item, before);
+  insert_before(item, before, expand_second);
 }
 
-void FlowTable::insert_before(FlowTableItem& /* item */, Gtk::Widget& /* before */)
+void FlowTable::insert_before(FlowTableItem& /* item */, Gtk::Widget& /* before */, bool /* expand_rightmost */)
 {
   std::cerr << G_STRFUNC << ": Not implemented" << std::endl;
   //TODO:
@@ -229,7 +220,14 @@ bool FlowTable::get_column_for_first_widget(const Gtk::Widget& first, guint& col
 
     if((&first == item.m_first))
     {
-      Gtk::Widget* child = item.m_hbox;
+      Gtk::Widget* child = 0;
+      if(item.m_hbox) //The first and second widgets are inside an HBox
+      {
+        child = item.m_hbox;
+      }
+      else //It must be a single item.
+        child = item.m_first;
+
       if(!child)
         return false;
 
diff --git a/glom/utility_widgets/flowtable.h b/glom/utility_widgets/flowtable.h
index aa56b49..aa9847e 100644
--- a/glom/utility_widgets/flowtable.h
+++ b/glom/utility_widgets/flowtable.h
@@ -65,8 +65,6 @@ protected:
     Gtk::HBox* m_hbox;
     Gtk::Widget* m_first;
     Gtk::Widget* m_second;
-    bool m_expand_first_full;
-    bool m_expand_second;
 
     bool operator==(Gtk::Widget* child) const
     {
@@ -75,7 +73,7 @@ protected:
   };
 
 private:
-  void insert_before(FlowTableItem& item, Gtk::Widget& before);
+  void insert_before(FlowTableItem& item, Gtk::Widget& before, bool expand_rightmost);
 
   int get_item_requested_height(const FlowTableItem& item) const;
   void get_item_requested_width(const FlowTableItem& item, int& first, int& second) const;



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