Merge heads.
[pidgin-git.git] / libpurple / whiteboard.h
blob0daa0ed8109226932317e7be575e8aafd4419901
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef PURPLE_WHITEBOARD_H
23 #define PURPLE_WHITEBOARD_H
24 /**
25 * SECTION:whiteboard
26 * @section_id: libpurple-whiteboard
27 * @short_description: <filename>whiteboard.h</filename>
28 * @title: Whiteboard Object
31 #define PURPLE_TYPE_WHITEBOARD (purple_whiteboard_get_type())
32 typedef struct _PurpleWhiteboard PurpleWhiteboard;
34 #define PURPLE_TYPE_WHITEBOARD_UI_OPS (purple_whiteboard_ui_ops_get_type())
36 typedef struct _PurpleWhiteboardUiOps PurpleWhiteboardUiOps;
37 typedef struct _PurpleWhiteboardOps PurpleWhiteboardOps;
39 #include "account.h"
41 /**
42 * PurpleWhiteboardUiOps:
43 * @create: create whiteboard
44 * @destroy: destory whiteboard
45 * @set_dimensions: set whiteboard dimensions
46 * @set_brush: set the size and color of the brush
47 * @draw_point: draw a point
48 * @draw_line: draw a line
49 * @clear: clear whiteboard
51 * The PurpleWhiteboard UI Operations
53 struct _PurpleWhiteboardUiOps
55 void (*create)(PurpleWhiteboard *wb);
56 void (*destroy)(PurpleWhiteboard *wb);
57 void (*set_dimensions)(PurpleWhiteboard *wb, int width, int height);
58 void (*set_brush) (PurpleWhiteboard *wb, int size, int color);
59 void (*draw_point)(PurpleWhiteboard *wb, int x, int y,
60 int color, int size);
61 void (*draw_line)(PurpleWhiteboard *wb, int x1, int y1,
62 int x2, int y2,
63 int color, int size);
64 void (*clear)(PurpleWhiteboard *wb);
66 /*< private >*/
67 void (*_purple_reserved1)(void);
68 void (*_purple_reserved2)(void);
69 void (*_purple_reserved3)(void);
70 void (*_purple_reserved4)(void);
73 /**
74 * PurpleWhiteboardOps:
75 * @start: start function
76 * @end: end function
77 * @get_dimensions: get whiteboard dimensions
78 * @set_dimensions: set whiteboard dimensions
79 * @get_brush: get the brush size and color
80 * @set_brush: set the brush size and color
81 * @send_draw_list: send_draw_list function
82 * @clear: clear whiteboard
84 * Whiteboard protocol operations
86 struct _PurpleWhiteboardOps
88 void (*start)(PurpleWhiteboard *wb);
89 void (*end)(PurpleWhiteboard *wb);
90 void (*get_dimensions)(const PurpleWhiteboard *wb, int *width, int *height);
91 void (*set_dimensions)(PurpleWhiteboard *wb, int width, int height);
92 void (*get_brush) (const PurpleWhiteboard *wb, int *size, int *color);
93 void (*set_brush) (PurpleWhiteboard *wb, int size, int color);
94 void (*send_draw_list)(PurpleWhiteboard *wb, GList *draw_list);
95 void (*clear)(PurpleWhiteboard *wb);
97 /*< private >*/
98 void (*_purple_reserved1)(void);
99 void (*_purple_reserved2)(void);
100 void (*_purple_reserved3)(void);
101 void (*_purple_reserved4)(void);
105 * PurpleWhiteboard:
106 * @ui_data: The UI data associated with this whiteboard. This is a convenience
107 * field provided to the UIs -- it is not used by the libpurple core.
109 * A Whiteboard
111 struct _PurpleWhiteboard
113 GObject gparent;
115 /*< public >*/
116 gpointer ui_data;
119 G_BEGIN_DECLS
121 /******************************************************************************/
122 /* PurpleWhiteboard API */
123 /******************************************************************************/
126 * purple_whiteboard_get_type:
128 * Returns: The #GType for the #PurpleWhiteboard object.
130 G_DECLARE_FINAL_TYPE(PurpleWhiteboard, purple_whiteboard, PURPLE, WHITEBOARD,
131 GObject)
134 * purple_whiteboard_ui_ops_get_type:
136 * Returns: The #GType for the #PurpleWhiteboardUiOps boxed structure.
138 GType purple_whiteboard_ui_ops_get_type(void);
141 * purple_whiteboard_set_ui_ops:
142 * @ops: The UI operations to set
144 * Sets the UI operations
146 void purple_whiteboard_set_ui_ops(PurpleWhiteboardUiOps *ops);
149 * purple_whiteboard_set_protocol_ops:
150 * @wb: The whiteboard for which to set the protocol operations
151 * @ops: The protocol operations to set
153 * Sets the protocol operations for a whiteboard
155 void purple_whiteboard_set_protocol_ops(PurpleWhiteboard *wb, PurpleWhiteboardOps *ops);
158 * purple_whiteboard_new:
159 * @account: The account.
160 * @who: Who you're drawing with.
161 * @state: The state.
163 * Creates a new whiteboard
165 * Returns: The new whiteboard
167 PurpleWhiteboard *purple_whiteboard_new(PurpleAccount *account, const char *who, int state);
170 * purple_whiteboard_get_account:
171 * @wb: The whiteboard.
173 * Returns the whiteboard's account.
175 * Returns: (transfer none): The whiteboard's account.
177 PurpleAccount *purple_whiteboard_get_account(PurpleWhiteboard *wb);
180 * purple_whiteboard_get_who:
181 * @wb: The whiteboard
183 * Return who you're drawing with.
185 * Returns: Who you're drawing with.
187 const char *purple_whiteboard_get_who(PurpleWhiteboard *wb);
190 * purple_whiteboard_set_state:
191 * @wb: The whiteboard.
192 * @state: The state
194 * Set the state of the whiteboard.
196 void purple_whiteboard_set_state(PurpleWhiteboard *wb, int state);
199 * purple_whiteboard_get_state:
200 * @wb: The whiteboard.
202 * Return the state of the whiteboard.
204 * Returns: The state of the whiteboard.
206 int purple_whiteboard_get_state(PurpleWhiteboard *wb);
209 * purple_whiteboard_start:
210 * @wb: The whiteboard.
212 * Starts a whiteboard
214 void purple_whiteboard_start(PurpleWhiteboard *wb);
217 * purple_whiteboard_get_session:
218 * @account: The account.
219 * @who: The user.
221 * Finds a whiteboard from an account and user.
223 * Returns: (transfer none): The whiteboard if found, otherwise %NULL.
225 PurpleWhiteboard *purple_whiteboard_get_session(const PurpleAccount *account, const char *who);
228 * purple_whiteboard_draw_list_destroy:
229 * @draw_list: (element-type gint): The drawing list.
231 * Destorys a drawing list for a whiteboard
233 void purple_whiteboard_draw_list_destroy(GList *draw_list);
236 * purple_whiteboard_get_dimensions:
237 * @wb: The whiteboard.
238 * @width: The width to be set.
239 * @height: The height to be set.
241 * Gets the dimension of a whiteboard.
243 * Returns: TRUE if the values of width and height were set.
245 gboolean purple_whiteboard_get_dimensions(PurpleWhiteboard *wb, int *width, int *height);
248 * purple_whiteboard_set_dimensions:
249 * @wb: The whiteboard.
250 * @width: The width.
251 * @height: The height.
253 * Sets the dimensions for a whiteboard.
255 void purple_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height);
258 * purple_whiteboard_draw_point:
259 * @wb: The whiteboard.
260 * @x: The x coordinate.
261 * @y: The y coordinate.
262 * @color: The color to use.
263 * @size: The brush size.
265 * Draws a point on a whiteboard.
267 void purple_whiteboard_draw_point(PurpleWhiteboard *wb, int x, int y, int color, int size);
270 * purple_whiteboard_send_draw_list:
271 * @wb: The whiteboard
272 * @list: (element-type gint): A GList of points
274 * Send a list of points to draw to the buddy.
276 void purple_whiteboard_send_draw_list(PurpleWhiteboard *wb, GList *list);
279 * purple_whiteboard_draw_line:
280 * @wb: The whiteboard.
281 * @x1: The top-left x coordinate.
282 * @y1: The top-left y coordinate.
283 * @x2: The bottom-right x coordinate.
284 * @y2: The bottom-right y coordinate.
285 * @color: The color to use.
286 * @size: The brush size.
288 * Draws a line on a whiteboard
290 void purple_whiteboard_draw_line(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size);
293 * purple_whiteboard_clear:
294 * @wb: The whiteboard.
296 * Clears a whiteboard
298 void purple_whiteboard_clear(PurpleWhiteboard *wb);
301 * purple_whiteboard_send_clear:
302 * @wb: The whiteboard
304 * Sends a request to the buddy to clear the whiteboard.
306 void purple_whiteboard_send_clear(PurpleWhiteboard *wb);
309 * purple_whiteboard_send_brush:
310 * @wb: The whiteboard
311 * @size: The size of the brush
312 * @color: The color of the brush
314 * Sends a request to change the size and color of the brush.
316 void purple_whiteboard_send_brush(PurpleWhiteboard *wb, int size, int color);
319 * purple_whiteboard_get_brush:
320 * @wb: The whiteboard
321 * @size: The size of the brush
322 * @color: The color of the brush
324 * Gets the size and color of the brush.
326 * Returns: TRUE if the size and color were set.
328 gboolean purple_whiteboard_get_brush(PurpleWhiteboard *wb, int *size, int *color);
331 * purple_whiteboard_set_brush:
332 * @wb: The whiteboard
333 * @size: The size of the brush
334 * @color: The color of the brush
336 * Sets the size and color of the brush.
338 void purple_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color);
341 * purple_whiteboard_get_draw_list:
342 * @wb: The whiteboard.
344 * Return the drawing list.
346 * Returns: (transfer none) (element-type gint): The drawing list
348 GList *purple_whiteboard_get_draw_list(PurpleWhiteboard *wb);
351 * purple_whiteboard_set_draw_list:
352 * @wb: The whiteboard
353 * @draw_list: (element-type gint): The drawing list.
355 * Set the drawing list.
357 void purple_whiteboard_set_draw_list(PurpleWhiteboard *wb, GList* draw_list);
360 * purple_whiteboard_set_protocol_data:
361 * @wb: The whiteboard.
362 * @proto_data: The protocol data to set for the whiteboard.
364 * Sets the protocol data for a whiteboard.
366 void purple_whiteboard_set_protocol_data(PurpleWhiteboard *wb, gpointer proto_data);
369 * purple_whiteboard_get_protocol_data:
370 * @wb: The whiteboard.
372 * Gets the protocol data for a whiteboard.
374 * Returns: The protocol data for the whiteboard.
376 gpointer purple_whiteboard_get_protocol_data(PurpleWhiteboard *wb);
379 * purple_whiteboard_set_ui_data:
380 * @wb: The whiteboard.
381 * @ui_data: A pointer to associate with this whiteboard.
383 * Set the UI data associated with this whiteboard.
385 void purple_whiteboard_set_ui_data(PurpleWhiteboard *wb, gpointer ui_data);
388 * purple_whiteboard_get_ui_data:
389 * @wb: The whiteboard..
391 * Get the UI data associated with this whiteboard.
393 * Returns: The UI data associated with this whiteboard. This is a
394 * convenience field provided to the UIs--it is not
395 * used by the libpurple core.
397 gpointer purple_whiteboard_get_ui_data(PurpleWhiteboard *wb);
399 G_END_DECLS
401 #endif /* PURPLE_WHITEBOARD_H */