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