Gtkmm2ext::Pane: attempt to track child lifetime, since Gtkmm 2.4 doesn't do this...
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / pane.h
index 452c9f9f0ade48d8fc2414f4adc493d32ef220c9..9612da08d28dd5771a14e2e60e0f4873ab9b9800 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <stdint.h>
 
+#include <gdkmm/cursor.h>
 #include <gtkmm/container.h>
 #include <gtkmm/eventbox.h>
 
@@ -41,14 +42,32 @@ class LIBGTKMM2EXT_API Pane : public Gtk::Container
   private:
        class Divider;
 
+
   public:
+       struct Child
+       {
+               Pane* pane;
+               Gtk::Widget* w;
+               int32_t minsize;
+
+               Child (Pane* p, Gtk::Widget* widget, uint32_t ms) : pane (p), w (widget), minsize (ms) {}
+       };
+
+       typedef std::list<Child> Children;
+
        Pane (bool horizontal);
+       ~Pane();
+
        void set_divider (std::vector<float>::size_type divider, float fract);
        float get_divider (std::vector<float>::size_type divider = 0);
+       void set_child_minsize (Gtk::Widget const &, int32_t);
 
        GType child_type_vfunc() const;
+       void set_drag_cursor (Gdk::Cursor);
 
+       void set_check_divider_position (bool);
 
+  protected:
        bool horizontal;
 
        void on_add (Gtk::Widget*);
@@ -60,13 +79,17 @@ class LIBGTKMM2EXT_API Pane : public Gtk::Container
        bool handle_press_event (GdkEventButton*, Divider*);
        bool handle_release_event (GdkEventButton*, Divider*);
        bool handle_motion_event (GdkEventMotion*, Divider*);
+       bool handle_enter_event (GdkEventCrossing*, Divider*);
+       bool handle_leave_event (GdkEventCrossing*, Divider*);
 
        void forall_vfunc (gboolean include_internals, GtkCallback callback, gpointer callback_data);
 
   private:
+       Gdk::Cursor drag_cursor;
+       bool did_move;
+
        void reallocate (Gtk::Allocation const &);
 
-       typedef std::list<Gtk::Widget*> Children;
        Children children;
 
        struct Divider : public Gtk::EventBox {
@@ -76,14 +99,19 @@ class LIBGTKMM2EXT_API Pane : public Gtk::Container
                bool dragging;
 
                bool on_expose_event (GdkEventExpose* ev);
-               bool on_enter_notify_event (GdkEventCrossing*);
-               bool on_leave_notify_event (GdkEventCrossing*);
        };
 
-       typedef std::vector<Divider*> Dividers;
+       typedef std::list<Divider*> Dividers;
        Dividers dividers;
        int divider_width;
+       bool check_fract;
+
        void add_divider ();
+       void handle_child_visibility ();
+       bool fract_is_ok (Dividers::size_type, float fract);
+
+       static void* notify_child_destroyed (void*);
+       void* child_destroyed (Gtk::Widget*);
 };
 
 class LIBGTKMM2EXT_API HPane : public Pane