Go to the documentation of this file.
29 #define G_LOG_DOMAIN "Widgets.Box"
39 #define DEFAULT_SPACING 2
68 int active_widgets = 0;
69 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
75 if ( child->
expand == TRUE ) {
81 if ( active_widgets > 0 ) {
82 width += ( active_widgets - 1 ) * spacing;
86 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
103 int active_widgets = 0;
104 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
110 if ( child->
expand == TRUE ) {
116 if ( active_widgets > 0 ) {
117 height += ( active_widgets - 1 ) * spacing;
121 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
136 int expanding_widgets = 0;
137 int active_widgets = 0;
140 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
147 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
153 if ( child->
expand == TRUE ) {
157 if ( child->
h > 0 ) {
161 if ( active_widgets > 0 ) {
162 b->
max_size += ( active_widgets - 1 ) * spacing;
166 g_debug (
"Widgets to large (height) for box: %d %d", b->
max_size, b->
widget.
h );
169 if ( active_widgets > 0 ) {
171 double rem = rem_height - b->
max_size;
173 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
175 if ( child->
enabled == FALSE ) {
178 if ( child->
expand == TRUE ) {
180 int expanding_widgets_size = ( rem ) / ( expanding_widgets - index );
182 top += expanding_widgets_size;
185 rem -= expanding_widgets_size;
200 int expanding_widgets = 0;
201 int active_widgets = 0;
204 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
213 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
219 if ( child->
expand == TRUE ) {
224 if ( child->
h > 0 ) {
228 b->
max_size += MAX ( 0, ( ( active_widgets - 1 ) * spacing ) );
229 if ( b->
max_size > ( rem_width ) ) {
231 g_debug (
"Widgets to large (width) for box: %d %d", b->
max_size, b->
widget.
w );
234 if ( active_widgets > 0 ) {
236 double rem = rem_width - b->
max_size;
238 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
240 if ( child->
enabled == FALSE ) {
243 if ( child->
expand == TRUE ) {
245 int expanding_widgets_size = ( rem ) / ( expanding_widgets - index );
247 left += expanding_widgets_size;
250 rem -= expanding_widgets_size;
266 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
276 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
319 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
325 gint rx = x - child->
x;
326 gint ry = y - child->
y;
328 if ( target != NULL ) {
338 box *b = g_malloc0 (
sizeof (
box ) );
@ ROFI_ORIENTATION_VERTICAL
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
box * box_create(widget *parent, const char *name, RofiOrientation type)
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
void box_add(box *box, widget *child, gboolean expand)
static void vert_calculate_size(box *b)
static void box_resize(widget *widget, short w, short h)
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
static void box_draw(widget *wid, cairo_t *draw)
static void box_free(widget *wid)
static void hori_calculate_size(box *b)
static int box_get_desired_width(widget *wid)
static void box_update(widget *wid)
static int box_get_desired_height(widget *wid)
static widget * box_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
@ ROFI_ORIENTATION_HORIZONTAL