| 1 /** |
|
| 2 * @file whiteboard.h The GaimWhiteboard core object |
|
| 3 * |
|
| 4 * gaim |
|
| 5 * |
|
| 6 * Gaim is the legal property of its developers, whose names are too numerous |
|
| 7 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
| 8 * source distribution. |
|
| 9 * |
|
| 10 * This program is free software; you can redistribute it and/or modify |
|
| 11 * it under the terms of the GNU General Public License as published by |
|
| 12 * the Free Software Foundation; either version 2 of the License, or |
|
| 13 * (at your option) any later version. |
|
| 14 * |
|
| 15 * This program is distributed in the hope that it will be useful, |
|
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 * GNU General Public License for more details. |
|
| 19 * |
|
| 20 * You should have received a copy of the GNU General Public License |
|
| 21 * along with this program; if not, write to the Free Software |
|
| 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 */ |
|
| 24 |
|
| 25 #ifndef _GAIM_WHITEBOARD_H_ |
|
| 26 #define _GAIM_WHITEBOARD_H_ |
|
| 27 |
|
| 28 /** |
|
| 29 * Whiteboard PRPL Operations |
|
| 30 */ |
|
| 31 typedef struct _GaimWhiteboardPrplOps GaimWhiteboardPrplOps; |
|
| 32 |
|
| 33 #include "account.h" |
|
| 34 |
|
| 35 /** |
|
| 36 * A GaimWhiteboard |
|
| 37 */ |
|
| 38 typedef struct _GaimWhiteboard |
|
| 39 { |
|
| 40 int state; /**< State of whiteboard session */ |
|
| 41 |
|
| 42 GaimAccount *account; /**< Account associated with this session */ |
|
| 43 char *who; /**< Name of the remote user */ |
|
| 44 |
|
| 45 void *ui_data; /**< Graphical user-interface data */ |
|
| 46 void *proto_data; /**< Protocol specific data */ |
|
| 47 GaimWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ |
|
| 48 |
|
| 49 GList *draw_list; /**< List of drawing elements/deltas to send */ |
|
| 50 } GaimWhiteboard; |
|
| 51 |
|
| 52 /** |
|
| 53 * The GaimWhiteboard UI Operations |
|
| 54 */ |
|
| 55 typedef struct _GaimWhiteboardUiOps |
|
| 56 { |
|
| 57 void (*create)(GaimWhiteboard *wb); /**< create function */ |
|
| 58 void (*destroy)(GaimWhiteboard *wb); /**< destory function */ |
|
| 59 void (*set_dimensions)(GaimWhiteboard *wb, int width, int height); /**< set_dimensions function */ |
|
| 60 void (*set_brush) (GaimWhiteboard *wb, int size, int color); /**< set the size and color of the brush */ |
|
| 61 void (*draw_point)(GaimWhiteboard *wb, int x, int y, |
|
| 62 int color, int size); /**< draw_point function */ |
|
| 63 void (*draw_line)(GaimWhiteboard *wb, int x1, int y1, |
|
| 64 int x2, int y2, |
|
| 65 int color, int size); /**< draw_line function */ |
|
| 66 void (*clear)(GaimWhiteboard *wb); /**< clear function */ |
|
| 67 } GaimWhiteboardUiOps; |
|
| 68 |
|
| 69 /** |
|
| 70 * GaimWhiteboard PRPL Operations |
|
| 71 */ |
|
| 72 struct _GaimWhiteboardPrplOps |
|
| 73 { |
|
| 74 void (*start)(GaimWhiteboard *wb); /**< start function */ |
|
| 75 void (*end)(GaimWhiteboard *wb); /**< end function */ |
|
| 76 void (*get_dimensions)(GaimWhiteboard *wb, int *width, int *height); /**< get_dimensions function */ |
|
| 77 void (*set_dimensions)(GaimWhiteboard *wb, int width, int height); /**< set_dimensions function */ |
|
| 78 void (*get_brush) (GaimWhiteboard *wb, int *size, int *color); /**< get the brush size and color */ |
|
| 79 void (*set_brush) (GaimWhiteboard *wb, int size, int color); /**< set the brush size and color */ |
|
| 80 void (*send_draw_list)(GaimWhiteboard *wb, GList *draw_list); /**< send_draw_list function */ |
|
| 81 void (*clear)(GaimWhiteboard *wb); /**< clear function */ |
|
| 82 }; |
|
| 83 |
|
| 84 #ifdef __cplusplus |
|
| 85 extern "C" { |
|
| 86 #endif /* __cplusplus */ |
|
| 87 |
|
| 88 /******************************************************************************/ |
|
| 89 /** @name GaimWhiteboard API */ |
|
| 90 /******************************************************************************/ |
|
| 91 /*@{*/ |
|
| 92 |
|
| 93 /** |
|
| 94 * Sets the UI operations |
|
| 95 * |
|
| 96 * @param ops The UI operations to set |
|
| 97 */ |
|
| 98 void gaim_whiteboard_set_ui_ops(GaimWhiteboardUiOps *ops); |
|
| 99 |
|
| 100 /** |
|
| 101 * Sets the prpl operations for a whiteboard |
|
| 102 * |
|
| 103 * @param wb The whiteboard for which to set the prpl operations |
|
| 104 * @param ops The prpl operations to set |
|
| 105 */ |
|
| 106 void gaim_whiteboard_set_prpl_ops(GaimWhiteboard *wb, GaimWhiteboardPrplOps *ops); |
|
| 107 |
|
| 108 /** |
|
| 109 * Creates a whiteboard |
|
| 110 * |
|
| 111 * @param account The account. |
|
| 112 * @param who Who you're drawing with. |
|
| 113 * @param state The state. |
|
| 114 * |
|
| 115 * @return The new whiteboard |
|
| 116 */ |
|
| 117 GaimWhiteboard *gaim_whiteboard_create(GaimAccount *account, const char *who, int state); |
|
| 118 |
|
| 119 /** |
|
| 120 * Destroys a whiteboard |
|
| 121 * |
|
| 122 * @param wb The whiteboard. |
|
| 123 */ |
|
| 124 void gaim_whiteboard_destroy(GaimWhiteboard *wb); |
|
| 125 |
|
| 126 /** |
|
| 127 * Starts a whiteboard |
|
| 128 * |
|
| 129 * @param wb The whiteboard. |
|
| 130 */ |
|
| 131 void gaim_whiteboard_start(GaimWhiteboard *wb); |
|
| 132 |
|
| 133 /** |
|
| 134 * Finds a whiteboard from an account and user. |
|
| 135 * |
|
| 136 * @param account The account. |
|
| 137 * @param who The user. |
|
| 138 * |
|
| 139 * @return The whiteboard if found, otherwise @c NULL. |
|
| 140 */ |
|
| 141 GaimWhiteboard *gaim_whiteboard_get_session(GaimAccount *account, const char *who); |
|
| 142 |
|
| 143 /** |
|
| 144 * Destorys a drawing list for a whiteboard |
|
| 145 * |
|
| 146 * @param draw_list The drawing list. |
|
| 147 */ |
|
| 148 void gaim_whiteboard_draw_list_destroy(GList *draw_list); |
|
| 149 |
|
| 150 /** |
|
| 151 * Gets the dimension of a whiteboard. |
|
| 152 * |
|
| 153 * @param wb The whiteboard. |
|
| 154 * @param width The width to be set. |
|
| 155 * @param height The height to be set. |
|
| 156 * |
|
| 157 * @return TRUE if the values of width and height were set. |
|
| 158 */ |
|
| 159 gboolean gaim_whiteboard_get_dimensions(GaimWhiteboard *wb, int *width, int *height); |
|
| 160 |
|
| 161 /** |
|
| 162 * Sets the dimensions for a whiteboard. |
|
| 163 * |
|
| 164 * @param wb The whiteboard. |
|
| 165 * @param width The width. |
|
| 166 * @param height The height. |
|
| 167 */ |
|
| 168 void gaim_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height); |
|
| 169 |
|
| 170 /** |
|
| 171 * Draws a point on a whiteboard. |
|
| 172 * |
|
| 173 * @param wb The whiteboard. |
|
| 174 * @param x The x coordinate. |
|
| 175 * @param y The y coordinate. |
|
| 176 * @param color The color to use. |
|
| 177 * @param size The brush size. |
|
| 178 */ |
|
| 179 void gaim_whiteboard_draw_point(GaimWhiteboard *wb, int x, int y, int color, int size); |
|
| 180 |
|
| 181 /** |
|
| 182 * Send a list of points to draw to the buddy. |
|
| 183 * |
|
| 184 * @param wb The whiteboard |
|
| 185 * @param list A GList of points |
|
| 186 */ |
|
| 187 void gaim_whiteboard_send_draw_list(GaimWhiteboard *wb, GList *list); |
|
| 188 |
|
| 189 /** |
|
| 190 * Draws a line on a whiteboard |
|
| 191 * |
|
| 192 * @param wb The whiteboard. |
|
| 193 * @param x1 The top-left x coordinate. |
|
| 194 * @param y1 The top-left y coordinate. |
|
| 195 * @param x2 The bottom-right x coordinate. |
|
| 196 * @param y2 The bottom-right y coordinate. |
|
| 197 * @param color The color to use. |
|
| 198 * @param size The brush size. |
|
| 199 */ |
|
| 200 void gaim_whiteboard_draw_line(GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size); |
|
| 201 |
|
| 202 /** |
|
| 203 * Clears a whiteboard |
|
| 204 * |
|
| 205 * @param wb The whiteboard. |
|
| 206 */ |
|
| 207 void gaim_whiteboard_clear(GaimWhiteboard *wb); |
|
| 208 |
|
| 209 /** |
|
| 210 * Sends a request to the buddy to clear the whiteboard. |
|
| 211 * |
|
| 212 * @param wb The whiteboard |
|
| 213 */ |
|
| 214 void gaim_whiteboard_send_clear(GaimWhiteboard *wb); |
|
| 215 |
|
| 216 /** |
|
| 217 * Sends a request to change the size and color of the brush. |
|
| 218 * |
|
| 219 * @param wb The whiteboard |
|
| 220 * @param size The size of the brush |
|
| 221 * @param color The color of the brush |
|
| 222 */ |
|
| 223 void gaim_whiteboard_send_brush(GaimWhiteboard *wb, int size, int color); |
|
| 224 |
|
| 225 /** |
|
| 226 * Gets the size and color of the brush. |
|
| 227 * |
|
| 228 * @param wb The whiteboard |
|
| 229 * @param size The size of the brush |
|
| 230 * @param color The color of the brush |
|
| 231 * |
|
| 232 * @return TRUE if the size and color were set. |
|
| 233 */ |
|
| 234 gboolean gaim_whiteboard_get_brush(GaimWhiteboard *wb, int *size, int *color); |
|
| 235 |
|
| 236 /** |
|
| 237 * Sets the size and color of the brush. |
|
| 238 * |
|
| 239 * @param wb The whiteboard |
|
| 240 * @param size The size of the brush |
|
| 241 * @param color The color of the brush |
|
| 242 */ |
|
| 243 void gaim_whiteboard_set_brush(GaimWhiteboard *wb, int size, int color); |
|
| 244 |
|
| 245 /*@}*/ |
|
| 246 |
|
| 247 #ifdef __cplusplus |
|
| 248 } |
|
| 249 #endif /* __cplusplus */ |
|
| 250 |
|
| 251 #endif /* _GAIM_WHITEBOARD_H_ */ |
|