columns.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * columns.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. ColumnsChild *vexpand;
  28. gint spacing;
  29. };
  30. struct ColumnsClass_tag {
  31. GtkContainerClass parent_class;
  32. };
  33. struct ColumnsChild_tag {
  34. /* If `widget' is non-NULL, this entry represents an actual widget. */
  35. GtkWidget *widget;
  36. gint colstart, colspan;
  37. bool force_left; /* for recalcitrant GtkLabels */
  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. /* Circularly linked list of children that are vertically aligned
  43. * with each other. */
  44. ColumnsChild *valign_next, *valign_prev;
  45. /* Temporary space used within some methods */
  46. bool visited;
  47. };
  48. GType columns_get_type(void);
  49. GtkWidget *columns_new(gint spacing);
  50. void columns_set_cols(Columns *cols, gint ncols, const gint *percentages);
  51. void columns_add(Columns *cols, GtkWidget *child,
  52. gint colstart, gint colspan);
  53. void columns_taborder_last(Columns *cols, GtkWidget *child);
  54. void columns_force_left_align(Columns *cols, GtkWidget *child);
  55. void columns_align_next_to(Columns *cols, GtkWidget *ch1, GtkWidget *ch2);
  56. void columns_vexpand(Columns *cols, GtkWidget *child);
  57. #ifdef __cplusplus
  58. }
  59. #endif /* __cplusplus */
  60. #endif /* COLUMNS_H */