1 /* a side panel that can slide in and out of view
2  */
3 
4 /*
5 
6     Copyright (C) 2007 The National Gallery
7 
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12 
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License along
19     with this program; if not, write to the Free Software Foundation, Inc.,
20     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 
22  */
23 
24 /*
25 
26     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
27 
28  */
29 
30 #define TYPE_PANE (pane_get_type())
31 #define PANE( obj ) (GTK_CHECK_CAST( (obj), TYPE_PANE, Pane ))
32 #define PANE_CLASS( klass ) \
33 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_PANE, PaneClass ))
34 #define IS_PANE( obj ) (GTK_CHECK_TYPE( (obj), TYPE_PANE ))
35 #define IS_PANE_CLASS( klass ) \
36 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_PANE ))
37 
38 /* Can hide on the left or the right hand side of a window.
39  */
40 typedef enum {
41 	PANE_HIDE_LEFT,
42 	PANE_HIDE_RIGHT
43 } PaneHandedness;
44 
45 typedef struct _Pane {
46 	GtkHPaned parent_object;
47 
48 	PaneHandedness handedness;	/* Hide on left or right */
49 
50 	/* The child pane we show on left or right.
51 	 */
52 	Panechild *panechild;
53 
54 	/* Are we visible or not.
55 	 */
56 	gboolean open;
57 
58 	/* The position of the divider. This changes as the pane is animated
59 	 * open and closed and does not reflect the position the user has
60 	 * selected by dragging.
61 	 */
62 	int position;
63 
64 	/* The position the user wants the pane to sit at.
65 	 */
66 	int user_position;
67 
68 	/* Animating towards this position. If close_on_end is true, close the
69 	 * pane at the end of animation.
70 	 */
71 	int target_position;
72 	gboolean close_on_end;
73 
74 	/* Set animation speed with this.
75 	 */
76 	int last_set_position;
77 
78 	/* Timeout for animation.
79 	 */
80 	guint animate_timeout;
81 } Pane;
82 
83 typedef struct _PaneClass {
84 	GtkHPanedClass parent_class;
85 
86 	/* Either position or open have changed.
87 	 */
88 	void (*changed)( Pane * );
89 } PaneClass;
90 
91 GType pane_get_type( void );
92 
93 Pane *pane_new( PaneHandedness handedness );
94 
95 void pane_set_position( Pane *pane, int position );
96 void pane_set_user_position( Pane *pane, int user_position );
97 void pane_set_open( Pane *pane, gboolean open );
98 void pane_set_state( Pane *pane, gboolean open, int user_position );
99 void pane_set_child( Pane *pane, Panechild *panechild );
100 
101 void pane_animate_closed( Pane *pane );
102 void pane_animate_open( Pane *pane );
103 
104