Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * \author Tilen Majerle
- * \email tilen@majerle.eu
- * \brief GUI structures and enumerations
- *
- \verbatim
- ----------------------------------------------------------------------
- Copyright (c) 2016 Tilen Majerle
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
- AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
- ----------------------------------------------------------------------
- \endverbatim
- */
- #ifndef GUI_DEFS_H
- #define GUI_DEFS_H
- /* C++ detection */
- #ifdef __cplusplus
- extern "C" {
- #endif
- /**
- * \addtogroup GUI
- * \{
- */
- #include "stdlib.h"
- #include "string.h"
- #include "stdint.h"
- #include "stdio.h"
- /**
- * \defgroup GUI_Typedefs
- * \brief Library Typedefs
- * \{
- */
- /**
- * \brief Results enumeration
- */
- typedef enum _GUI_Result_t {
- guiOK = 0x00,
- guiERROR = 0x01
- } GUI_Result_t;
- /**
- * \brief GUI object ID
- */
- typedef uint32_t GUI_ID_t;
- /**
- * \brief Color definition
- */
- typedef uint32_t GUI_Color_t;
- /**
- * \brief Color gradient definition
- */
- typedef struct {
- GUI_Color_t Start;
- GUI_Color_t Stop;
- } GUI_Gradient_t;
- /**
- * \brief Window object structure
- */
- typedef struct _GUI_WINDOW_t {
- uint16_t X; /*!< Object X position relative to parent window in units of pixels */
- uint16_t Y; /*!< Object Y position relative to parent window in units of pixels */
- uint16_t Width; /*!< Object width in units of pixels */
- uint16_t Height; /*!< Object height in units of pixels */
- struct _GUI_WINDOW_t* ParentWindow; /*!< Pointer to parent window object */
- uint32_t Number; /*!< Window number */
- union {
- struct {
- uint8_t IsChild:1; /*!< Flag indicating window is children of main window */
- } F;
- uint32_t Value;
- } Flags; /*!< List of all flags */
- } GUI_WINDOW_t;
- /**
- * \brief Common GUI values for most of the widgets
- */
- typedef struct _GUI_COMMON_t {
- GUI_WINDOW_t* ParentWindow; /*!< Pointer to parent window object */
- uint16_t X; /*!< Object X position relative to parent window in units of pixels */
- uint16_t Y; /*!< Object Y position relative to parent window in units of pixels */
- uint16_t Width; /*!< Object width in units of pixels */
- uint16_t Height; /*!< Object height in units of pixels */
- } GUI_COMMON_t;
- /**
- * \brief GUI button structure
- */
- typedef struct _GUI_BUTTON_t {
- GUI_COMMON_t C; /*!< Common structure object */
- GUI_Color_t ColBG; /*!< Background color */
- GUI_Color_t ColFG; /*!< Foreground or text color */
- GUI_Gradient_t GraT; /*!< Top part gradient color */
- GUI_Gradient_t GraB; /*!< Bottom part gradient color */
- } GUI_BUTTON_t;
- /**
- * \brief GUI main object structure
- */
- typedef struct _GUI_t {
- uint32_t Time; /*!< Current time in units of milliseconds */
- GUI_WINDOW_t* Windows; /*!< Linked list of all windows in GUI */
- GUI_BUTTON_t* Button; /*!< Linked list of all buttons in GUI */
- } GUI_t;
- extern GUI_t GUI;
- /**
- * \}
- */
- /* C++ detection */
- #ifdef __cplusplus
- }
- #endif
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement