| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 32 | kaklik | /***************************************************************************** |
| 2 | * Module for Microchip Graphics Library |
||
| 3 | * GOL Layer |
||
| 4 | ***************************************************************************** |
||
| 5 | * FileName: GOL.h |
||
| 6 | * Dependencies: None |
||
| 7 | * Processor: PIC24F, PIC24H, dsPIC, PIC32 |
||
| 8 | * Compiler: MPLAB C30 V3.00, MPLAB C32 |
||
| 9 | * Linker: MPLAB LINK30, MPLAB LINK32 |
||
| 10 | * Company: Microchip Technology Incorporated |
||
| 11 | * |
||
| 12 | * Software License Agreement |
||
| 13 | * |
||
| 14 | * Copyright © 2008 Microchip Technology Inc. All rights reserved. |
||
| 15 | * Microchip licenses to you the right to use, modify, copy and distribute |
||
| 16 | * Software only when embedded on a Microchip microcontroller or digital |
||
| 17 | * signal controller, which is integrated into your product or third party |
||
| 18 | * product (pursuant to the sublicense terms in the accompanying license |
||
| 19 | * agreement). |
||
| 20 | * |
||
| 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 | * Anton Alkhimenok and |
||
| 40 | * Paolo A. Tamayo |
||
| 41 | * 11/12/07 Version 1.0 release |
||
| 42 | * PAT 06/29/09 Added BTN_MSG_STILLPRESSED message for |
||
| 43 | * button object and EVENT_STILLPRESS for |
||
| 44 | * INPUT_DEVICE_EVENT list. |
||
| 45 | *****************************************************************************/ |
||
| 46 | #ifndef _GOL_H |
||
| 47 | #define _GOL_H |
||
| 48 | |||
| 49 | #include "Graphics\Graphics.h" |
||
| 50 | |||
| 51 | /********************************************************************* |
||
| 52 | * Overview: GOL scheme defines the style scheme to be used by an object. |
||
| 53 | * |
||
| 54 | *********************************************************************/ |
||
| 55 | typedef struct |
||
| 56 | { |
||
| 57 | WORD EmbossDkColor; // Emboss dark color used for 3d effect. |
||
| 58 | WORD EmbossLtColor; // Emboss light color used for 3d effect. |
||
| 59 | WORD TextColor0; // Character color 0 used for objects that supports text. |
||
| 60 | WORD TextColor1; // Character color 1 used for objects that supports text. |
||
| 61 | WORD TextColorDisabled; // Character color used when object is in a disabled state. |
||
| 62 | WORD Color0; // Color 0 usually assigned to an Object state. |
||
| 63 | WORD Color1; // Color 1 usually assigned to an Object state. |
||
| 64 | WORD ColorDisabled; // Color used when an Object is in a disabled state. |
||
| 65 | WORD CommonBkColor; // Background color used to hide Objects. |
||
| 66 | void *pFont; // Font selected for the scheme. |
||
| 67 | } GOL_SCHEME; |
||
| 68 | |||
| 69 | /********************************************************************* |
||
| 70 | * Overview: Pointer to the GOL default scheme (GOL_SCHEME). This |
||
| 71 | * scheme is created in GOLInit() function. GOL scheme |
||
| 72 | * defines the style scheme to be used by an object. |
||
| 73 | * Use GOLGetSchemeDefault() to get this pointer. |
||
| 74 | * |
||
| 75 | *********************************************************************/ |
||
| 76 | extern GOL_SCHEME *_pDefaultGolScheme; |
||
| 77 | |||
| 78 | /********************************************************************* |
||
| 79 | * Overview: This structure defines the Object types used in the library. |
||
| 80 | * |
||
| 81 | *********************************************************************/ |
||
| 82 | typedef enum |
||
| 83 | { |
||
| 84 | OBJ_BUTTON, // Type defined for Button Object. |
||
| 85 | OBJ_WINDOW, // Type defined for Window Object. |
||
| 86 | OBJ_CHECKBOX, // Type defined for Check Box Object. |
||
| 87 | OBJ_RADIOBUTTON, // Type defined for Radio Button Object. |
||
| 88 | OBJ_EDITBOX, // Type defined for Edit Box Object. |
||
| 89 | OBJ_LISTBOX, // Type defined for List Box Object. |
||
| 90 | OBJ_SLIDER, // Type defined for Slider and/or Scroll Bar Object. |
||
| 91 | OBJ_PROGRESSBAR, // Type defined for Progress Object. |
||
| 92 | OBJ_STATICTEXT, // Type defined for Static Text Object. |
||
| 93 | OBJ_PICTURE, // Type defined for Picture or Bitmap Object. |
||
| 94 | OBJ_GROUPBOX, // Type defined for Group Box Object. |
||
| 95 | OBJ_CUSTOM, // Type defined for Custom Object. |
||
| 96 | OBJ_ROUNDDIAL, // Type defined for Dial Object. |
||
| 97 | OBJ_METER, // Type defined for Meter Object. |
||
| 98 | OBJ_GRID, // Type defined for Grid Object. |
||
| 99 | OBJ_CHART, // Type defined for Chart Object. |
||
| 100 | OBJ_TEXTENTRY, // Type defined for Text-Entry Object. |
||
| 101 | OBJ_DIGITALMETER, // Type defined for DIGITALMETER Object. |
||
| 102 | OBJ_UNKNOWN // Type is undefined and not supported by the library. |
||
| 103 | } GOL_OBJ_TYPE; |
||
| 104 | |||
| 105 | /********************************************************************* |
||
| 106 | * Overview: This structure defines the GOL message used in the library. |
||
| 107 | * - The types must be one of the INPUT_DEVICE_TYPE: |
||
| 108 | * - TYPE_UNKNOWN |
||
| 109 | * - TYPE_KEYBOARD |
||
| 110 | * - TYPE_TOUCHSCREEN |
||
| 111 | * - TYPE_MOUSE |
||
| 112 | * - uiEvent must be one of the INPUT_DEVICE_EVENT. |
||
| 113 | * - for touch screen: |
||
| 114 | * - EVENT_INVALID |
||
| 115 | * - EVENT_MOVE |
||
| 116 | * - EVENT_PRESS |
||
| 117 | * - EVENT_STILLPRESS |
||
| 118 | * - EVENT_RELEASE |
||
| 119 | * - for keyboard: |
||
| 120 | * - EVENT_KEYSCAN (param2 contains scan code) |
||
| 121 | * - EVENT_KEYCODE (param2 contains character code) |
||
| 122 | * - param1: |
||
| 123 | * - for touch screen is the x position |
||
| 124 | * - for keyboard ID of object receiving the message |
||
| 125 | * - param2 |
||
| 126 | * - for touch screen y position |
||
| 127 | * - for keyboard scan or key code |
||
| 128 | * |
||
| 129 | *********************************************************************/ |
||
| 130 | typedef struct |
||
| 131 | { |
||
| 132 | BYTE type; // Type of input device. |
||
| 133 | BYTE uiEvent; // The generic events for input device. |
||
| 134 | SHORT param1; // Parameter 1 meaning is dependent on the type of input device. |
||
| 135 | SHORT param2; // Parameter 2 meaning is dependent on the type of input device. |
||
| 136 | } GOL_MSG; |
||
| 137 | |||
| 138 | /********************************************************************* |
||
| 139 | * Overview: This structure defines the types of input devices |
||
| 140 | * used in the library. |
||
| 141 | * |
||
| 142 | *********************************************************************/ |
||
| 143 | typedef enum |
||
| 144 | { |
||
| 145 | TYPE_UNKNOWN = 0, // Unknown device. |
||
| 146 | TYPE_KEYBOARD, // Keyboard. |
||
| 147 | TYPE_TOUCHSCREEN, // Touchscreen. |
||
| 148 | TYPE_MOUSE, // Mouse. |
||
| 149 | TYPE_TIMER, // Timer. |
||
| 150 | TYPE_SYSTEM // System Messages. |
||
| 151 | } INPUT_DEVICE_TYPE; |
||
| 152 | |||
| 153 | /********************************************************************* |
||
| 154 | * Overview: This structure defines the types of GOL message events |
||
| 155 | * used in the library. |
||
| 156 | * |
||
| 157 | *********************************************************************/ |
||
| 158 | typedef enum |
||
| 159 | { |
||
| 160 | EVENT_INVALID = 0, // An invalid event. |
||
| 161 | EVENT_MOVE, // A move event. |
||
| 162 | EVENT_PRESS, // A press event. |
||
| 163 | EVENT_STILLPRESS, // A continuous press event. |
||
| 164 | EVENT_RELEASE, // A release event. |
||
| 165 | EVENT_KEYSCAN, // A keyscan event, parameters has the object ID keyboard scan code. |
||
| 166 | EVENT_CHARCODE, // Character code is presented at the parameters. |
||
| 167 | EVENT_SET, // A generic set event. |
||
| 168 | EVENT_SET_STATE, // A set state event. |
||
| 169 | EVENT_CLR_STATE // A clear state event. |
||
| 170 | } INPUT_DEVICE_EVENT; |
||
| 171 | |||
| 172 | /********************************************************************* |
||
| 173 | * Overview: This structure defines the list of translated messages for |
||
| 174 | * GOL Objects used in the library. |
||
| 175 | * |
||
| 176 | *********************************************************************/ |
||
| 177 | typedef enum |
||
| 178 | { |
||
| 179 | OBJ_MSG_INVALID = 0, // Invalid message response. |
||
| 180 | CB_MSG_CHECKED, // Check Box check action ID. |
||
| 181 | CB_MSG_UNCHECKED, // Check Box un-check action ID. |
||
| 182 | RB_MSG_CHECKED, // Radio Button check action ID. |
||
| 183 | WND_MSG_CLIENT, // Window client area selected action ID. |
||
| 184 | WND_MSG_TITLE, // Window title bar selected action ID. |
||
| 185 | BTN_MSG_PRESSED, // Button pressed action ID. |
||
| 186 | BTN_MSG_STILLPRESSED, // Button is continuously pressed ID. |
||
| 187 | BTN_MSG_RELEASED, // Button released action ID. |
||
| 188 | BTN_MSG_CANCELPRESS, // Button released action ID with button press canceled. |
||
| 189 | PICT_MSG_SELECTED, // Picture selected action ID. |
||
| 190 | GB_MSG_SELECTED, // Group Box selected action ID. |
||
| 191 | CC_MSG_SELECTED, // Custom Control selected action ID. |
||
| 192 | SLD_MSG_INC, // Slider or Scroll Bar increment action ID. |
||
| 193 | SLD_MSG_DEC, // Slider or Scroll Bar decrement action ID. |
||
| 194 | ST_MSG_SELECTED, // Static Text selected action ID. |
||
| 195 | DM_MSG_SELECTED, // Digital Meter selected action ID. |
||
| 196 | PB_MSG_SELECTED, // Progress Bar selected action ID. |
||
| 197 | RD_MSG_CLOCKWISE, // Dial move clockwise action ID. |
||
| 198 | RD_MSG_CTR_CLOCKWISE, // Dial move counter clockwise action ID. |
||
| 199 | MTR_MSG_SET, // Meter set value action ID. |
||
| 200 | EB_MSG_CHAR, // Edit Box insert character action ID. |
||
| 201 | EB_MSG_DEL, // Edit Box remove character action ID. |
||
| 202 | EB_MSG_TOUCHSCREEN, // Edit Box touchscreen selected action ID. |
||
| 203 | LB_MSG_SEL, // List Box item select action ID. |
||
| 204 | LB_MSG_MOVE, // List Box item move action ID. |
||
| 205 | LB_MSG_TOUCHSCREEN, // List Box touchscreen selected action ID. |
||
| 206 | GRID_MSG_TOUCHED, // Grid item touched action ID. |
||
| 207 | GRID_MSG_ITEM_SELECTED, // Grid item selected action ID. |
||
| 208 | GRID_MSG_UP, // Grid up action ID. |
||
| 209 | GRID_MSG_DOWN, // Grid down action ID. |
||
| 210 | GRID_MSG_LEFT, // Grid left action ID. |
||
| 211 | GRID_MSG_RIGHT, // Grid right action ID. |
||
| 212 | CH_MSG_SELECTED, // Chart selected action ID |
||
| 213 | TE_MSG_RELEASED, // TextEntry released action ID |
||
| 214 | TE_MSG_PRESSED, // TextEntry pressed action ID |
||
| 215 | TE_MSG_ADD_CHAR, // TextEntry add character action ID |
||
| 216 | TE_MSG_DELETE, // TextEntry delete character action ID |
||
| 217 | TE_MSG_SPACE, // TextEntry add space character action ID |
||
| 218 | TE_MSG_ENTER, // TextEntry enter action ID |
||
| 219 | OBJ_MSG_PASSIVE // Passive message response. No change in object needed. |
||
| 220 | } TRANS_MSG; |
||
| 221 | |||
| 222 | /********************************************************************* |
||
| 223 | * Overview: This structure defines the first nine fields of the |
||
| 224 | * Objects structure. This allows generic operations on |
||
| 225 | * library Objects. |
||
| 226 | * |
||
| 227 | *********************************************************************/ |
||
| 228 | typedef struct |
||
| 229 | { |
||
| 230 | WORD ID; // Unique id assigned for referencing. |
||
| 231 | void *pNxtObj; // A pointer to the next object. |
||
| 232 | GOL_OBJ_TYPE type; // Identifies the type of GOL object. |
||
| 233 | WORD state; // State of object. |
||
| 234 | SHORT left; // Left position of the Object. |
||
| 235 | SHORT top; // Top position of the Object. |
||
| 236 | SHORT right; // Right position of the Object. |
||
| 237 | SHORT bottom; // Bottom position of the Object. |
||
| 238 | GOL_SCHEME *pGolScheme; // Pointer to the scheme used. |
||
| 239 | } OBJ_HEADER; |
||
| 240 | |||
| 241 | /********************************************************************* |
||
| 242 | * Overview: The following are the common Objcet States. |
||
| 243 | * |
||
| 244 | *********************************************************************/ |
||
| 245 | |||
| 246 | // Focus state bit. |
||
| 247 | #define FOCUSED 0x0001 |
||
| 248 | |||
| 249 | // Disabled state bit. |
||
| 250 | #define DISABLED 0x0002 |
||
| 251 | |||
| 252 | // Object hide state bit. Object will be hidden from the |
||
| 253 | // screen by drawing over it the common background color. |
||
| 254 | #define HIDE 0x8000 |
||
| 255 | |||
| 256 | // Object redraw state bit. The whole Object must be redrawn. |
||
| 257 | #define DRAW 0x7C00 |
||
| 258 | |||
| 259 | // Focus redraw state bit. The focus rectangle must be redrawn. |
||
| 260 | #define DRAW_FOCUS 0x2000 |
||
| 261 | |||
| 262 | // Partial Object redraw state bit. A part or parts of |
||
| 263 | // of the Object must be redrawn to show updated state. |
||
| 264 | #define DRAW_UPDATE 0x3C00 |
||
| 265 | |||
| 266 | /********************************************************************* |
||
| 267 | * Overview: The following are the global variables of GOL. |
||
| 268 | * |
||
| 269 | *********************************************************************/ |
||
| 270 | |||
| 271 | /********************************************************************* |
||
| 272 | * Overview: Pointer to the current linked list of objects displayed |
||
| 273 | * and receiving messages. GOLDraw() and GOLMsg() process |
||
| 274 | * objects referenced by this pointer. |
||
| 275 | * |
||
| 276 | *********************************************************************/ |
||
| 277 | extern OBJ_HEADER *_pGolObjects; |
||
| 278 | |||
| 279 | /********************************************************************* |
||
| 280 | * Overview: Pointer to the object receiving keyboad input. This pointer |
||
| 281 | * is used or modified by the following APIs: |
||
| 282 | * - GOLSetFocus() |
||
| 283 | * - GOLGetFocus() |
||
| 284 | * - GOLGetFocusNext() |
||
| 285 | * - GOLGetFocusPrev() |
||
| 286 | * - GOLCanBeFocused() |
||
| 287 | * |
||
| 288 | *********************************************************************/ |
||
| 289 | extern OBJ_HEADER *_pObjectFocused; |
||
| 290 | |||
| 291 | // Line type used for focus mark. |
||
| 292 | #define FOCUS_LINE 2 |
||
| 293 | |||
| 294 | /********************************************************************* |
||
| 295 | * Overview: This option defines the 3-D effect emboss size for objects. |
||
| 296 | * The default value of this is 3 set in GOL.h. If it is not |
||
| 297 | * defined in GraphicsConfig.h file then the default value is used. |
||
| 298 | * |
||
| 299 | *********************************************************************/ |
||
| 300 | #ifndef GOL_EMBOSS_SIZE |
||
| 301 | #define GOL_EMBOSS_SIZE 3 |
||
| 302 | #endif |
||
| 303 | |||
| 304 | /********************************************************************* |
||
| 305 | * Overview: The following are the style scheme default settings. |
||
| 306 | * |
||
| 307 | *********************************************************************/ |
||
| 308 | |||
| 309 | // Default GOL font. |
||
| 310 | extern const FONT_FLASH GOLFontDefault; |
||
| 311 | |||
| 312 | // Default Font assignement. |
||
| 313 | #define FONTDEFAULT GOLFontDefault |
||
| 314 | |||
| 315 | #ifdef USE_PALETTE |
||
| 316 | |||
| 317 | #include "PaletteColorDefines.h" |
||
| 318 | |||
| 319 | #else |
||
| 320 | |||
| 321 | // Brown color scheme |
||
| 322 | #define SADDLEBROWN RGB565CONVERT(139, 69, 19) // Saddle Color |
||
| 323 | #define SIENNA RGB565CONVERT(160, 82, 45) // Sienna Color |
||
| 324 | #define PERU RGB565CONVERT(205, 133, 63) // Peru Color |
||
| 325 | #define BURLYWOOD RGB565CONVERT(222, 184, 135) // Burly wood Color |
||
| 326 | #define WHEAT RGB565CONVERT(245, 245, 220) // Wheat Color |
||
| 327 | #define TAN RGB565CONVERT(210, 180, 140) // Tan Color |
||
| 328 | #define GRAY80 RGB565CONVERT(204, 204, 204) // Gray80 Color |
||
| 329 | #define GRAY90 RGB565CONVERT(229, 229, 229) // Gray90 Color |
||
| 330 | #define GRAY95 RGB565CONVERT(242, 242, 242) // Gray95 Color |
||
| 331 | #if (COLOR_DEPTH == 1) |
||
| 332 | |||
| 333 | /* default settings for a monochrome display */ |
||
| 334 | |||
| 335 | // Emboss dark color default value. |
||
| 336 | #define EMBOSSDKCOLORDEFAULT 0x00 |
||
| 337 | |||
| 338 | // Emboss light color default value. |
||
| 339 | #define EMBOSSLTCOLORDEFAULT 0xFF |
||
| 340 | |||
| 341 | // Text color 0 default value. |
||
| 342 | #define TEXTCOLOR0DEFAULT 0xFF |
||
| 343 | |||
| 344 | // Text color 1 default value. |
||
| 345 | #define TEXTCOLOR1DEFAULT 0x00 |
||
| 346 | |||
| 347 | // Text color disabled default value. |
||
| 348 | #define TEXTCOLORDISABLEDDEFAULT 0xFF |
||
| 349 | |||
| 350 | // Color 0 default value. |
||
| 351 | #define COLOR0DEFAULT 0x00 |
||
| 352 | |||
| 353 | // Color 1 default value. |
||
| 354 | #define COLOR1DEFAULT 0xFF |
||
| 355 | |||
| 356 | // Disabled color default value. |
||
| 357 | #define COLORDISABLEDDEFAULT 0x00 |
||
| 358 | |||
| 359 | // Common background color default value. |
||
| 360 | #define COMMONBACKGROUNDCOLORDEFAULT 0x00 |
||
| 361 | |||
| 362 | #else |
||
| 363 | #if defined (GFX_PICTAIL_V1) |
||
| 364 | |||
| 365 | /* default settings for Microtips display */ |
||
| 366 | |||
| 367 | // Emboss dark color default value. |
||
| 368 | #define EMBOSSDKCOLORDEFAULT RGB565CONVERT(0x2B, 0x55, 0x87) |
||
| 369 | |||
| 370 | // Emboss light color default value. |
||
| 371 | #define EMBOSSLTCOLORDEFAULT RGB565CONVERT(0xD4, 0xE4, 0xF7) |
||
| 372 | |||
| 373 | // Text color 0 default value. |
||
| 374 | #define TEXTCOLOR0DEFAULT RGB565CONVERT(0x07, 0x1E, 0x48) |
||
| 375 | |||
| 376 | // Text color 1 default value. |
||
| 377 | #define TEXTCOLOR1DEFAULT WHITE |
||
| 378 | |||
| 379 | // Text color disabled default value. |
||
| 380 | #define TEXTCOLORDISABLEDDEFAULT WHEAT |
||
| 381 | |||
| 382 | // Color 0 default value. |
||
| 383 | #define COLOR0DEFAULT RGB565CONVERT(0x93, 0xEF, 0xFF) |
||
| 384 | |||
| 385 | // Color 1 default value. |
||
| 386 | #define COLOR1DEFAULT RGB565CONVERT(0x26, 0xC7, 0xF2) |
||
| 387 | |||
| 388 | // Disabled color default value. |
||
| 389 | #define COLORDISABLEDDEFAULT RGB565CONVERT(0xB6, 0xD2, 0xFB) |
||
| 390 | |||
| 391 | // Common background color default value. |
||
| 392 | #define COMMONBACKGROUNDCOLORDEFAULT RGB565CONVERT(0xEF, 0xFE, 0xFF) |
||
| 393 | |||
| 394 | #else |
||
| 395 | |||
| 396 | /* default settings for TRULY display */ |
||
| 397 | |||
| 398 | // Emboss dark color default value. |
||
| 399 | #define EMBOSSDKCOLORDEFAULT RGB565CONVERT(0x2B, 0x55, 0x87) |
||
| 400 | |||
| 401 | // Emboss light color default value. |
||
| 402 | #define EMBOSSLTCOLORDEFAULT RGB565CONVERT(0xD4, 0xE4, 0xF7) |
||
| 403 | |||
| 404 | // Text color 0 default value. |
||
| 405 | #define TEXTCOLOR0DEFAULT RGB565CONVERT(0x07, 0x1E, 0x48) |
||
| 406 | |||
| 407 | // Text color 1 default value. |
||
| 408 | #define TEXTCOLOR1DEFAULT WHITE |
||
| 409 | |||
| 410 | // Text color disabled default value. |
||
| 411 | #define TEXTCOLORDISABLEDDEFAULT WHEAT |
||
| 412 | |||
| 413 | // Color 0 default value. |
||
| 414 | #define COLOR0DEFAULT RGB565CONVERT(0xA9, 0xDB, 0xEF) |
||
| 415 | |||
| 416 | // Color 1 default value. |
||
| 417 | #define COLOR1DEFAULT RGB565CONVERT(0x26, 0xC7, 0xF2) |
||
| 418 | |||
| 419 | // Disabled color default value. |
||
| 420 | #define COLORDISABLEDDEFAULT RGB565CONVERT(0xB6, 0xD2, 0xFB) |
||
| 421 | |||
| 422 | // Common background color default value. |
||
| 423 | #define COMMONBACKGROUNDCOLORDEFAULT RGB565CONVERT(0xD4, 0xED, 0xF7) |
||
| 424 | |||
| 425 | #endif // #if defined (GFX_PICTAIL_V1) |
||
| 426 | #endif // USE_MONOCHROME |
||
| 427 | #endif |
||
| 428 | |||
| 429 | /********************************************************************* |
||
| 430 | * Function: WORD GOLCanBeFocused(OBJ_HEADER* object) |
||
| 431 | * |
||
| 432 | * Overview: This function returns non-zero if the object can |
||
| 433 | * be focused. Only button, check box, radio button, |
||
| 434 | * slider, edit box, list box, scroll bar can accept |
||
| 435 | * focus. If the object is disabled it cannot be set |
||
| 436 | * to focused state. |
||
| 437 | * |
||
| 438 | * PreCondition: none |
||
| 439 | * |
||
| 440 | * Input: object - Pointer to the object of interest. |
||
| 441 | * |
||
| 442 | * Output: This returns a non-zero if the object can be focused |
||
| 443 | * and zero if not. |
||
| 444 | * |
||
| 445 | * Side Effects: none |
||
| 446 | * |
||
| 447 | ********************************************************************/ |
||
| 448 | WORD GOLCanBeFocused(OBJ_HEADER *object); |
||
| 449 | |||
| 450 | /********************************************************************* |
||
| 451 | * Function: OBJ_HEADER *GOLGetFocusNext() |
||
| 452 | * |
||
| 453 | * Overview: This function returns the pointer to the previous object |
||
| 454 | * in the active linked list which is able to receive |
||
| 455 | * keyboard input. |
||
| 456 | * |
||
| 457 | * PreCondition: none |
||
| 458 | * |
||
| 459 | * Input: none |
||
| 460 | * |
||
| 461 | * Output: This returns the pointer of the previous object in the |
||
| 462 | * active list capable of receiving keyboard input. If |
||
| 463 | * there is no object capable of receiving keyboard |
||
| 464 | * inputs (i.e. none can be focused) NULL is returned. |
||
| 465 | * |
||
| 466 | * Side Effects: none |
||
| 467 | * |
||
| 468 | ********************************************************************/ |
||
| 469 | OBJ_HEADER *GOLGetFocusPrev(void); |
||
| 470 | |||
| 471 | /********************************************************************* |
||
| 472 | * Function: OBJ_HEADER *GOLGetFocusNext() |
||
| 473 | * |
||
| 474 | * Overview: This function returns the pointer to the next object |
||
| 475 | * in the active linked list which is able to receive |
||
| 476 | * keyboard input. |
||
| 477 | * |
||
| 478 | * PreCondition: none |
||
| 479 | * |
||
| 480 | * Input: none |
||
| 481 | * |
||
| 482 | * Output: This returns the pointer of the next object in the |
||
| 483 | * active list capable of receiving keyboard input. If |
||
| 484 | * there is no object capable of receiving keyboard |
||
| 485 | * inputs (i.e. none can be focused) NULL is returned. |
||
| 486 | * |
||
| 487 | * Side Effects: none |
||
| 488 | * |
||
| 489 | ********************************************************************/ |
||
| 490 | OBJ_HEADER *GOLGetFocusNext(void); |
||
| 491 | |||
| 492 | /********************************************************************* |
||
| 493 | * Function: void GOLSetFocus(OBJ_HEADER* object) |
||
| 494 | * |
||
| 495 | * Overview: This function sets the keyboard input focus to the |
||
| 496 | * object. If the object cannot accept keyboard messages |
||
| 497 | * focus will not be changed. This function resets FOCUSED |
||
| 498 | * state for the object was in focus previously, set |
||
| 499 | * FOCUSED state for the required object and marks the |
||
| 500 | * objects to be redrawn. |
||
| 501 | * |
||
| 502 | * PreCondition: none |
||
| 503 | * |
||
| 504 | * Input: object - Pointer to the object of interest. |
||
| 505 | * |
||
| 506 | * Output: none |
||
| 507 | * |
||
| 508 | * Side Effects: none |
||
| 509 | * |
||
| 510 | ********************************************************************/ |
||
| 511 | void GOLSetFocus(OBJ_HEADER *object); |
||
| 512 | |||
| 513 | /********************************************************************* |
||
| 514 | * Macros: GOLGetFocus() |
||
| 515 | * |
||
| 516 | * Overview: This macro returns the pointer to the current object |
||
| 517 | * receiving keyboard input. |
||
| 518 | * |
||
| 519 | * PreCondition: none |
||
| 520 | * |
||
| 521 | * Input: none |
||
| 522 | * |
||
| 523 | * Output: Returns the pointer to the object receiving keyboard input. |
||
| 524 | * If there is no object in focus NULL is returned. |
||
| 525 | * |
||
| 526 | * Side Effects: none |
||
| 527 | * |
||
| 528 | ********************************************************************/ |
||
| 529 | #define GOLGetFocus() _pObjectFocused |
||
| 530 | |||
| 531 | /********************************************************************* |
||
| 532 | * Macros: GetObjType(pObj) |
||
| 533 | * |
||
| 534 | * Overview: This macro returns the object type. |
||
| 535 | * |
||
| 536 | * PreCondition: none |
||
| 537 | * |
||
| 538 | * Input: pObj - Pointer to the object of interest. |
||
| 539 | * |
||
| 540 | * Output: Returns the OBJ_TYPE of the object. |
||
| 541 | * |
||
| 542 | * Side Effects: none |
||
| 543 | * |
||
| 544 | ********************************************************************/ |
||
| 545 | #define GetObjType(pObj) ((OBJ_HEADER *)pObj)->type |
||
| 546 | |||
| 547 | /********************************************************************* |
||
| 548 | * Macros: GetObjID(pObj) |
||
| 549 | * |
||
| 550 | * Overview: This macro returns the object ID. |
||
| 551 | * |
||
| 552 | * PreCondition: none |
||
| 553 | * |
||
| 554 | * Input: pObj - Pointer to the object of interest. |
||
| 555 | * |
||
| 556 | * Output: Returns the ID of the object. |
||
| 557 | * |
||
| 558 | * Example: |
||
| 559 | * <CODE> |
||
| 560 | * void UseOfGetObjID(OBJ_HEADER *pObj) { |
||
| 561 | * WORD id; |
||
| 562 | * switch(id = GetObjID(pObj)) { |
||
| 563 | * case ID_WINDOW1: |
||
| 564 | * // do something |
||
| 565 | * case ID_WINDOW2: |
||
| 566 | * // do something else |
||
| 567 | * case ID_WINDOW3: |
||
| 568 | * // do something else |
||
| 569 | * default: |
||
| 570 | * // do something else |
||
| 571 | * } |
||
| 572 | * } |
||
| 573 | * </CODE> |
||
| 574 | * |
||
| 575 | * Side Effects: none |
||
| 576 | * |
||
| 577 | ********************************************************************/ |
||
| 578 | #define GetObjID(pObj) ((OBJ_HEADER *)pObj)->ID |
||
| 579 | |||
| 580 | /********************************************************************* |
||
| 581 | * Macros: GetObjNext(pObj) |
||
| 582 | * |
||
| 583 | * Overview: This macro returns the next object after the specified |
||
| 584 | * object. |
||
| 585 | * |
||
| 586 | * PreCondition: none |
||
| 587 | * |
||
| 588 | * Input: pObj - Pointer to the object of interest. |
||
| 589 | * |
||
| 590 | * Output: Returns the pointer of the next object. |
||
| 591 | * |
||
| 592 | * Example: |
||
| 593 | * <CODE> |
||
| 594 | * // This is the same example for the GetObjType() macro |
||
| 595 | * // We just replaced one line |
||
| 596 | * void RedrawButtons(void) { |
||
| 597 | * OBJ_HEADER *pCurr; |
||
| 598 | * |
||
| 599 | * pCurr = GOLGetList(); // get active list |
||
| 600 | * while(pCurr->pNxtObj != NULL) { |
||
| 601 | * if (GetObjType(pCurr) == BUTTON) |
||
| 602 | * pCurr->state = BTN_DRAW; // set button to be redrawn |
||
| 603 | * pCurr = GetObjNext(pCurr); // Use of GetObjNext() macro |
||
| 604 | * // replaces the old line |
||
| 605 | * } |
||
| 606 | * GolDraw(); // redraw all buttons in the |
||
| 607 | * // active list |
||
| 608 | * } |
||
| 609 | * </CODE> |
||
| 610 | * |
||
| 611 | * Side Effects: none |
||
| 612 | * |
||
| 613 | ********************************************************************/ |
||
| 614 | #define GetObjNext(pObj) ((OBJ_HEADER *)pObj)->pNxtObj |
||
| 615 | |||
| 616 | /********************************************************************* |
||
| 617 | * Macros: IsObjUpdated(pObj) |
||
| 618 | * |
||
| 619 | * Overview: This macro tests if the object is pending to |
||
| 620 | * be redrawn. This is done by testing the 6 MSBits |
||
| 621 | * of objects state to detect if the object must |
||
| 622 | * be redrawn. |
||
| 623 | * |
||
| 624 | * PreCondition: none |
||
| 625 | * |
||
| 626 | * Input: pObj - Pointer to the object of interest. |
||
| 627 | * |
||
| 628 | * Output: Returns a nonzero value if the object needs |
||
| 629 | * to be redrawn. Zero if not. |
||
| 630 | * |
||
| 631 | * Example: |
||
| 632 | * <CODE> |
||
| 633 | * int DrawButtonWindowOnly() { |
||
| 634 | * static OBJ_HEADER *pCurrentObj = NULL; |
||
| 635 | * SHORT done = 0; |
||
| 636 | * |
||
| 637 | * if (pCurrentObj == NULL) |
||
| 638 | * pCurrentObj = GOLGetList(); // get current list |
||
| 639 | * |
||
| 640 | * while(pCurrentObj != NULL){ |
||
| 641 | * if(IsObjUpdated(pCurrentObj)){ |
||
| 642 | * switch(pCurrentObj->type){ |
||
| 643 | * case OBJ_BUTTON: |
||
| 644 | * done = BtnDraw((BUTTON*)pCurrentObj); |
||
| 645 | * break; |
||
| 646 | * case OBJ_WINDOW: |
||
| 647 | * done = WndDraw((WINDOW*)pCurrentObj); |
||
| 648 | * break; |
||
| 649 | * } |
||
| 650 | * // reset state of object if done |
||
| 651 | * if (done) |
||
| 652 | * GOLDrawComplete(pCurrentObj) |
||
| 653 | * // Return if not done. This means that BtnDraw() |
||
| 654 | * // was terminated prematurely by device busy status |
||
| 655 | * // and must be recalled to finish rendering of |
||
| 656 | * // objects in the list that have new states. |
||
| 657 | * else |
||
| 658 | * return 0; |
||
| 659 | * } |
||
| 660 | * // go to the next object in the list |
||
| 661 | * pCurrentObj = pCurrentObj->pNxtObj; |
||
| 662 | * } |
||
| 663 | * return 1; |
||
| 664 | * } |
||
| 665 | * </CODE> |
||
| 666 | * |
||
| 667 | * Side Effects: none |
||
| 668 | * |
||
| 669 | ********************************************************************/ |
||
| 670 | #define IsObjUpdated(pObj) (((OBJ_HEADER *)pObj)->state & 0xfc00) |
||
| 671 | |||
| 672 | /********************************************************************* |
||
| 673 | * Macros: GOLDrawComplete(pObj) |
||
| 674 | * |
||
| 675 | * Overview: This macro resets the drawing states of the object |
||
| 676 | * (6 MSBits of the objects state). |
||
| 677 | * |
||
| 678 | * PreCondition: none |
||
| 679 | * |
||
| 680 | * Input: pObj - Pointer to the object of interest. |
||
| 681 | * |
||
| 682 | * Output: none |
||
| 683 | * |
||
| 684 | * Example: |
||
| 685 | * <CODE> |
||
| 686 | * // This function should be called again whenever an incomplete |
||
| 687 | * // rendering (done = 0) of an object occurs. |
||
| 688 | * // internal states in the BtnDraw() or WndDraw() should pickup |
||
| 689 | * // on the state where it left off to continue rendering. |
||
| 690 | * void GOLDraw() { |
||
| 691 | * static OBJ_HEADER *pCurrentObj = NULL; |
||
| 692 | * SHORT done; |
||
| 693 | * |
||
| 694 | * if(pCurrentObj == NULL) { |
||
| 695 | * if(GOLDrawCallback()) { |
||
| 696 | * // If it's last object jump to head |
||
| 697 | * pCurrentObj = GOLGetList(); |
||
| 698 | * } else { |
||
| 699 | * return; |
||
| 700 | * } |
||
| 701 | * } |
||
| 702 | * done = 0; |
||
| 703 | * |
||
| 704 | * while(pCurrentObj != NULL) { |
||
| 705 | * if(IsObjUpdated(pCurrentObj)) { |
||
| 706 | * switch(pCurrentObj->type) { |
||
| 707 | * case OBJ_BUTTON: |
||
| 708 | * done = BtnDraw((BUTTON*)pCurrentObj); |
||
| 709 | * break; |
||
| 710 | * case OBJ_WINDOW: |
||
| 711 | * done = WndDraw((WINDOW*)pCurrentObj); |
||
| 712 | * break; |
||
| 713 | * } |
||
| 714 | * if(done){ |
||
| 715 | * GOLDrawComplete(pCurrentObj); |
||
| 716 | * }else{ |
||
| 717 | * return; |
||
| 718 | * } |
||
| 719 | * } |
||
| 720 | * pCurrentObj = pCurrentObj->pNxtObj; |
||
| 721 | * } |
||
| 722 | * } |
||
| 723 | * </CODE> |
||
| 724 | * |
||
| 725 | * Side Effects: none |
||
| 726 | * |
||
| 727 | ********************************************************************/ |
||
| 728 | #define GOLDrawComplete(pObj) ((OBJ_HEADER *)pObj)->state &= 0x03ff |
||
| 729 | |||
| 730 | /********************************************************************* |
||
| 731 | * Macros: SetState(pObj, stateBits) |
||
| 732 | * |
||
| 733 | * Overview: This macro sets the state bits of an object. |
||
| 734 | * Object must be redrawn to display the changes. |
||
| 735 | * It is possible to set several state bits with |
||
| 736 | * this macro. |
||
| 737 | * |
||
| 738 | * PreCondition: none |
||
| 739 | * |
||
| 740 | * Input: pObj - Pointer to the object of interest. |
||
| 741 | * stateBits - Defines which state bits are to be |
||
| 742 | * set. Please refer to specific objects for object |
||
| 743 | * state bits definition for details |
||
| 744 | * |
||
| 745 | * Output: none |
||
| 746 | * |
||
| 747 | * Example: |
||
| 748 | * <CODE> |
||
| 749 | * void BtnMsgDefault(WORD msg, BUTTON* pB){ |
||
| 750 | * switch(msg){ |
||
| 751 | * case BTN_MSG_PRESSED: |
||
| 752 | * // set pressed and redraw |
||
| 753 | * SetState(pB, BTN_PRESSED|BTN_DRAW); |
||
| 754 | * break; |
||
| 755 | * case BTN_MSG_RELEASED: |
||
| 756 | * ClrState(pB, BTN_PRESSED); // reset pressed |
||
| 757 | * SetState(pB, BTN_DRAW); // redraw |
||
| 758 | * break; |
||
| 759 | * } |
||
| 760 | * } |
||
| 761 | * </CODE> |
||
| 762 | * |
||
| 763 | * Side Effects: none |
||
| 764 | * |
||
| 765 | ********************************************************************/ |
||
| 766 | #define SetState(pObj, stateBits) ((OBJ_HEADER *)pObj)->state |= (stateBits) |
||
| 767 | |||
| 768 | /********************************************************************* |
||
| 769 | * Macros: ClrState(pObj, stateBits) |
||
| 770 | * |
||
| 771 | * Overview: This macro clear the state bits of an object. |
||
| 772 | * Object must be redrawn to display the changes. |
||
| 773 | * It is possible to clear several state bits with |
||
| 774 | * this macro. |
||
| 775 | * |
||
| 776 | * PreCondition: none |
||
| 777 | * |
||
| 778 | * Input: pObj - Pointer to the object of interest. |
||
| 779 | * stateBits - Defines which state bits are to be |
||
| 780 | * cleared. Please refer to specific objects for object |
||
| 781 | * state bits definition for details |
||
| 782 | * |
||
| 783 | * Output: none |
||
| 784 | * |
||
| 785 | * Example: |
||
| 786 | * See example for SetState(). |
||
| 787 | * |
||
| 788 | * Side Effects: none |
||
| 789 | * |
||
| 790 | ********************************************************************/ |
||
| 791 | #define ClrState(pObj, stateBits) ((OBJ_HEADER *)pObj)->state &= (~(stateBits)) |
||
| 792 | |||
| 793 | /********************************************************************* |
||
| 794 | * Macros: GetState(pObj, stateBits) |
||
| 795 | * |
||
| 796 | * Overview: This macro retrieves the current value of |
||
| 797 | * the state bits of an object. It is possible |
||
| 798 | * to get several state bits. |
||
| 799 | * |
||
| 800 | * PreCondition: none |
||
| 801 | * |
||
| 802 | * Input: pObj - Pointer to the object of interest. |
||
| 803 | * stateBits - Defines which state bits are requested. |
||
| 804 | * Please refer to specific objects for object |
||
| 805 | * state bits definition for details |
||
| 806 | * |
||
| 807 | * Output: Macro returns a non-zero if any bit in the |
||
| 808 | * stateBits mask is set. |
||
| 809 | * |
||
| 810 | * Example: |
||
| 811 | * <CODE> |
||
| 812 | * #define BTN_HIDE 0x8000 |
||
| 813 | * BUTTON *pB; |
||
| 814 | * // pB is created and initialized |
||
| 815 | * // do something here to set state |
||
| 816 | * |
||
| 817 | * // Hide the button (remove from screen) |
||
| 818 | * if (GetState(pB,BTN_HIDE)) { |
||
| 819 | * SetColor(pB->pGolScheme->CommonBkColor); |
||
| 820 | * Bar(pB->left,pB->top,pB->right,pB->bottom); |
||
| 821 | * |
||
| 822 | * } |
||
| 823 | * </CODE> |
||
| 824 | * |
||
| 825 | * Side Effects: none |
||
| 826 | * |
||
| 827 | ********************************************************************/ |
||
| 828 | #define GetState(pObj, stateBits) (((OBJ_HEADER *)pObj)->state & (stateBits)) |
||
| 829 | |||
| 830 | /********************************************************************* |
||
| 831 | * Function: GOL_SCHEME *GOLCreateScheme() |
||
| 832 | * |
||
| 833 | * Overview: This function creates a new style scheme object |
||
| 834 | * and initializes the parameters to default values. |
||
| 835 | * |
||
| 836 | * PreCondition: none |
||
| 837 | * |
||
| 838 | * Input: none |
||
| 839 | * |
||
| 840 | * Output: Pointer to the new GOL_SCHEME created. |
||
| 841 | * |
||
| 842 | * Example: |
||
| 843 | * <CODE> |
||
| 844 | * extern const char Font22[] __attribute__((aligned(2))); |
||
| 845 | * extern const char Font16[] __attribute__((aligned(2))); |
||
| 846 | * |
||
| 847 | * GOLSCHEME *pScheme1, *pScheme2; |
||
| 848 | * pScheme1 = GOLCreateScheme(); |
||
| 849 | * pScheme2 = GOLCreateScheme(); |
||
| 850 | * |
||
| 851 | * pScheme1->pFont = (BYTE*)Font22; |
||
| 852 | * pScheme2->pFont = (BYTE*)Font16; |
||
| 853 | * </CODE> |
||
| 854 | * |
||
| 855 | * Side Effects: none |
||
| 856 | * |
||
| 857 | ********************************************************************/ |
||
| 858 | GOL_SCHEME *GOLCreateScheme(void); |
||
| 859 | |||
| 860 | /********************************************************************* |
||
| 861 | * Macros: GOLSetScheme(pObj, pScheme) |
||
| 862 | * |
||
| 863 | * Overview: This macro sets the GOL scheme to be used for the object. |
||
| 864 | * |
||
| 865 | * PreCondition: none |
||
| 866 | * |
||
| 867 | * Input: pObj - Pointer to the object of interest. |
||
| 868 | * pScheme - Pointer to the style scheme to be used. |
||
| 869 | * |
||
| 870 | * Output: none |
||
| 871 | * |
||
| 872 | * Example: |
||
| 873 | * <CODE> |
||
| 874 | * extern FONT_FLASH Gentium12; |
||
| 875 | * GOLSCHEME *pScheme1; |
||
| 876 | * BUTTON *pButton; |
||
| 877 | * |
||
| 878 | * pScheme1 = GOLCreateScheme(); |
||
| 879 | * pScheme1->pFont = &Gentium12; |
||
| 880 | * |
||
| 881 | * // assume button is created and initialized |
||
| 882 | * |
||
| 883 | * // reassign the scheme used by pButton to pScheme1 |
||
| 884 | * GOLSetScheme(pButton, pScheme1); |
||
| 885 | * </CODE> |
||
| 886 | * |
||
| 887 | * Side Effects: none |
||
| 888 | * |
||
| 889 | ********************************************************************/ |
||
| 890 | #define GOLSetScheme(pObj, pScheme) ((OBJ_HEADER *)pObj)->pGolScheme = pScheme |
||
| 891 | |||
| 892 | /********************************************************************* |
||
| 893 | * Macros: GOLGetScheme(pObj) |
||
| 894 | * |
||
| 895 | * Overview: This macro gets the GOL scheme used by the given object. |
||
| 896 | * |
||
| 897 | * PreCondition: none |
||
| 898 | * |
||
| 899 | * Input: pObj - Pointer to the object of interest. |
||
| 900 | * |
||
| 901 | * Output: Returns the style scheme used by the given object. |
||
| 902 | * |
||
| 903 | * Example: |
||
| 904 | * <CODE> |
||
| 905 | * GOLSCHEME *pScheme2; |
||
| 906 | * BUTTON *pButton; |
||
| 907 | * |
||
| 908 | * // assume button is created and initialized |
||
| 909 | * // get the scheme assigned to pButton |
||
| 910 | * pScheme2 = GOLGetScheme(pButton); |
||
| 911 | * </CODE> |
||
| 912 | * |
||
| 913 | * Side Effects: none |
||
| 914 | * |
||
| 915 | ********************************************************************/ |
||
| 916 | #define GOLGetScheme(pObj) ((OBJ_HEADER *)pObj)->pGolScheme |
||
| 917 | |||
| 918 | /********************************************************************* |
||
| 919 | * Macros: GOLGetSchemeDefault() |
||
| 920 | * |
||
| 921 | * Overview: This macro returns the default GOL scheme pointer. |
||
| 922 | * |
||
| 923 | * PreCondition: none |
||
| 924 | * |
||
| 925 | * Input: none |
||
| 926 | * |
||
| 927 | * Output: Returns the pointer to the default style scheme. |
||
| 928 | * |
||
| 929 | * Side Effects: none |
||
| 930 | * |
||
| 931 | ********************************************************************/ |
||
| 932 | #define GOLGetSchemeDefault() _pDefaultGolScheme |
||
| 933 | |||
| 934 | /********************************************************************* |
||
| 935 | * Function: void GOLInit() |
||
| 936 | * |
||
| 937 | * Overview: This function initializes the graphics library and |
||
| 938 | * creates a default style scheme with default settings |
||
| 939 | * referenced by the global scheme pointer. GOLInit() |
||
| 940 | * function must be called before GOL functions can be |
||
| 941 | * used. It is not necessary to call GraphInit() |
||
| 942 | * function if this function is used. |
||
| 943 | * |
||
| 944 | * PreCondition: none |
||
| 945 | * |
||
| 946 | * Input: none |
||
| 947 | * |
||
| 948 | * Output: none |
||
| 949 | * |
||
| 950 | * Side Effects: This sets the line type to SOLID_LINE, sets the |
||
| 951 | * screen to all BLACK, sets the current drawing color |
||
| 952 | * to WHITE, sets the graphic cursor position to upper |
||
| 953 | * left corner of the screen, sets active and visual |
||
| 954 | * pages to page #0, clears the active page and disables |
||
| 955 | * clipping. This also creates a default style scheme. |
||
| 956 | * |
||
| 957 | ********************************************************************/ |
||
| 958 | void GOLInit(); |
||
| 959 | |||
| 960 | /********************************************************************* |
||
| 961 | * Function: void GOLAddObject(OBJ_HEADER* object) |
||
| 962 | * |
||
| 963 | * Overview: This function adds an object to the tail of the |
||
| 964 | * active list pointed to by _pGolObjects. The new list |
||
| 965 | * tail is set to point to NULL. |
||
| 966 | * |
||
| 967 | * PreCondition: none |
||
| 968 | * |
||
| 969 | * Input: pObj - Pointer to the object to be added on the current |
||
| 970 | * active list. |
||
| 971 | * |
||
| 972 | * Output: none |
||
| 973 | * |
||
| 974 | * Example: |
||
| 975 | * <CODE> |
||
| 976 | * void MoveObject(OBJ_HEADER *pSrcList, OBJ_HEADER *pDstList, |
||
| 977 | * OBJ_HEADER *pObjtoMove) { |
||
| 978 | * OBJ_HEADER *pTemp = pSrcList; |
||
| 979 | * |
||
| 980 | * if(pTemp != pObjtoMove) { |
||
| 981 | * while(pTemp->pNxtObj != pObjtoMove) |
||
| 982 | * pTemp = pTemp->pNxtObj; |
||
| 983 | * } |
||
| 984 | * |
||
| 985 | * pTemp->pNxtObj = pObjtoMove ->pNxt; // remove object from list |
||
| 986 | * GOLSetList(pDstList); // destination as active list |
||
| 987 | * GOLAddObject(pObjtoMove); // add object to active list |
||
| 988 | * } |
||
| 989 | * </CODE> |
||
| 990 | * |
||
| 991 | * Side Effects: none |
||
| 992 | * |
||
| 993 | ********************************************************************/ |
||
| 994 | void GOLAddObject(OBJ_HEADER *object); |
||
| 995 | |||
| 996 | /********************************************************************* |
||
| 997 | * Macros: void GOLNewList() |
||
| 998 | * |
||
| 999 | * Overview: This macro starts a new linked list of objects and |
||
| 1000 | * resets the keyboard focus to none. This macro assigns |
||
| 1001 | * the current active list _pGolObjects and current receiving |
||
| 1002 | * keyboard input _pObjectFocused object pointers to NULL. |
||
| 1003 | * Any keyboard inputs at this point will be ignored. |
||
| 1004 | * Previous active list must be saved in another pointer if |
||
| 1005 | * to be referenced later. If not needed anymore memory used |
||
| 1006 | * by that list should be freed by GOLFree() function. |
||
| 1007 | * |
||
| 1008 | * PreCondition: none |
||
| 1009 | * |
||
| 1010 | * Input: none |
||
| 1011 | * |
||
| 1012 | * Output: none |
||
| 1013 | * |
||
| 1014 | * Example: |
||
| 1015 | * <CODE> |
||
| 1016 | * OBJ_HEADER *pSave; |
||
| 1017 | * |
||
| 1018 | * pSave = GOLGetList(); // save current list |
||
| 1019 | * GOLNewList(); // start the new list |
||
| 1020 | * // current list is now NULL |
||
| 1021 | * |
||
| 1022 | * // assume that objects are already created |
||
| 1023 | * // you can now add objects to the new list |
||
| 1024 | * GOLAddObject(pButton); |
||
| 1025 | * GOLAddObject(pWindow); |
||
| 1026 | * GOLAddObject(pSlider); |
||
| 1027 | * </CODE> |
||
| 1028 | * |
||
| 1029 | * Side Effects: This macro sets the focused object pointer |
||
| 1030 | * (_pObjectFocused) to NULL. |
||
| 1031 | * |
||
| 1032 | ********************************************************************/ |
||
| 1033 | #define GOLNewList() \ |
||
| 1034 | _pGolObjects = NULL; \ |
||
| 1035 | _pObjectFocused = NULL |
||
| 1036 | |||
| 1037 | /********************************************************************* |
||
| 1038 | * Macros: GOLGetList() |
||
| 1039 | * |
||
| 1040 | * Overview: This macro gets the current active list. |
||
| 1041 | * |
||
| 1042 | * PreCondition: none |
||
| 1043 | * |
||
| 1044 | * Input: none |
||
| 1045 | * |
||
| 1046 | * Output: Returns the pointer to the current active list. |
||
| 1047 | * |
||
| 1048 | * Example: |
||
| 1049 | * See GOLNewList() example. |
||
| 1050 | * |
||
| 1051 | * Side Effects: none |
||
| 1052 | * |
||
| 1053 | ********************************************************************/ |
||
| 1054 | #define GOLGetList() _pGolObjects |
||
| 1055 | |||
| 1056 | /********************************************************************* |
||
| 1057 | * Macros: GOLSetList(objsList) |
||
| 1058 | * |
||
| 1059 | * Overview: This macro sets the given object list as the active |
||
| 1060 | * list and resets the keyboard focus to none. This macro |
||
| 1061 | * assigns the receiving keyboard input object _pObjectFocused |
||
| 1062 | * pointer to NULL. If the new active list has an objects |
||
| 1063 | * state set to focus, the _pObjectFocused pointer must be |
||
| 1064 | * set to this object or the objects state must be change |
||
| 1065 | * to unfocused. This is to avoid two objects displaying a |
||
| 1066 | * focused state when only one object in the active list must |
||
| 1067 | * be set to a focused state at anytime. |
||
| 1068 | * |
||
| 1069 | * PreCondition: none |
||
| 1070 | * |
||
| 1071 | * Input: objsList - The pointer to the new active list. |
||
| 1072 | * |
||
| 1073 | * Output: none |
||
| 1074 | * |
||
| 1075 | * Example: |
||
| 1076 | * <CODE> |
||
| 1077 | * OBJ_HEADER *pSave; |
||
| 1078 | * pSave = GOLGetList(); // save current list |
||
| 1079 | * GOLNewList(); // start the new list |
||
| 1080 | * // current list is now NULL |
||
| 1081 | * |
||
| 1082 | * // you can now add objects to the current list |
||
| 1083 | * // assume that objects are already created |
||
| 1084 | * GOLAddObject(pButton); |
||
| 1085 | * GOLAddObject(pWindow); |
||
| 1086 | * GOLAddObject(pSlider); |
||
| 1087 | * |
||
| 1088 | * // do something here on the new list |
||
| 1089 | * // return the old list |
||
| 1090 | * GOLSetList(pSave); |
||
| 1091 | * </CODE> |
||
| 1092 | * |
||
| 1093 | * Side Effects: This macro sets the focused object pointer |
||
| 1094 | * (_pObjectFocused) to NULL. Previous active list |
||
| 1095 | * should be saved if needed to be referenced later. |
||
| 1096 | * If not, use GOLFree() function to free the memory |
||
| 1097 | * used by the objects before calling GOLSetList(). |
||
| 1098 | * |
||
| 1099 | ********************************************************************/ |
||
| 1100 | #define GOLSetList(objsList) \ |
||
| 1101 | _pGolObjects = objsList; \ |
||
| 1102 | _pObjectFocused = NULL |
||
| 1103 | |||
| 1104 | /********************************************************************* |
||
| 1105 | * Function: OBJ_HEADER* GOLFindObject(WORD ID) |
||
| 1106 | * |
||
| 1107 | * Overview: This function finds an object in the active list |
||
| 1108 | * pointed to by _pGolObjects using the given object ID. |
||
| 1109 | * |
||
| 1110 | * PreCondition: none |
||
| 1111 | * |
||
| 1112 | * Input: ID - User assigned value set during the creation of the object. |
||
| 1113 | * |
||
| 1114 | * Output: Pointer to the object with the given ID. |
||
| 1115 | * |
||
| 1116 | * Example: |
||
| 1117 | * <CODE> |
||
| 1118 | * void CopyObject(OBJ_HEADER *pSrcList, OBJ_HEADER *pDstList, WORD ID) |
||
| 1119 | * { |
||
| 1120 | * OBJ_HEADER *pTemp; |
||
| 1121 | * |
||
| 1122 | * pTemp = GOLFindObject(ID); // find the object |
||
| 1123 | * if (pTemp != NULL) { |
||
| 1124 | * GOLSetList(pDstList); // destination as active list |
||
| 1125 | * GOLAddObject(pObj); // add object to active list |
||
| 1126 | * } |
||
| 1127 | * } |
||
| 1128 | * </CODE> |
||
| 1129 | * |
||
| 1130 | * Side Effects: none |
||
| 1131 | * |
||
| 1132 | ********************************************************************/ |
||
| 1133 | OBJ_HEADER * GOLFindObject(WORD ID); |
||
| 1134 | |||
| 1135 | /********************************************************************* |
||
| 1136 | * Function: void GOLFree() |
||
| 1137 | * |
||
| 1138 | * Overview: This function frees all the memory used by objects in |
||
| 1139 | * the active list and initializes _pGolObjects pointer |
||
| 1140 | * to NULL to start a new empty list. This function must |
||
| 1141 | * be called only inside the GOLDrawCallback()function when |
||
| 1142 | * using GOLDraw() and GOLMsg() functions. This requirement |
||
| 1143 | * assures that primitive rendering settings are not altered |
||
| 1144 | * by the rendering state machines of the objects. |
||
| 1145 | * |
||
| 1146 | * PreCondition: none |
||
| 1147 | * |
||
| 1148 | * Input: none |
||
| 1149 | * |
||
| 1150 | * Output: none |
||
| 1151 | * |
||
| 1152 | * Example: |
||
| 1153 | * <CODE> |
||
| 1154 | * void DeletePage(OBJ_HEADER *pPage) { |
||
| 1155 | * OBJ_HEADER *pTemp; |
||
| 1156 | * |
||
| 1157 | * // assuming pPage is different from the current active list |
||
| 1158 | * pTemp = GOLGetList(); // save the active list |
||
| 1159 | * GOLSetList(pPage); // set list as active list |
||
| 1160 | * GolFree(); // pPage objects are deleted |
||
| 1161 | * |
||
| 1162 | * GOLSetList(pTemp); // restore the active list |
||
| 1163 | * } |
||
| 1164 | * </CODE> |
||
| 1165 | * |
||
| 1166 | * Side Effects: All objects in the active list are deleted from memory. |
||
| 1167 | * |
||
| 1168 | ********************************************************************/ |
||
| 1169 | void GOLFree(void); |
||
| 1170 | |||
| 1171 | /********************************************************************* |
||
| 1172 | * Function: BOOL GOLDeleteObject(OBJ_HEADER * object) |
||
| 1173 | * |
||
| 1174 | * PreCondition: none |
||
| 1175 | * |
||
| 1176 | * Input: pointer to the object |
||
| 1177 | * |
||
| 1178 | * Output: none |
||
| 1179 | * |
||
| 1180 | * Side Effects: none |
||
| 1181 | * |
||
| 1182 | * Overview: deletes an object to the linked list objects for the current screen. |
||
| 1183 | * |
||
| 1184 | * Note: none |
||
| 1185 | * |
||
| 1186 | ********************************************************************/ |
||
| 1187 | BOOL GOLDeleteObject(OBJ_HEADER *object); |
||
| 1188 | |||
| 1189 | /********************************************************************* |
||
| 1190 | * Function: BOOL GOLDeleteObjectByID(WORD ID) |
||
| 1191 | * |
||
| 1192 | * PreCondition: none |
||
| 1193 | * |
||
| 1194 | * Input: ID of the object. |
||
| 1195 | * |
||
| 1196 | * Output: none |
||
| 1197 | * |
||
| 1198 | * Side Effects: none |
||
| 1199 | * |
||
| 1200 | * Overview: Deletes an object in the current active linked list of objects using the ID parameter |
||
| 1201 | * of the object. |
||
| 1202 | * |
||
| 1203 | * Note: none |
||
| 1204 | * |
||
| 1205 | ********************************************************************/ |
||
| 1206 | BOOL GOLDeleteObjectByID(WORD ID); |
||
| 1207 | |||
| 1208 | /********************************************************************* |
||
| 1209 | * Function: WORD GOLDraw() |
||
| 1210 | * |
||
| 1211 | * Overview: This function loops through the active list and redraws |
||
| 1212 | * objects that need to be redrawn. Partial redrawing or |
||
| 1213 | * full redraw is performed depending on the drawing states |
||
| 1214 | * of the objects. |
||
| 1215 | * GOLDrawCallback() function is called by GOLDraw() |
||
| 1216 | * when drawing of objects in the active list is completed. |
||
| 1217 | * |
||
| 1218 | * PreCondition: none |
||
| 1219 | * |
||
| 1220 | * Input: none |
||
| 1221 | * |
||
| 1222 | * Output: Non-zero if the active link list drawing is completed. |
||
| 1223 | * |
||
| 1224 | * Example: |
||
| 1225 | * <CODE> |
||
| 1226 | * // Assume objects are created & states are set to draw objects |
||
| 1227 | * while(1){ |
||
| 1228 | * if(GOLDraw()){ // parse active list and redraw objects that needs to be redrawn |
||
| 1229 | |||
| 1230 | * // here GOL drawing is completed |
||
| 1231 | * // it is safe to modify objects states and linked list |
||
| 1232 | * |
||
| 1233 | * TouchGetMsg(&msg); // evaluate messages from touch screen device |
||
| 1234 | * |
||
| 1235 | * GOLMsg(&msg); // evaluate each object is affected by the message |
||
| 1236 | * } |
||
| 1237 | * } |
||
| 1238 | * </CODE> |
||
| 1239 | * |
||
| 1240 | * Side Effects: none |
||
| 1241 | * |
||
| 1242 | ********************************************************************/ |
||
| 1243 | WORD GOLDraw(void); |
||
| 1244 | |||
| 1245 | /********************************************************************* |
||
| 1246 | * Function: void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom) |
||
| 1247 | * |
||
| 1248 | * Overview: This function marks all objects in the active |
||
| 1249 | * list intersected by the given rectangular area |
||
| 1250 | * to be redrawn. |
||
| 1251 | * |
||
| 1252 | * PreCondition: none |
||
| 1253 | * |
||
| 1254 | * Input: left - Defines the left most border of the rectangle area. |
||
| 1255 | * top - Defines the top most border of the rectangle area. |
||
| 1256 | * right - Defines the right most border of the rectangle area. |
||
| 1257 | * bottom - Defines the bottom most border of the rectangle area. |
||
| 1258 | * |
||
| 1259 | * Output: none |
||
| 1260 | * |
||
| 1261 | * Example: |
||
| 1262 | * <CODE> |
||
| 1263 | * OBJ_HEADER *pTemp; |
||
| 1264 | * OBJ_HEADER *pAllObjects; |
||
| 1265 | * |
||
| 1266 | * // assume *pAllObjects points to a list of all existing objects |
||
| 1267 | * // created and initialized |
||
| 1268 | * |
||
| 1269 | * // mark all objects inside the rectangle to be redrawn |
||
| 1270 | * GOLRedrawRec(10,10,100,100); |
||
| 1271 | * |
||
| 1272 | * pTemp = pAllObjects; |
||
| 1273 | * GOLStartNewList(); // reset active list |
||
| 1274 | * while(pTemp->pNxtObj != NULL) { |
||
| 1275 | * if (pTemp->state&0x7C00) // add only objects to be |
||
| 1276 | * GOLAddObject(pTemp); // redrawn to the active list |
||
| 1277 | * pTemp = pTemp->pNxtObj; |
||
| 1278 | * } |
||
| 1279 | * GOLDraw(); // redraw active list |
||
| 1280 | * </CODE> |
||
| 1281 | * |
||
| 1282 | * Side Effects: none |
||
| 1283 | * |
||
| 1284 | ********************************************************************/ |
||
| 1285 | void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom); |
||
| 1286 | |||
| 1287 | /********************************************************************* |
||
| 1288 | * Macros: GOLRedraw(pObj) |
||
| 1289 | * |
||
| 1290 | * Overview: This macro sets the object to be redrawn. For the |
||
| 1291 | * redraw to be effective, the object must be in the |
||
| 1292 | * current active list. If not, the redraw action will |
||
| 1293 | * not be performed until the list where the object is |
||
| 1294 | * currently inserted will be set to be the active list. |
||
| 1295 | * |
||
| 1296 | * PreCondition: none |
||
| 1297 | * |
||
| 1298 | * Input: pObj - Pointer to the object to be redrawn. |
||
| 1299 | * |
||
| 1300 | * Output: none |
||
| 1301 | * |
||
| 1302 | * Example: |
||
| 1303 | * <CODE> |
||
| 1304 | * void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom) { |
||
| 1305 | * // set all objects encompassed by the rectangle to be redrawn |
||
| 1306 | * OBJ_HEADER *pCurrentObj; |
||
| 1307 | * |
||
| 1308 | * pCurrentObj = GOLGetList(); |
||
| 1309 | * while(pCurrentObj != NULL){ |
||
| 1310 | * if ( |
||
| 1311 | * ((pCurrentObj->left >= left) && (pCurrentObj->left <= right)) || |
||
| 1312 | * ((pCurrentObj->right >= left) && (pCurrentObj->right <= right))|| |
||
| 1313 | * ((pCurrentObj->top >= top) && (pCurrentObj->top <= bottom)) || |
||
| 1314 | * ((pCurrentObj->bottom >= top) && (pCurrentObj->bottom <= bottom))){ |
||
| 1315 | * GOLRedraw(pCurrentObj); |
||
| 1316 | * } |
||
| 1317 | * pCurrentObj = pCurrentObj->pNxtObj; |
||
| 1318 | * }//end of while |
||
| 1319 | * } |
||
| 1320 | * </CODE> |
||
| 1321 | * |
||
| 1322 | * Side Effects: none |
||
| 1323 | * |
||
| 1324 | ********************************************************************/ |
||
| 1325 | #define GOLRedraw(pObj) ((OBJ_HEADER *)pObj)->state |= 0x7c00; |
||
| 1326 | |||
| 1327 | /********************************************************************* |
||
| 1328 | * Function: void GOLMsg(GOL_MSG *pMsg) |
||
| 1329 | * |
||
| 1330 | * Overview: This function receives a GOL message from user and |
||
| 1331 | * loops through the active list of objects to check |
||
| 1332 | * which object is affected by the message. For affected |
||
| 1333 | * objects the message is translated and GOLMsgCallback() |
||
| 1334 | * is called. In the call back function, user has the |
||
| 1335 | * ability to implement action for the message. If the |
||
| 1336 | * call back function returns non-zero OBJMsgDefault() |
||
| 1337 | * is called to process message for the object by default. |
||
| 1338 | * If zero is returned OBJMsgDefault() is not called. |
||
| 1339 | * Please refer to GOL Messages section for deatils. |
||
| 1340 | * |
||
| 1341 | * This function should be called when GOL drawing |
||
| 1342 | * is completed. It can be done when GOLDraw() returns |
||
| 1343 | * non-zero value or inside GOLDrawCallback() function. |
||
| 1344 | * |
||
| 1345 | * PreCondition: none |
||
| 1346 | * |
||
| 1347 | * Input: pMsg - Pointer to the GOL message from user. |
||
| 1348 | * |
||
| 1349 | * Output: none |
||
| 1350 | * |
||
| 1351 | * Example: |
||
| 1352 | * <CODE> |
||
| 1353 | * // Assume objects are created & states are set to draw objects |
||
| 1354 | * while(1){ |
||
| 1355 | * if(GOLDraw()){ |
||
| 1356 | * // GOL drawing is completed here |
||
| 1357 | * // it is safe to change objects |
||
| 1358 | * TouchGetMsg(&msg); // from user interface module |
||
| 1359 | * GOLMsg(&msg); |
||
| 1360 | * } |
||
| 1361 | * } |
||
| 1362 | * </CODE> |
||
| 1363 | * |
||
| 1364 | * Side Effects: none |
||
| 1365 | * |
||
| 1366 | ********************************************************************/ |
||
| 1367 | void GOLMsg(GOL_MSG *pMsg); |
||
| 1368 | |||
| 1369 | /********************************************************************* |
||
| 1370 | * Function: WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg) |
||
| 1371 | * |
||
| 1372 | * Overview: The user MUST implement this function. GOLMsg() calls |
||
| 1373 | * this function when a valid message for an object in the |
||
| 1374 | * active list is received. User action for the message should |
||
| 1375 | * be implemented here. If this function returns non-zero, |
||
| 1376 | * the message for the object will be processed by default. |
||
| 1377 | * If zero is returned, GOL will not perform any action. |
||
| 1378 | * |
||
| 1379 | * PreCondition: none |
||
| 1380 | * |
||
| 1381 | * Input: objMsg - Translated message for the object or the action ID response from the object. |
||
| 1382 | * pObj - Pointer to the object that processed the message. |
||
| 1383 | * pMsg - Pointer to the GOL message from user. |
||
| 1384 | * |
||
| 1385 | * Output: Return a non-zero if the message will be processed by default. |
||
| 1386 | * If a zero is returned, the message will not be processed by GOL. |
||
| 1387 | * |
||
| 1388 | * Example: |
||
| 1389 | * <CODE> |
||
| 1390 | * WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG *pMsg){ |
||
| 1391 | * static char focusSwitch = 1; |
||
| 1392 | * |
||
| 1393 | * switch(GetObjID(pObj)){ |
||
| 1394 | * case ID_BUTTON1: |
||
| 1395 | * // Change text and focus state |
||
| 1396 | * if(objMsg == BTN_MSG_RELEASED){ |
||
| 1397 | * focusSwitch ^= 1; |
||
| 1398 | * if(focusSwitch){ |
||
| 1399 | * BtnSetText((BUTTON*)pObj, "Focused"); |
||
| 1400 | * SetState(pObj,BTN_FOCUSED); |
||
| 1401 | * }else{ |
||
| 1402 | * BtnSetText((BUTTON*)pObj, "Unfocused"); |
||
| 1403 | * ClrState(pObj,BTN_FOCUSED); |
||
| 1404 | * } |
||
| 1405 | * } |
||
| 1406 | * // Process by default |
||
| 1407 | * return 1; |
||
| 1408 | * case ID_BUTTON2: |
||
| 1409 | * // Change text |
||
| 1410 | * if(objMsg == BTN_MSG_PRESSED){ |
||
| 1411 | * BtnSetText((BUTTON*)pObj, "Pressed"); |
||
| 1412 | * } |
||
| 1413 | * if(objMsg == BTN_MSG_RELEASED){ |
||
| 1414 | * BtnSetText((BUTTON*)pObj, "Released"); |
||
| 1415 | * } |
||
| 1416 | * // Process by default |
||
| 1417 | * return 1; |
||
| 1418 | * case ID_BUTTON3: |
||
| 1419 | * // Change face picture |
||
| 1420 | * if(objMsg == BTN_MSG_PRESSED){ |
||
| 1421 | * BtnSetBitmap(pObj,arrowLeft); |
||
| 1422 | * } |
||
| 1423 | * if(objMsg == BTN_MSG_RELEASED){ |
||
| 1424 | * BtnSetBitmap(pObj,(char*)arrowRight); |
||
| 1425 | * } |
||
| 1426 | * // Process by default |
||
| 1427 | * return 1; |
||
| 1428 | * case ID_BUTTON_NEXT: |
||
| 1429 | * if(objMsg == BTN_MSG_RELEASED){ |
||
| 1430 | * screenState = CREATE_CHECKBOXES; |
||
| 1431 | * } |
||
| 1432 | * // Process by default |
||
| 1433 | * return 1; |
||
| 1434 | * case ID_BUTTON_BACK: |
||
| 1435 | * return 1; |
||
| 1436 | * default: |
||
| 1437 | * return 1; |
||
| 1438 | * } |
||
| 1439 | * } |
||
| 1440 | * </CODE> |
||
| 1441 | * |
||
| 1442 | * Side Effects: none |
||
| 1443 | * |
||
| 1444 | ********************************************************************/ |
||
| 1445 | WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg); |
||
| 1446 | |||
| 1447 | /********************************************************************* |
||
| 1448 | * Function: WORD GOLDrawCallback() |
||
| 1449 | * |
||
| 1450 | * Overview: GOLDrawCallback() function MUST BE implemented by |
||
| 1451 | * the user. This is called inside the GOLDraw() |
||
| 1452 | * function when the drawing of objects in the active |
||
| 1453 | * list is completed. User drawing must be done here. |
||
| 1454 | * Drawing color, line type, clipping region, graphic |
||
| 1455 | * cursor position and current font will not be changed |
||
| 1456 | * by GOL if this function returns a zero. To pass |
||
| 1457 | * drawing control to GOL this function must return |
||
| 1458 | * a non-zero value. If GOL messaging is not using |
||
| 1459 | * the active link list, it is safe to modify the |
||
| 1460 | * list here. |
||
| 1461 | * |
||
| 1462 | * PreCondition: none |
||
| 1463 | * |
||
| 1464 | * Input: none |
||
| 1465 | * |
||
| 1466 | * Output: Return a one if GOLDraw() will have drawing control |
||
| 1467 | * on the active list. Return a zero if user wants to |
||
| 1468 | * keep the drawing control. |
||
| 1469 | * |
||
| 1470 | * Example: |
||
| 1471 | * <CODE> |
||
| 1472 | * #define SIG_STATE_SET 0 |
||
| 1473 | * #define SIG_STATE_DRAW 1 |
||
| 1474 | * WORD GOLDrawCallback(){ |
||
| 1475 | * static BYTE state = SIG_STATE_SET; |
||
| 1476 | * if(state == SIG_STATE_SET){ |
||
| 1477 | * // Draw the button with disabled colors |
||
| 1478 | * GOLPanelDraw(SIG_PANEL_LEFT,SIG_PANEL_TOP, |
||
| 1479 | * SIG_PANEL_RIGHT,SIG_PANEL_BOTTOM, 0, |
||
| 1480 | * WHITE, altScheme->EmbossLtColor, |
||
| 1481 | * altScheme->EmbossDkColor, |
||
| 1482 | * NULL, GOL_EMBOSS_SIZE); |
||
| 1483 | * |
||
| 1484 | * state = SIG_STATE_DRAW; |
||
| 1485 | * } |
||
| 1486 | * |
||
| 1487 | * if(!GOLPanelDrawTsk()){ |
||
| 1488 | * // do not return drawing control to GOL |
||
| 1489 | * // drawing is not complete |
||
| 1490 | * return 0; |
||
| 1491 | * }else{ |
||
| 1492 | * state = SIG_STATE_SET; |
||
| 1493 | * // return drawing control to GOL, drawing is complete |
||
| 1494 | * return 1; |
||
| 1495 | * } |
||
| 1496 | * } |
||
| 1497 | * </CODE> |
||
| 1498 | * |
||
| 1499 | * Side Effects: none |
||
| 1500 | * |
||
| 1501 | ********************************************************************/ |
||
| 1502 | WORD GOLDrawCallback(void); |
||
| 1503 | |||
| 1504 | /********************************************************************* |
||
| 1505 | * Variables for rounded panel drawing. Used by GOLRndPanelDraw and GOLRndPanelDrawTsk |
||
| 1506 | ********************************************************************/ |
||
| 1507 | extern SHORT _rpnlX1; // Panel center x position of upper left corner |
||
| 1508 | extern SHORT _rpnlY1; // Panel center y position of upper left corner |
||
| 1509 | extern SHORT _rpnlX2; // Panel center x position of lower right corner |
||
| 1510 | extern SHORT _rpnlY2; // Panel center y position of lower right corner |
||
| 1511 | extern SHORT _rpnlR; // radius (defines the rounded corner size) |
||
| 1512 | extern WORD _rpnlFaceColor; // Panel face color |
||
| 1513 | extern WORD _rpnlEmbossLtColor; // Panel emboss light color |
||
| 1514 | extern WORD _rpnlEmbossDkColor; // Panel emboss dark color |
||
| 1515 | extern WORD _rpnlEmbossSize; // Size of panel emboss (Usually uses GOL_EMBOSS_SIZE but maybe different |
||
| 1516 | |||
| 1517 | // for some objects)emboss size |
||
| 1518 | extern void *_pRpnlBitmap; // Bitmap used in the panel |
||
| 1519 | |||
| 1520 | /********************************************************************* |
||
| 1521 | * Macros: GOLPanelDraw( left, top, right, bottom, |
||
| 1522 | * radius, |
||
| 1523 | * faceClr, |
||
| 1524 | * embossLtClr, embossDkClr, |
||
| 1525 | * pBitmap, |
||
| 1526 | * embossSize) |
||
| 1527 | * |
||
| 1528 | * Overview: This macro sets the parameters to draw a panel. |
||
| 1529 | * Panel is not an object. It will not be added to |
||
| 1530 | * the active list. Use GOLPanelDrawTsk() to display |
||
| 1531 | * the panel on the screen. |
||
| 1532 | * The following relationships of the parameters determines |
||
| 1533 | * the general shape of the button: |
||
| 1534 | * 1. Panel width is determined by right - left. |
||
| 1535 | * 2. Panel height is determined by top - bottom. |
||
| 1536 | * 3. Panel radius - specifies if the panel will have a rounded |
||
| 1537 | * edge. If zero then the panel will have |
||
| 1538 | * sharp (cornered) edge. |
||
| 1539 | * 4. If 2*radius = height = width, the panel is circular. |
||
| 1540 | * |
||
| 1541 | * PreCondition: none |
||
| 1542 | * |
||
| 1543 | * Input: left - Panel's left most position. |
||
| 1544 | * top - Panel's top most position. |
||
| 1545 | * right - Panel's right most position. |
||
| 1546 | * bottom - Panel's bottom most position. |
||
| 1547 | * radius - The radius of the rounded corner of the panel. |
||
| 1548 | * faceClr - Defines the face color of the panel. |
||
| 1549 | * embossLtClr - Defines the emboss light color. |
||
| 1550 | * embossDkClr - Defines the emboss dark color. |
||
| 1551 | * pBitmap - Defines the bitmap used in the face of the panel. |
||
| 1552 | * embossSize - Defines the emboss size of the panel. |
||
| 1553 | * |
||
| 1554 | * Output: none |
||
| 1555 | * |
||
| 1556 | * Example: |
||
| 1557 | * <CODE> |
||
| 1558 | * // Dimensions for signature box |
||
| 1559 | * #define SIG_PANEL_LEFT 10 |
||
| 1560 | * #define SIG_PANEL_RIGHT 310 |
||
| 1561 | * #define SIG_PANEL_TOP 50 |
||
| 1562 | * #define SIG_PANEL_BOTTOM 170 |
||
| 1563 | * |
||
| 1564 | * #define SIG_STATE_SET 0 |
||
| 1565 | * #define SIG_STATE_DRAW 1 |
||
| 1566 | * |
||
| 1567 | * GOL_SCHEME *altScheme; // style scheme |
||
| 1568 | * |
||
| 1569 | * // Draws box for signature |
||
| 1570 | * WORD PanelSignature() { |
||
| 1571 | * static BYTE state = SIG_STATE_SET; |
||
| 1572 | * |
||
| 1573 | * if(state == SIG_STATE_SET){ |
||
| 1574 | * // set data for panel drawing (radius = 0) |
||
| 1575 | * // assume altScheme is defined |
||
| 1576 | * GOLPanelDraw(SIG_PANEL_LEFT,SIG_PANEL_TOP, |
||
| 1577 | * SIG_PANEL_RIGHT,SIG_PANEL_BOTTOM,0, |
||
| 1578 | * WHITE, |
||
| 1579 | * altScheme->EmbossLtColor, |
||
| 1580 | * altScheme->EmbossDkColor, |
||
| 1581 | * NULL, GOL_EMBOSS_SIZE); |
||
| 1582 | * |
||
| 1583 | * state = SIG_STATE_DRAW; // change state |
||
| 1584 | * } |
||
| 1585 | * |
||
| 1586 | * if(!GOLPanelDrawTsk()) |
||
| 1587 | * return 0; // drawing is not completed |
||
| 1588 | * } else { |
||
| 1589 | * state = SIG_STATE_SET; // set state to initial |
||
| 1590 | * return 1; // drawing is done |
||
| 1591 | * } |
||
| 1592 | * } |
||
| 1593 | * </CODE> |
||
| 1594 | * |
||
| 1595 | * Side Effects: none |
||
| 1596 | * |
||
| 1597 | ********************************************************************/ |
||
| 1598 | #define GOLPanelDraw(left, top, right, bottom, radius, faceClr, embossLtClr, embossDkClr, pBitmap, embossSize) \ |
||
| 1599 | _rpnlX1 = left; \ |
||
| 1600 | _rpnlY1 = top; \ |
||
| 1601 | _rpnlX2 = right; \ |
||
| 1602 | _rpnlY2 = bottom; \ |
||
| 1603 | _rpnlR = radius; \ |
||
| 1604 | _rpnlFaceColor = faceClr; \ |
||
| 1605 | _rpnlEmbossLtColor = embossLtClr; \ |
||
| 1606 | _rpnlEmbossDkColor = embossDkClr; \ |
||
| 1607 | _pRpnlBitmap = pBitmap; \ |
||
| 1608 | _rpnlEmbossSize = embossSize; |
||
| 1609 | |||
| 1610 | /********************************************************************* |
||
| 1611 | * Function: WORD GOLPanelDrawTsk() |
||
| 1612 | * |
||
| 1613 | * Overview: This function draws a panel on the screen with parameters |
||
| 1614 | * set by GOLPanelDraw() macro. This function must be called |
||
| 1615 | * repeatedly (depending on the return value) for a successful |
||
| 1616 | * rendering of the panel. |
||
| 1617 | * |
||
| 1618 | * PreCondition: Parameters of the panel must be set by GOLPanelDraw() macro. |
||
| 1619 | * |
||
| 1620 | * Input: none |
||
| 1621 | * |
||
| 1622 | * Output: Returns the status of the panel rendering |
||
| 1623 | * <CODE> |
||
| 1624 | * 0 Rendering of the panel is not yet finished. |
||
| 1625 | * 1 Rendering of the panel is finished. |
||
| 1626 | * </CODE> |
||
| 1627 | * |
||
| 1628 | * Example: |
||
| 1629 | * See GOLPanelDraw() example. |
||
| 1630 | * |
||
| 1631 | * Side Effects: none |
||
| 1632 | * |
||
| 1633 | ********************************************************************/ |
||
| 1634 | WORD GOLPanelDrawTsk(void); |
||
| 1635 | |||
| 1636 | /********************************************************************* |
||
| 1637 | * Function: WORD GOLTwoTonePanelDrawTsk() |
||
| 1638 | * |
||
| 1639 | * Overview: This function draws a two tone panel on the screen with parameters |
||
| 1640 | * set by GOLPanelDraw() macro. This function must be called |
||
| 1641 | * repeatedly (depending on the return value) for a successful |
||
| 1642 | * rendering of the panel. |
||
| 1643 | * |
||
| 1644 | * PreCondition: Parameters of the panel must be set by GOLPanelDraw() macro. |
||
| 1645 | * |
||
| 1646 | * Input: none |
||
| 1647 | * |
||
| 1648 | * Output: Returns the status of the panel rendering |
||
| 1649 | * <CODE> |
||
| 1650 | * 0 Rendering of the panel is not yet finished. |
||
| 1651 | * 1 Rendering of the panel is finished. |
||
| 1652 | * </CODE> |
||
| 1653 | * |
||
| 1654 | * Example: |
||
| 1655 | * Usage is similar to GOLPanelDraw() example. |
||
| 1656 | * |
||
| 1657 | * Side Effects: none |
||
| 1658 | * |
||
| 1659 | ********************************************************************/ |
||
| 1660 | WORD GOLTwoTonePanelDrawTsk(void); |
||
| 1661 | |||
| 1662 | #endif // _GOL_H |
Powered by WebSVN v2.8.3