2 Copyright (C) 2016 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __libgtkmm2ext_pane_h__
21 #define __libgtkmm2ext_pane_h__
28 #include <gdkmm/cursor.h>
29 #include <gtkmm/container.h>
30 #include <gtkmm/eventbox.h>
32 #include "gtkmm2ext/visibility.h"
40 class LIBGTKMM2EXT_API Pane : public Gtk::Container
53 Child (Pane* p, Gtk::Widget* widget, uint32_t ms) : pane (p), w (widget), minsize (ms) {}
56 typedef std::list<Child> Children;
58 Pane (bool horizontal);
61 void set_divider (std::vector<float>::size_type divider, float fract);
62 float get_divider (std::vector<float>::size_type divider = 0);
63 void set_child_minsize (Gtk::Widget const &, int32_t);
65 GType child_type_vfunc() const;
66 void set_drag_cursor (Gdk::Cursor);
68 void set_check_divider_position (bool);
73 void on_add (Gtk::Widget*);
74 void on_remove (Gtk::Widget*);
75 void on_size_request (GtkRequisition*);
76 void on_size_allocate (Gtk::Allocation&);
77 bool on_expose_event (GdkEventExpose*);
79 bool handle_press_event (GdkEventButton*, Divider*);
80 bool handle_release_event (GdkEventButton*, Divider*);
81 bool handle_motion_event (GdkEventMotion*, Divider*);
82 bool handle_enter_event (GdkEventCrossing*, Divider*);
83 bool handle_leave_event (GdkEventCrossing*, Divider*);
85 void forall_vfunc (gboolean include_internals, GtkCallback callback, gpointer callback_data);
88 Gdk::Cursor drag_cursor;
91 void reallocate (Gtk::Allocation const &);
95 struct Divider : public Gtk::EventBox {
101 bool on_expose_event (GdkEventExpose* ev);
104 typedef std::list<Divider*> Dividers;
110 void handle_child_visibility ();
111 bool fract_is_ok (Dividers::size_type, float fract);
113 static void* notify_child_destroyed (void*);
114 void* child_destroyed (Gtk::Widget*);
117 class LIBGTKMM2EXT_API HPane : public Pane
120 HPane () : Pane (true) {}
123 class LIBGTKMM2EXT_API VPane : public Pane
126 VPane () : Pane (false) {}
131 #endif /* __libgtkmm2ext_pane_h__ */