gtkcols.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #ifndef COLUMNS_H
  7. #define COLUMNS_H
  8. #include <gdk/gdk.h>
  9. #include <gtk/gtk.h>
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif /* __cplusplus */
  13. #define TYPE_COLUMNS (columns_get_type())
  14. #define COLUMNS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_COLUMNS, Columns))
  15. #define COLUMNS_CLASS(klass) \
  16. (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_COLUMNS, ColumnsClass))
  17. #define IS_COLUMNS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_COLUMNS))
  18. #define IS_COLUMNS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_COLUMNS))
  19. typedef struct Columns_tag Columns;
  20. typedef struct ColumnsClass_tag ColumnsClass;
  21. typedef struct ColumnsChild_tag ColumnsChild;
  22. struct Columns_tag {
  23. GtkContainer container;
  24. /* private after here */
  25. GList *children; /* this holds ColumnsChild structures */
  26. GList *taborder; /* this just holds GtkWidgets */
  27. gint spacing;
  28. };
  29. struct ColumnsClass_tag {
  30. GtkContainerClass parent_class;
  31. };
  32. struct ColumnsChild_tag {
  33. /* If `widget' is non-NULL, this entry represents an actual widget. */
  34. GtkWidget *widget;
  35. gint colstart, colspan;
  36. gboolean force_left; /* for recalcitrant GtkLabels */
  37. ColumnsChild *same_height_as;
  38. /* Otherwise, this entry represents a change in the column setup. */
  39. gint ncols;
  40. gint *percentages;
  41. gint x, y, w, h; /* used during an individual size computation */
  42. };
  43. GType columns_get_type(void);
  44. GtkWidget *columns_new(gint spacing);
  45. void columns_set_cols(Columns *cols, gint ncols, const gint *percentages);
  46. void columns_add(Columns *cols, GtkWidget *child,
  47. gint colstart, gint colspan);
  48. void columns_taborder_last(Columns *cols, GtkWidget *child);
  49. void columns_force_left_align(Columns *cols, GtkWidget *child);
  50. void columns_force_same_height(Columns *cols, GtkWidget *ch1, GtkWidget *ch2);
  51. #ifdef __cplusplus
  52. }
  53. #endif /* __cplusplus */
  54. #endif /* COLUMNS_H */