Headers for emWin lib
Dependents: DISCO-F746NG_rtos_test
emWin_header/BUTTON.h@0:1bf8f02b0770, 2016-03-26 (annotated)
- Committer:
- redbird
- Date:
- Sat Mar 26 22:49:50 2016 +0000
- Revision:
- 0:1bf8f02b0770
new code integration
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
redbird | 0:1bf8f02b0770 | 1 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 2 | * SEGGER Microcontroller GmbH & Co. KG * |
redbird | 0:1bf8f02b0770 | 3 | * Solutions for real time microcontroller applications * |
redbird | 0:1bf8f02b0770 | 4 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 5 | * * |
redbird | 0:1bf8f02b0770 | 6 | * (c) 1996 - 2014 SEGGER Microcontroller GmbH & Co. KG * |
redbird | 0:1bf8f02b0770 | 7 | * * |
redbird | 0:1bf8f02b0770 | 8 | * Internet: www.segger.com Support: support@segger.com * |
redbird | 0:1bf8f02b0770 | 9 | * * |
redbird | 0:1bf8f02b0770 | 10 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 11 | |
redbird | 0:1bf8f02b0770 | 12 | ** emWin V5.24 - Graphical user interface for embedded applications ** |
redbird | 0:1bf8f02b0770 | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
redbird | 0:1bf8f02b0770 | 14 | emWin is protected by international copyright laws. Knowledge of the |
redbird | 0:1bf8f02b0770 | 15 | source code may not be used to write a similar product. This file may |
redbird | 0:1bf8f02b0770 | 16 | only be used in accordance with the following terms: |
redbird | 0:1bf8f02b0770 | 17 | |
redbird | 0:1bf8f02b0770 | 18 | The software has been licensed to NXP Semiconductors USA, Inc. whose |
redbird | 0:1bf8f02b0770 | 19 | registered office is situated at 411 E. Plumeria Drive, San Jose, |
redbird | 0:1bf8f02b0770 | 20 | CA 95134, USA solely for the purposes of creating libraries for |
redbird | 0:1bf8f02b0770 | 21 | NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and |
redbird | 0:1bf8f02b0770 | 22 | distributed under the terms and conditions of the NXP End User License |
redbird | 0:1bf8f02b0770 | 23 | Agreement. |
redbird | 0:1bf8f02b0770 | 24 | Full source code is available at: www.segger.com |
redbird | 0:1bf8f02b0770 | 25 | |
redbird | 0:1bf8f02b0770 | 26 | We appreciate your understanding and fairness. |
redbird | 0:1bf8f02b0770 | 27 | ---------------------------------------------------------------------- |
redbird | 0:1bf8f02b0770 | 28 | File : BUTTON.h |
redbird | 0:1bf8f02b0770 | 29 | Purpose : BUTTON public header file (API) |
redbird | 0:1bf8f02b0770 | 30 | --------------------END-OF-HEADER------------------------------------- |
redbird | 0:1bf8f02b0770 | 31 | */ |
redbird | 0:1bf8f02b0770 | 32 | |
redbird | 0:1bf8f02b0770 | 33 | #ifndef BUTTON_H |
redbird | 0:1bf8f02b0770 | 34 | #define BUTTON_H |
redbird | 0:1bf8f02b0770 | 35 | |
redbird | 0:1bf8f02b0770 | 36 | #include "WM.h" |
redbird | 0:1bf8f02b0770 | 37 | #include "DIALOG_Intern.h" /* Req. for Create indirect data structure */ |
redbird | 0:1bf8f02b0770 | 38 | #include "WIDGET.h" |
redbird | 0:1bf8f02b0770 | 39 | |
redbird | 0:1bf8f02b0770 | 40 | #if GUI_WINSUPPORT |
redbird | 0:1bf8f02b0770 | 41 | |
redbird | 0:1bf8f02b0770 | 42 | #if defined(__cplusplus) |
redbird | 0:1bf8f02b0770 | 43 | extern "C" { /* Make sure we have C-declarations in C++ programs */ |
redbird | 0:1bf8f02b0770 | 44 | #endif |
redbird | 0:1bf8f02b0770 | 45 | |
redbird | 0:1bf8f02b0770 | 46 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 47 | * |
redbird | 0:1bf8f02b0770 | 48 | * Create flags |
redbird | 0:1bf8f02b0770 | 49 | */ |
redbird | 0:1bf8f02b0770 | 50 | /* For compatibility only ! */ |
redbird | 0:1bf8f02b0770 | 51 | #define BUTTON_CF_HIDE WM_CF_HIDE |
redbird | 0:1bf8f02b0770 | 52 | #define BUTTON_CF_SHOW WM_CF_SHOW |
redbird | 0:1bf8f02b0770 | 53 | #define BUTTON_CF_MEMDEV WM_CF_MEMDEV |
redbird | 0:1bf8f02b0770 | 54 | |
redbird | 0:1bf8f02b0770 | 55 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 56 | * |
redbird | 0:1bf8f02b0770 | 57 | * Color indices |
redbird | 0:1bf8f02b0770 | 58 | */ |
redbird | 0:1bf8f02b0770 | 59 | #define BUTTON_CI_UNPRESSED 0 |
redbird | 0:1bf8f02b0770 | 60 | #define BUTTON_CI_PRESSED 1 |
redbird | 0:1bf8f02b0770 | 61 | #define BUTTON_CI_DISABLED 2 |
redbird | 0:1bf8f02b0770 | 62 | |
redbird | 0:1bf8f02b0770 | 63 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 64 | * |
redbird | 0:1bf8f02b0770 | 65 | * Bitmap indices |
redbird | 0:1bf8f02b0770 | 66 | */ |
redbird | 0:1bf8f02b0770 | 67 | #define BUTTON_BI_UNPRESSED 0 |
redbird | 0:1bf8f02b0770 | 68 | #define BUTTON_BI_PRESSED 1 |
redbird | 0:1bf8f02b0770 | 69 | #define BUTTON_BI_DISABLED 2 |
redbird | 0:1bf8f02b0770 | 70 | |
redbird | 0:1bf8f02b0770 | 71 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 72 | * |
redbird | 0:1bf8f02b0770 | 73 | * States |
redbird | 0:1bf8f02b0770 | 74 | */ |
redbird | 0:1bf8f02b0770 | 75 | #define BUTTON_STATE_FOCUS WIDGET_STATE_FOCUS |
redbird | 0:1bf8f02b0770 | 76 | #define BUTTON_STATE_PRESSED WIDGET_STATE_USER0 |
redbird | 0:1bf8f02b0770 | 77 | |
redbird | 0:1bf8f02b0770 | 78 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 79 | * |
redbird | 0:1bf8f02b0770 | 80 | * Skinning property indices |
redbird | 0:1bf8f02b0770 | 81 | */ |
redbird | 0:1bf8f02b0770 | 82 | #define BUTTON_SKINFLEX_PI_PRESSED 0 |
redbird | 0:1bf8f02b0770 | 83 | #define BUTTON_SKINFLEX_PI_FOCUSSED 1 |
redbird | 0:1bf8f02b0770 | 84 | #define BUTTON_SKINFLEX_PI_ENABLED 2 |
redbird | 0:1bf8f02b0770 | 85 | #define BUTTON_SKINFLEX_PI_DISABLED 3 |
redbird | 0:1bf8f02b0770 | 86 | |
redbird | 0:1bf8f02b0770 | 87 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 88 | * |
redbird | 0:1bf8f02b0770 | 89 | * Types |
redbird | 0:1bf8f02b0770 | 90 | * |
redbird | 0:1bf8f02b0770 | 91 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 92 | */ |
redbird | 0:1bf8f02b0770 | 93 | typedef WM_HMEM BUTTON_Handle; |
redbird | 0:1bf8f02b0770 | 94 | |
redbird | 0:1bf8f02b0770 | 95 | typedef struct { |
redbird | 0:1bf8f02b0770 | 96 | GUI_COLOR aColorFrame[3]; |
redbird | 0:1bf8f02b0770 | 97 | GUI_COLOR aColorUpper[2]; |
redbird | 0:1bf8f02b0770 | 98 | GUI_COLOR aColorLower[2]; |
redbird | 0:1bf8f02b0770 | 99 | int Radius; |
redbird | 0:1bf8f02b0770 | 100 | } BUTTON_SKINFLEX_PROPS; |
redbird | 0:1bf8f02b0770 | 101 | |
redbird | 0:1bf8f02b0770 | 102 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 103 | * |
redbird | 0:1bf8f02b0770 | 104 | * Create function(s) |
redbird | 0:1bf8f02b0770 | 105 | |
redbird | 0:1bf8f02b0770 | 106 | Note: the parameters to a create function may vary. |
redbird | 0:1bf8f02b0770 | 107 | Some widgets may have multiple create functions |
redbird | 0:1bf8f02b0770 | 108 | */ |
redbird | 0:1bf8f02b0770 | 109 | |
redbird | 0:1bf8f02b0770 | 110 | BUTTON_Handle BUTTON_Create (int x0, int y0, int xSize, int ySize, int ID, int Flags); |
redbird | 0:1bf8f02b0770 | 111 | BUTTON_Handle BUTTON_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int Id, int Flags); |
redbird | 0:1bf8f02b0770 | 112 | BUTTON_Handle BUTTON_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id); |
redbird | 0:1bf8f02b0770 | 113 | BUTTON_Handle BUTTON_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes); |
redbird | 0:1bf8f02b0770 | 114 | BUTTON_Handle BUTTON_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb); |
redbird | 0:1bf8f02b0770 | 115 | |
redbird | 0:1bf8f02b0770 | 116 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 117 | * |
redbird | 0:1bf8f02b0770 | 118 | * Standard member functions |
redbird | 0:1bf8f02b0770 | 119 | * |
redbird | 0:1bf8f02b0770 | 120 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 121 | */ |
redbird | 0:1bf8f02b0770 | 122 | GUI_COLOR BUTTON_GetDefaultBkColor (unsigned Index); |
redbird | 0:1bf8f02b0770 | 123 | const GUI_FONT * BUTTON_GetDefaultFont (void); |
redbird | 0:1bf8f02b0770 | 124 | int BUTTON_GetDefaultTextAlign (void); |
redbird | 0:1bf8f02b0770 | 125 | GUI_COLOR BUTTON_GetDefaultTextColor (unsigned Index); |
redbird | 0:1bf8f02b0770 | 126 | void BUTTON_SetDefaultBkColor (GUI_COLOR Color, unsigned Index); |
redbird | 0:1bf8f02b0770 | 127 | GUI_COLOR BUTTON_SetDefaultFocusColor(GUI_COLOR Color); |
redbird | 0:1bf8f02b0770 | 128 | void BUTTON_SetDefaultFont (const GUI_FONT * pFont); |
redbird | 0:1bf8f02b0770 | 129 | void BUTTON_SetDefaultTextAlign (int Align); |
redbird | 0:1bf8f02b0770 | 130 | void BUTTON_SetDefaultTextColor (GUI_COLOR Color, unsigned Index); |
redbird | 0:1bf8f02b0770 | 131 | |
redbird | 0:1bf8f02b0770 | 132 | #define BUTTON_EnableMemdev(hObj) WM_EnableMemdev (hObj) |
redbird | 0:1bf8f02b0770 | 133 | #define BUTTON_DisableMemdev(hObj) WM_DisableMemdev (hObj) |
redbird | 0:1bf8f02b0770 | 134 | #define BUTTON_Delete(hObj) WM_DeleteWindow (hObj) |
redbird | 0:1bf8f02b0770 | 135 | #define BUTTON_Paint(hObj) WM_Paint (hObj) |
redbird | 0:1bf8f02b0770 | 136 | #define BUTTON_Invalidate(hObj) WM_InvalidateWindow(hObj) |
redbird | 0:1bf8f02b0770 | 137 | |
redbird | 0:1bf8f02b0770 | 138 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 139 | * |
redbird | 0:1bf8f02b0770 | 140 | * The callback ... |
redbird | 0:1bf8f02b0770 | 141 | * |
redbird | 0:1bf8f02b0770 | 142 | * Do not call it directly ! It is only to be used from within an |
redbird | 0:1bf8f02b0770 | 143 | * overwritten callback. |
redbird | 0:1bf8f02b0770 | 144 | */ |
redbird | 0:1bf8f02b0770 | 145 | void BUTTON_Callback(WM_MESSAGE *pMsg); |
redbird | 0:1bf8f02b0770 | 146 | |
redbird | 0:1bf8f02b0770 | 147 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 148 | * |
redbird | 0:1bf8f02b0770 | 149 | * Member functions |
redbird | 0:1bf8f02b0770 | 150 | * |
redbird | 0:1bf8f02b0770 | 151 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 152 | */ |
redbird | 0:1bf8f02b0770 | 153 | GUI_COLOR BUTTON_GetBkColor (BUTTON_Handle hObj, unsigned int Index); |
redbird | 0:1bf8f02b0770 | 154 | const GUI_BITMAP * BUTTON_GetBitmap(BUTTON_Handle hObj,unsigned int Index); |
redbird | 0:1bf8f02b0770 | 155 | const GUI_FONT * BUTTON_GetFont (BUTTON_Handle hObj); |
redbird | 0:1bf8f02b0770 | 156 | GUI_COLOR BUTTON_GetFrameColor (BUTTON_Handle hObj); |
redbird | 0:1bf8f02b0770 | 157 | WIDGET * BUTTON_GetpWidget (BUTTON_Handle hObj); |
redbird | 0:1bf8f02b0770 | 158 | void BUTTON_GetText (BUTTON_Handle hObj, char * pBuffer, int MaxLen); |
redbird | 0:1bf8f02b0770 | 159 | GUI_COLOR BUTTON_GetTextColor (BUTTON_Handle hObj, unsigned int Index); |
redbird | 0:1bf8f02b0770 | 160 | int BUTTON_GetTextAlign (BUTTON_Handle hObj); |
redbird | 0:1bf8f02b0770 | 161 | int BUTTON_GetUserData (BUTTON_Handle hObj, void * pDest, int NumBytes); |
redbird | 0:1bf8f02b0770 | 162 | unsigned BUTTON_IsPressed (BUTTON_Handle hObj); |
redbird | 0:1bf8f02b0770 | 163 | void BUTTON_SetBitmap (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap); |
redbird | 0:1bf8f02b0770 | 164 | void BUTTON_SetBitmapEx (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap, int x, int y); |
redbird | 0:1bf8f02b0770 | 165 | void BUTTON_SetBkColor (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color); |
redbird | 0:1bf8f02b0770 | 166 | void BUTTON_SetBMP (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap); |
redbird | 0:1bf8f02b0770 | 167 | void BUTTON_SetBMPEx (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap, int x, int y); |
redbird | 0:1bf8f02b0770 | 168 | void BUTTON_SetFont (BUTTON_Handle hObj, const GUI_FONT * pfont); |
redbird | 0:1bf8f02b0770 | 169 | void BUTTON_SetFrameColor (BUTTON_Handle hObj, GUI_COLOR Color); |
redbird | 0:1bf8f02b0770 | 170 | void BUTTON_SetState (BUTTON_Handle hObj, int State); /* Not to be doc. */ |
redbird | 0:1bf8f02b0770 | 171 | void BUTTON_SetPressed (BUTTON_Handle hObj, int State); |
redbird | 0:1bf8f02b0770 | 172 | GUI_COLOR BUTTON_SetFocusColor (BUTTON_Handle hObj, GUI_COLOR Color); |
redbird | 0:1bf8f02b0770 | 173 | void BUTTON_SetFocussable (BUTTON_Handle hObj, int State); |
redbird | 0:1bf8f02b0770 | 174 | void BUTTON_SetStreamedBitmap (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap); |
redbird | 0:1bf8f02b0770 | 175 | void BUTTON_SetStreamedBitmapEx(BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap, int x, int y); |
redbird | 0:1bf8f02b0770 | 176 | int BUTTON_SetText (BUTTON_Handle hObj, const char* s); |
redbird | 0:1bf8f02b0770 | 177 | void BUTTON_SetTextAlign (BUTTON_Handle hObj, int Align); |
redbird | 0:1bf8f02b0770 | 178 | void BUTTON_SetTextColor (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color); |
redbird | 0:1bf8f02b0770 | 179 | void BUTTON_SetTextOffset (BUTTON_Handle hObj, int xPos, int yPos); |
redbird | 0:1bf8f02b0770 | 180 | void BUTTON_SetSelfDrawEx (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw, int x, int y); /* Not to be doc. */ |
redbird | 0:1bf8f02b0770 | 181 | void BUTTON_SetSelfDraw (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw); /* Not to be doc. */ |
redbird | 0:1bf8f02b0770 | 182 | void BUTTON_SetReactOnLevel (void); |
redbird | 0:1bf8f02b0770 | 183 | void BUTTON_SetReactOnTouch (void); |
redbird | 0:1bf8f02b0770 | 184 | int BUTTON_SetUserData (BUTTON_Handle hObj, const void * pSrc, int NumBytes); |
redbird | 0:1bf8f02b0770 | 185 | |
redbird | 0:1bf8f02b0770 | 186 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 187 | * |
redbird | 0:1bf8f02b0770 | 188 | * Member functions: Skinning |
redbird | 0:1bf8f02b0770 | 189 | * |
redbird | 0:1bf8f02b0770 | 190 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 191 | */ |
redbird | 0:1bf8f02b0770 | 192 | void BUTTON_GetSkinFlexProps (BUTTON_SKINFLEX_PROPS * pProps, int Index); |
redbird | 0:1bf8f02b0770 | 193 | void BUTTON_SetSkinClassic (BUTTON_Handle hObj); |
redbird | 0:1bf8f02b0770 | 194 | void BUTTON_SetSkin (BUTTON_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin); |
redbird | 0:1bf8f02b0770 | 195 | int BUTTON_DrawSkinFlex (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo); |
redbird | 0:1bf8f02b0770 | 196 | void BUTTON_SetSkinFlexProps (const BUTTON_SKINFLEX_PROPS * pProps, int Index); |
redbird | 0:1bf8f02b0770 | 197 | void BUTTON_SetDefaultSkinClassic(void); |
redbird | 0:1bf8f02b0770 | 198 | WIDGET_DRAW_ITEM_FUNC * BUTTON_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin); |
redbird | 0:1bf8f02b0770 | 199 | |
redbird | 0:1bf8f02b0770 | 200 | #define BUTTON_SKIN_FLEX BUTTON_DrawSkinFlex |
redbird | 0:1bf8f02b0770 | 201 | |
redbird | 0:1bf8f02b0770 | 202 | #if defined(__cplusplus) |
redbird | 0:1bf8f02b0770 | 203 | } |
redbird | 0:1bf8f02b0770 | 204 | #endif |
redbird | 0:1bf8f02b0770 | 205 | |
redbird | 0:1bf8f02b0770 | 206 | #endif // GUI_WINSUPPORT |
redbird | 0:1bf8f02b0770 | 207 | #endif // BUTTON_H |
redbird | 0:1bf8f02b0770 | 208 | |
redbird | 0:1bf8f02b0770 | 209 | /*************************** End of file ****************************/ |