1 ////////////////////////////////////////////////////////////////////////////////
2 //3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
3 //      10        20        30        40        50        60        70        80
4 //
5 // notify-osd
6 //
7 // bubble.h - implements all the rendering of a notification bubble
8 //
9 // Copyright 2009 Canonical Ltd.
10 //
11 // Authors:
12 //    Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
13 //    David Barth <david.barth@canonical.com>
14 //
15 // Contributor(s):
16 //    Eitan Isaacson <eitan@ascender.com> (ATK interface for a11y, rev. 351)
17 //
18 // This program is free software: you can redistribute it and/or modify it
19 // under the terms of the GNU General Public License version 3, as published
20 // by the Free Software Foundation.
21 //
22 // This program is distributed in the hope that it will be useful, but
23 // WITHOUT ANY WARRANTY; without even the implied warranties of
24 // MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
25 // PURPOSE.  See the GNU General Public License for more details.
26 //
27 // You should have received a copy of the GNU General Public License along
28 // with this program.  If not, see <http://www.gnu.org/licenses/>.
29 //
30 ////////////////////////////////////////////////////////////////////////////////
31 
32 #ifndef __BUBBLE_H
33 #define __BUBBLE_H
34 
35 #include <glib-object.h>
36 #include <gdk-pixbuf/gdk-pixbuf.h>
37 
38 #include "defaults.h"
39 
40 typedef enum
41 {
42 	LAYOUT_NONE = 0,
43 	LAYOUT_ICON_ONLY,
44 	LAYOUT_ICON_INDICATOR,
45 	LAYOUT_ICON_TITLE,
46 	LAYOUT_ICON_TITLE_BODY,
47 	LAYOUT_TITLE_BODY,
48 	LAYOUT_TITLE_ONLY
49 } BubbleLayout;
50 
51 G_BEGIN_DECLS
52 
53 #define BUBBLE_TYPE             (bubble_get_type ())
54 #define BUBBLE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUBBLE_TYPE, Bubble))
55 #define BUBBLE_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), BUBBLE_TYPE, BubbleClass))
56 #define IS_BUBBLE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUBBLE_TYPE))
57 #define IS_BUBBLE_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), BUBBLE_TYPE))
58 #define BUBBLE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BUBBLE_TYPE, BubbleClass))
59 
60 typedef struct _Bubble        Bubble;
61 typedef struct _BubbleClass   BubbleClass;
62 typedef struct _BubblePrivate BubblePrivate;
63 
64 // instance structure
65 struct _Bubble
66 {
67 	GObject   parent;
68 	Defaults* defaults;
69 
70 	//< private >
71 	BubblePrivate *priv;
72 };
73 
74 // class structure
75 struct _BubbleClass
76 {
77 	GObjectClass parent;
78 
79 	//< signals >
80 	void (*timed_out) (Bubble* bubble);
81 	void (*value_changed) (Bubble* bubble);
82 	void (*message_body_deleted) (Bubble* bubble);
83 	void (*message_body_inserted) (Bubble* bubble);
84 };
85 
86 GType bubble_get_type (void);
87 
88 Bubble*
89 bubble_new (Defaults* defaults);
90 
91 gchar*
92 bubble_get_synchronous (Bubble *self);
93 
94 gchar*
95 bubble_get_sender (Bubble *self);
96 
97 void
98 bubble_set_title (Bubble*      self,
99 		  const gchar* title);
100 
101 const gchar*
102 bubble_get_title (Bubble* self);
103 
104 void
105 bubble_set_message_body (Bubble*      self,
106 			 const gchar* body);
107 
108 const gchar*
109 bubble_get_message_body (Bubble* self);
110 
111 void
112 bubble_set_icon_from_path (Bubble*      self,
113 			   const gchar* filepath);
114 
115 void
116 bubble_set_icon (Bubble*      self,
117 		 const gchar* filename);
118 
119 void
120 bubble_set_icon_from_pixbuf (Bubble*      self,
121 			     GdkPixbuf*   pixbuf);
122 
123 GdkPixbuf*
124 bubble_get_icon_pixbuf (Bubble *self);
125 
126 void
127 bubble_set_value (Bubble* self,
128 		  gint    value);
129 
130 gint
131 bubble_get_value (Bubble* self);
132 
133 void
134 bubble_set_size (Bubble* self,
135 		 gint    width,
136 		 gint    height);
137 
138 void
139 bubble_get_size (Bubble* self,
140 		 gint*   width,
141 		 gint*   height);
142 
143 void
144 bubble_set_timeout (Bubble* self,
145 		    guint   timeout);
146 
147 guint
148 bubble_get_timeout (Bubble* self);
149 
150 void
151 bubble_set_timer_id (Bubble* self,
152 		     guint   timer_id);
153 
154 guint
155 bubble_get_timer_id (Bubble* self);
156 
157 void
158 bubble_set_mouse_over (Bubble*  self,
159 		       gboolean flag);
160 
161 gboolean
162 bubble_is_mouse_over (Bubble* self);
163 
164 void
165 bubble_move (Bubble* self,
166 	     gint x,
167 	     gint y);
168 
169 gboolean
170 bubble_timed_out (Bubble* self);
171 
172 void
173 bubble_show (Bubble* self);
174 
175 void
176 bubble_refresh (Bubble* self);
177 
178 void
179 bubble_hide (Bubble* self);
180 
181 void
182 bubble_set_id (Bubble* self,
183 	       guint   id);
184 
185 guint
186 bubble_get_id (Bubble* self);
187 
188 gboolean
189 bubble_is_visible (Bubble* self);
190 
191 void
192 bubble_start_timer (Bubble*  self,
193 		    gboolean trigger);
194 
195 void
196 bubble_clear_timer (Bubble* self);
197 
198 void
199 bubble_get_position (Bubble* self,
200 		     gint*   x,
201 		     gint*   y);
202 
203 gint
204 bubble_get_height (Bubble *self);
205 
206 gint
207 bubble_get_future_height (Bubble *self);
208 
209 void
210 bubble_recalc_size (Bubble *self);
211 
212 gboolean
213 bubble_is_synchronous (Bubble *self);
214 
215 void
216 bubble_set_synchronous (Bubble *self,
217 			const gchar *sync);
218 
219 void
220 bubble_set_sender (Bubble *self,
221 		   const gchar *sender);
222 
223 gboolean
224 bubble_is_urgent (Bubble *self);
225 
226 guint
227 bubble_get_urgency (Bubble *self);
228 
229 void
230 bubble_set_urgency (Bubble *self,
231 		    guint urgency);
232 
233 void
234 bubble_fade_out (Bubble *self,
235 		 guint   msecs);
236 
237 void
238 bubble_fade_in (Bubble *self,
239 		guint   msecs);
240 
241 void
242 bubble_determine_layout (Bubble* self);
243 
244 BubbleLayout
245 bubble_get_layout (Bubble* self);
246 
247 void
248 bubble_set_icon_only (Bubble*  self,
249 		      gboolean allowed);
250 
251 void
252 bubble_set_append (Bubble*  self,
253 		   gboolean allowed);
254 
255 gboolean
256 bubble_is_append_allowed (Bubble* self);
257 
258 void
259 bubble_append_message_body (Bubble*      self,
260 			    const gchar* append_body);
261 
262 void
263 bubble_sync_with (Bubble *self,
264 		  Bubble *other);
265 
266 GObject*
267 bubble_show_dialog (Bubble *bubble,
268 		    const char *process_name,
269 		    gchar **actions);
270 
271 G_END_DECLS
272 
273 #endif // __BUBBLE_H
274