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 ) ) {
112 if ( active_widgets > 0 ) {
113 height += ( active_widgets - 1 ) * spacing;
117 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
132 int expanding_widgets = 0;
133 int active_widgets = 0;
136 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
143 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
149 if ( child->
expand == TRUE ) {
153 if ( child->
h > 0 ) {
157 if ( active_widgets > 0 ) {
158 b->
max_size += ( active_widgets - 1 ) * spacing;
162 g_debug (
"Widgets to large (height) for box: %d %d", b->
max_size, b->
widget.
h );
165 if ( active_widgets > 0 ) {
167 double rem = rem_height - b->
max_size;
169 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
171 if ( child->
enabled == FALSE ) {
174 if ( child->
expand == TRUE ) {
176 int expanding_widgets_size = ( rem ) / ( expanding_widgets - index );
178 top += expanding_widgets_size;
181 rem -= expanding_widgets_size;
196 int expanding_widgets = 0;
197 int active_widgets = 0;
200 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
209 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
215 if ( child->
expand == TRUE ) {
220 if ( child->
h > 0 ) {
224 b->
max_size += MAX ( 0, ( ( active_widgets - 1 ) * spacing ) );
225 if ( b->
max_size > ( rem_width ) ) {
227 g_debug (
"Widgets to large (width) for box: %d %d", b->
max_size, b->
widget.
w );
230 if ( active_widgets > 0 ) {
232 double rem = rem_width - b->
max_size;
237 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
239 if ( child->
enabled == FALSE ) {
242 if ( child->
expand == TRUE ) {
244 int expanding_widgets_size = ( rem ) / ( expanding_widgets - index );
246 left += expanding_widgets_size;
249 rem -= expanding_widgets_size;
265 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
275 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
318 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
324 gint rx = x - child->
x;
325 gint ry = y - child->
y;
327 if ( target != NULL ) {
337 for ( GList *iter = g_list_first ( ( (
box *) wid )->children ); iter != NULL; iter = g_list_next ( iter ) ) {
345 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 void box_set_state(widget *wid, const char *state)
static widget * box_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
@ ROFI_ORIENTATION_HORIZONTAL