]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/layout.h
Restore parent to 0 if an exception occurs while setting things up
[libs/gltk.git] / source / layout.h
index cbd763e9e5337dc7a6395d7d0b3a860c6d9ad7e1..7ae3907c772d740f0ad1ab3e28386f5bc0042213 100644 (file)
@@ -84,6 +84,7 @@ protected:
        {
                ConstraintType type;
                Slot ⌖
+               int spacing;
 
                Constraint(ConstraintType, Slot &);
        };
@@ -99,7 +100,7 @@ protected:
        struct Slot: public sigc::trackable
        {
                Layout &layout;
-               unsigned index;
+               int index;
                Widget &widget;
                Geometry autosize_geom;
                Geometry geom;
@@ -111,6 +112,7 @@ protected:
                virtual ~Slot() { }
 
                void autosize_changed();
+               void visibility_changed(bool);
        };
 
        enum SolveMode
@@ -124,6 +126,7 @@ protected:
 
        Container *container;
        std::list<Slot *> slots;
+       unsigned n_active_slots;
        Sides margin;
        unsigned row_spacing;
        unsigned col_spacing;
@@ -145,10 +148,19 @@ public:
        void remove_widget(Widget &);
 protected:
        virtual Slot *create_slot(Widget &);
+       void update_slot_indices();
        Slot &get_slot_for_widget(Widget &);
        static ConstraintType complement(ConstraintType);
+       void create_constraint(Widget &, ConstraintType, Widget &, int);
+
 public:
-       void add_constraint(Widget &, ConstraintType, Widget &);
+       /** Adds a constraint between two widgets. */
+       void add_constraint(Widget &src, ConstraintType type, Widget &tgt);
+
+       /** Adds a constraint between two widgets, overriding the default spacing.
+       Not all constraint types use a spacing. */
+       void add_constraint(Widget &src, ConstraintType type, Widget &tgt, unsigned);
+
        void set_gravity(Widget &, int, int);
        void set_expand(Widget &, bool, bool);