1 /*
2  * Copyright 2010-2011 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of either or both of the following licenses:
6  *
7  * 1) the GNU Lesser General Public License version 3, as published by the
8  * Free Software Foundation; and/or
9  * 2) the GNU Lesser General Public License version 2.1, as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranties of
14  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
15  * PURPOSE.  See the applicable version of the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of both the GNU Lesser General Public
19  * License version 3 and version 2.1 along with this program.  If not, see
20  * <http://www.gnu.org/licenses/>
21  *
22  * Authored by: Jason Smith <jason.smith@canonical.com>
23  *              Neil Jagdish Patel <neil.patel@canonical.com>
24  *              Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
25  *
26  */
27 
28 #ifndef _BAMF_VIEW_H_
29 #define _BAMF_VIEW_H_
30 
31 #include <glib-object.h>
32 
33 G_BEGIN_DECLS
34 
35 #define BAMF_TYPE_VIEW (bamf_view_get_type ())
36 
37 #define BAMF_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
38         BAMF_TYPE_VIEW, BamfView))
39 
40 #define BAMF_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
41         BAMF_TYPE_VIEW, BamfViewClass))
42 
43 #define BAMF_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
44         BAMF_TYPE_VIEW))
45 
46 #define BAMF_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
47         BAMF_TYPE_VIEW))
48 
49 #define BAMF_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
50         BAMF_TYPE_VIEW, BamfViewClass))
51 
52 #define BAMF_VIEW_SIGNAL_ACTIVE_CHANGED       "active-changed"
53 #define BAMF_VIEW_SIGNAL_RUNNING_CHANGED      "running-changed"
54 #define BAMF_VIEW_SIGNAL_STARTING_CHANGED     "starting-changed"
55 #define BAMF_VIEW_SIGNAL_URGENT_CHANGED       "urgent-changed"
56 #define BAMF_VIEW_SIGNAL_USER_VISIBLE_CHANGED "user-visible-changed"
57 #define BAMF_VIEW_SIGNAL_NAME_CHANGED         "name-changed"
58 #define BAMF_VIEW_SIGNAL_ICON_CHANGED         "icon-changed"
59 #define BAMF_VIEW_SIGNAL_CHILD_ADDED          "child-added"
60 #define BAMF_VIEW_SIGNAL_CHILD_REMOVED        "child-removed"
61 #define BAMF_VIEW_SIGNAL_CHILD_MOVED          "child-moved"
62 #define BAMF_VIEW_SIGNAL_CLOSED               "closed"
63 
64 typedef enum
65 {
66   BAMF_CLICK_BEHAVIOR_NONE,
67   BAMF_CLICK_BEHAVIOR_OPEN,
68   BAMF_CLICK_BEHAVIOR_FOCUS,
69   BAMF_CLICK_BEHAVIOR_FOCUS_ALL,
70   BAMF_CLICK_BEHAVIOR_MINIMIZE,
71   BAMF_CLICK_BEHAVIOR_RESTORE,
72   BAMF_CLICK_BEHAVIOR_RESTORE_ALL,
73   BAMF_CLICK_BEHAVIOR_PICKER,
74 } BamfClickBehavior;
75 
76 typedef struct _BamfView        BamfView;
77 typedef struct _BamfViewClass   BamfViewClass;
78 typedef struct _BamfViewPrivate BamfViewPrivate;
79 
80 struct _BamfView
81 {
82   GInitiallyUnowned parent;
83 
84   BamfViewPrivate *priv;
85 };
86 
87 struct _BamfViewClass
88 {
89   GInitiallyUnownedClass parent_class;
90 
91   GList            * (*get_children)        (BamfView *view);
92   gboolean           (*is_active)           (BamfView *view);
93   gboolean           (*is_running)          (BamfView *view);
94   gboolean           (*is_urgent)           (BamfView *view);
95   gboolean           (*is_user_visible)     (BamfView *view);
96   gchar            * (*get_name)            (BamfView *view);
97   gchar            * (*get_icon)            (BamfView *view);
98   const gchar      * (*view_type)           (BamfView *view);
99   void               (*set_path)            (BamfView *view, const gchar *path);
100   void               (*set_sticky)          (BamfView *view, gboolean value);
101   BamfClickBehavior  (*click_behavior)      (BamfView *view);
102 
103   /*< signals >*/
104   void (*active_changed)              (BamfView *view, gboolean active);
105   void (*closed)                      (BamfView *view);
106   void (*child_added)                 (BamfView *view, BamfView *child);
107   void (*child_removed)               (BamfView *view, BamfView *child);
108   void (*running_changed)             (BamfView *view, gboolean running);
109   void (*urgent_changed)              (BamfView *view, gboolean urgent);
110   void (*user_visible_changed)        (BamfView *view, gboolean user_visible);
111   void (*name_changed)                (BamfView *view, gchar* old_name, gchar* new_name);
112   void (*icon_changed)                (BamfView *view, gchar* icon);
113   void (*child_moved)                 (BamfView *view, BamfView *child);
114 
115   gboolean (*is_starting)             (BamfView *view);
116   void     (*starting_changed)        (BamfView *view, gboolean starting);
117 
118   /*< private >*/
119   void (*_view_padding1) (void);
120 };
121 
122 GType      bamf_view_get_type             (void) G_GNUC_CONST;
123 
124 GList    * bamf_view_get_children  (BamfView *view);
125 
126 GList    * bamf_view_peek_children (BamfView *view);
127 
128 gboolean   bamf_view_has_child     (BamfView *view, BamfView *child);
129 
130 gboolean   bamf_view_is_closed     (BamfView *view);
131 
132 gboolean   bamf_view_is_active     (BamfView *view);
133 
134 gboolean   bamf_view_is_starting   (BamfView *view);
135 
136 gboolean   bamf_view_is_running    (BamfView *view);
137 
138 gboolean   bamf_view_is_urgent     (BamfView *view);
139 
140 gboolean   bamf_view_is_user_visible  (BamfView *view);
141 
142 gchar    * bamf_view_get_name      (BamfView *view);
143 
144 gchar    * bamf_view_get_icon      (BamfView *view);
145 
146 const gchar    * bamf_view_get_view_type (BamfView *view);
147 
148 void bamf_view_set_sticky (BamfView *view, gboolean value);
149 
150 gboolean bamf_view_is_sticky (BamfView *view);
151 
152 /* Deprecated symbols */
153 G_GNUC_DEPRECATED
154 BamfClickBehavior bamf_view_get_click_suggestion (BamfView *view);
155 
156 G_GNUC_DEPRECATED_FOR (bamf_view_user_visible)
157 gboolean bamf_view_user_visible (BamfView *view);
158 
159 G_END_DECLS
160 
161 #endif
162