gntbox.h
Go to the documentation of this file.
1
5 /*
6 * GNT - The GLib Ncurses Toolkit
7 *
8 * GNT is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26
27 #ifndef GNT_BOX_H
28 #define GNT_BOX_H
29
30 #include "gnt.h"
31 #include "gntwidget.h"
32
33 #define GNT_TYPE_BOX (gnt_box_get_gtype())
34 #define GNT_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BOX, GntBox))
35 #define GNT_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BOX, GntBoxClass))
36 #define GNT_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BOX))
37 #define GNT_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BOX))
38 #define GNT_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BOX, GntBoxClass))
39
40 typedef struct _GntBox GntBox;
41 typedef struct _GntBoxClass GntBoxClass;
42
43 typedef enum
44 {
45 /* These for vertical boxes */
46 GNT_ALIGN_LEFT,
47 GNT_ALIGN_RIGHT,
48
49 GNT_ALIGN_MID,
50
51 /* These for horizontal boxes */
52 GNT_ALIGN_TOP,
53 GNT_ALIGN_BOTTOM
54 } GntAlignment;
55
56 struct _GntBox
57 {
58 GntWidget parent;
59
60 gboolean vertical;
61 gboolean homogeneous;
62 gboolean fill;
63 GList *list; /* List of widgets */
64
65 GntWidget *active;
66 int pad; /* Number of spaces to use between widgets */
67 GntAlignment alignment; /* How are the widgets going to be aligned? */
68
69 char *title;
70 GList *focus; /* List of widgets to cycle focus (only valid for parent boxes) */
71
72 void (*gnt_reserved1)(void);
73 void (*gnt_reserved2)(void);
74 void (*gnt_reserved3)(void);
75 void (*gnt_reserved4)(void);
76 };
77
78 struct _GntBoxClass
79 {
80 GntWidgetClass parent;
81
82 void (*gnt_reserved1)(void);
83 void (*gnt_reserved2)(void);
84 void (*gnt_reserved3)(void);
85 void (*gnt_reserved4)(void);
86 };
87
88 G_BEGIN_DECLS
89
94 GType gnt_box_get_gtype(void);
95
96 #define gnt_vbox_new(homo) gnt_box_new(homo, TRUE)
97 #define gnt_hbox_new(homo) gnt_box_new(homo, FALSE)
98
108 GntWidget * gnt_box_new(gboolean homo, gboolean vert);
109
116 void gnt_box_add_widget(GntBox *box, GntWidget *widget);
117
124 void gnt_box_set_title(GntBox *box, const char *title);
125
132 void gnt_box_set_pad(GntBox *box, int pad);
133
142 void gnt_box_set_toplevel(GntBox *box, gboolean set);
143
149 void gnt_box_sync_children(GntBox *box);
150
157 void gnt_box_set_alignment(GntBox *box, GntAlignment alignment);
158
165 void gnt_box_remove(GntBox *box, GntWidget *widget);
166
172 void gnt_box_remove_all(GntBox *box);
173
180 void gnt_box_readjust(GntBox *box);
181
188 void gnt_box_set_fill(GntBox *box, gboolean fill);
189
197 void gnt_box_move_focus(GntBox *box, int dir);
198
205 void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget);
206
207 G_END_DECLS
208
209 #endif /* GNT_BOX_H */
210
gnt_box_sync_children
void gnt_box_sync_children(GntBox *box)
Reposition and refresh the widgets in the box.
gntwidget.h
Widget API.
gnt_box_add_widget
void gnt_box_add_widget(GntBox *box, GntWidget *widget)
Add a widget in the box.
gnt_box_set_alignment
void gnt_box_set_alignment(GntBox *box, GntAlignment alignment)
Set the alignment for the widgets in the box.
_GntBoxClass
Definition: gntbox.h:78
gnt.h
GNT API.
gnt_box_new
GntWidget * gnt_box_new(gboolean homo, gboolean vert)
Create a new GntBox.
_GntBox
Definition: gntbox.h:56
gnt_box_set_toplevel
void gnt_box_set_toplevel(GntBox *box, gboolean set)
Set whether it&#39;s a toplevel box (ie, a window) or not.
gnt_box_remove_all
void gnt_box_remove_all(GntBox *box)
Remove all widgets from the box.
gnt_box_set_title
void gnt_box_set_title(GntBox *box, const char *title)
Set a title for the box.
gnt_box_remove
void gnt_box_remove(GntBox *box, GntWidget *widget)
Remove a widget from the box.
gnt_box_give_focus_to_child
void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget)
Give focus to a specific child widget.
gnt_box_move_focus
void gnt_box_move_focus(GntBox *box, int dir)
Move the focus from one widget to the other.
gnt_box_set_pad
void gnt_box_set_pad(GntBox *box, int pad)
Set the padding to use between the widgets in the box.
gnt_box_set_fill
void gnt_box_set_fill(GntBox *box, gboolean fill)
Set whether the widgets in the box should fill the empty spaces.
_GntWidgetClass
Definition: gntwidget.h:113
gnt_box_get_gtype
G_BEGIN_DECLS GType gnt_box_get_gtype(void)
The GType for GntBox.
_GntWidget
Definition: gntwidget.h:98
gnt_box_readjust
void gnt_box_readjust(GntBox *box)
Readjust the size of each child widget, reposition the child widgets and recalculate the size of the ...