28 #define G_LOG_DOMAIN "Widgets.Box" 38 #define DEFAULT_SPACING 2 67 int active_widgets = 0;
68 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
74 if ( child->
expand == TRUE ) {
80 if ( active_widgets > 0 ) {
81 width += ( active_widgets - 1 ) * spacing;
85 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
102 int active_widgets = 0;
103 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
109 if ( child->
expand == TRUE ) {
115 if ( active_widgets > 0 ) {
116 height += ( active_widgets - 1 ) * spacing;
120 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
135 int expanding_widgets = 0;
136 int active_widgets = 0;
139 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
146 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
152 if ( child->
expand == TRUE ) {
156 if ( child->
h > 0 ) {
160 if ( active_widgets > 0 ) {
161 b->
max_size += ( active_widgets - 1 ) * spacing;
165 g_debug (
"Widgets to large (height) for box: %d %d", b->
max_size, b->
widget.
h );
168 if ( active_widgets > 0 ) {
170 double rem = rem_height - b->
max_size;
172 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
174 if ( child->
enabled == FALSE ) {
177 if ( child->
expand == TRUE ) {
179 int expanding_widgets_size = ( rem ) / ( expanding_widgets - index );
181 top += expanding_widgets_size;
184 rem -= expanding_widgets_size;
199 int expanding_widgets = 0;
200 int active_widgets = 0;
203 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
212 for ( GList *iter = g_list_first ( b->
children ); iter != NULL; iter = g_list_next ( iter ) ) {
218 if ( child->
expand == TRUE ) {
223 if ( child->
h > 0 ) {
227 b->
max_size += MAX ( 0, ( ( active_widgets - 1 ) * spacing ) );
228 if ( b->
max_size > ( rem_width ) ) {
230 g_debug (
"Widgets to large (width) for box: %d %d", b->
max_size, b->
widget.
w );
233 if ( active_widgets > 0 ) {
235 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 box *b = g_malloc0 (
sizeof (
box ) );
static int box_get_desired_height(widget *wid)
int rofi_theme_get_boolean(const widget *widget, const char *property, int def)
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property, int def)
static void hori_calculate_size(box *b)
static void vert_calculate_size(box *b)
static void box_draw(widget *wid, cairo_t *draw)
box * box_create(widget *parent, const char *name, RofiOrientation type)
static void box_resize(widget *widget, short w, short h)
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)
static void box_free(widget *wid)
static widget * box_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
static void box_update(widget *wid)
static int box_get_desired_width(widget *wid)
void box_add(box *box, widget *child, gboolean expand)