29#define G_LOG_DOMAIN "Widgets.Box"
38#define DEFAULT_SPACING 2
65 int active_widgets = 0;
66 for (GList *iter = g_list_first(b->
children); iter != NULL;
67 iter = g_list_next(iter)) {
73 if (child->
expand == TRUE) {
79 if (active_widgets > 0) {
80 width += (active_widgets - 1) * spacing;
83 for (GList *iter = g_list_first(b->
children); iter != NULL;
84 iter = g_list_next(iter)) {
100 int active_widgets = 0;
101 for (GList *iter = g_list_first(b->
children); iter != NULL;
102 iter = g_list_next(iter)) {
110 if (active_widgets > 0) {
111 height += (active_widgets - 1) * spacing;
114 for (GList *iter = g_list_first(b->
children); iter != NULL;
115 iter = g_list_next(iter)) {
129 int expanding_widgets = 0;
130 int active_widgets = 0;
133 for (GList *iter = g_list_first(b->
children); iter != NULL;
134 iter = g_list_next(iter)) {
142 for (GList *iter = g_list_first(b->
children); iter != NULL;
143 iter = g_list_next(iter)) {
149 if (child->
expand == TRUE) {
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,
166 if (active_widgets > 0) {
168 double rem = rem_height - b->
max_size;
170 for (GList *iter = g_list_first(b->
children); iter != NULL;
171 iter = g_list_next(iter)) {
176 if (child->
expand == TRUE) {
178 int expanding_widgets_size = (rem) / (expanding_widgets - index);
180 top += expanding_widgets_size;
183 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;
201 iter = g_list_next(iter)) {
210 for (GList *iter = g_list_first(b->
children); iter != NULL;
211 iter = g_list_next(iter)) {
217 if (child->
expand == TRUE) {
226 b->
max_size += MAX(0, ((active_widgets - 1) * spacing));
229 g_debug(
"Widgets to large (width) for box: %d %d", b->
max_size,
233 if (active_widgets > 0) {
235 double rem = rem_width - b->
max_size;
240 for (GList *iter = g_list_first(b->
children); iter != NULL;
241 iter = g_list_next(iter)) {
246 if (child->
expand == TRUE) {
248 int expanding_widgets_size = (rem) / (expanding_widgets - index);
250 left += expanding_widgets_size;
253 rem -= expanding_widgets_size;
267 for (GList *iter = g_list_first(b->
children); iter != NULL;
268 iter = g_list_next(iter)) {
277 for (GList *iter = g_list_first(b->
children); iter != NULL;
278 iter = g_list_next(iter)) {
320 for (GList *iter = g_list_first(b->
children); iter != NULL;
321 iter = g_list_next(iter)) {
327 gint rx = x - child->
x;
328 gint ry = y - child->
y;
330 if (target != NULL) {
339 for (GList *iter = g_list_first(((
box *)wid)->children); iter != NULL;
340 iter = g_list_next(iter)) {
347 box *b = g_malloc0(
sizeof(
box));
static void vert_calculate_size(box *b)
static int box_get_desired_width(widget *wid, const int height)
static void box_set_state(widget *wid, const char *state)
static void box_update(widget *wid)
static void hori_calculate_size(box *b)
static void box_free(widget *wid)
static void box_resize(widget *widget, short w, short h)
static widget * box_find_mouse_target(widget *wid, WidgetType type, gint x, gint y)
static int box_get_desired_height(widget *wid, const int width)
static void box_draw(widget *wid, cairo_t *draw)
void box_add(box *box, widget *child, gboolean expand)
box * box_create(widget *parent, const char *name, RofiOrientation type)
@ ROFI_ORIENTATION_HORIZONTAL
@ ROFI_ORIENTATION_VERTICAL
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)
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
RofiOrientation rofi_theme_get_orientation(const widget *widget, const char *property, RofiOrientation def)