Adding upstream version 0.5.12.
[debian/lxpanel.git] / src / icon-grid.h
CommitLineData
2ba86315
DB
1/**
2 * Copyright (c) 2009 LxDE Developers, see the file AUTHORS for details.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef ICON_GRID_H
20#define ICON_GRID_H
21
22#include <gtk/gtk.h>
23
24#include "panel.h"
25
26struct _icon_grid_element;
27struct _icon_grid;
28
29/* Representative of an icon grid element. This is a widget to be packed into a rectangular grid whose size adapts to conditions. */
30typedef struct _icon_grid_element {
31 struct _icon_grid_element * flink; /* Forward link */
32 struct _icon_grid * ig; /* Back pointer to IconGrid */
33 GtkWidget * widget; /* Customer's widget */
34 gboolean visible; /* True if widget is visible */
35} IconGridElement;
36
37/* Representative of an icon grid. This is a manager that packs widgets into a rectangular grid whose size adapts to conditions. */
38typedef struct _icon_grid {
39 IconGridElement * child_list; /* List of icon grid elements */
40 Panel * panel; /* Back pointer to panel */
41 GtkWidget * container; /* Container widget */
42 GtkOrientation orientation; /* Desired orientation */
43 gint child_width; /* Desired child width */
44 gint child_height; /* Desired child height */
45 gint spacing; /* Desired spacing between grid elements */
46 gint border; /* Desired border around grid elements */
47 gint target_dimension; /* Desired dimension perpendicular to orientation */
48 gboolean constrain_width; /* True if width should be constrained by allocated space */
49 gboolean actual_dimension; /* True if container has been allocated space */
50 gboolean children_changed; /* True if icon grid element list changed */
51 GtkWidget * widget; /* Layout widget we use for packing */
52 int rows; /* Computed layout rows */
53 int columns; /* Computed layout columns */
54 int container_width; /* Container's allocated width */
55 int container_height; /* Container's allocated height */
56 int constrained_child_width; /* Child width constrained by allocation */
57} IconGrid;
58
59extern IconGrid * icon_grid_new(
60 Panel * panel, GtkWidget * container,
61 GtkOrientation orientation, gint child_width, gint child_height, gint spacing, gint border, gint target_dimension);
62 /* Create an icon grid */
63extern void icon_grid_set_constrain_width(IconGrid * ig, gboolean constrain_width);
64 /* Set the constrain-width property */
65extern void icon_grid_set_geometry(IconGrid * ig,
66 GtkOrientation orientation, gint child_width, gint child_height, gint spacing, gint border, gint target_dimension);
67 /* Change the geometry of an icon grid */
68extern void icon_grid_add(IconGrid * ig, GtkWidget * child, gboolean visible);
69 /* Add a child to the icon grid */
70extern void icon_grid_remove(IconGrid * ig, GtkWidget * child);
71 /* Remove a child from the icon grid */
72extern void icon_grid_reorder_child(IconGrid * ig, GtkWidget * child, gint position);
73 /* Reorder the position of a child in the icon grid */
74extern void icon_grid_set_visible(IconGrid * ig, GtkWidget * child, gboolean visible);
75 /* Set the visibility of a child in the icon grid */
76extern void icon_grid_free(IconGrid * ig); /* Free the icon grid */
77
78#endif