Advertisement
tilz0R

Untitled

Jan 29th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.59 KB | None | 0 0
  1. /**
  2.  * \author  Tilen Majerle
  3.  * \email   tilen@majerle.eu
  4.  * \brief   GUI structures and enumerations
  5.  * 
  6. \verbatim
  7.    ----------------------------------------------------------------------
  8.     Copyright (c) 2016 Tilen Majerle
  9.  
  10.     Permission is hereby granted, free of charge, to any person
  11.     obtaining a copy of this software and associated documentation
  12.     files (the "Software"), to deal in the Software without restriction,
  13.     including without limitation the rights to use, copy, modify, merge,
  14.     publish, distribute, sublicense, and/or sell copies of the Software,
  15.     and to permit persons to whom the Software is furnished to do so,
  16.     subject to the following conditions:
  17.  
  18.     The above copyright notice and this permission notice shall be
  19.     included in all copies or substantial portions of the Software.
  20.  
  21.     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22.     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  23.     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
  24.     AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  25.     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  26.     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  27.     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  28.     OTHER DEALINGS IN THE SOFTWARE.
  29.    ----------------------------------------------------------------------
  30. \endverbatim
  31.  */
  32. #ifndef GUI_DEFS_H
  33. #define GUI_DEFS_H
  34.  
  35. /* C++ detection */
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. /**
  41.  * \addtogroup      GUI
  42.  * \{
  43.  */
  44. #include "stdlib.h"
  45. #include "string.h"
  46. #include "stdint.h"
  47. #include "stdio.h"
  48.    
  49. /**
  50.  * \defgroup        GUI_Typedefs
  51.  * \brief           Library Typedefs
  52.  * \{
  53.  */
  54.  
  55. /**
  56.  * \brief           Results enumeration
  57.  */
  58. typedef enum _GUI_Result_t {
  59.     guiOK = 0x00,
  60.     guiERROR = 0x01
  61. } GUI_Result_t;
  62.  
  63. /**
  64.  * \brief           GUI object ID
  65.  */
  66. typedef uint32_t GUI_ID_t;
  67.  
  68. /**
  69.  * \brief           Color definition
  70.  */
  71. typedef uint32_t GUI_Color_t;
  72.  
  73. /**
  74.  * \brief           Color gradient definition
  75.  */
  76. typedef struct {
  77.     GUI_Color_t Start;
  78.     GUI_Color_t Stop;
  79. } GUI_Gradient_t;
  80.  
  81.  
  82. /**
  83.  * \brief           Window object structure
  84.  */
  85. typedef struct _GUI_WINDOW_t {
  86.     uint16_t X;                             /*!< Object X position relative to parent window in units of pixels */
  87.     uint16_t Y;                             /*!< Object Y position relative to parent window in units of pixels */
  88.     uint16_t Width;                         /*!< Object width in units of pixels */
  89.     uint16_t Height;                        /*!< Object height in units of pixels */
  90.     struct _GUI_WINDOW_t* ParentWindow;     /*!< Pointer to parent window object */
  91.     uint32_t Number;                        /*!< Window number */
  92.     union {                    
  93.         struct {
  94.             uint8_t IsChild:1;              /*!< Flag indicating window is children of main window */
  95.         } F;
  96.         uint32_t Value;
  97.     } Flags;                                /*!< List of all flags */
  98. } GUI_WINDOW_t;
  99.  
  100. /**
  101.  * \brief           Common GUI values for most of the widgets
  102.  */
  103. typedef struct _GUI_COMMON_t {
  104.     GUI_WINDOW_t* ParentWindow;             /*!< Pointer to parent window object */
  105.     uint16_t X;                             /*!< Object X position relative to parent window in units of pixels */
  106.     uint16_t Y;                             /*!< Object Y position relative to parent window in units of pixels */
  107.     uint16_t Width;                         /*!< Object width in units of pixels */
  108.     uint16_t Height;                        /*!< Object height in units of pixels */
  109. } GUI_COMMON_t;
  110.  
  111. /**
  112.  * \brief           GUI button structure
  113.  */
  114. typedef struct _GUI_BUTTON_t {
  115.     GUI_COMMON_t C;                         /*!< Common structure object */
  116.     GUI_Color_t ColBG;                      /*!< Background color */
  117.     GUI_Color_t ColFG;                      /*!< Foreground or text color */
  118.     GUI_Gradient_t GraT;                    /*!< Top part gradient color */
  119.     GUI_Gradient_t GraB;                    /*!< Bottom part gradient color */
  120. } GUI_BUTTON_t;
  121.  
  122. /**
  123.  * \brief           GUI main object structure
  124.  */
  125. typedef struct _GUI_t {
  126.     uint32_t Time;                          /*!< Current time in units of milliseconds */
  127.     GUI_WINDOW_t* Windows;                  /*!< Linked list of all windows in GUI */
  128.     GUI_BUTTON_t* Button;                   /*!< Linked list of all buttons in GUI */
  129. } GUI_t;
  130. extern GUI_t GUI;
  131.  
  132. /**
  133.  * \}
  134.  */
  135.  
  136. /* C++ detection */
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140.  
  141. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement