damon zhang / Mbed OS rt1050_emwin_gui_demo
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPINBOX.h Source File

SPINBOX.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - 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  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP 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 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : SPINBOX.h
00040 Purpose     : SPINBOX header file
00041 --------------------END-OF-HEADER-------------------------------------
00042 */
00043 
00044 #ifndef SPINBOX_H
00045 #define SPINBOX_H
00046 
00047 #include "WM.h"
00048 #include "DIALOG_Intern.h" // Required for Create indirect data structure
00049 #include "WIDGET.h"
00050 #include "GUI_Debug.h"
00051 #include "EDIT.h"
00052 
00053 #if GUI_WINSUPPORT
00054 
00055 #if defined(__cplusplus)
00056   extern "C" {             // Make sure we have C-declarations in C++ programs
00057 #endif
00058 
00059 /*********************************************************************
00060 *
00061 *       Defines
00062 *
00063 **********************************************************************
00064 */
00065 /*********************************************************************
00066 *
00067 *       States
00068 */
00069 #define SPINBOX_STATE_PRESSED(x)     (U8)(1 << (U8)x)    // These flags are stored in (SPINBOX_OBJ->State)        | x must be 0 or 1
00070 #define SPINBOX_STATE_FOCUS          WIDGET_STATE_FOCUS  // This is read from         (SPINBOX_OBJ->Widget.State)
00071 
00072 #define SPINBOX_EDGE_RIGHT           0
00073 #define SPINBOX_EDGE_LEFT            1
00074 #define SPINBOX_EDGE_CENTER          2
00075 
00076 #define SPINBOX_EM_STEP              0
00077 #define SPINBOX_EM_EDIT              1
00078 
00079 #ifndef SPINBOX_EM_DEFAULT
00080   #define SPINBOX_EM_DEFAULT         SPINBOX_EM_STEP
00081 #endif
00082 
00083 /*********************************************************************
00084 *
00085 *       Color indices
00086 */
00087 #define SPINBOX_CI_DISABLED          EDIT_CI_DISABLED
00088 #define SPINBOX_CI_ENABLED           EDIT_CI_ENABLED
00089 #define SPINBOX_CI_PRESSED           2
00090 
00091 /*********************************************************************
00092 *
00093 *       Skinning property indices
00094 */
00095 #define SPINBOX_SKIN_FLEX            SPINBOX_DrawSkinFlex
00096 
00097 #define SPINBOX_SKINFLEX_PI_PRESSED  0
00098 #define SPINBOX_SKINFLEX_PI_FOCUSSED 1
00099 #define SPINBOX_SKINFLEX_PI_ENABLED  2
00100 #define SPINBOX_SKINFLEX_PI_DISABLED 3
00101 #define SPINBOX_SKIN_FLEX_RADIUS     2
00102 
00103 /*********************************************************************
00104 *
00105 *       Public Types
00106 *
00107 **********************************************************************
00108 */
00109 typedef WM_HMEM SPINBOX_Handle;
00110 
00111 typedef struct {
00112   GUI_COLOR aColorFrame[2];   // [0] Outer color of surrounding frame.         [1] Inner color of surrounding frame.
00113   GUI_COLOR aColorUpper[2];   // [0] Upper color of gradient for upper button. [1] Lower color of gradient for upper button.
00114   GUI_COLOR aColorLower[2];   // [0] Upper color of gradient for lower button. [1] Lower color of gradient for lower button.
00115   GUI_COLOR ColorArrow;       // Color of the button arrow.
00116   GUI_COLOR ColorBk;          // Color of the background.                      // See WIDGET_ITEM_CREATE in SPINBOX_DrawSkinFlex()
00117   GUI_COLOR ColorText;        // Color of the text.                            // See WIDGET_ITEM_CREATE in SPINBOX_DrawSkinFlex()
00118   GUI_COLOR ColorButtonFrame; // Color of the button frame.
00119 } SPINBOX_SKINFLEX_PROPS;
00120 
00121 /*********************************************************************
00122 *
00123 *       Prototypes
00124 *
00125 **********************************************************************
00126 */
00127 /*********************************************************************
00128 *
00129 *       Creation
00130 */
00131 SPINBOX_Handle SPINBOX_CreateEx      (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int Id, int Min, int Max);
00132 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);
00133 SPINBOX_Handle SPINBOX_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
00134 
00135 /*********************************************************************
00136 *
00137 *       Callback, should be called only from within a custom callback.
00138 */
00139 void           SPINBOX_Callback(WM_MESSAGE * pMsg);
00140 
00141 /*********************************************************************
00142 *
00143 *       Get / Set properties
00144 */
00145 void        SPINBOX_EnableBlink     (SPINBOX_Handle hObj, int Period, int OnOff);
00146 GUI_COLOR   SPINBOX_GetBkColor      (SPINBOX_Handle hObj, unsigned int Index);
00147 GUI_COLOR   SPINBOX_GetButtonBkColor(SPINBOX_Handle hObj, unsigned int Index);
00148 EDIT_Handle SPINBOX_GetEditHandle   (SPINBOX_Handle hObj);
00149 int         SPINBOX_GetUserData     (SPINBOX_Handle hObj, void * pDest, int NumBytes);
00150 I32         SPINBOX_GetValue        (SPINBOX_Handle hObj);
00151 void        SPINBOX_SetBkColor      (SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
00152 void        SPINBOX_SetButtonBkColor(SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
00153 void        SPINBOX_SetButtonSize   (SPINBOX_Handle hObj, unsigned ButtonSize);
00154 void        SPINBOX_SetEdge         (SPINBOX_Handle hObj, U8 Edge);
00155 void        SPINBOX_SetEditMode     (SPINBOX_Handle hObj, U8 EditMode);
00156 void        SPINBOX_SetFont         (SPINBOX_Handle hObj, const GUI_FONT * pFont);
00157 void        SPINBOX_SetRange        (SPINBOX_Handle hObj, I32 Min, I32 Max);
00158 U16         SPINBOX_SetStep         (SPINBOX_Handle hObj, U16 Step);
00159 void        SPINBOX_SetTextColor    (SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
00160 int         SPINBOX_SetUserData     (SPINBOX_Handle hObj, const void * pSrc, int NumBytes);
00161 void        SPINBOX_SetValue        (SPINBOX_Handle hObj, I32 Value);
00162 
00163 /*********************************************************************
00164 *
00165 *       Managing default values
00166 */
00167 U16  SPINBOX_GetDefaultButtonSize(void);
00168 void SPINBOX_SetDefaultButtonSize(U16 ButtonSize);
00169 
00170 /*********************************************************************
00171 *
00172 *       Skinning
00173 */
00174 void                    SPINBOX_GetSkinFlexProps     (SPINBOX_SKINFLEX_PROPS * pProps, int Index);
00175 void                    SPINBOX_SetSkinClassic       (SPINBOX_Handle hObj);
00176 void                    SPINBOX_SetSkin              (SPINBOX_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00177 int                     SPINBOX_DrawSkinFlex         (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
00178 void                    SPINBOX_SetSkinFlexProps     (const SPINBOX_SKINFLEX_PROPS * pProps, int Index);
00179 void                    SPINBOX_SetDefaultSkinClassic(void);
00180 WIDGET_DRAW_ITEM_FUNC * SPINBOX_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00181 
00182 #if defined(__cplusplus)
00183   }
00184 #endif
00185 
00186 #endif  // GUI_WINSUPPORT
00187 #endif  // SPINBOX_H
00188 
00189 /*************************** End of file ****************************/