gntbox.h

Go to the documentation of this file.
00001 
00005 /*
00006  * GNT - The GLib Ncurses Toolkit
00007  *
00008  * GNT is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This library is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 
00027 #ifndef GNT_BOX_H
00028 #define GNT_BOX_H
00029 
00030 #include "gnt.h"
00031 #include "gntwidget.h"
00032 
00033 #define GNT_TYPE_BOX                (gnt_box_get_gtype())
00034 #define GNT_BOX(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BOX, GntBox))
00035 #define GNT_BOX_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BOX, GntBoxClass))
00036 #define GNT_IS_BOX(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BOX))
00037 #define GNT_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BOX))
00038 #define GNT_BOX_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BOX, GntBoxClass))
00039 
00040 typedef struct _GntBox          GntBox;
00041 typedef struct _GntBoxClass     GntBoxClass;
00042 
00043 typedef enum
00044 {
00045     /* These for vertical boxes */
00046     GNT_ALIGN_LEFT,
00047     GNT_ALIGN_RIGHT,
00048 
00049     GNT_ALIGN_MID,
00050 
00051     /* These for horizontal boxes */
00052     GNT_ALIGN_TOP,
00053     GNT_ALIGN_BOTTOM
00054 } GntAlignment;
00055 
00056 struct _GntBox
00057 {
00058     GntWidget parent;
00059 
00060     gboolean vertical;
00061     gboolean homogeneous;
00062     gboolean fill;
00063     GList *list;        /* List of widgets */
00064 
00065     GntWidget *active;
00066     int pad;            /* Number of spaces to use between widgets */
00067     GntAlignment alignment;  /* How are the widgets going to be aligned? */
00068 
00069     char *title;
00070     GList *focus;       /* List of widgets to cycle focus (only valid for parent boxes) */
00071 
00072     void (*gnt_reserved1)(void);
00073     void (*gnt_reserved2)(void);
00074     void (*gnt_reserved3)(void);
00075     void (*gnt_reserved4)(void);
00076 };
00077 
00078 struct _GntBoxClass
00079 {
00080     GntWidgetClass parent;
00081 
00082     void (*gnt_reserved1)(void);
00083     void (*gnt_reserved2)(void);
00084     void (*gnt_reserved3)(void);
00085     void (*gnt_reserved4)(void);
00086 };
00087 
00088 G_BEGIN_DECLS
00089 
00094 GType gnt_box_get_gtype(void);
00095 
00096 #define gnt_vbox_new(homo) gnt_box_new(homo, TRUE)
00097 #define gnt_hbox_new(homo) gnt_box_new(homo, FALSE)
00098 
00108 GntWidget * gnt_box_new(gboolean homo, gboolean vert);
00109 
00116 void gnt_box_add_widget(GntBox *box, GntWidget *widget);
00117 
00124 void gnt_box_set_title(GntBox *box, const char *title);
00125 
00132 void gnt_box_set_pad(GntBox *box, int pad);
00133 
00142 void gnt_box_set_toplevel(GntBox *box, gboolean set);
00143 
00149 void gnt_box_sync_children(GntBox *box);
00150 
00157 void gnt_box_set_alignment(GntBox *box, GntAlignment alignment);
00158 
00165 void gnt_box_remove(GntBox *box, GntWidget *widget);
00166 
00172 void gnt_box_remove_all(GntBox *box);
00173 
00180 void gnt_box_readjust(GntBox *box);
00181 
00188 void gnt_box_set_fill(GntBox *box, gboolean fill);
00189 
00197 void gnt_box_move_focus(GntBox *box, int dir);
00198 
00205 void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget);
00206 
00207 G_END_DECLS
00208 
00209 #endif /* GNT_BOX_H */
00210