Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPINBOX.h Source File

SPINBOX.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH                         *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2018  SEGGER Microcontroller GmbH                *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.48 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software  has been licensed to  Cypress Semiconductor Corporation,
00019 whose registered  office is situated  at 198 Champion Ct. San Jose, CA 
00020 95134 USA  solely for the  purposes of creating  libraries for Cypress
00021 PSoC3 and  PSoC5 processor-based devices,  sublicensed and distributed
00022 under  the  terms  and  conditions  of  the  Cypress  End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 Licensor:                 SEGGER Microcontroller Systems LLC
00030 Licensed to:              Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA
00031 Licensed SEGGER software: emWin
00032 License number:           GUI-00319
00033 License model:            Services and License Agreement, signed June 10th, 2009
00034 Licensed platform:        Any Cypress platform (Initial targets are: PSoC3, PSoC5)
00035 ----------------------------------------------------------------------
00036 Support and Update Agreement (SUA)
00037 SUA period:               2009-06-12 - 2022-07-27
00038 Contact to extend SUA:    sales@segger.com
00039 ----------------------------------------------------------------------
00040 File        : SPINBOX.h
00041 Purpose     : SPINBOX header file
00042 --------------------END-OF-HEADER-------------------------------------
00043 */
00044 
00045 #ifndef SPINBOX_H
00046 #define SPINBOX_H
00047 
00048 #include "WM.h"
00049 #include "DIALOG_Intern.h" // Required for Create indirect data structure
00050 #include "WIDGET.h"
00051 #include "GUI_Debug.h"
00052 #include "EDIT.h"
00053 
00054 #if GUI_WINSUPPORT
00055 
00056 #if defined(__cplusplus)
00057   extern "C" {             // Make sure we have C-declarations in C++ programs
00058 #endif
00059 
00060 /*********************************************************************
00061 *
00062 *       Defines
00063 *
00064 **********************************************************************
00065 */
00066 /*********************************************************************
00067 *
00068 *       States
00069 */
00070 #define SPINBOX_STATE_PRESSED(x)     (U8)(1 << (U8)x)    // These flags are stored in (SPINBOX_OBJ->State)        | x must be 0 or 1
00071 #define SPINBOX_STATE_FOCUS          WIDGET_STATE_FOCUS  // This is read from         (SPINBOX_OBJ->Widget.State)
00072 
00073 #define SPINBOX_EDGE_RIGHT           0
00074 #define SPINBOX_EDGE_LEFT            1
00075 #define SPINBOX_EDGE_CENTER          2
00076 
00077 #define SPINBOX_EM_STEP              0
00078 #define SPINBOX_EM_EDIT              1
00079 
00080 #ifndef SPINBOX_EM_DEFAULT
00081   #define SPINBOX_EM_DEFAULT         SPINBOX_EM_STEP
00082 #endif
00083 
00084 /*********************************************************************
00085 *
00086 *       Color indices
00087 */
00088 #define SPINBOX_CI_DISABLED          EDIT_CI_DISABLED
00089 #define SPINBOX_CI_ENABLED           EDIT_CI_ENABLED
00090 #define SPINBOX_CI_PRESSED           2
00091 
00092 /*********************************************************************
00093 *
00094 *       Skinning property indices
00095 */
00096 #define SPINBOX_SKIN_FLEX            SPINBOX_DrawSkinFlex
00097 
00098 #define SPINBOX_SKINFLEX_PI_PRESSED  0
00099 #define SPINBOX_SKINFLEX_PI_FOCUSED  1
00100 #define SPINBOX_SKINFLEX_PI_ENABLED  2
00101 #define SPINBOX_SKINFLEX_PI_DISABLED 3
00102 #define SPINBOX_SKIN_FLEX_RADIUS     2
00103 
00104 /*********************************************************************
00105 *
00106 *       Public Types
00107 *
00108 **********************************************************************
00109 */
00110 typedef WM_HMEM SPINBOX_Handle;
00111 
00112 typedef struct {
00113   GUI_COLOR aColorFrame[2];   // [0] Outer color of surrounding frame.         [1] Inner color of surrounding frame.
00114   GUI_COLOR aColorUpper[2];   // [0] Upper color of gradient for upper button. [1] Lower color of gradient for upper button.
00115   GUI_COLOR aColorLower[2];   // [0] Upper color of gradient for lower button. [1] Lower color of gradient for lower button.
00116   GUI_COLOR ColorArrow;       // Color of the button arrow.
00117   GUI_COLOR ColorBk;          // Color of the background.                      // See WIDGET_ITEM_CREATE in SPINBOX_DrawSkinFlex()
00118   GUI_COLOR ColorText;        // Color of the text.                            // See WIDGET_ITEM_CREATE in SPINBOX_DrawSkinFlex()
00119   GUI_COLOR ColorButtonFrame; // Color of the button frame.
00120 } SPINBOX_SKINFLEX_PROPS;
00121 
00122 /*********************************************************************
00123 *
00124 *       Prototypes
00125 *
00126 **********************************************************************
00127 */
00128 /*********************************************************************
00129 *
00130 *       Creation
00131 */
00132 SPINBOX_Handle SPINBOX_CreateEx      (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int Id, int Min, int Max);
00133 SPINBOX_Handle SPINBOX_CreateUser    (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int Id, int Min, int Max, int NumExtraBytes);
00134 SPINBOX_Handle SPINBOX_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
00135 
00136 /*********************************************************************
00137 *
00138 *       Callback, should be called only from within a custom callback.
00139 */
00140 void           SPINBOX_Callback(WM_MESSAGE * pMsg);
00141 
00142 /*********************************************************************
00143 *
00144 *       Get / Set properties
00145 */
00146 void             SPINBOX_EnableBlink     (SPINBOX_Handle hObj, int Period, int OnOff);
00147 GUI_COLOR        SPINBOX_GetBkColor      (SPINBOX_Handle hObj, unsigned int Index);
00148 GUI_COLOR        SPINBOX_GetButtonBkColor(SPINBOX_Handle hObj, unsigned int Index);
00149 EDIT_Handle      SPINBOX_GetEditHandle   (SPINBOX_Handle hObj);
00150 const GUI_FONT * SPINBOX_GetFont         (SPINBOX_Handle hObj);
00151 GUI_COLOR        SPINBOX_GetTextColor    (SPINBOX_Handle hObj, unsigned int Index);
00152 int              SPINBOX_GetUserData     (SPINBOX_Handle hObj, void * pDest, int NumBytes);
00153 I32              SPINBOX_GetValue        (SPINBOX_Handle hObj);
00154 void             SPINBOX_SetBkColor      (SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
00155 void             SPINBOX_SetButtonBkColor(SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
00156 void             SPINBOX_SetButtonSize   (SPINBOX_Handle hObj, unsigned ButtonSize);
00157 void             SPINBOX_SetEdge         (SPINBOX_Handle hObj, U8 Edge);
00158 void             SPINBOX_SetEditMode     (SPINBOX_Handle hObj, U8 EditMode);
00159 void             SPINBOX_SetFont         (SPINBOX_Handle hObj, const GUI_FONT * pFont);
00160 void             SPINBOX_SetRange        (SPINBOX_Handle hObj, I32 Min, I32 Max);
00161 U16              SPINBOX_SetStep         (SPINBOX_Handle hObj, U16 Step);
00162 void             SPINBOX_SetTextColor    (SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
00163 int              SPINBOX_SetUserData     (SPINBOX_Handle hObj, const void * pSrc, int NumBytes);
00164 void             SPINBOX_SetValue        (SPINBOX_Handle hObj, I32 Value);
00165 
00166 /*********************************************************************
00167 *
00168 *       Managing default values
00169 */
00170 U16  SPINBOX_GetDefaultButtonSize(void);
00171 void SPINBOX_SetDefaultButtonSize(U16 ButtonSize);
00172 
00173 /*********************************************************************
00174 *
00175 *       Skinning
00176 */
00177 void                    SPINBOX_GetSkinFlexProps     (SPINBOX_SKINFLEX_PROPS * pProps, int Index);
00178 void                    SPINBOX_SetSkinClassic       (SPINBOX_Handle hObj);
00179 void                    SPINBOX_SetSkin              (SPINBOX_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00180 int                     SPINBOX_DrawSkinFlex         (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
00181 void                    SPINBOX_SetSkinFlexProps     (const SPINBOX_SKINFLEX_PROPS * pProps, int Index);
00182 void                    SPINBOX_SetDefaultSkinClassic(void);
00183 WIDGET_DRAW_ITEM_FUNC * SPINBOX_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00184 
00185 #if defined(__cplusplus)
00186   }
00187 #endif
00188 
00189 #endif  // GUI_WINSUPPORT
00190 #endif  // SPINBOX_H
00191 
00192 /*************************** End of file ****************************/