| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /***************************************************************************** |
| 2 | * Module for Microchip Graphics Library |
||
| 3 | * GOL Layer |
||
| 4 | * Slider |
||
| 5 | ***************************************************************************** |
||
| 6 | * FileName: Slider.h |
||
| 7 | * Dependencies: none |
||
| 8 | * Processor: PIC24F, PIC24H, dsPIC, PIC32 |
||
| 9 | * Compiler: MPLAB C30 V3.00, MPLAB C32 |
||
| 10 | * Linker: MPLAB LINK30, MPLAB LINK32 |
||
| 11 | * Company: Microchip Technology Incorporated |
||
| 12 | * |
||
| 13 | * Software License Agreement |
||
| 14 | * |
||
| 15 | * Copyright © 2008 Microchip Technology Inc. All rights reserved. |
||
| 16 | * Microchip licenses to you the right to use, modify, copy and distribute |
||
| 17 | * Software only when embedded on a Microchip microcontroller or digital |
||
| 18 | * signal controller, which is integrated into your product or third party |
||
| 19 | * product (pursuant to the sublicense terms in the accompanying license |
||
| 20 | * agreement). |
||
| 21 | * |
||
| 22 | * You should refer to the license agreement accompanying this Software |
||
| 23 | * for additional information regarding your rights and obligations. |
||
| 24 | * |
||
| 25 | * SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY |
||
| 26 | * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY |
||
| 27 | * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR |
||
| 28 | * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR |
||
| 29 | * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, |
||
| 30 | * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT |
||
| 31 | * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, |
||
| 32 | * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, |
||
| 33 | * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY |
||
| 34 | * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), |
||
| 35 | * OR OTHER SIMILAR COSTS. |
||
| 36 | * |
||
| 37 | * Author Date Comment |
||
| 38 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
| 39 | * Paolo A. Tamayo 11/12/07 Version 1.0 release |
||
| 40 | *****************************************************************************/ |
||
| 41 | #ifndef _SLIDER_H |
||
| 42 | #define _SLIDER_H |
||
| 43 | |||
| 44 | #include <Graphics\GOL.h> |
||
| 45 | |||
| 46 | /********************************************************************* |
||
| 47 | * Object States Definition: |
||
| 48 | *********************************************************************/ |
||
| 49 | #define SLD_FOCUSED 0x0001 // Bit for focus state |
||
| 50 | #define SLD_DISABLED 0x0002 // Bit for disabled state |
||
| 51 | #define SLD_VERTICAL 0x0004 // Bit for orientation (0 - horizontal, 1 - vertical) |
||
| 52 | #define SLD_SCROLLBAR 0x0010 // Bit for type usage (0 - Slider, 1 - ScrollBar) |
||
| 53 | #define SLD_DRAW_THUMB 0x1000 // Bit to indicate that only thumb area must be redrawn |
||
| 54 | #define SLD_DRAW_FOCUS 0x2000 // Bit to indicate that only the focus will be redrawn |
||
| 55 | #define SLD_DRAW 0x4000 // Bit to indicate whole slider must be redrawn |
||
| 56 | #define SLD_HIDE 0x8000 // Bit to remove object from screen |
||
| 57 | |||
| 58 | /********************************************************************* |
||
| 59 | * Overview: Defines the parameters required for a slider/scrollbar Object. |
||
| 60 | * Depending on the SLD_SCROLLBAR state bit slider or scrollbar mode |
||
| 61 | * is set. If SLD_SCROLLBAR is set, mode is scrollbar; if not set |
||
| 62 | * mode is slider. For scrollbar mode, focus rectangle is not drawn. |
||
| 63 | * |
||
| 64 | *********************************************************************/ |
||
| 65 | typedef struct |
||
| 66 | { |
||
| 67 | OBJ_HEADER hdr; // Generic header for all Objects (see OBJ_HEADER). |
||
| 68 | WORD currPos; // Position of the slider relative to minimum. |
||
| 69 | WORD prevPos; // Previous position of the slider relative to minimum. |
||
| 70 | WORD range; // User defined range of the slider. Minimum value at 0 and maximum at 0x7FFF. |
||
| 71 | WORD pos; // Position of the slider in range domain. |
||
| 72 | WORD page; // User specified resolution to incrementally change the position |
||
| 73 | |||
| 74 | // in range domain. |
||
| 75 | WORD thWidth; // Thumb width. This is computed internally. |
||
| 76 | |||
| 77 | // User must not change this value. |
||
| 78 | WORD thHeight; // Thumb width. This is computed internally. |
||
| 79 | // User must not change this value. |
||
| 80 | } SLIDER; |
||
| 81 | |||
| 82 | /********************************************************************* |
||
| 83 | * Function: SldSetRange(SLIDER *pSld, SHORT newRange) |
||
| 84 | * |
||
| 85 | * Overview: This sets the range of the thumb. If this field is changed |
||
| 86 | * Object must be completely redrawn to reflect the change. |
||
| 87 | * |
||
| 88 | * PreCondition: none |
||
| 89 | * |
||
| 90 | * Input: pSld - Pointer to the object. |
||
| 91 | * newRange - Value of the new range used. |
||
| 92 | * |
||
| 93 | * Output: None. |
||
| 94 | * |
||
| 95 | * Example: |
||
| 96 | * <CODE> |
||
| 97 | * SLIDER *pSld; |
||
| 98 | * |
||
| 99 | * SldSetRange(pSld, 100); |
||
| 100 | * // to completely redraw the object when GOLDraw() is executed. |
||
| 101 | * SetState(pSld, SLD_DRAW); |
||
| 102 | * |
||
| 103 | * </CODE> |
||
| 104 | * |
||
| 105 | * Side Effects: Position of the thumb may change when redrawn. |
||
| 106 | * |
||
| 107 | ********************************************************************/ |
||
| 108 | void SldSetRange(SLIDER *pSld, SHORT newRange); |
||
| 109 | |||
| 110 | /********************************************************************* |
||
| 111 | * Function: void SldSetPage(SLIDER *pSld, WORD newPage) |
||
| 112 | * |
||
| 113 | * Overview: This sets the page size of the object. Page size defines |
||
| 114 | * the delta change of the thumb position when incremented |
||
| 115 | * via SldIncPos() or decremented via SldDecPos(). Page size |
||
| 116 | * minimum value is 1. Maximum value is range/2. |
||
| 117 | * |
||
| 118 | * PreCondition: none |
||
| 119 | * |
||
| 120 | * Input: pSld - Pointer to the object. |
||
| 121 | * newPage - Value of the new page used. |
||
| 122 | * |
||
| 123 | * Output: None. |
||
| 124 | * |
||
| 125 | * Example: |
||
| 126 | * See SldIncPos() example. |
||
| 127 | * |
||
| 128 | * Side Effects: Position of the thumb may change when redrawn. |
||
| 129 | * |
||
| 130 | ********************************************************************/ |
||
| 131 | void SldSetPage(SLIDER *pSld, WORD newPage); |
||
| 132 | |||
| 133 | /********************************************************************* |
||
| 134 | * Macros: SldGetRange(pSld) |
||
| 135 | * |
||
| 136 | * Overview: Returns the current slider page. Value is always |
||
| 137 | * in the 1-range/2 inclusive for both slider and |
||
| 138 | * scrollbar type. |
||
| 139 | * |
||
| 140 | * PreCondition: none |
||
| 141 | * |
||
| 142 | * Input: pSld - Pointer to the object. |
||
| 143 | * |
||
| 144 | * Output: Returns the current value of the slider range. |
||
| 145 | * |
||
| 146 | * Example: |
||
| 147 | * <CODE> |
||
| 148 | * WORD range; |
||
| 149 | * SLIDER *pSld; |
||
| 150 | * |
||
| 151 | * range = SldGetRange(pSld); |
||
| 152 | * </CODE> |
||
| 153 | * |
||
| 154 | * Side Effects: none |
||
| 155 | * |
||
| 156 | ********************************************************************/ |
||
| 157 | #define SldGetRange(pSld) (pSld->range) |
||
| 158 | |||
| 159 | /********************************************************************* |
||
| 160 | * Macros: SldGetPage(pSld) |
||
| 161 | * |
||
| 162 | * Overview: Returns returns the current slider thumb position. |
||
| 163 | * Value is always in the 1 to range/2 inclusive. |
||
| 164 | * |
||
| 165 | * PreCondition: none |
||
| 166 | * |
||
| 167 | * Input: pSld - Pointer to the object. |
||
| 168 | * |
||
| 169 | * Output: Returns the current value of the slider page. |
||
| 170 | * |
||
| 171 | * Example: |
||
| 172 | * <CODE> |
||
| 173 | * WORD page; |
||
| 174 | * SLIDER *pSld; |
||
| 175 | * |
||
| 176 | * page = SldGetPage(pSld); |
||
| 177 | * </CODE> |
||
| 178 | * |
||
| 179 | * Side Effects: none |
||
| 180 | * |
||
| 181 | ********************************************************************/ |
||
| 182 | #define SldGetPage(pSld) (pSld->page) |
||
| 183 | |||
| 184 | /********************************************************************* |
||
| 185 | * Macros: SldGetPos(pSld) |
||
| 186 | * |
||
| 187 | * Overview: Returns returns the current position of the slider thumb. |
||
| 188 | * |
||
| 189 | * PreCondition: none |
||
| 190 | * |
||
| 191 | * Input: pSld - Pointer to the object. |
||
| 192 | * |
||
| 193 | * Output: Returns the current position of the slider's thumb. |
||
| 194 | * |
||
| 195 | * Example: |
||
| 196 | * <CODE> |
||
| 197 | * #define MAXVALUE 100; |
||
| 198 | * |
||
| 199 | * SLIDER *pSlider; |
||
| 200 | * DWORD ctr = 0; |
||
| 201 | * |
||
| 202 | * // create slider here and initialize parameters |
||
| 203 | * SetState(pSlider, SLD_DRAW); |
||
| 204 | * SldDraw(pSlider); |
||
| 205 | * |
||
| 206 | * while("some condition") { |
||
| 207 | * SldSetPos(pSlider, ctr); |
||
| 208 | * SetState(pSlider, SLD_DRAW_THUMB); |
||
| 209 | * SldDraw(pSlider); |
||
| 210 | * // update ctr here |
||
| 211 | * ctr = "some source of value"; |
||
| 212 | * } |
||
| 213 | * |
||
| 214 | * if (SldGetPos(pSlider) > (MAXVALUE 1)) |
||
| 215 | * return 0; |
||
| 216 | * else |
||
| 217 | * "do something else" |
||
| 218 | * </CODE> |
||
| 219 | * |
||
| 220 | * Side Effects: none |
||
| 221 | * |
||
| 222 | ********************************************************************/ |
||
| 223 | #define SldGetPos(pSld) (pSld)->pos |
||
| 224 | |||
| 225 | /********************************************************************* |
||
| 226 | * Function: SldSetPos(SLIDER *pSld, SHORT newPos) |
||
| 227 | * |
||
| 228 | * Overview: This function sets the position of the slider thumb. |
||
| 229 | * Value should be in the set range inclusive. Object must |
||
| 230 | * be redrawn to reflect the change. |
||
| 231 | * |
||
| 232 | * PreCondition: none |
||
| 233 | * |
||
| 234 | * Input: pSld - Pointer to the object. |
||
| 235 | * newPos - The new position of the slider's thumb. |
||
| 236 | * |
||
| 237 | * Output: none |
||
| 238 | * |
||
| 239 | * Example: |
||
| 240 | * <CODE> |
||
| 241 | * SLIDER *pSlider; |
||
| 242 | * DWORD ctr = 0; |
||
| 243 | * |
||
| 244 | * // create slider here and initialize parameters |
||
| 245 | * SetState(pSlider, SLD_DRAW); |
||
| 246 | * SldDraw(pSlider); |
||
| 247 | * |
||
| 248 | * while("some condition") { |
||
| 249 | * SldSetPos(pSlider, ctr); |
||
| 250 | * SetState(pSlider, SLD_DRAW_THUMB); |
||
| 251 | * SldDraw(pSlider); |
||
| 252 | * // update ctr here |
||
| 253 | * ctr = "some source of value"; |
||
| 254 | * } |
||
| 255 | * </CODE> |
||
| 256 | * |
||
| 257 | * Side Effects: none |
||
| 258 | * |
||
| 259 | ********************************************************************/ |
||
| 260 | void SldSetPos(SLIDER *pSld, SHORT newPos); |
||
| 261 | |||
| 262 | /********************************************************************* |
||
| 263 | * Macros: SldIncPos(pSld) |
||
| 264 | * |
||
| 265 | * Overview: This macro increment the slider position by the delta |
||
| 266 | * change (page) value set. Object must be redrawn after |
||
| 267 | * this function is called to reflect the changes to the object. |
||
| 268 | * |
||
| 269 | * PreCondition: none |
||
| 270 | * |
||
| 271 | * Input: pSld - Pointer to the object. |
||
| 272 | * |
||
| 273 | * Output: none |
||
| 274 | * |
||
| 275 | * Example: |
||
| 276 | * <CODE> |
||
| 277 | * void ControlSpeed(SLIDER* pSld, int setSpeed, int curSpeed) |
||
| 278 | * { |
||
| 279 | * SldSetPage(pSld, 1); // set page size to 1 |
||
| 280 | * if (setSpeed < curSpeed) { |
||
| 281 | * while(SldGetPos(pSld) < SetSpeed) |
||
| 282 | * SldIncPos(pSld); // increment by 1 |
||
| 283 | * } |
||
| 284 | * else if (setSpeed > curSpeed) { |
||
| 285 | * while(SldGetPos(pSld) > SetSpeed) |
||
| 286 | * SldDecPos(pSld); // decrement by 1 |
||
| 287 | * } |
||
| 288 | * } |
||
| 289 | * </CODE> |
||
| 290 | * |
||
| 291 | * Side Effects: none |
||
| 292 | * |
||
| 293 | ********************************************************************/ |
||
| 294 | #define SldIncPos(pSld) \ |
||
| 295 | SldSetPos \ |
||
| 296 | ( \ |
||
| 297 | pSld, \ |
||
| 298 | (((DWORD) pSld->pos + (DWORD) pSld->page) <= (DWORD) pSld->range) ? (pSld->pos + pSld->page) : pSld->range \ |
||
| 299 | ) |
||
| 300 | |||
| 301 | /********************************************************************* |
||
| 302 | * Macros: SldDecPos(pSld) |
||
| 303 | * |
||
| 304 | * Overview: This macro decrement the slider position by the delta |
||
| 305 | * change (page) value set. Object must be redrawn after |
||
| 306 | * this function is called to reflect the changes to the object. |
||
| 307 | * |
||
| 308 | * PreCondition: none |
||
| 309 | * |
||
| 310 | * Input: pSld - Pointer to the object. |
||
| 311 | * |
||
| 312 | * Output: none |
||
| 313 | * |
||
| 314 | * Example: |
||
| 315 | * See SldIncPos() example. |
||
| 316 | * |
||
| 317 | * Side Effects: none |
||
| 318 | * |
||
| 319 | ********************************************************************/ |
||
| 320 | #define SldDecPos(pSld) SldSetPos(pSld, (((LONG) pSld->pos - (LONG) pSld->page) >= 0) ? (pSld->pos - pSld->page) : 0) |
||
| 321 | |||
| 322 | /********************************************************************* |
||
| 323 | * Function: SLIDER *SldCreate(WORD ID, SHORT left, SHORT top, SHORT right, |
||
| 324 | * SHORT bottom, WORD state, SHORT range, |
||
| 325 | * SHORT page, SHORT pos, GOL_SCHEME *pScheme); |
||
| 326 | * |
||
| 327 | * Overview: This function creates a SLIDER object with the parameters given. |
||
| 328 | * Depending on the SLD_SCROLLBAR state bit slider or scrollbar mode |
||
| 329 | * is set. If SLD_SCROLLBAR is set, mode is scrollbar; if not set |
||
| 330 | * mode is slider. It automatically attaches the new object into a |
||
| 331 | * global linked list of objects and returns the address of the object. |
||
| 332 | * |
||
| 333 | * PreCondition: none |
||
| 334 | * |
||
| 335 | * Input: ID - Unique user defined ID for the object instance. |
||
| 336 | * left - Left most position of the Object. |
||
| 337 | * top - Top most position of the Object. |
||
| 338 | * right - Right most position of the Object. |
||
| 339 | * bottom - Bottom most position of the Object. |
||
| 340 | * state - This defines the initial state of the Object. |
||
| 341 | * range - This specifies the maximum value of the slider when the |
||
| 342 | * thumb is on the rightmost position for a horizontal orientation |
||
| 343 | * and bottom most position for the vertical orientation. Minimum |
||
| 344 | * value is always at zero. |
||
| 345 | * page - This is the incremental change of the slider when user action |
||
| 346 | * requests to move the slider thumb. This value is added or |
||
| 347 | * subtracted to the current position of the thumb. |
||
| 348 | * pos - This defines the initial position of the thumb. |
||
| 349 | * pScheme - The pointer to the style scheme used for the Object. |
||
| 350 | * Set to NULL if default style scheme is used. |
||
| 351 | * |
||
| 352 | * Output: Returns the pointer to the object created. |
||
| 353 | * |
||
| 354 | * Example: |
||
| 355 | * <CODE> |
||
| 356 | * GOL_SCHEME *pScheme; |
||
| 357 | * SLIDER *slider[3]; |
||
| 358 | * WORD state; |
||
| 359 | * |
||
| 360 | * pScheme = GOLCreateScheme(); |
||
| 361 | * |
||
| 362 | * // create a slider with |
||
| 363 | * // range = [0 50000] |
||
| 364 | * // delta = 500 |
||
| 365 | * // initial position = 25000 |
||
| 366 | * state = SLD_DRAW; |
||
| 367 | * slider[0] = SldCreate( 5, |
||
| 368 | * 150, 145, 285, 181, |
||
| 369 | * state, |
||
| 370 | * 50000, 500, 25000, |
||
| 371 | * pScheme); |
||
| 372 | * if (slider[0] == NULL) |
||
| 373 | * return 0; |
||
| 374 | * |
||
| 375 | * // create a scrollbar with |
||
| 376 | * // range = [0 100] |
||
| 377 | * // delta = 20 |
||
| 378 | * // initial position = 0 |
||
| 379 | * |
||
| 380 | * state = SLD_DRAW|SLD_SCROLLBAR; |
||
| 381 | * slider[1] = SldCreate( 6, |
||
| 382 | * 150, 190, 285, 220, |
||
| 383 | * state, |
||
| 384 | * 100, 20, 0, |
||
| 385 | * pScheme); |
||
| 386 | * if (slider[1] == NULL) |
||
| 387 | * return 0; |
||
| 388 | * |
||
| 389 | * // create a vertical slider with |
||
| 390 | * // range = [0 30] |
||
| 391 | * // delta = 2 |
||
| 392 | * // initial position = 20 |
||
| 393 | * |
||
| 394 | * state = SLD_DRAW|SLD_VERTICAL; |
||
| 395 | * slider[2] = SldCreate( 7, |
||
| 396 | * 120, 145, 140, 220, |
||
| 397 | * state, |
||
| 398 | * 30, 2, 20, |
||
| 399 | * pScheme); |
||
| 400 | * if (slider[2] == NULL) |
||
| 401 | * return 0; |
||
| 402 | * |
||
| 403 | * // draw the sliders |
||
| 404 | * while(!sldDraw(slider[0]); // draw the horizontal slider |
||
| 405 | * while(!sldDraw(slider[1]); // draw the horizontal scroll bar |
||
| 406 | * while(!sldDraw(slider[2]); // draw the vertical slider |
||
| 407 | * return 1; |
||
| 408 | * </CODE> |
||
| 409 | * |
||
| 410 | * Side Effects: none |
||
| 411 | * |
||
| 412 | ********************************************************************/ |
||
| 413 | SLIDER *SldCreate |
||
| 414 | ( |
||
| 415 | WORD ID, |
||
| 416 | SHORT left, |
||
| 417 | SHORT top, |
||
| 418 | SHORT right, |
||
| 419 | SHORT bottom, |
||
| 420 | WORD state, |
||
| 421 | WORD range, |
||
| 422 | WORD page, |
||
| 423 | WORD pos, |
||
| 424 | GOL_SCHEME *pScheme |
||
| 425 | ); |
||
| 426 | |||
| 427 | /********************************************************************* |
||
| 428 | * Function: void SldMsgDefault(WORD translatedMsg, SLIDER* pSld, GOL_MSG* pMsg) |
||
| 429 | * |
||
| 430 | * Overview: This function performs the actual state change |
||
| 431 | * based on the translated message given. The following state changes |
||
| 432 | * are supported: |
||
| 433 | * <TABLE> |
||
| 434 | * Translated Message Input Source Set/Clear State Bit Description |
||
| 435 | * ################## ############ ###### ########### |
||
| 436 | * SLD_MSG_INC Touch Screen, Set SLD_DRAW_THUMB Slider will be redrawn with thumb in the incremented position. |
||
| 437 | * Keyboard |
||
| 438 | * SLD_MSG_DEC Touch Screen, Set SLD_DRAW_THUMB Slider will be redrawn with thumb in the decremented position. |
||
| 439 | * Keyboard |
||
| 440 | * </TABLE> |
||
| 441 | * |
||
| 442 | * PreCondition: none |
||
| 443 | * |
||
| 444 | * Input: translatedMsg - The translated message. |
||
| 445 | * pSld - The pointer to the object whose state will be modified. |
||
| 446 | * pMsg - The pointer to the GOL message. |
||
| 447 | * |
||
| 448 | * Output: none |
||
| 449 | * |
||
| 450 | * Example: |
||
| 451 | * Usage is similar to BtnTranslateMsg() example. |
||
| 452 | * |
||
| 453 | * Side Effects: none |
||
| 454 | * |
||
| 455 | ********************************************************************/ |
||
| 456 | void SldMsgDefault(WORD translatedMsg, SLIDER *pSld, GOL_MSG *pMsg); |
||
| 457 | |||
| 458 | /********************************************************************* |
||
| 459 | * Function: WORD SldTranslateMsg(SLIDER *pSld, GOL_MSG *pMsg) |
||
| 460 | * |
||
| 461 | * Overview: This function evaluates the message from a user if the |
||
| 462 | * message will affect the object or not. The table below |
||
| 463 | * enumerates the translated messages for each event of the |
||
| 464 | * touch screen and keyboard inputs. |
||
| 465 | * |
||
| 466 | * <TABLE> |
||
| 467 | * Translated Message Input Source Events Description |
||
| 468 | * ################## ############ ###### ########### |
||
| 469 | * SLD_MSG_INC Touch Screen EVENT_PRESS, EVENT_MOVE If events occurs and the x,y position falls in the area of the slider and the slider position is to the LEFT of the x,y position for a horizontal slider or BELOW the x,y position for a vertical slider. |
||
| 470 | * Keyboard EVENT_KEYSCAN If event occurs and parameter1 passed matches the objects ID and parameter 2 passed matches SCAN_UP_PRESSED or SCAN_LEFT_PRESSED. |
||
| 471 | * SLD_MSG_DEC Touch Screen EVENT_PRESS, EVENT_MOVE If events occurs and the x,y position falls in the area of the slider and the slider position is to the RIGHT of the x,y position for a horizontal slider or ABOVE the x,y position for a vertical slider. |
||
| 472 | * Keyboard EVENT_KEYSCAN If event occurs and parameter1 passed matches the objects ID and parameter 2 passed matches SCAN_DOWN_PRESSED or SCAN_RIGHT_PRESSED. |
||
| 473 | * OBJ_MSG_PASSIVE Touch Screen EVENT_RELEASE If event occurs and the x,y position falls in the area of the slider. |
||
| 474 | * OBJ_MSG_INVALID Any Any If the message did not affect the object. |
||
| 475 | * </TABLE> |
||
| 476 | * |
||
| 477 | * PreCondition: none |
||
| 478 | * |
||
| 479 | * Input: pSld - The pointer to the object where the message will be |
||
| 480 | * evaluated to check if the message will affect the object. |
||
| 481 | * pMsg - Pointer to the message struct containing the message from |
||
| 482 | * the user interface. |
||
| 483 | * |
||
| 484 | * Output: Returns the translated message depending on the received GOL message: |
||
| 485 | * - SLD_MSG_INC Increment slider position |
||
| 486 | * - SLD_MSG_DEC Decrement slider position |
||
| 487 | * - OBJ_MSG_PASSIVE - no effect on slider state |
||
| 488 | * - OBJ_MSG_INVALID Slider is not affected |
||
| 489 | * |
||
| 490 | * Example: |
||
| 491 | * Usage is similar to BtnTranslateMsg() example. |
||
| 492 | * |
||
| 493 | * Side Effects: none |
||
| 494 | * |
||
| 495 | ********************************************************************/ |
||
| 496 | WORD SldTranslateMsg(SLIDER *pSld, GOL_MSG *pMsg); |
||
| 497 | |||
| 498 | /********************************************************************* |
||
| 499 | * Function: WORD SldDraw(SLIDER *pSld) |
||
| 500 | * |
||
| 501 | * Overview: This function renders the object on the screen using |
||
| 502 | * the current parameter settings. Location of the object is |
||
| 503 | * determined by the left, top, right and bottom parameters. |
||
| 504 | * The colors used are dependent on the state of the object. |
||
| 505 | * |
||
| 506 | * When rendering objects of the same type, each object |
||
| 507 | * must be rendered completely before the rendering of the |
||
| 508 | * next object is started. This is to avoid incomplete |
||
| 509 | * object rendering. |
||
| 510 | * |
||
| 511 | * PreCondition: Object must be created before this function is called. |
||
| 512 | * |
||
| 513 | * Input: pSld - Pointer to the object to be rendered. |
||
| 514 | * |
||
| 515 | * Output: Returns the status of the drawing |
||
| 516 | * - 1 - If the rendering was completed and |
||
| 517 | * - 0 - If the rendering is not yet finished. |
||
| 518 | * Next call to the function will resume the |
||
| 519 | * rendering on the pending drawing state. |
||
| 520 | * |
||
| 521 | * Example: |
||
| 522 | * See SldCreate() example. |
||
| 523 | * |
||
| 524 | * Side Effects: none |
||
| 525 | * |
||
| 526 | ********************************************************************/ |
||
| 527 | WORD SldDraw(SLIDER *pSld); |
||
| 528 | #endif //_SLIDER_H |
Powered by WebSVN v2.8.3