Merging upstream version 0.7.0 (Closes: #493243, #510888, #567617, #699414, #709777...
[debian/lxpanel.git] / src / icon-grid.h
index 8f3964c..340fbbb 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2009 LxDE Developers, see the file AUTHORS for details.
+ * Copyright (c) 2009-2014 LxDE Developers, see the file AUTHORS for details.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifndef ICON_GRID_H
-#define ICON_GRID_H
+#ifndef __ICON_GRID_H__
+#define __ICON_GRID_H__ 1
 
 #include <gtk/gtk.h>
 
-#include "panel.h"
+G_BEGIN_DECLS
 
-struct _icon_grid_element;
-struct _icon_grid;
+#define PANEL_TYPE_ICON_GRID               (panel_icon_grid_get_type())
+#define PANEL_ICON_GRID(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+                                            PANEL_TYPE_ICON_GRID, PanelIconGrid))
+#define PANEL_ICON_GRID_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), \
+                                            PANEL_TYPE_ICON_GRID, PanelIconGridClass))
+#define PANEL_IS_ICON_GRID(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                                            PANEL_TYPE_ICON_GRID))
+#define PANEL_IS_ICON_GRID_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                                            PANEL_TYPE_ICON_GRID))
 
-/* Representative of an icon grid element.  This is a widget to be packed into a rectangular grid whose size adapts to conditions. */
-typedef struct _icon_grid_element {
-    struct _icon_grid_element * flink;         /* Forward link */
-    struct _icon_grid * ig;                    /* Back pointer to IconGrid */
-    GtkWidget * widget;                                /* Customer's widget */
-    gboolean visible;                          /* True if widget is visible */
-} IconGridElement;
+extern GType panel_icon_grid_get_type   (void) G_GNUC_CONST;
 
-/* Representative of an icon grid.  This is a manager that packs widgets into a rectangular grid whose size adapts to conditions. */
-typedef struct _icon_grid {
-    IconGridElement * child_list;              /* List of icon grid elements */
-    Panel * panel;                             /* Back pointer to panel */
-    GtkWidget * container;                     /* Container widget */
-    GtkOrientation orientation;                        /* Desired orientation */
-    gint child_width;                          /* Desired child width */
-    gint child_height;                         /* Desired child height */
-    gint spacing;                              /* Desired spacing between grid elements */
-    gint border;                               /* Desired border around grid elements */
-    gint target_dimension;                     /* Desired dimension perpendicular to orientation */
-    gboolean constrain_width;                  /* True if width should be constrained by allocated space */
-    gboolean actual_dimension;                 /* True if container has been allocated space */
-    gboolean children_changed;                 /* True if icon grid element list changed */
-    GtkWidget * widget;                                /* Layout widget we use for packing */
-    int rows;                                  /* Computed layout rows */
-    int columns;                               /* Computed layout columns */
-    int container_width;                       /* Container's allocated width */
-    int container_height;                      /* Container's allocated height */
-    int constrained_child_width;               /* Child width constrained by allocation */
-} IconGrid;
+typedef struct _PanelIconGrid           PanelIconGrid;
+typedef struct _PanelIconGridClass      PanelIconGridClass;
 
-extern IconGrid * icon_grid_new(
-    Panel * panel, GtkWidget * container,
+extern GtkWidget * panel_icon_grid_new(
     GtkOrientation orientation, gint child_width, gint child_height, gint spacing, gint border, gint target_dimension);
                                                /* Create an icon grid */
-extern void icon_grid_set_constrain_width(IconGrid * ig, gboolean constrain_width);
+extern void panel_icon_grid_set_constrain_width(PanelIconGrid * ig, gboolean constrain_width);
                                                /* Set the constrain-width property */
-extern void icon_grid_set_geometry(IconGrid * ig,
+/* extern void panel_icon_grid_set_fill_width(PanelIconGrid * ig, gboolean fill_width);
+                                                Set the fill-width property */
+extern void panel_icon_grid_set_geometry(PanelIconGrid * ig,
     GtkOrientation orientation, gint child_width, gint child_height, gint spacing, gint border, gint target_dimension);
                                                /* Change the geometry of an icon grid */
-extern void icon_grid_add(IconGrid * ig, GtkWidget * child, gboolean visible);
-                                               /* Add a child to the icon grid */
-extern void icon_grid_remove(IconGrid * ig, GtkWidget * child);
-                                               /* Remove a child from the icon grid */
-extern void icon_grid_reorder_child(IconGrid * ig, GtkWidget * child, gint position);
+extern gint panel_icon_grid_get_child_position(PanelIconGrid * ig, GtkWidget * child);
+                                               /* Get the index of an icon grid element. */
+extern void panel_icon_grid_reorder_child(PanelIconGrid * ig, GtkWidget * child, gint position);
                                                /* Reorder the position of a child in the icon grid */
-extern void icon_grid_set_visible(IconGrid * ig, GtkWidget * child, gboolean visible);
-                                               /* Set the visibility of a child in the icon grid */
-extern void icon_grid_free(IconGrid * ig);     /* Free the icon grid */
+
+G_END_DECLS
 
 #endif