Microcontroller GUI library from embeddedlightning.com

Dependents:   Bicycl_Computer_NUCLEO-F411RE Bicycl_Computer_NUCLEO-L476RG

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ugui.h Source File

ugui.h

00001 /* -------------------------------------------------------------------------------- */
00002 /* -- µGUI - Generic GUI module (C)Achim Döbler, 2015                            -- */
00003 /* -------------------------------------------------------------------------------- */
00004 // µGUI is a generic GUI module for embedded systems.
00005 // This is a free software that is open for education, research and commercial
00006 // developments under license policy of following terms.
00007 //
00008 //  Copyright (C) 2015, Achim Döbler, all rights reserved.
00009 //  URL: http://www.embeddedlightning.com/
00010 //  URL: https://github.com/achimdoebler/UGUI
00011 //
00012 //
00013 // * The µGUI module is a free software and there is NO WARRANTY.
00014 // * No restriction on use. You can use, modify and redistribute it for
00015 //   personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
00016 // * Redistributions of source code must retain the above copyright notice.
00017 //
00018 /* -------------------------------------------------------------------------------- */
00019 #ifndef __UGUI_H
00020 #define __UGUI_H
00021 
00022 #include "mbed.h"
00023 #include "ugui_config.h"
00024 
00025 
00026 /* -------------------------------------------------------------------------------- */
00027 /* -- µGUI FONTS                                                                 -- */
00028 /* -- Source: http://www.mikrocontroller.net/user/show/benedikt                  -- */
00029 /* -------------------------------------------------------------------------------- */
00030 typedef enum
00031 {
00032     FONT_TYPE_1BPP,
00033     FONT_TYPE_8BPP
00034 } FONT_TYPE;
00035 
00036 typedef struct
00037 {
00038    unsigned char* p;
00039    FONT_TYPE font_type;
00040    UG_S16 char_width;
00041    UG_S16 char_height;
00042    UG_U16 start_char;
00043    UG_U16 end_char;
00044    UG_U8  *widths;
00045 } UG_FONT;
00046 
00047 #ifdef USE_FONT_4X6
00048    extern const UG_FONT FONT_4X6;
00049 #endif
00050 #ifdef USE_FONT_5X8
00051    extern const UG_FONT FONT_5X8;
00052 #endif
00053 #ifdef USE_FONT_5X12
00054    extern const UG_FONT FONT_5X12;
00055 #endif
00056 #ifdef USE_FONT_6X8
00057    extern const UG_FONT FONT_6X8;
00058 #endif
00059 #ifdef USE_FONT_6X10
00060    extern const UG_FONT FONT_6X10;
00061 #endif
00062 #ifdef USE_FONT_7X12
00063    extern const UG_FONT FONT_7X12;
00064 #endif
00065 #ifdef USE_FONT_8X8
00066    extern const UG_FONT FONT_8X8;
00067 #endif
00068 #ifdef USE_FONT_8X12
00069    extern const UG_FONT FONT_8X12;
00070 #endif
00071 #ifdef USE_FONT_8X14
00072    extern const UG_FONT FONT_8X14;
00073 #endif
00074 #ifdef USE_FONT_10X16
00075    extern const UG_FONT FONT_10X16;
00076 #endif
00077 #ifdef USE_FONT_12X16
00078    extern const UG_FONT FONT_12X16;
00079 #endif
00080 #ifdef USE_FONT_12X20
00081    extern const UG_FONT FONT_12X20;
00082 #endif
00083 #ifdef USE_FONT_16X26
00084    extern const UG_FONT FONT_16X26;
00085 #endif
00086 #ifdef USE_FONT_22X36
00087    extern const UG_FONT FONT_22X36;
00088 #endif
00089 #ifdef USE_FONT_24X40
00090    extern const UG_FONT FONT_24X40;
00091 #endif
00092 #ifdef USE_FONT_32X53
00093    extern const UG_FONT FONT_32X53;
00094 #endif
00095 
00096 /* -------------------------------------------------------------------------------- */
00097 /* -- TYPEDEFS                                                                   -- */
00098 /* -------------------------------------------------------------------------------- */
00099 typedef struct S_OBJECT                               UG_OBJECT;
00100 typedef struct S_WINDOW                               UG_WINDOW;
00101 typedef UG_S8                                         UG_RESULT;
00102 typedef UG_U32                                        UG_COLOR;
00103 /* -------------------------------------------------------------------------------- */
00104 /* -- DEFINES                                                                    -- */
00105 /* -------------------------------------------------------------------------------- */
00106 #ifndef NULL
00107    #define NULL ((void*) 0)
00108 #endif
00109 
00110 /* Alignments */
00111 #define ALIGN_H_LEFT                                  (1<<0)
00112 #define ALIGN_H_CENTER                                (1<<1)
00113 #define ALIGN_H_RIGHT                                 (1<<2)
00114 #define ALIGN_V_TOP                                   (1<<3)
00115 #define ALIGN_V_CENTER                                (1<<4)
00116 #define ALIGN_V_BOTTOM                                (1<<5)
00117 #define ALIGN_BOTTOM_RIGHT                            (ALIGN_V_BOTTOM|ALIGN_H_RIGHT)
00118 #define ALIGN_BOTTOM_CENTER                           (ALIGN_V_BOTTOM|ALIGN_H_CENTER)
00119 #define ALIGN_BOTTOM_LEFT                             (ALIGN_V_BOTTOM|ALIGN_H_LEFT)
00120 #define ALIGN_CENTER_RIGHT                            (ALIGN_V_CENTER|ALIGN_H_RIGHT)
00121 #define ALIGN_CENTER                                  (ALIGN_V_CENTER|ALIGN_H_CENTER)
00122 #define ALIGN_CENTER_LEFT                             (ALIGN_V_CENTER|ALIGN_H_LEFT)
00123 #define ALIGN_TOP_RIGHT                               (ALIGN_V_TOP|ALIGN_H_RIGHT)
00124 #define ALIGN_TOP_CENTER                              (ALIGN_V_TOP|ALIGN_H_CENTER)
00125 #define ALIGN_TOP_LEFT                                (ALIGN_V_TOP|ALIGN_H_LEFT)
00126 
00127 /* Default IDs */
00128 #define OBJ_ID_0                                      0
00129 #define OBJ_ID_1                                      1
00130 #define OBJ_ID_2                                      2
00131 #define OBJ_ID_3                                      3
00132 #define OBJ_ID_4                                      4
00133 #define OBJ_ID_5                                      5
00134 #define OBJ_ID_6                                      6
00135 #define OBJ_ID_7                                      7
00136 #define OBJ_ID_8                                      8
00137 #define OBJ_ID_9                                      9
00138 #define OBJ_ID_10                                     10
00139 #define OBJ_ID_11                                     11
00140 #define OBJ_ID_12                                     12
00141 #define OBJ_ID_13                                     13
00142 #define OBJ_ID_14                                     14
00143 #define OBJ_ID_15                                     15
00144 #define OBJ_ID_16                                     16
00145 #define OBJ_ID_17                                     17
00146 #define OBJ_ID_18                                     18
00147 #define OBJ_ID_19                                     19
00148 
00149 /* -------------------------------------------------------------------------------- */
00150 /* -- FUNCTION RESULTS                                                           -- */
00151 /* -------------------------------------------------------------------------------- */
00152 #define UG_RESULT_FAIL                               -1
00153 #define UG_RESULT_OK                                  0
00154 
00155 /* -------------------------------------------------------------------------------- */
00156 /* -- UNIVERSAL STRUCTURES                                                       -- */
00157 /* -------------------------------------------------------------------------------- */
00158 /* Area structure */
00159 typedef struct
00160 {
00161    UG_S16 xs;
00162    UG_S16 ys;
00163    UG_S16 xe;
00164    UG_S16 ye;
00165 } UG_AREA;
00166 
00167 /* Text structure */
00168 typedef struct
00169 {
00170    char* str;
00171    const UG_FONT* font;
00172    UG_AREA a;
00173    UG_COLOR fc;
00174    UG_COLOR bc;
00175    UG_U8 align;
00176    UG_S16 h_space;
00177    UG_S16 v_space;
00178 } UG_TEXT;
00179 
00180 /* -------------------------------------------------------------------------------- */
00181 /* -- BITMAP                                                                     -- */
00182 /* -------------------------------------------------------------------------------- */
00183 typedef struct
00184 {
00185    void* p;
00186    UG_U16 width;
00187    UG_U16 height;
00188    UG_U8 bpp;
00189    UG_U8 colors;
00190 } UG_BMP;
00191 
00192 #define BMP_BPP_1                                     (1<<0)
00193 #define BMP_BPP_2                                     (1<<1)
00194 #define BMP_BPP_4                                     (1<<2)
00195 #define BMP_BPP_8                                     (1<<3)
00196 #define BMP_BPP_16                                    (1<<4)
00197 #define BMP_BPP_32                                    (1<<5)
00198 #define BMP_RGB888                                    (1<<0)
00199 #define BMP_RGB565                                    (1<<1)
00200 #define BMP_RGB555                                    (1<<2)
00201 
00202 /* -------------------------------------------------------------------------------- */
00203 /* -- MESSAGE                                                                    -- */
00204 /* -------------------------------------------------------------------------------- */
00205 /* Message structure */
00206 typedef struct
00207 {
00208    UG_U8 type;
00209    UG_U8 id;
00210    UG_U8 sub_id;
00211    UG_U8 event;
00212    void* src;
00213 } UG_MESSAGE;
00214 
00215 /* Message types */
00216 #define MSG_TYPE_NONE                                 0
00217 #define MSG_TYPE_WINDOW                               1
00218 #define MSG_TYPE_OBJECT                               2
00219 
00220 /* -------------------------------------------------------------------------------- */
00221 /* -- TOUCH                                                                      -- */
00222 /* -------------------------------------------------------------------------------- */
00223 /* Touch structure */
00224 typedef struct
00225 {
00226    UG_U8 state;
00227    UG_S16 xp;
00228    UG_S16 yp;
00229 } UG_TOUCH;
00230 
00231 
00232 #define TOUCH_STATE_PRESSED                           1
00233 #define TOUCH_STATE_RELEASED                          0
00234 
00235 /* -------------------------------------------------------------------------------- */
00236 /* -- OBJECTS                                                                    -- */
00237 /* -------------------------------------------------------------------------------- */
00238 /* Object structure */
00239 struct S_OBJECT
00240 {
00241    UG_U8 state;                              /* object state                               */
00242    UG_U8 touch_state;                        /* object touch state                         */
00243    void (*update) (UG_WINDOW*,UG_OBJECT*);   /* pointer to object-specific update function */
00244    UG_AREA a_abs;                            /* absolute area of the object                */
00245    UG_AREA a_rel;                            /* relative area of the object                */
00246    UG_U8 type;                               /* object type                                */
00247    UG_U8 id;                                 /* object ID                                  */
00248    UG_U8 event;                              /* object-specific events                     */
00249    void* data;                               /* pointer to object-specific data            */
00250 };
00251 
00252 /* Currently supported objects */
00253 #define OBJ_TYPE_NONE                                 0
00254 #define OBJ_TYPE_BUTTON                               1
00255 #define OBJ_TYPE_TEXTBOX                              2
00256 #define OBJ_TYPE_IMAGE                                3
00257 
00258 /* Standard object events */
00259 #define OBJ_EVENT_NONE                                0
00260 #define OBJ_EVENT_CLICKED                             1
00261 #ifdef USE_PRERENDER_EVENT
00262 #define OBJ_EVENT_PRERENDER                           2
00263 #endif
00264 #ifdef USE_POSTRENDER_EVENT
00265 #define OBJ_EVENT_POSTRENDER                          3
00266 #endif
00267 #define OBJ_EVENT_PRESSED                             4
00268 #define OBJ_EVENT_RELEASED                            5
00269 
00270 
00271 /* Object states */
00272 #define OBJ_STATE_FREE                                (1<<0)
00273 #define OBJ_STATE_VALID                               (1<<1)
00274 #define OBJ_STATE_BUSY                                (1<<2)
00275 #define OBJ_STATE_VISIBLE                             (1<<3)
00276 #define OBJ_STATE_ENABLE                              (1<<4)
00277 #define OBJ_STATE_UPDATE                              (1<<5)
00278 #define OBJ_STATE_REDRAW                              (1<<6)
00279 #define OBJ_STATE_TOUCH_ENABLE                        (1<<7)
00280 #define OBJ_STATE_INIT                                (OBJ_STATE_FREE | OBJ_STATE_VALID)
00281 
00282 /* Object touch states */
00283 #define OBJ_TOUCH_STATE_CHANGED                       (1<<0)
00284 #define OBJ_TOUCH_STATE_PRESSED_ON_OBJECT             (1<<1)
00285 #define OBJ_TOUCH_STATE_PRESSED_OUTSIDE_OBJECT        (1<<2)
00286 #define OBJ_TOUCH_STATE_RELEASED_ON_OBJECT            (1<<3)
00287 #define OBJ_TOUCH_STATE_RELEASED_OUTSIDE_OBJECT       (1<<4)
00288 #define OBJ_TOUCH_STATE_IS_PRESSED_ON_OBJECT          (1<<5)
00289 #define OBJ_TOUCH_STATE_IS_PRESSED                    (1<<6)
00290 #define OBJ_TOUCH_STATE_CLICK_ON_OBJECT               (1<<7)
00291 #define OBJ_TOUCH_STATE_INIT                          0
00292 
00293 /* -------------------------------------------------------------------------------- */
00294 /* -- WINDOW                                                                     -- */
00295 /* -------------------------------------------------------------------------------- */
00296 /* Title structure */
00297 typedef struct
00298 {
00299    char* str;
00300    const UG_FONT* font;
00301    UG_S8 h_space;
00302    UG_S8 v_space;
00303    UG_U8 align;
00304    UG_COLOR fc;
00305    UG_COLOR bc;
00306    UG_COLOR ifc;
00307    UG_COLOR ibc;
00308    UG_U8 height;
00309 } UG_TITLE;
00310 
00311 /* Window structure */
00312 struct S_WINDOW
00313 {
00314    UG_U8 objcnt;
00315    UG_OBJECT* objlst;
00316    UG_U8 state;
00317    UG_COLOR fc;
00318    UG_COLOR bc;
00319    UG_S16 xs;
00320    UG_S16 ys;
00321    UG_S16 xe;
00322    UG_S16 ye;
00323    UG_U8 style;
00324    UG_TITLE title;
00325    void (*cb)( UG_MESSAGE* );
00326 };
00327 
00328 /* Window states */
00329 #define WND_STATE_FREE                                (1<<0)
00330 #define WND_STATE_VALID                               (1<<1)
00331 #define WND_STATE_BUSY                                (1<<2)
00332 #define WND_STATE_VISIBLE                             (1<<3)
00333 #define WND_STATE_ENABLE                              (1<<4)
00334 #define WND_STATE_UPDATE                              (1<<5)
00335 #define WND_STATE_REDRAW_TITLE                        (1<<6)
00336 
00337 /* Window styles */
00338 #define WND_STYLE_2D                                  (0<<0)
00339 #define WND_STYLE_3D                                  (1<<0)
00340 #define WND_STYLE_HIDE_TITLE                          (0<<1)
00341 #define WND_STYLE_SHOW_TITLE                          (1<<1)
00342 
00343 /* -------------------------------------------------------------------------------- */
00344 /* -- BUTTON OBJECT                                                              -- */
00345 /* -------------------------------------------------------------------------------- */
00346 /* Button structure */
00347 typedef struct
00348 {
00349    UG_U8 state;
00350    UG_U8 style;
00351    UG_COLOR fc;
00352    UG_COLOR bc;
00353    UG_COLOR afc;
00354    UG_COLOR abc;
00355    const UG_FONT* font;
00356    UG_U8 align;
00357    UG_S8 h_space;
00358    UG_S8 v_space;
00359    char* str;
00360 }UG_BUTTON;
00361 
00362 /* Default button IDs */
00363 #define BTN_ID_0                                      OBJ_ID_0
00364 #define BTN_ID_1                                      OBJ_ID_1
00365 #define BTN_ID_2                                      OBJ_ID_2
00366 #define BTN_ID_3                                      OBJ_ID_3
00367 #define BTN_ID_4                                      OBJ_ID_4
00368 #define BTN_ID_5                                      OBJ_ID_5
00369 #define BTN_ID_6                                      OBJ_ID_6
00370 #define BTN_ID_7                                      OBJ_ID_7
00371 #define BTN_ID_8                                      OBJ_ID_8
00372 #define BTN_ID_9                                      OBJ_ID_9
00373 #define BTN_ID_10                                     OBJ_ID_10
00374 #define BTN_ID_11                                     OBJ_ID_11
00375 #define BTN_ID_12                                     OBJ_ID_12
00376 #define BTN_ID_13                                     OBJ_ID_13
00377 #define BTN_ID_14                                     OBJ_ID_14
00378 #define BTN_ID_15                                     OBJ_ID_15
00379 #define BTN_ID_16                                     OBJ_ID_16
00380 #define BTN_ID_17                                     OBJ_ID_17
00381 #define BTN_ID_18                                     OBJ_ID_18
00382 #define BTN_ID_19                                     OBJ_ID_19
00383 
00384 /* Button states */
00385 #define BTN_STATE_RELEASED                            (0<<0)
00386 #define BTN_STATE_PRESSED                             (1<<0)
00387 #define BTN_STATE_ALWAYS_REDRAW                       (1<<1)
00388 
00389 /* Button style */
00390 #define BTN_STYLE_2D                                  (0<<0)
00391 #define BTN_STYLE_3D                                  (1<<0)
00392 #define BTN_STYLE_TOGGLE_COLORS                       (1<<1)
00393 #define BTN_STYLE_USE_ALTERNATE_COLORS                (1<<2)
00394 #define BTN_STYLE_NO_BORDERS                          (1<<3)
00395 #define BTN_STYLE_NO_FILL                             (1<<4)
00396 
00397 /* Button events */
00398 #define BTN_EVENT_CLICKED                             OBJ_EVENT_CLICKED
00399 
00400 /* -------------------------------------------------------------------------------- */
00401 /* -- TEXTBOX OBJECT                                                             -- */
00402 /* -------------------------------------------------------------------------------- */
00403 /* Textbox structure */
00404 typedef struct
00405 {
00406    char* str;
00407    const UG_FONT* font;
00408    UG_U8 style;
00409    UG_COLOR fc;
00410    UG_COLOR bc;
00411    UG_U8 align;
00412    UG_S8 h_space;
00413    UG_S8 v_space;
00414 } UG_TEXTBOX;
00415 
00416 /* Default textbox IDs */
00417 #define TXB_ID_0                                      OBJ_ID_0
00418 #define TXB_ID_1                                      OBJ_ID_1
00419 #define TXB_ID_2                                      OBJ_ID_2
00420 #define TXB_ID_3                                      OBJ_ID_3
00421 #define TXB_ID_4                                      OBJ_ID_4
00422 #define TXB_ID_5                                      OBJ_ID_5
00423 #define TXB_ID_6                                      OBJ_ID_6
00424 #define TXB_ID_7                                      OBJ_ID_7
00425 #define TXB_ID_8                                      OBJ_ID_8
00426 #define TXB_ID_9                                      OBJ_ID_9
00427 #define TXB_ID_10                                     OBJ_ID_10
00428 #define TXB_ID_11                                     OBJ_ID_11
00429 #define TXB_ID_12                                     OBJ_ID_12
00430 #define TXB_ID_13                                     OBJ_ID_13
00431 #define TXB_ID_14                                     OBJ_ID_14
00432 #define TXB_ID_15                                     OBJ_ID_15
00433 #define TXB_ID_16                                     OBJ_ID_16
00434 #define TXB_ID_17                                     OBJ_ID_17
00435 #define TXB_ID_18                                     OBJ_ID_18
00436 #define TXB_ID_19                                     OBJ_ID_19
00437 
00438 /* -------------------------------------------------------------------------------- */
00439 /* -- IMAGE OBJECT                                                               -- */
00440 /* -------------------------------------------------------------------------------- */
00441 /* Image structure */
00442 typedef struct
00443 {
00444    void* img;
00445    UG_U8 type;
00446 } UG_IMAGE;
00447 
00448 /* Default image IDs */
00449 #define IMG_ID_0                                      OBJ_ID_0
00450 #define IMG_ID_1                                      OBJ_ID_1
00451 #define IMG_ID_2                                      OBJ_ID_2
00452 #define IMG_ID_3                                      OBJ_ID_3
00453 #define IMG_ID_4                                      OBJ_ID_4
00454 #define IMG_ID_5                                      OBJ_ID_5
00455 #define IMG_ID_6                                      OBJ_ID_6
00456 #define IMG_ID_7                                      OBJ_ID_7
00457 #define IMG_ID_8                                      OBJ_ID_8
00458 #define IMG_ID_9                                      OBJ_ID_9
00459 #define IMG_ID_10                                     OBJ_ID_10
00460 #define IMG_ID_11                                     OBJ_ID_11
00461 #define IMG_ID_12                                     OBJ_ID_12
00462 #define IMG_ID_13                                     OBJ_ID_13
00463 #define IMG_ID_14                                     OBJ_ID_14
00464 #define IMG_ID_15                                     OBJ_ID_15
00465 #define IMG_ID_16                                     OBJ_ID_16
00466 #define IMG_ID_17                                     OBJ_ID_17
00467 #define IMG_ID_18                                     OBJ_ID_18
00468 #define IMG_ID_19                                     OBJ_ID_19
00469 
00470 /* Image types */
00471 #define IMG_TYPE_BMP                                  (1<<0)
00472 
00473 /* -------------------------------------------------------------------------------- */
00474 /* -- µGUI DRIVER                                                                -- */
00475 /* -------------------------------------------------------------------------------- */
00476 typedef struct
00477 {
00478   void* driver;
00479   UG_U8 state;
00480 } UG_DRIVER;
00481 
00482 #define DRIVER_REGISTERED                             (1<<0)
00483 #define DRIVER_ENABLED                                (1<<1)
00484 
00485 /* Supported drivers */
00486 #define NUMBER_OF_DRIVERS                             3
00487 #define DRIVER_DRAW_LINE                              0
00488 #define DRIVER_FILL_FRAME                             1
00489 #define DRIVER_FILL_AREA                              2
00490 
00491 /* -------------------------------------------------------------------------------- */
00492 /* -- µGUI CORE STRUCTURE                                                        -- */
00493 /* -------------------------------------------------------------------------------- */
00494 typedef struct
00495 {
00496    void (*pset)(UG_S16,UG_S16,UG_COLOR);
00497    UG_S16 x_dim;
00498    UG_S16 y_dim;
00499    UG_TOUCH touch;
00500    UG_WINDOW* next_window;
00501    UG_WINDOW* active_window;
00502    UG_WINDOW* last_window;
00503    struct
00504    {
00505       UG_S16 x_pos;
00506       UG_S16 y_pos;
00507       UG_S16 x_start;
00508       UG_S16 y_start;
00509       UG_S16 x_end;
00510       UG_S16 y_end;
00511       UG_COLOR fore_color;
00512       UG_COLOR back_color;
00513    } console;
00514    UG_FONT font;
00515    UG_S8 char_h_space;
00516    UG_S8 char_v_space;
00517    UG_COLOR fore_color;
00518    UG_COLOR back_color;
00519    UG_COLOR desktop_color;
00520    UG_U8 state;
00521    UG_DRIVER driver[NUMBER_OF_DRIVERS];
00522 } UG_GUI;
00523 
00524 #define UG_SATUS_WAIT_FOR_UPDATE                      (1<<0)
00525 
00526 /* -------------------------------------------------------------------------------- */
00527 /* -- µGUI COLORS                                                                -- */
00528 /* -- Source: http://www.rapidtables.com/web/color/RGB_Color.htm                 -- */
00529 /* -------------------------------------------------------------------------------- */
00530 #define  C_MAROON                     0x800000
00531 #define  C_DARK_RED                   0x8B0000
00532 #define  C_BROWN                      0xA52A2A
00533 #define  C_FIREBRICK                  0xB22222
00534 #define  C_CRIMSON                    0xDC143C
00535 #define  C_RED                        0xFF0000
00536 #define  C_TOMATO                     0xFF6347
00537 #define  C_CORAL                      0xFF7F50
00538 #define  C_INDIAN_RED                 0xCD5C5C
00539 #define  C_LIGHT_CORAL                0xF08080
00540 #define  C_DARK_SALMON                0xE9967A
00541 #define  C_SALMON                     0xFA8072
00542 #define  C_LIGHT_SALMON               0xFFA07A
00543 #define  C_ORANGE_RED                 0xFF4500
00544 #define  C_DARK_ORANGE                0xFF8C00
00545 #define  C_ORANGE                     0xFFA500
00546 #define  C_GOLD                       0xFFD700
00547 #define  C_DARK_GOLDEN_ROD            0xB8860B
00548 #define  C_GOLDEN_ROD                 0xDAA520
00549 #define  C_PALE_GOLDEN_ROD            0xEEE8AA
00550 #define  C_DARK_KHAKI                 0xBDB76B
00551 #define  C_KHAKI                      0xF0E68C
00552 #define  C_OLIVE                      0x808000
00553 #define  C_YELLOW                     0xFFFF00
00554 #define  C_YELLOW_GREEN               0x9ACD32
00555 #define  C_DARK_OLIVE_GREEN           0x556B2F
00556 #define  C_OLIVE_DRAB                 0x6B8E23
00557 #define  C_LAWN_GREEN                 0x7CFC00
00558 #define  C_CHART_REUSE                0x7FFF00
00559 #define  C_GREEN_YELLOW               0xADFF2F
00560 #define  C_DARK_GREEN                 0x006400
00561 #define  C_GREEN                      0x00FF00
00562 #define  C_FOREST_GREEN               0x228B22
00563 #define  C_LIME                       0x00FF00
00564 #define  C_LIME_GREEN                 0x32CD32
00565 #define  C_LIGHT_GREEN                0x90EE90
00566 #define  C_PALE_GREEN                 0x98FB98
00567 #define  C_DARK_SEA_GREEN             0x8FBC8F
00568 #define  C_MEDIUM_SPRING_GREEN        0x00FA9A
00569 #define  C_SPRING_GREEN               0x00FF7F
00570 #define  C_SEA_GREEN                  0x2E8B57
00571 #define  C_MEDIUM_AQUA_MARINE         0x66CDAA
00572 #define  C_MEDIUM_SEA_GREEN           0x3CB371
00573 #define  C_LIGHT_SEA_GREEN            0x20B2AA
00574 #define  C_DARK_SLATE_GRAY            0x2F4F4F
00575 #define  C_TEAL                       0x008080
00576 #define  C_DARK_CYAN                  0x008B8B
00577 #define  C_AQUA                       0x00FFFF
00578 #define  C_CYAN                       0x00FFFF
00579 #define  C_LIGHT_CYAN                 0xE0FFFF
00580 #define  C_DARK_TURQUOISE             0x00CED1
00581 #define  C_TURQUOISE                  0x40E0D0
00582 #define  C_MEDIUM_TURQUOISE           0x48D1CC
00583 #define  C_PALE_TURQUOISE             0xAFEEEE
00584 #define  C_AQUA_MARINE                0x7FFFD4
00585 #define  C_POWDER_BLUE                0xB0E0E6
00586 #define  C_CADET_BLUE                 0x5F9EA0
00587 #define  C_STEEL_BLUE                 0x4682B4
00588 #define  C_CORN_FLOWER_BLUE           0x6495ED
00589 #define  C_DEEP_SKY_BLUE              0x00BFFF
00590 #define  C_DODGER_BLUE                0x1E90FF
00591 #define  C_LIGHT_BLUE                 0xADD8E6
00592 #define  C_SKY_BLUE                   0x87CEEB
00593 #define  C_LIGHT_SKY_BLUE             0x87CEFA
00594 #define  C_MIDNIGHT_BLUE              0x191970
00595 #define  C_NAVY                       0x000080
00596 #define  C_DARK_BLUE                  0x00008B
00597 #define  C_MEDIUM_BLUE                0x0000CD
00598 #define  C_BLUE                       0x0000FF
00599 #define  C_ROYAL_BLUE                 0x4169E1
00600 #define  C_BLUE_VIOLET                0x8A2BE2
00601 #define  C_INDIGO                     0x4B0082
00602 #define  C_DARK_SLATE_BLUE            0x483D8B
00603 #define  C_SLATE_BLUE                 0x6A5ACD
00604 #define  C_MEDIUM_SLATE_BLUE          0x7B68EE
00605 #define  C_MEDIUM_PURPLE              0x9370DB
00606 #define  C_DARK_MAGENTA               0x8B008B
00607 #define  C_DARK_VIOLET                0x9400D3
00608 #define  C_DARK_ORCHID                0x9932CC
00609 #define  C_MEDIUM_ORCHID              0xBA55D3
00610 #define  C_PURPLE                     0x800080
00611 #define  C_THISTLE                    0xD8BFD8
00612 #define  C_PLUM                       0xDDA0DD
00613 #define  C_VIOLET                     0xEE82EE
00614 #define  C_MAGENTA                    0xFF00FF
00615 #define  C_ORCHID                     0xDA70D6
00616 #define  C_MEDIUM_VIOLET_RED          0xC71585
00617 #define  C_PALE_VIOLET_RED            0xDB7093
00618 #define  C_DEEP_PINK                  0xFF1493
00619 #define  C_HOT_PINK                   0xFF69B4
00620 #define  C_LIGHT_PINK                 0xFFB6C1
00621 #define  C_PINK                       0xFFC0CB
00622 #define  C_ANTIQUE_WHITE              0xFAEBD7
00623 #define  C_BEIGE                      0xF5F5DC
00624 #define  C_BISQUE                     0xFFE4C4
00625 #define  C_BLANCHED_ALMOND            0xFFEBCD
00626 #define  C_WHEAT                      0xF5DEB3
00627 #define  C_CORN_SILK                  0xFFF8DC
00628 #define  C_LEMON_CHIFFON              0xFFFACD
00629 #define  C_LIGHT_GOLDEN_ROD_YELLOW    0xFAFAD2
00630 #define  C_LIGHT_YELLOW               0xFFFFE0
00631 #define  C_SADDLE_BROWN               0x8B4513
00632 #define  C_SIENNA                     0xA0522D
00633 #define  C_CHOCOLATE                  0xD2691E
00634 #define  C_PERU                       0xCD853F
00635 #define  C_SANDY_BROWN                0xF4A460
00636 #define  C_BURLY_WOOD                 0xDEB887
00637 #define  C_TAN                        0xD2B48C
00638 #define  C_ROSY_BROWN                 0xBC8F8F
00639 #define  C_MOCCASIN                   0xFFE4B5
00640 #define  C_NAVAJO_WHITE               0xFFDEAD
00641 #define  C_PEACH_PUFF                 0xFFDAB9
00642 #define  C_MISTY_ROSE                 0xFFE4E1
00643 #define  C_LAVENDER_BLUSH             0xFFF0F5
00644 #define  C_LINEN                      0xFAF0E6
00645 #define  C_OLD_LACE                   0xFDF5E6
00646 #define  C_PAPAYA_WHIP                0xFFEFD5
00647 #define  C_SEA_SHELL                  0xFFF5EE
00648 #define  C_MINT_CREAM                 0xF5FFFA
00649 #define  C_SLATE_GRAY                 0x708090
00650 #define  C_LIGHT_SLATE_GRAY           0x778899
00651 #define  C_LIGHT_STEEL_BLUE           0xB0C4DE
00652 #define  C_LAVENDER                   0xE6E6FA
00653 #define  C_FLORAL_WHITE               0xFFFAF0
00654 #define  C_ALICE_BLUE                 0xF0F8FF
00655 #define  C_GHOST_WHITE                0xF8F8FF
00656 #define  C_HONEYDEW                   0xF0FFF0
00657 #define  C_IVORY                      0xFFFFF0
00658 #define  C_AZURE                      0xF0FFFF
00659 #define  C_SNOW                       0xFFFAFA
00660 #define  C_BLACK                      0x000000
00661 #define  C_DIM_GRAY                   0x696969
00662 #define  C_GRAY                       0x808080
00663 #define  C_DARK_GRAY                  0xA9A9A9
00664 #define  C_SILVER                     0xC0C0C0
00665 #define  C_LIGHT_GRAY                 0xD3D3D3
00666 #define  C_GAINSBORO                  0xDCDCDC
00667 #define  C_WHITE_SMOKE                0xF5F5F5
00668 #define  C_WHITE                      0xFFFFFF
00669 
00670 /* -------------------------------------------------------------------------------- */
00671 /* -- PROTOTYPES                                                                 -- */
00672 /* -------------------------------------------------------------------------------- */
00673 /* Classic functions */
00674 UG_S16 UG_Init( UG_GUI* g, void (*p)(UG_S16,UG_S16,UG_COLOR), UG_S16 x, UG_S16 y );
00675 UG_S16 UG_SelectGUI( UG_GUI* g );
00676 void UG_FontSelect( const UG_FONT* font );
00677 void UG_FillScreen( UG_COLOR c );
00678 void UG_FillFrame( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c );
00679 void UG_FillRoundFrame( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_S16 r, UG_COLOR c );
00680 void UG_DrawMesh( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c );
00681 void UG_DrawFrame( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c );
00682 void UG_DrawRoundFrame( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_S16 r, UG_COLOR c );
00683 void UG_DrawPixel( UG_S16 x0, UG_S16 y0, UG_COLOR c );
00684 void UG_DrawCircle( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_COLOR c );
00685 void UG_FillCircle( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_COLOR c );
00686 void UG_DrawArc( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_U8 s, UG_COLOR c );
00687 void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c );
00688 void UG_PutString( UG_S16 x, UG_S16 y, char* str );
00689 void UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc );
00690 void UG_ConsolePutString( char* str );
00691 void UG_ConsoleSetArea( UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye );
00692 void UG_ConsoleSetForecolor( UG_COLOR c );
00693 void UG_ConsoleSetBackcolor( UG_COLOR c );
00694 void UG_SetForecolor( UG_COLOR c );
00695 void UG_SetBackcolor( UG_COLOR c );
00696 UG_S16 UG_GetXDim( void );
00697 UG_S16 UG_GetYDim( void );
00698 void UG_FontSetHSpace( UG_U16 s );
00699 void UG_FontSetVSpace( UG_U16 s );
00700 
00701 /* Miscellaneous functions */
00702 void UG_WaitForUpdate( void );
00703 void UG_Update( void );
00704 void UG_DrawBMP( UG_S16 xp, UG_S16 yp, UG_BMP* bmp );
00705 void UG_TouchUpdate( UG_S16 xp, UG_S16 yp, UG_U8 state );
00706 
00707 /* Driver functions */
00708 void UG_DriverRegister( UG_U8 type, void* driver );
00709 void UG_DriverEnable( UG_U8 type );
00710 void UG_DriverDisable( UG_U8 type );
00711 
00712 /* Window functions */
00713 UG_RESULT UG_WindowCreate( UG_WINDOW* wnd, UG_OBJECT* objlst, UG_U8 objcnt, void (*cb)( UG_MESSAGE* ) );
00714 UG_RESULT UG_WindowDelete( UG_WINDOW* wnd );
00715 UG_RESULT UG_WindowShow( UG_WINDOW* wnd );
00716 UG_RESULT UG_WindowHide( UG_WINDOW* wnd );
00717 UG_RESULT UG_WindowResize( UG_WINDOW* wnd, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye );
00718 UG_RESULT UG_WindowAlert( UG_WINDOW* wnd );
00719 UG_RESULT UG_WindowSetForeColor( UG_WINDOW* wnd, UG_COLOR fc );
00720 UG_RESULT UG_WindowSetBackColor( UG_WINDOW* wnd, UG_COLOR bc );
00721 UG_RESULT UG_WindowSetTitleTextColor( UG_WINDOW* wnd, UG_COLOR c );
00722 UG_RESULT UG_WindowSetTitleColor( UG_WINDOW* wnd, UG_COLOR c );
00723 UG_RESULT UG_WindowSetTitleInactiveTextColor( UG_WINDOW* wnd, UG_COLOR c );
00724 UG_RESULT UG_WindowSetTitleInactiveColor( UG_WINDOW* wnd, UG_COLOR c );
00725 UG_RESULT UG_WindowSetTitleText( UG_WINDOW* wnd, char* str );
00726 UG_RESULT UG_WindowSetTitleTextFont( UG_WINDOW* wnd, const UG_FONT* font );
00727 UG_RESULT UG_WindowSetTitleTextHSpace( UG_WINDOW* wnd, UG_S8 hs );
00728 UG_RESULT UG_WindowSetTitleTextVSpace( UG_WINDOW* wnd, UG_S8 vs );
00729 UG_RESULT UG_WindowSetTitleTextAlignment( UG_WINDOW* wnd, UG_U8 align );
00730 UG_RESULT UG_WindowSetTitleHeight( UG_WINDOW* wnd, UG_U8 height );
00731 UG_RESULT UG_WindowSetXStart( UG_WINDOW* wnd, UG_S16 xs );
00732 UG_RESULT UG_WindowSetYStart( UG_WINDOW* wnd, UG_S16 ys );
00733 UG_RESULT UG_WindowSetXEnd( UG_WINDOW* wnd, UG_S16 xe );
00734 UG_RESULT UG_WindowSetYEnd( UG_WINDOW* wnd, UG_S16 ye );
00735 UG_RESULT UG_WindowSetStyle( UG_WINDOW* wnd, UG_U8 style );
00736 UG_COLOR UG_WindowGetForeColor( UG_WINDOW* wnd );
00737 UG_COLOR UG_WindowGetBackColor( UG_WINDOW* wnd );
00738 UG_COLOR UG_WindowGetTitleTextColor( UG_WINDOW* wnd );
00739 UG_COLOR UG_WindowGetTitleColor( UG_WINDOW* wnd );
00740 UG_COLOR UG_WindowGetTitleInactiveTextColor( UG_WINDOW* wnd );
00741 UG_COLOR UG_WindowGetTitleInactiveColor( UG_WINDOW* wnd );
00742 char* UG_WindowGetTitleText( UG_WINDOW* wnd );
00743 UG_FONT* UG_WindowGetTitleTextFont( UG_WINDOW* wnd );
00744 UG_S8 UG_WindowGetTitleTextHSpace( UG_WINDOW* wnd );
00745 UG_S8 UG_WindowGetTitleTextVSpace( UG_WINDOW* wnd );
00746 UG_U8 UG_WindowGetTitleTextAlignment( UG_WINDOW* wnd );
00747 UG_U8 UG_WindowGetTitleHeight( UG_WINDOW* wnd );
00748 UG_S16 UG_WindowGetXStart( UG_WINDOW* wnd );
00749 UG_S16 UG_WindowGetYStart( UG_WINDOW* wnd );
00750 UG_S16 UG_WindowGetXEnd( UG_WINDOW* wnd );
00751 UG_S16 UG_WindowGetYEnd( UG_WINDOW* wnd );
00752 UG_U8 UG_WindowGetStyle( UG_WINDOW* wnd );
00753 UG_RESULT UG_WindowGetArea( UG_WINDOW* wnd, UG_AREA* a );
00754 UG_S16 UG_WindowGetInnerWidth( UG_WINDOW* wnd );
00755 UG_S16 UG_WindowGetOuterWidth( UG_WINDOW* wnd );
00756 UG_S16 UG_WindowGetInnerHeight( UG_WINDOW* wnd );
00757 UG_S16 UG_WindowGetOuterHeight( UG_WINDOW* wnd );
00758 
00759 /* Button functions */
00760 UG_RESULT UG_ButtonCreate( UG_WINDOW* wnd, UG_BUTTON* btn, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye );
00761 UG_RESULT UG_ButtonDelete( UG_WINDOW* wnd, UG_U8 id );
00762 UG_RESULT UG_ButtonShow( UG_WINDOW* wnd, UG_U8 id );
00763 UG_RESULT UG_ButtonHide( UG_WINDOW* wnd, UG_U8 id );
00764 UG_RESULT UG_ButtonSetForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR fc );
00765 UG_RESULT UG_ButtonSetBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR bc );
00766 UG_RESULT UG_ButtonSetAlternateForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR afc );
00767 UG_RESULT UG_ButtonSetAlternateBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR abc );
00768 UG_RESULT UG_ButtonSetText( UG_WINDOW* wnd, UG_U8 id, char* str );
00769 UG_RESULT UG_ButtonSetFont( UG_WINDOW* wnd, UG_U8 id, const UG_FONT* font );
00770 UG_RESULT UG_ButtonSetStyle( UG_WINDOW* wnd, UG_U8 id, UG_U8 style );
00771 UG_RESULT UG_ButtonSetHSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 hs );
00772 UG_RESULT UG_ButtonSetVSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 vs );
00773 UG_RESULT UG_ButtonSetAlignment( UG_WINDOW* wnd, UG_U8 id, UG_U8 align );
00774 UG_COLOR UG_ButtonGetForeColor( UG_WINDOW* wnd, UG_U8 id );
00775 UG_COLOR UG_ButtonGetBackColor( UG_WINDOW* wnd, UG_U8 id );
00776 UG_COLOR UG_ButtonGetAlternateForeColor( UG_WINDOW* wnd, UG_U8 id );
00777 UG_COLOR UG_ButtonGetAlternateBackColor( UG_WINDOW* wnd, UG_U8 id );
00778 char* UG_ButtonGetText( UG_WINDOW* wnd, UG_U8 id );
00779 UG_FONT* UG_ButtonGetFont( UG_WINDOW* wnd, UG_U8 id );
00780 UG_U8 UG_ButtonGetStyle( UG_WINDOW* wnd, UG_U8 id );
00781 UG_S8 UG_ButtonGetHSpace( UG_WINDOW* wnd, UG_U8 id );
00782 UG_S8 UG_ButtonGetVSpace( UG_WINDOW* wnd, UG_U8 id );
00783 UG_U8 UG_ButtonGetAlignment( UG_WINDOW* wnd, UG_U8 id );
00784 
00785 /* Textbox functions */
00786 UG_RESULT UG_TextboxCreate( UG_WINDOW* wnd, UG_TEXTBOX* txb, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye );
00787 UG_RESULT UG_TextboxDelete( UG_WINDOW* wnd, UG_U8 id );
00788 UG_RESULT UG_TextboxShow( UG_WINDOW* wnd, UG_U8 id );
00789 UG_RESULT UG_TextboxHide( UG_WINDOW* wnd, UG_U8 id );
00790 UG_RESULT UG_TextboxSetForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR fc );
00791 UG_RESULT UG_TextboxSetBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR bc );
00792 UG_RESULT UG_TextboxSetText( UG_WINDOW* wnd, UG_U8 id, char* str );
00793 UG_RESULT UG_TextboxSetFont( UG_WINDOW* wnd, UG_U8 id, const UG_FONT* font );
00794 UG_RESULT UG_TextboxSetHSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 hs );
00795 UG_RESULT UG_TextboxSetVSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 vs );
00796 UG_RESULT UG_TextboxSetAlignment( UG_WINDOW* wnd, UG_U8 id, UG_U8 align );
00797 UG_COLOR UG_TextboxGetForeColor( UG_WINDOW* wnd, UG_U8 id );
00798 UG_COLOR UG_TextboxGetBackColor( UG_WINDOW* wnd, UG_U8 id );
00799 char* UG_TextboxGetText( UG_WINDOW* wnd, UG_U8 id );
00800 UG_FONT* UG_TextboxGetFont( UG_WINDOW* wnd, UG_U8 id );
00801 UG_S8 UG_TextboxGetHSpace( UG_WINDOW* wnd, UG_U8 id );
00802 UG_S8 UG_TextboxGetVSpace( UG_WINDOW* wnd, UG_U8 id );
00803 UG_U8 UG_TextboxGetAlignment( UG_WINDOW* wnd, UG_U8 id );
00804 
00805 /* Image functions */
00806 UG_RESULT UG_ImageCreate( UG_WINDOW* wnd, UG_IMAGE* img, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye );
00807 UG_RESULT UG_ImageDelete( UG_WINDOW* wnd, UG_U8 id );
00808 UG_RESULT UG_ImageShow( UG_WINDOW* wnd, UG_U8 id );
00809 UG_RESULT UG_ImageHide( UG_WINDOW* wnd, UG_U8 id );
00810 UG_RESULT UG_ImageSetBMP( UG_WINDOW* wnd, UG_U8 id, const UG_BMP* bmp );
00811 
00812 
00813 
00814 #endif
00815