summaryrefslogtreecommitdiff
path: root/shell/egg-flow-box.h
blob: 3154a9f7f01ffb9f8e7db99c6fd19ef319b5477a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 * Copyright (C) 2010 Openismus GmbH
 * Copyright (C) 2013 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Authors:
 *      Tristan Van Berkom <tristanvb@openismus.com>
 *      Matthias Clasen <mclasen@redhat.com>
 *      William Jon McCann <jmccann@redhat.com>
 */

#ifndef __EGG_FLOW_BOX_H__
#define __EGG_FLOW_BOX_H__

#include <gtk/gtk.h>

G_BEGIN_DECLS


#define EGG_TYPE_FLOW_BOX                  (egg_flow_box_get_type ())
#define EGG_FLOW_BOX(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_FLOW_BOX, EggFlowBox))
#define EGG_FLOW_BOX_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_FLOW_BOX, EggFlowBoxClass))
#define EGG_IS_FLOW_BOX(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_FLOW_BOX))
#define EGG_IS_FLOW_BOX_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_FLOW_BOX))
#define EGG_FLOW_BOX_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_FLOW_BOX, EggFlowBoxClass))

typedef struct _EggFlowBox            EggFlowBox;
typedef struct _EggFlowBoxPrivate     EggFlowBoxPrivate;
typedef struct _EggFlowBoxClass       EggFlowBoxClass;

/**
 * EggFlowBoxForeachFunc:
 * @flow_box: an #EggFlowBox
 * @child: The child #GtkWidget
 * @data: user data
 *
 * A function used by egg_flow_box_selected_foreach() to map all
 * selected children.  It will be called on every selected child in the box.
 */
typedef void (* EggFlowBoxForeachFunc)     (EggFlowBox      *flow_box,
                                            GtkWidget       *child,
                                            gpointer         data);

struct _EggFlowBox
{
  GtkContainer container;

  /*< private >*/
  EggFlowBoxPrivate *priv;
};

struct _EggFlowBoxClass
{
  GtkContainerClass parent_class;

  void (* child_activated) (EggFlowBox *self, GtkWidget *child);
  void (* selected_children_changed) (EggFlowBox *self);
  void (*activate_cursor_child) (EggFlowBox *self);
  void (*toggle_cursor_child) (EggFlowBox *self);
  void (*move_cursor) (EggFlowBox *self, GtkMovementStep step, gint count);
  void (*select_all) (EggFlowBox *self);
  void (*unselect_all) (EggFlowBox *self);
};

GType                 egg_flow_box_get_type                  (void) G_GNUC_CONST;

GtkWidget            *egg_flow_box_new                       (void);

void                  egg_flow_box_set_homogeneous           (EggFlowBox           *box,
                                                              gboolean              homogeneous);
gboolean              egg_flow_box_get_homogeneous           (EggFlowBox           *box);
void                  egg_flow_box_set_halign_policy         (EggFlowBox           *box,
                                                              GtkAlign              align);
GtkAlign              egg_flow_box_get_halign_policy         (EggFlowBox           *box);
void                  egg_flow_box_set_valign_policy         (EggFlowBox           *box,
                                                              GtkAlign              align);
GtkAlign              egg_flow_box_get_valign_policy         (EggFlowBox           *box);
void                  egg_flow_box_set_row_spacing           (EggFlowBox           *box,
                                                              guint                 spacing);
guint                 egg_flow_box_get_row_spacing           (EggFlowBox           *box);

void                  egg_flow_box_set_column_spacing        (EggFlowBox           *box,
                                                              guint                 spacing);
guint                 egg_flow_box_get_column_spacing        (EggFlowBox           *box);

void                  egg_flow_box_set_min_children_per_line (EggFlowBox           *box,
                                                              guint                 n_children);
guint                 egg_flow_box_get_min_children_per_line (EggFlowBox           *box);

void                  egg_flow_box_set_max_children_per_line (EggFlowBox           *box,
                                                              guint                 n_children);
guint                 egg_flow_box_get_max_children_per_line (EggFlowBox           *box);

gboolean              egg_flow_box_get_activate_on_single_click (EggFlowBox        *box);
void                  egg_flow_box_set_activate_on_single_click (EggFlowBox        *box,
                                                                 gboolean           single);

GList                *egg_flow_box_get_selected_children        (EggFlowBox        *box);
void                  egg_flow_box_selected_foreach             (EggFlowBox        *box,
                                                                 EggFlowBoxForeachFunc func,
                                                                 gpointer           data);
void                  egg_flow_box_select_child                 (EggFlowBox        *box,
                                                                 GtkWidget         *child);
void                  egg_flow_box_unselect_child               (EggFlowBox        *box,
                                                                 GtkWidget         *child);
void                  egg_flow_box_select_all                   (EggFlowBox        *box);
void                  egg_flow_box_unselect_all                 (EggFlowBox        *box);
gboolean              egg_flow_box_is_child_selected            (EggFlowBox        *box,
                                                                 GtkWidget         *child);
GtkSelectionMode      egg_flow_box_get_selection_mode           (EggFlowBox        *box);
void                  egg_flow_box_set_selection_mode           (EggFlowBox        *box,
                                                                 GtkSelectionMode   mode);
void                  egg_flow_box_set_adjustment               (EggFlowBox        *box,
                                                                 GtkAdjustment     *adjustment);

G_END_DECLS


#endif /* __EGG_FLOW_BOX_H__ */