Nuvoton
/
NuMaker-mbed-emWin-example
NuMaker emWin HMI
emWin/Include/BUTTON.h@1:c0f972361605, 2019-02-27 (annotated)
- Committer:
- csyang2
- Date:
- Wed Feb 27 14:34:09 2019 +0800
- Revision:
- 1:c0f972361605
Add emWin related materials
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
csyang2 |
1:c0f972361605 | 1 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 2 | * SEGGER Software GmbH * |
csyang2 |
1:c0f972361605 | 3 | * Solutions for real time microcontroller applications * |
csyang2 |
1:c0f972361605 | 4 | ********************************************************************** |
csyang2 |
1:c0f972361605 | 5 | * * |
csyang2 |
1:c0f972361605 | 6 | * (c) 1996 - 2018 SEGGER Microcontroller GmbH * |
csyang2 |
1:c0f972361605 | 7 | * * |
csyang2 |
1:c0f972361605 | 8 | * Internet: www.segger.com Support: support@segger.com * |
csyang2 |
1:c0f972361605 | 9 | * * |
csyang2 |
1:c0f972361605 | 10 | ********************************************************************** |
csyang2 |
1:c0f972361605 | 11 | |
csyang2 |
1:c0f972361605 | 12 | ** emWin V5.48 - Graphical user interface for embedded applications ** |
csyang2 |
1:c0f972361605 | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
csyang2 |
1:c0f972361605 | 14 | emWin is protected by international copyright laws. Knowledge of the |
csyang2 |
1:c0f972361605 | 15 | source code may not be used to write a similar product. This file may |
csyang2 |
1:c0f972361605 | 16 | only be used in accordance with the following terms: |
csyang2 |
1:c0f972361605 | 17 | |
csyang2 |
1:c0f972361605 | 18 | The software has been licensed by SEGGER Software GmbH to Nuvoton Technology Corporationat the address: No. 4, Creation Rd. III, Hsinchu Science Park, Taiwan |
csyang2 |
1:c0f972361605 | 19 | for the purposes of creating libraries for its |
csyang2 |
1:c0f972361605 | 20 | Arm Cortex-M and Arm9 32-bit microcontrollers, commercialized and distributed by Nuvoton Technology Corporation |
csyang2 |
1:c0f972361605 | 21 | under the terms and conditions of an End User |
csyang2 |
1:c0f972361605 | 22 | License Agreement supplied with the libraries. |
csyang2 |
1:c0f972361605 | 23 | Full source code is available at: www.segger.com |
csyang2 |
1:c0f972361605 | 24 | |
csyang2 |
1:c0f972361605 | 25 | We appreciate your understanding and fairness. |
csyang2 |
1:c0f972361605 | 26 | ---------------------------------------------------------------------- |
csyang2 |
1:c0f972361605 | 27 | Licensing information |
csyang2 |
1:c0f972361605 | 28 | Licensor: SEGGER Software GmbH |
csyang2 |
1:c0f972361605 | 29 | Licensed to: Nuvoton Technology Corporation, No. 4, Creation Rd. III, Hsinchu Science Park, 30077 Hsinchu City, Taiwan |
csyang2 |
1:c0f972361605 | 30 | Licensed SEGGER software: emWin |
csyang2 |
1:c0f972361605 | 31 | License number: GUI-00735 |
csyang2 |
1:c0f972361605 | 32 | License model: emWin License Agreement, signed February 27, 2018 |
csyang2 |
1:c0f972361605 | 33 | Licensed platform: Cortex-M and ARM9 32-bit series microcontroller designed and manufactured by or for Nuvoton Technology Corporation |
csyang2 |
1:c0f972361605 | 34 | ---------------------------------------------------------------------- |
csyang2 |
1:c0f972361605 | 35 | Support and Update Agreement (SUA) |
csyang2 |
1:c0f972361605 | 36 | SUA period: 2018-03-26 - 2019-03-27 |
csyang2 |
1:c0f972361605 | 37 | Contact to extend SUA: sales@segger.com |
csyang2 |
1:c0f972361605 | 38 | ---------------------------------------------------------------------- |
csyang2 |
1:c0f972361605 | 39 | File : BUTTON.h |
csyang2 |
1:c0f972361605 | 40 | Purpose : BUTTON public header file (API) |
csyang2 |
1:c0f972361605 | 41 | --------------------END-OF-HEADER------------------------------------- |
csyang2 |
1:c0f972361605 | 42 | */ |
csyang2 |
1:c0f972361605 | 43 | |
csyang2 |
1:c0f972361605 | 44 | #ifndef BUTTON_H |
csyang2 |
1:c0f972361605 | 45 | #define BUTTON_H |
csyang2 |
1:c0f972361605 | 46 | |
csyang2 |
1:c0f972361605 | 47 | #include "WM.h" |
csyang2 |
1:c0f972361605 | 48 | #include "DIALOG_Intern.h" /* Req. for Create indirect data structure */ |
csyang2 |
1:c0f972361605 | 49 | #include "WIDGET.h" |
csyang2 |
1:c0f972361605 | 50 | |
csyang2 |
1:c0f972361605 | 51 | #if GUI_WINSUPPORT |
csyang2 |
1:c0f972361605 | 52 | |
csyang2 |
1:c0f972361605 | 53 | #if defined(__cplusplus) |
csyang2 |
1:c0f972361605 | 54 | extern "C" { /* Make sure we have C-declarations in C++ programs */ |
csyang2 |
1:c0f972361605 | 55 | #endif |
csyang2 |
1:c0f972361605 | 56 | |
csyang2 |
1:c0f972361605 | 57 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 58 | * |
csyang2 |
1:c0f972361605 | 59 | * Create flags |
csyang2 |
1:c0f972361605 | 60 | */ |
csyang2 |
1:c0f972361605 | 61 | /* For compatibility only ! */ |
csyang2 |
1:c0f972361605 | 62 | #define BUTTON_CF_HIDE WM_CF_HIDE |
csyang2 |
1:c0f972361605 | 63 | #define BUTTON_CF_SHOW WM_CF_SHOW |
csyang2 |
1:c0f972361605 | 64 | #define BUTTON_CF_MEMDEV WM_CF_MEMDEV |
csyang2 |
1:c0f972361605 | 65 | |
csyang2 |
1:c0f972361605 | 66 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 67 | * |
csyang2 |
1:c0f972361605 | 68 | * Color indices |
csyang2 |
1:c0f972361605 | 69 | */ |
csyang2 |
1:c0f972361605 | 70 | #define BUTTON_CI_UNPRESSED 0 |
csyang2 |
1:c0f972361605 | 71 | #define BUTTON_CI_PRESSED 1 |
csyang2 |
1:c0f972361605 | 72 | #define BUTTON_CI_DISABLED 2 |
csyang2 |
1:c0f972361605 | 73 | |
csyang2 |
1:c0f972361605 | 74 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 75 | * |
csyang2 |
1:c0f972361605 | 76 | * Bitmap indices |
csyang2 |
1:c0f972361605 | 77 | */ |
csyang2 |
1:c0f972361605 | 78 | #define BUTTON_BI_UNPRESSED 0 |
csyang2 |
1:c0f972361605 | 79 | #define BUTTON_BI_PRESSED 1 |
csyang2 |
1:c0f972361605 | 80 | #define BUTTON_BI_DISABLED 2 |
csyang2 |
1:c0f972361605 | 81 | |
csyang2 |
1:c0f972361605 | 82 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 83 | * |
csyang2 |
1:c0f972361605 | 84 | * States |
csyang2 |
1:c0f972361605 | 85 | */ |
csyang2 |
1:c0f972361605 | 86 | #define BUTTON_STATE_FOCUS WIDGET_STATE_FOCUS |
csyang2 |
1:c0f972361605 | 87 | #define BUTTON_STATE_PRESSED WIDGET_STATE_USER0 |
csyang2 |
1:c0f972361605 | 88 | |
csyang2 |
1:c0f972361605 | 89 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 90 | * |
csyang2 |
1:c0f972361605 | 91 | * Skinning property indices |
csyang2 |
1:c0f972361605 | 92 | */ |
csyang2 |
1:c0f972361605 | 93 | #define BUTTON_SKINFLEX_PI_PRESSED 0 |
csyang2 |
1:c0f972361605 | 94 | #define BUTTON_SKINFLEX_PI_FOCUSED 1 |
csyang2 |
1:c0f972361605 | 95 | #define BUTTON_SKINFLEX_PI_ENABLED 2 |
csyang2 |
1:c0f972361605 | 96 | #define BUTTON_SKINFLEX_PI_DISABLED 3 |
csyang2 |
1:c0f972361605 | 97 | |
csyang2 |
1:c0f972361605 | 98 | #define BUTTON_SKINFLEX_PI_FOCUSSED BUTTON_SKINFLEX_PI_FOCUSED |
csyang2 |
1:c0f972361605 | 99 | |
csyang2 |
1:c0f972361605 | 100 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 101 | * |
csyang2 |
1:c0f972361605 | 102 | * Types |
csyang2 |
1:c0f972361605 | 103 | * |
csyang2 |
1:c0f972361605 | 104 | ********************************************************************** |
csyang2 |
1:c0f972361605 | 105 | */ |
csyang2 |
1:c0f972361605 | 106 | typedef WM_HMEM BUTTON_Handle; |
csyang2 |
1:c0f972361605 | 107 | |
csyang2 |
1:c0f972361605 | 108 | typedef struct { |
csyang2 |
1:c0f972361605 | 109 | GUI_COLOR aColorFrame[3]; |
csyang2 |
1:c0f972361605 | 110 | GUI_COLOR aColorUpper[2]; |
csyang2 |
1:c0f972361605 | 111 | GUI_COLOR aColorLower[2]; |
csyang2 |
1:c0f972361605 | 112 | int Radius; |
csyang2 |
1:c0f972361605 | 113 | } BUTTON_SKINFLEX_PROPS; |
csyang2 |
1:c0f972361605 | 114 | |
csyang2 |
1:c0f972361605 | 115 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 116 | * |
csyang2 |
1:c0f972361605 | 117 | * Create function(s) |
csyang2 |
1:c0f972361605 | 118 | |
csyang2 |
1:c0f972361605 | 119 | Note: the parameters to a create function may vary. |
csyang2 |
1:c0f972361605 | 120 | Some widgets may have multiple create functions |
csyang2 |
1:c0f972361605 | 121 | */ |
csyang2 |
1:c0f972361605 | 122 | |
csyang2 |
1:c0f972361605 | 123 | BUTTON_Handle BUTTON_Create (int x0, int y0, int xSize, int ySize, int ID, int Flags); |
csyang2 |
1:c0f972361605 | 124 | BUTTON_Handle BUTTON_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int Id, int Flags); |
csyang2 |
1:c0f972361605 | 125 | BUTTON_Handle BUTTON_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id); |
csyang2 |
1:c0f972361605 | 126 | BUTTON_Handle BUTTON_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes); |
csyang2 |
1:c0f972361605 | 127 | BUTTON_Handle BUTTON_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb); |
csyang2 |
1:c0f972361605 | 128 | |
csyang2 |
1:c0f972361605 | 129 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 130 | * |
csyang2 |
1:c0f972361605 | 131 | * Managing default values |
csyang2 |
1:c0f972361605 | 132 | * |
csyang2 |
1:c0f972361605 | 133 | ********************************************************************** |
csyang2 |
1:c0f972361605 | 134 | */ |
csyang2 |
1:c0f972361605 | 135 | GUI_COLOR BUTTON_GetDefaultBkColor (unsigned Index); |
csyang2 |
1:c0f972361605 | 136 | const GUI_FONT * BUTTON_GetDefaultFont (void); |
csyang2 |
1:c0f972361605 | 137 | int BUTTON_GetDefaultTextAlign (void); |
csyang2 |
1:c0f972361605 | 138 | GUI_COLOR BUTTON_GetDefaultTextColor (unsigned Index); |
csyang2 |
1:c0f972361605 | 139 | void BUTTON_SetDefaultBkColor (GUI_COLOR Color, unsigned Index); |
csyang2 |
1:c0f972361605 | 140 | GUI_COLOR BUTTON_SetDefaultFocusColor(GUI_COLOR Color); |
csyang2 |
1:c0f972361605 | 141 | void BUTTON_SetDefaultFont (const GUI_FONT * pFont); |
csyang2 |
1:c0f972361605 | 142 | void BUTTON_SetDefaultTextAlign (int Align); |
csyang2 |
1:c0f972361605 | 143 | void BUTTON_SetDefaultTextColor (GUI_COLOR Color, unsigned Index); |
csyang2 |
1:c0f972361605 | 144 | |
csyang2 |
1:c0f972361605 | 145 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 146 | * |
csyang2 |
1:c0f972361605 | 147 | * The callback ... |
csyang2 |
1:c0f972361605 | 148 | * |
csyang2 |
1:c0f972361605 | 149 | * Do not call it directly ! It is only to be used from within an |
csyang2 |
1:c0f972361605 | 150 | * overwritten callback. |
csyang2 |
1:c0f972361605 | 151 | */ |
csyang2 |
1:c0f972361605 | 152 | void BUTTON_Callback(WM_MESSAGE *pMsg); |
csyang2 |
1:c0f972361605 | 153 | |
csyang2 |
1:c0f972361605 | 154 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 155 | * |
csyang2 |
1:c0f972361605 | 156 | * Member functions |
csyang2 |
1:c0f972361605 | 157 | * |
csyang2 |
1:c0f972361605 | 158 | ********************************************************************** |
csyang2 |
1:c0f972361605 | 159 | */ |
csyang2 |
1:c0f972361605 | 160 | GUI_COLOR BUTTON_GetBkColor (BUTTON_Handle hObj, unsigned int Index); |
csyang2 |
1:c0f972361605 | 161 | const GUI_BITMAP * BUTTON_GetBitmap (BUTTON_Handle hObj,unsigned int Index); |
csyang2 |
1:c0f972361605 | 162 | const GUI_FONT * BUTTON_GetFont (BUTTON_Handle hObj); |
csyang2 |
1:c0f972361605 | 163 | GUI_COLOR BUTTON_GetFrameColor (BUTTON_Handle hObj); |
csyang2 |
1:c0f972361605 | 164 | WIDGET * BUTTON_GetpWidget (BUTTON_Handle hObj); |
csyang2 |
1:c0f972361605 | 165 | void BUTTON_GetText (BUTTON_Handle hObj, char * pBuffer, int MaxLen); |
csyang2 |
1:c0f972361605 | 166 | GUI_COLOR BUTTON_GetTextColor (BUTTON_Handle hObj, unsigned int Index); |
csyang2 |
1:c0f972361605 | 167 | int BUTTON_GetTextAlign (BUTTON_Handle hObj); |
csyang2 |
1:c0f972361605 | 168 | int BUTTON_GetUserData (BUTTON_Handle hObj, void * pDest, int NumBytes); |
csyang2 |
1:c0f972361605 | 169 | unsigned BUTTON_IsPressed (BUTTON_Handle hObj); |
csyang2 |
1:c0f972361605 | 170 | void BUTTON_SetBitmap (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap); |
csyang2 |
1:c0f972361605 | 171 | void BUTTON_SetBitmapEx (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap, int x, int y); |
csyang2 |
1:c0f972361605 | 172 | void BUTTON_SetBkColor (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color); |
csyang2 |
1:c0f972361605 | 173 | void BUTTON_SetBMP (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap); |
csyang2 |
1:c0f972361605 | 174 | void BUTTON_SetBMPEx (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap, int x, int y); |
csyang2 |
1:c0f972361605 | 175 | void BUTTON_SetFont (BUTTON_Handle hObj, const GUI_FONT * pfont); |
csyang2 |
1:c0f972361605 | 176 | void BUTTON_SetFrameColor (BUTTON_Handle hObj, GUI_COLOR Color); |
csyang2 |
1:c0f972361605 | 177 | void BUTTON_SetState (BUTTON_Handle hObj, int State); /* Not to be doc. */ |
csyang2 |
1:c0f972361605 | 178 | void BUTTON_SetPressed (BUTTON_Handle hObj, int State); |
csyang2 |
1:c0f972361605 | 179 | GUI_COLOR BUTTON_SetFocusColor (BUTTON_Handle hObj, GUI_COLOR Color); |
csyang2 |
1:c0f972361605 | 180 | void BUTTON_SetStreamedBitmap (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap); |
csyang2 |
1:c0f972361605 | 181 | void BUTTON_SetStreamedBitmapEx(BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap, int x, int y); |
csyang2 |
1:c0f972361605 | 182 | int BUTTON_SetText (BUTTON_Handle hObj, const char* s); |
csyang2 |
1:c0f972361605 | 183 | void BUTTON_SetTextAlign (BUTTON_Handle hObj, int Align); |
csyang2 |
1:c0f972361605 | 184 | void BUTTON_SetTextColor (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color); |
csyang2 |
1:c0f972361605 | 185 | void BUTTON_SetTextOffset (BUTTON_Handle hObj, int xPos, int yPos); |
csyang2 |
1:c0f972361605 | 186 | void BUTTON_SetSelfDrawEx (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw, int x, int y); /* Not to be doc. */ |
csyang2 |
1:c0f972361605 | 187 | void BUTTON_SetSelfDraw (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw); /* Not to be doc. */ |
csyang2 |
1:c0f972361605 | 188 | void BUTTON_SetReactOnLevel (void); |
csyang2 |
1:c0f972361605 | 189 | void BUTTON_SetReactOnTouch (void); |
csyang2 |
1:c0f972361605 | 190 | int BUTTON_SetUserData (BUTTON_Handle hObj, const void * pSrc, int NumBytes); |
csyang2 |
1:c0f972361605 | 191 | |
csyang2 |
1:c0f972361605 | 192 | #define BUTTON_SetFocussable BUTTON_SetFocusable |
csyang2 |
1:c0f972361605 | 193 | #define BUTTON_SetFocusable WIDGET_SetFocusable |
csyang2 |
1:c0f972361605 | 194 | |
csyang2 |
1:c0f972361605 | 195 | /********************************************************************* |
csyang2 |
1:c0f972361605 | 196 | * |
csyang2 |
1:c0f972361605 | 197 | * Member functions: Skinning |
csyang2 |
1:c0f972361605 | 198 | * |
csyang2 |
1:c0f972361605 | 199 | ********************************************************************** |
csyang2 |
1:c0f972361605 | 200 | */ |
csyang2 |
1:c0f972361605 | 201 | void BUTTON_GetSkinFlexProps (BUTTON_SKINFLEX_PROPS * pProps, int Index); |
csyang2 |
1:c0f972361605 | 202 | void BUTTON_SetSkinClassic (BUTTON_Handle hObj); |
csyang2 |
1:c0f972361605 | 203 | void BUTTON_SetSkin (BUTTON_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin); |
csyang2 |
1:c0f972361605 | 204 | int BUTTON_DrawSkinFlex (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo); |
csyang2 |
1:c0f972361605 | 205 | void BUTTON_SetSkinFlexProps (const BUTTON_SKINFLEX_PROPS * pProps, int Index); |
csyang2 |
1:c0f972361605 | 206 | void BUTTON_SetDefaultSkinClassic(void); |
csyang2 |
1:c0f972361605 | 207 | WIDGET_DRAW_ITEM_FUNC * BUTTON_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin); |
csyang2 |
1:c0f972361605 | 208 | |
csyang2 |
1:c0f972361605 | 209 | #define BUTTON_SKIN_FLEX BUTTON_DrawSkinFlex |
csyang2 |
1:c0f972361605 | 210 | |
csyang2 |
1:c0f972361605 | 211 | #if defined(__cplusplus) |
csyang2 |
1:c0f972361605 | 212 | } |
csyang2 |
1:c0f972361605 | 213 | #endif |
csyang2 |
1:c0f972361605 | 214 | |
csyang2 |
1:c0f972361605 | 215 | #endif // GUI_WINSUPPORT |
csyang2 |
1:c0f972361605 | 216 | #endif // BUTTON_H |
csyang2 |
1:c0f972361605 | 217 | |
csyang2 |
1:c0f972361605 | 218 | /*************************** End of file ****************************/ |