Download

Support

lib/ewl_object.h

Go to the documentation of this file.
00001 /* vim: set sw=8 ts=8 sts=8 expandtab: */
00002 #ifndef EWL_OBJECT_H
00003 #define EWL_OBJECT_H
00004 
00016 #define EWL_OBJECT_MIN_SIZE (1)
00017 
00022 #define EWL_OBJECT_MAX_SIZE (INT_MAX)
00023 
00028 typedef struct Ewl_Object Ewl_Object;
00029 
00034 #define EWL_OBJECT(object) ((Ewl_Object *) object)
00035 
00065 struct Ewl_Object
00066 {
00067         struct
00068         {
00069                 int x, 
00070                     y; 
00071                 int w, 
00072                     h; 
00073         } current; 
00075         struct
00076         {
00077                 int w, 
00078                     h; 
00079         }
00080         preferred, 
00081         maximum, 
00082         minimum; 
00084         struct
00085         {
00086                 short l, 
00087                       r, 
00088                       t, 
00089                       b; 
00090         } pad, 
00091         insets; 
00093         unsigned int flags; 
00094 };
00095 
00096 int              ewl_object_init(Ewl_Object *o);
00097 void             ewl_object_current_geometry_get(Ewl_Object *o, int *x, int *y,
00098                                                 int *w, int *h);
00099 
00100 void             ewl_object_current_size_get(Ewl_Object *o, int *w, int *h);
00101 int              ewl_object_current_x_get(Ewl_Object *o);
00102 int              ewl_object_current_y_get(Ewl_Object *o);
00103 int              ewl_object_current_w_get(Ewl_Object *o);
00104 int              ewl_object_current_h_get(Ewl_Object *o);
00105 
00106 void             ewl_object_preferred_inner_size_set(Ewl_Object *o, int w, int h);
00107 void             ewl_object_preferred_inner_size_get(Ewl_Object *o, int *w, int *h);
00108 void             ewl_object_preferred_size_get(Ewl_Object *o, int *w, int *h);
00109 
00110 void             ewl_object_preferred_inner_w_set(Ewl_Object *o, int w);
00111 int              ewl_object_preferred_w_get(Ewl_Object *o);
00112 int              ewl_object_preferred_inner_w_get(Ewl_Object *o);
00113 
00114 void             ewl_object_preferred_inner_h_set(Ewl_Object *o, int h);
00115 int              ewl_object_preferred_inner_h_get(Ewl_Object *o);
00116 int              ewl_object_preferred_h_get(Ewl_Object *o);
00117 
00118 void             ewl_object_geometry_request(Ewl_Object *o, int x, int y,
00119                                              int w, int h);
00120 void             ewl_object_size_request(Ewl_Object *o, int w, int h);
00121 void             ewl_object_position_request(Ewl_Object *o, int x, int y);
00122 void             ewl_object_x_request(Ewl_Object *o, int x);
00123 void             ewl_object_y_request(Ewl_Object *o, int y);
00124 void             ewl_object_w_request(Ewl_Object *o, int w);
00125 void             ewl_object_h_request(Ewl_Object *o, int h);
00126 
00127 void             ewl_object_minimum_size_set(Ewl_Object *o, int w, int h);
00128 void             ewl_object_minimum_w_set(Ewl_Object *o, int w);
00129 void             ewl_object_minimum_h_set(Ewl_Object *o, int h);
00130 
00131 void             ewl_object_minimum_size_get(Ewl_Object *o, int *w, int *h);
00132 int              ewl_object_minimum_w_get(Ewl_Object *o);
00133 int              ewl_object_minimum_h_get(Ewl_Object *o);
00134 
00135 void             ewl_object_maximum_size_set(Ewl_Object *o, int w, int h);
00136 void             ewl_object_maximum_w_set(Ewl_Object *o, int w);
00137 void             ewl_object_maximum_h_set(Ewl_Object *o, int h);
00138 
00139 void             ewl_object_maximum_size_get(Ewl_Object *o, int *w, int *h);
00140 int              ewl_object_maximum_w_get(Ewl_Object *o);
00141 int              ewl_object_maximum_h_get(Ewl_Object *o);
00142 
00143 unsigned int     ewl_object_alignment_get(Ewl_Object *o);
00144 void             ewl_object_alignment_set(Ewl_Object *o, unsigned int align);
00145 void             ewl_object_place(Ewl_Object *o, int x, int y, int w, int h);
00146 
00147 unsigned int     ewl_object_fill_policy_get(Ewl_Object *o);
00148 void             ewl_object_fill_policy_set(Ewl_Object *o, unsigned int fill);
00149 
00150 /*
00151  * Padding setting and retrieval functions.
00152  */
00153 void             ewl_object_padding_set(Ewl_Object *o, int l, int r, int t,
00154                                         int b);
00155 void             ewl_object_padding_get(Ewl_Object *o, int *l, int *r, int *t,
00156                                        int *b);
00157 int              ewl_object_padding_top_get(Ewl_Object *o);
00158 int              ewl_object_padding_bottom_get(Ewl_Object *o);
00159 int              ewl_object_padding_left_get(Ewl_Object *o);
00160 int              ewl_object_padding_right_get(Ewl_Object *o);
00161 
00162 /*
00163  * Inset setting and retrieval functions.
00164  */
00165 void             ewl_object_insets_set(Ewl_Object *o, int l, int r, int t,
00166                                        int b);
00167 void             ewl_object_insets_get(Ewl_Object *o, int *l, int *r, int *t,
00168                                        int *b);
00169 int              ewl_object_insets_top_get(Ewl_Object *o);
00170 int              ewl_object_insets_bottom_get(Ewl_Object *o);
00171 int              ewl_object_insets_left_get(Ewl_Object *o);
00172 int              ewl_object_insets_right_get(Ewl_Object *o);
00173 
00174 void             ewl_object_flags_add(Ewl_Object *o, unsigned int flags,
00175                                       unsigned int mask);
00176 void             ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
00177                                          unsigned int mask);
00178 
00183 #define PADDING_TOP(o) ((const Ewl_Object *)(o))->pad.t
00184 
00189 #define PADDING_BOTTOM(o) ((const Ewl_Object *)(o))->pad.b
00190 
00195 #define PADDING_LEFT(o) ((const Ewl_Object *)(o))->pad.l
00196 
00201 #define PADDING_RIGHT(o) ((const Ewl_Object *)(o))->pad.r
00202 
00207 #define PADDING_HORIZONTAL(o) (EWL_OBJECT(o)->pad.l + EWL_OBJECT(o)->pad.r)
00208 
00213 #define PADDING_VERTICAL(o) (EWL_OBJECT(o)->pad.t + EWL_OBJECT(o)->pad.b)
00214 
00219 #define INSET_LEFT(o) ((const Ewl_Object *)(o))->insets.l
00220 
00225 #define INSET_RIGHT(o) ((const Ewl_Object *)(o))->insets.r
00226 
00231 #define INSET_TOP(o) ((const Ewl_Object *)(o))->insets.t
00232 
00237 #define INSET_BOTTOM(o) ((const Ewl_Object *)(o))->insets.b
00238 
00243 #define INSET_HORIZONTAL(o) (EWL_OBJECT(o)->insets.l + EWL_OBJECT(o)->insets.r)
00244 
00249 #define INSET_VERTICAL(o) (EWL_OBJECT(o)->insets.t + EWL_OBJECT(o)->insets.b)
00250 
00255 #define CURRENT_X(o) ((const Ewl_Object *)(o))->current.x
00256 
00261 #define CURRENT_Y(o) ((const Ewl_Object *)(o))->current.y
00262 
00267 #define CURRENT_W(o) ((const Ewl_Object *)(o))->current.w
00268 
00273 #define CURRENT_H(o) ((const Ewl_Object *)(o))->current.h
00274 
00279 #define PREFERRED_W(o) ((const Ewl_Object *)(o))->preferred.w
00280 
00285 #define PREFERRED_H(o) ((const Ewl_Object *)(o))->preferred.h
00286 
00291 #define MAXIMUM_W(o) ((const Ewl_Object *)(o))->maximum.w
00292 
00297 #define MAXIMUM_H(o) ((const Ewl_Object *)(o))->maximum.h
00298 
00303 #define MINIMUM_W(o) ((const Ewl_Object *)(o))->minimum.w
00304 
00309 #define MINIMUM_H(o) ((const Ewl_Object *)(o))->minimum.h
00310 
00318 #define ewl_object_custom_size_set(o, w, h) \
00319         { \
00320                 ewl_object_minimum_size_set(o, w, h); \
00321                 ewl_object_maximum_size_set(o, w, h); \
00322                  ewl_object_fill_policy_set(o, EWL_FLAG_FILL_NONE); \
00323         }
00324 
00331 #define ewl_object_custom_w_set(o, w) \
00332         { \
00333                 ewl_object_maximum_w_set(o, w); \
00334                 ewl_object_minimum_w_set(o, w); \
00335                 ewl_object_fill_policy_set(o, ewl_object_fill_policy_get(o) & \
00336                                 ~(EWL_FLAG_FILL_HFILL | EWL_FLAG_FILL_HSHRINKABLE)); \
00337         }
00338 
00345 #define ewl_object_custom_h_set(o, h) \
00346         { \
00347                 ewl_object_maximum_h_set(o, h); \
00348                 ewl_object_minimum_h_set(o, h); \
00349                 ewl_object_fill_policy_set(o, ewl_object_fill_policy_get(o) & \
00350                                 ~(EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_VSHRINKABLE)); \
00351         }
00352 
00357 #endif

Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Fri Jan 23 21:56:24 2009