| 1 | /* |
| 2 | * gtkcols.h - header file for a columns-based widget container |
| 3 | * capable of supporting the PuTTY portable dialog box layout |
| 4 | * mechanism. |
| 5 | */ |
| 6 | |
| 7 | #ifndef COLUMNS_H |
| 8 | #define COLUMNS_H |
| 9 | |
| 10 | #include <gdk/gdk.h> |
| 11 | #include <gtk/gtk.h> |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif /* __cplusplus */ |
| 16 | |
| 17 | #define TYPE_COLUMNS (columns_get_type()) |
| 18 | #define COLUMNS(obj) (GTK_CHECK_CAST((obj), TYPE_COLUMNS, Columns)) |
| 19 | #define COLUMNS_CLASS(klass) \ |
| 20 | (GTK_CHECK_CLASS_CAST((klass), TYPE_COLUMNS, ColumnsClass)) |
| 21 | #define IS_COLUMNS(obj) (GTK_CHECK_TYPE((obj), TYPE_COLUMNS)) |
| 22 | #define IS_COLUMNS_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), TYPE_COLUMNS)) |
| 23 | |
| 24 | typedef struct Columns_tag Columns; |
| 25 | typedef struct ColumnsClass_tag ColumnsClass; |
| 26 | typedef struct ColumnsChild_tag ColumnsChild; |
| 27 | |
| 28 | struct Columns_tag { |
| 29 | GtkContainer container; |
| 30 | /* private after here */ |
| 31 | GList *children; /* this holds ColumnsChild structures */ |
| 32 | GList *taborder; /* this just holds GtkWidgets */ |
| 33 | gint spacing; |
| 34 | }; |
| 35 | |
| 36 | struct ColumnsClass_tag { |
| 37 | GtkContainerClass parent_class; |
| 38 | }; |
| 39 | |
| 40 | struct ColumnsChild_tag { |
| 41 | /* If `widget' is non-NULL, this entry represents an actual widget. */ |
| 42 | GtkWidget *widget; |
| 43 | gint colstart, colspan; |
| 44 | gboolean force_left; /* for recalcitrant GtkLabels */ |
| 45 | /* Otherwise, this entry represents a change in the column setup. */ |
| 46 | gint ncols; |
| 47 | gint *percentages; |
| 48 | }; |
| 49 | |
| 50 | GtkType columns_get_type(void); |
| 51 | GtkWidget *columns_new(gint spacing); |
| 52 | void columns_set_cols(Columns *cols, gint ncols, const gint *percentages); |
| 53 | void columns_add(Columns *cols, GtkWidget *child, |
| 54 | gint colstart, gint colspan); |
| 55 | void columns_taborder_last(Columns *cols, GtkWidget *child); |
| 56 | void columns_force_left_align(Columns *cols, GtkWidget *child); |
| 57 | |
| 58 | #ifdef __cplusplus |
| 59 | } |
| 60 | #endif /* __cplusplus */ |
| 61 | |
| 62 | #endif /* COLUMNS_H */ |