gtkwrapbox.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * GtkWrapBox: Wrapping box widget
  5. * Copyright (C) 1999 Tim Janik
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef __GTK_WRAP_BOX_H__
  23. #define __GTK_WRAP_BOX_H__
  24. #include <gdk/gdk.h>
  25. #include <gtk/gtkcontainer.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif /* __cplusplus */
  29. /* --- type macros --- */
  30. #define GTK_TYPE_WRAP_BOX (gtk_wrap_box_get_type ())
  31. #define GTK_WRAP_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_WRAP_BOX, GtkWrapBox))
  32. #define GTK_WRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_WRAP_BOX, GtkWrapBoxClass))
  33. #define GTK_IS_WRAP_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_WRAP_BOX))
  34. #define GTK_IS_WRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WRAP_BOX))
  35. #define GTK_WRAP_BOX_GET_CLASS(obj) (GTK_WRAP_BOX_CLASS (((GtkObject*) (obj))->klass))
  36. /* --- typedefs --- */
  37. typedef struct _GtkWrapBox GtkWrapBox;
  38. typedef struct _GtkWrapBoxClass GtkWrapBoxClass;
  39. typedef struct _GtkWrapBoxChild GtkWrapBoxChild;
  40. /* --- GtkWrapBox --- */
  41. struct _GtkWrapBox
  42. {
  43. GtkContainer container;
  44. guint homogeneous : 1;
  45. guint justify : 4;
  46. guint line_justify : 4;
  47. guint8 hspacing;
  48. guint8 vspacing;
  49. guint16 n_children;
  50. GtkWrapBoxChild *children;
  51. gfloat aspect_ratio; /* 1/256..256 */
  52. guint child_limit;
  53. };
  54. struct _GtkWrapBoxClass
  55. {
  56. GtkContainerClass parent_class;
  57. GSList* (*rlist_line_children) (GtkWrapBox *wbox,
  58. GtkWrapBoxChild **child_p,
  59. GtkAllocation *area,
  60. guint *max_child_size,
  61. gboolean *expand_line);
  62. };
  63. struct _GtkWrapBoxChild
  64. {
  65. GtkWidget *widget;
  66. guint hexpand : 1;
  67. guint hfill : 1;
  68. guint vexpand : 1;
  69. guint vfill : 1;
  70. guint forced_break : 1;
  71. GtkWrapBoxChild *next;
  72. };
  73. #define GTK_JUSTIFY_TOP GTK_JUSTIFY_LEFT
  74. #define GTK_JUSTIFY_BOTTOM GTK_JUSTIFY_RIGHT
  75. /* --- prototypes --- */
  76. GtkType gtk_wrap_box_get_type (void);
  77. void gtk_wrap_box_set_homogeneous (GtkWrapBox *wbox,
  78. gboolean homogeneous);
  79. void gtk_wrap_box_set_hspacing (GtkWrapBox *wbox,
  80. guint hspacing);
  81. void gtk_wrap_box_set_vspacing (GtkWrapBox *wbox,
  82. guint vspacing);
  83. void gtk_wrap_box_set_justify (GtkWrapBox *wbox,
  84. GtkJustification justify);
  85. void gtk_wrap_box_set_line_justify (GtkWrapBox *wbox,
  86. GtkJustification line_justify);
  87. void gtk_wrap_box_set_aspect_ratio (GtkWrapBox *wbox,
  88. gfloat aspect_ratio);
  89. void gtk_wrap_box_pack (GtkWrapBox *wbox,
  90. GtkWidget *child,
  91. gboolean hexpand,
  92. gboolean hfill,
  93. gboolean vexpand,
  94. gboolean vfill);
  95. void gtk_wrap_box_reorder_child (GtkWrapBox *wbox,
  96. GtkWidget *child,
  97. gint position);
  98. void gtk_wrap_box_query_child_packing (GtkWrapBox *wbox,
  99. GtkWidget *child,
  100. gboolean *hexpand,
  101. gboolean *hfill,
  102. gboolean *vexpand,
  103. gboolean *vfill);
  104. void gtk_wrap_box_query_child_forced_break (GtkWrapBox *wbox,
  105. GtkWidget *child,
  106. gboolean *forced_break);
  107. void gtk_wrap_box_set_child_packing (GtkWrapBox *wbox,
  108. GtkWidget *child,
  109. gboolean hexpand,
  110. gboolean hfill,
  111. gboolean vexpand,
  112. gboolean vfill);
  113. void gtk_wrap_box_set_child_forced_break (GtkWrapBox *wbox,
  114. GtkWidget *child,
  115. gboolean forced_break);
  116. guint* gtk_wrap_box_query_line_lengths (GtkWrapBox *wbox,
  117. guint *n_lines);
  118. #ifdef __cplusplus
  119. }
  120. #endif /* __cplusplus */
  121. #endif /* __GTK_WRAP_BOX_H__ */