2 * @file whiteboard.h The PurpleWhiteboard core object
7 * Purple is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #ifndef _PURPLE_WHITEBOARD_H_
27 #define _PURPLE_WHITEBOARD_H_
30 * Whiteboard PRPL Operations
32 typedef struct _PurpleWhiteboardPrplOps PurpleWhiteboardPrplOps
;
39 typedef struct _PurpleWhiteboard
41 int state
; /**< State of whiteboard session */
43 PurpleAccount
*account
; /**< Account associated with this session */
44 char *who
; /**< Name of the remote user */
46 void *ui_data
; /**< Graphical user-interface data */
47 void *proto_data
; /**< Protocol specific data */
48 PurpleWhiteboardPrplOps
*prpl_ops
; /**< Protocol-plugin operations */
50 GList
*draw_list
; /**< List of drawing elements/deltas to send */
54 * The PurpleWhiteboard UI Operations
56 typedef struct _PurpleWhiteboardUiOps
58 void (*create
)(PurpleWhiteboard
*wb
); /**< create function */
59 void (*destroy
)(PurpleWhiteboard
*wb
); /**< destory function */
60 void (*set_dimensions
)(PurpleWhiteboard
*wb
, int width
, int height
); /**< set_dimensions function */
61 void (*set_brush
) (PurpleWhiteboard
*wb
, int size
, int color
); /**< set the size and color of the brush */
62 void (*draw_point
)(PurpleWhiteboard
*wb
, int x
, int y
,
63 int color
, int size
); /**< draw_point function */
64 void (*draw_line
)(PurpleWhiteboard
*wb
, int x1
, int y1
,
66 int color
, int size
); /**< draw_line function */
67 void (*clear
)(PurpleWhiteboard
*wb
); /**< clear function */
69 void (*_purple_reserved1
)(void);
70 void (*_purple_reserved2
)(void);
71 void (*_purple_reserved3
)(void);
72 void (*_purple_reserved4
)(void);
73 } PurpleWhiteboardUiOps
;
76 * PurpleWhiteboard PRPL Operations
78 struct _PurpleWhiteboardPrplOps
80 void (*start
)(PurpleWhiteboard
*wb
); /**< start function */
81 void (*end
)(PurpleWhiteboard
*wb
); /**< end function */
82 void (*get_dimensions
)(const PurpleWhiteboard
*wb
, int *width
, int *height
); /**< get_dimensions function */
83 void (*set_dimensions
)(PurpleWhiteboard
*wb
, int width
, int height
); /**< set_dimensions function */
84 void (*get_brush
) (const PurpleWhiteboard
*wb
, int *size
, int *color
); /**< get the brush size and color */
85 void (*set_brush
) (PurpleWhiteboard
*wb
, int size
, int color
); /**< set the brush size and color */
86 void (*send_draw_list
)(PurpleWhiteboard
*wb
, GList
*draw_list
); /**< send_draw_list function */
87 void (*clear
)(PurpleWhiteboard
*wb
); /**< clear function */
89 void (*_purple_reserved1
)(void);
90 void (*_purple_reserved2
)(void);
91 void (*_purple_reserved3
)(void);
92 void (*_purple_reserved4
)(void);
97 #endif /* __cplusplus */
99 /******************************************************************************/
100 /** @name PurpleWhiteboard API */
101 /******************************************************************************/
105 * Sets the UI operations
107 * @param ops The UI operations to set
109 void purple_whiteboard_set_ui_ops(PurpleWhiteboardUiOps
*ops
);
112 * Sets the prpl operations for a whiteboard
114 * @param wb The whiteboard for which to set the prpl operations
115 * @param ops The prpl operations to set
117 void purple_whiteboard_set_prpl_ops(PurpleWhiteboard
*wb
, PurpleWhiteboardPrplOps
*ops
);
120 * Creates a whiteboard
122 * @param account The account.
123 * @param who Who you're drawing with.
124 * @param state The state.
126 * @return The new whiteboard
128 PurpleWhiteboard
*purple_whiteboard_create(PurpleAccount
*account
, const char *who
, int state
);
131 * Destroys a whiteboard
133 * @param wb The whiteboard.
135 void purple_whiteboard_destroy(PurpleWhiteboard
*wb
);
138 * Starts a whiteboard
140 * @param wb The whiteboard.
142 void purple_whiteboard_start(PurpleWhiteboard
*wb
);
145 * Finds a whiteboard from an account and user.
147 * @param account The account.
148 * @param who The user.
150 * @return The whiteboard if found, otherwise @c NULL.
152 PurpleWhiteboard
*purple_whiteboard_get_session(const PurpleAccount
*account
, const char *who
);
155 * Destorys a drawing list for a whiteboard
157 * @param draw_list The drawing list.
159 void purple_whiteboard_draw_list_destroy(GList
*draw_list
);
162 * Gets the dimension of a whiteboard.
164 * @param wb The whiteboard.
165 * @param width The width to be set.
166 * @param height The height to be set.
168 * @return TRUE if the values of width and height were set.
170 gboolean
purple_whiteboard_get_dimensions(const PurpleWhiteboard
*wb
, int *width
, int *height
);
173 * Sets the dimensions for a whiteboard.
175 * @param wb The whiteboard.
176 * @param width The width.
177 * @param height The height.
179 void purple_whiteboard_set_dimensions(PurpleWhiteboard
*wb
, int width
, int height
);
182 * Draws a point on a whiteboard.
184 * @param wb The whiteboard.
185 * @param x The x coordinate.
186 * @param y The y coordinate.
187 * @param color The color to use.
188 * @param size The brush size.
190 void purple_whiteboard_draw_point(PurpleWhiteboard
*wb
, int x
, int y
, int color
, int size
);
193 * Send a list of points to draw to the buddy.
195 * @param wb The whiteboard
196 * @param list A GList of points
198 void purple_whiteboard_send_draw_list(PurpleWhiteboard
*wb
, GList
*list
);
201 * Draws a line on a whiteboard
203 * @param wb The whiteboard.
204 * @param x1 The top-left x coordinate.
205 * @param y1 The top-left y coordinate.
206 * @param x2 The bottom-right x coordinate.
207 * @param y2 The bottom-right y coordinate.
208 * @param color The color to use.
209 * @param size The brush size.
211 void purple_whiteboard_draw_line(PurpleWhiteboard
*wb
, int x1
, int y1
, int x2
, int y2
, int color
, int size
);
214 * Clears a whiteboard
216 * @param wb The whiteboard.
218 void purple_whiteboard_clear(PurpleWhiteboard
*wb
);
221 * Sends a request to the buddy to clear the whiteboard.
223 * @param wb The whiteboard
225 void purple_whiteboard_send_clear(PurpleWhiteboard
*wb
);
228 * Sends a request to change the size and color of the brush.
230 * @param wb The whiteboard
231 * @param size The size of the brush
232 * @param color The color of the brush
234 void purple_whiteboard_send_brush(PurpleWhiteboard
*wb
, int size
, int color
);
237 * Gets the size and color of the brush.
239 * @param wb The whiteboard
240 * @param size The size of the brush
241 * @param color The color of the brush
243 * @return TRUE if the size and color were set.
245 gboolean
purple_whiteboard_get_brush(const PurpleWhiteboard
*wb
, int *size
, int *color
);
248 * Sets the size and color of the brush.
250 * @param wb The whiteboard
251 * @param size The size of the brush
252 * @param color The color of the brush
254 void purple_whiteboard_set_brush(PurpleWhiteboard
*wb
, int size
, int color
);
260 #endif /* __cplusplus */
262 #endif /* _PURPLE_WHITEBOARD_H_ */