1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00
putty-source/unix/gtkcols.h
Simon Tatham df85003ea5 First stab at a GTK layout engine. It's missing all sorts of stuff
(list boxes are particularly conspicuously absent), it has no event
handling at all, and it isn't in any way integrated into pterm - you
have to build it specially using the test stubs in gtkdlg.c. But
what there is so far seems to work plausibly well, so it's a start.
Rather than browbeat the existing GTK container/layout widgets into
doing what I wanted, I decided to implement two subclasses of
GtkContainer myself, which implement precisely the layout model
assumed by the config box specification; this has the rather cool
consequence that the box can be resized and will maintain the same
layout at all times that it would have had if initially created at
that size.

[originally from svn r2931]
2003-03-13 19:52:28 +00:00

63 lines
1.8 KiB
C

/*
* gtkcols.h - header file for a columns-based widget container
* capable of supporting the PuTTY portable dialog box layout
* mechanism.
*/
#ifndef COLUMNS_H
#define COLUMNS_H
#include <gdk/gdk.h>
#include <gtk/gtkcontainer.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define TYPE_COLUMNS (columns_get_type())
#define COLUMNS(obj) (GTK_CHECK_CAST((obj), TYPE_COLUMNS, Columns))
#define COLUMNS_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass), TYPE_COLUMNS, ColumnsClass))
#define IS_COLUMNS(obj) (GTK_CHECK_TYPE((obj), TYPE_COLUMNS))
#define IS_COLUMNS_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), TYPE_COLUMNS))
typedef struct Columns_tag Columns;
typedef struct ColumnsClass_tag ColumnsClass;
typedef struct ColumnsChild_tag ColumnsChild;
struct Columns_tag {
GtkContainer container;
/* private after here */
GList *children; /* this holds ColumnsChild structures */
GList *taborder; /* this just holds GtkWidgets */
gint spacing;
};
struct ColumnsClass_tag {
GtkContainerClass parent_class;
};
struct ColumnsChild_tag {
/* If `widget' is non-NULL, this entry represents an actual widget. */
GtkWidget *widget;
gint colstart, colspan;
gboolean force_left; /* for recalcitrant GtkLabels */
/* Otherwise, this entry represents a change in the column setup. */
gint ncols;
gint *percentages;
};
GtkType columns_get_type(void);
GtkWidget *columns_new(gint spacing);
void columns_set_cols(Columns *cols, gint ncols, const gint *percentages);
void columns_add(Columns *cols, GtkWidget *child,
gint colstart, gint colspan);
void columns_taborder_last(Columns *cols, GtkWidget *child);
void columns_force_left_align(Columns *cols, GtkWidget *child);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* COLUMNS_H */