
RT1050 GUI demo using emWin library
emwin/emWin_header/EDIT.h@0:dd702039127a, 2018-09-20 (annotated)
- Committer:
- alejandroRL
- Date:
- Thu Sep 20 19:16:34 2018 +0000
- Revision:
- 0:dd702039127a
emWin GUI Demo for RT1050
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alejandroRL | 0:dd702039127a | 1 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 2 | * SEGGER Microcontroller GmbH & Co. KG * |
alejandroRL | 0:dd702039127a | 3 | * Solutions for real time microcontroller applications * |
alejandroRL | 0:dd702039127a | 4 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 5 | * * |
alejandroRL | 0:dd702039127a | 6 | * (c) 1996 - 2016 SEGGER Microcontroller GmbH & Co. KG * |
alejandroRL | 0:dd702039127a | 7 | * * |
alejandroRL | 0:dd702039127a | 8 | * Internet: www.segger.com Support: support@segger.com * |
alejandroRL | 0:dd702039127a | 9 | * * |
alejandroRL | 0:dd702039127a | 10 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 11 | |
alejandroRL | 0:dd702039127a | 12 | ** emWin V5.38 - Graphical user interface for embedded applications ** |
alejandroRL | 0:dd702039127a | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
alejandroRL | 0:dd702039127a | 14 | emWin is protected by international copyright laws. Knowledge of the |
alejandroRL | 0:dd702039127a | 15 | source code may not be used to write a similar product. This file may |
alejandroRL | 0:dd702039127a | 16 | only be used in accordance with the following terms: |
alejandroRL | 0:dd702039127a | 17 | |
alejandroRL | 0:dd702039127a | 18 | The software has been licensed to NXP Semiconductors USA, Inc. whose |
alejandroRL | 0:dd702039127a | 19 | registered office is situated at 411 E. Plumeria Drive, San Jose, |
alejandroRL | 0:dd702039127a | 20 | CA 95134, USA solely for the purposes of creating libraries for |
alejandroRL | 0:dd702039127a | 21 | NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and |
alejandroRL | 0:dd702039127a | 22 | distributed under the terms and conditions of the NXP End User License |
alejandroRL | 0:dd702039127a | 23 | Agreement. |
alejandroRL | 0:dd702039127a | 24 | Full source code is available at: www.segger.com |
alejandroRL | 0:dd702039127a | 25 | |
alejandroRL | 0:dd702039127a | 26 | We appreciate your understanding and fairness. |
alejandroRL | 0:dd702039127a | 27 | ---------------------------------------------------------------------- |
alejandroRL | 0:dd702039127a | 28 | Licensing information |
alejandroRL | 0:dd702039127a | 29 | |
alejandroRL | 0:dd702039127a | 30 | Licensor: SEGGER Microcontroller Systems LLC |
alejandroRL | 0:dd702039127a | 31 | Licensed to: NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA |
alejandroRL | 0:dd702039127a | 32 | Licensed SEGGER software: emWin |
alejandroRL | 0:dd702039127a | 33 | License number: GUI-00186 |
alejandroRL | 0:dd702039127a | 34 | License model: emWin License Agreement, dated August 20th 2011 |
alejandroRL | 0:dd702039127a | 35 | Licensed product: - |
alejandroRL | 0:dd702039127a | 36 | Licensed platform: NXP's ARM 7/9, Cortex-M0,M3,M4 |
alejandroRL | 0:dd702039127a | 37 | Licensed number of seats: - |
alejandroRL | 0:dd702039127a | 38 | ---------------------------------------------------------------------- |
alejandroRL | 0:dd702039127a | 39 | File : EDIT.h |
alejandroRL | 0:dd702039127a | 40 | Purpose : EDIT include |
alejandroRL | 0:dd702039127a | 41 | --------------------END-OF-HEADER------------------------------------- |
alejandroRL | 0:dd702039127a | 42 | */ |
alejandroRL | 0:dd702039127a | 43 | |
alejandroRL | 0:dd702039127a | 44 | #ifndef EDIT_H |
alejandroRL | 0:dd702039127a | 45 | #define EDIT_H |
alejandroRL | 0:dd702039127a | 46 | |
alejandroRL | 0:dd702039127a | 47 | #include "WM.h" |
alejandroRL | 0:dd702039127a | 48 | #include "DIALOG_Intern.h" // Required for Create indirect data structure |
alejandroRL | 0:dd702039127a | 49 | |
alejandroRL | 0:dd702039127a | 50 | #if GUI_WINSUPPORT |
alejandroRL | 0:dd702039127a | 51 | |
alejandroRL | 0:dd702039127a | 52 | #if defined(__cplusplus) |
alejandroRL | 0:dd702039127a | 53 | extern "C" { // Make sure we have C-declarations in C++ programs |
alejandroRL | 0:dd702039127a | 54 | #endif |
alejandroRL | 0:dd702039127a | 55 | |
alejandroRL | 0:dd702039127a | 56 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 57 | * |
alejandroRL | 0:dd702039127a | 58 | * Defaults for configuration switches |
alejandroRL | 0:dd702039127a | 59 | * |
alejandroRL | 0:dd702039127a | 60 | * The following are defaults for config switches which affect the |
alejandroRL | 0:dd702039127a | 61 | * interface specified in this module |
alejandroRL | 0:dd702039127a | 62 | * |
alejandroRL | 0:dd702039127a | 63 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 64 | */ |
alejandroRL | 0:dd702039127a | 65 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 66 | * |
alejandroRL | 0:dd702039127a | 67 | * Defines |
alejandroRL | 0:dd702039127a | 68 | * |
alejandroRL | 0:dd702039127a | 69 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 70 | */ |
alejandroRL | 0:dd702039127a | 71 | // |
alejandroRL | 0:dd702039127a | 72 | // Create / Status flags |
alejandroRL | 0:dd702039127a | 73 | // |
alejandroRL | 0:dd702039127a | 74 | #define EDIT_CF_LEFT GUI_TA_LEFT |
alejandroRL | 0:dd702039127a | 75 | #define EDIT_CF_RIGHT GUI_TA_RIGHT |
alejandroRL | 0:dd702039127a | 76 | #define EDIT_CF_HCENTER GUI_TA_HCENTER |
alejandroRL | 0:dd702039127a | 77 | #define EDIT_CF_VCENTER GUI_TA_VCENTER |
alejandroRL | 0:dd702039127a | 78 | #define EDIT_CF_TOP GUI_TA_TOP |
alejandroRL | 0:dd702039127a | 79 | #define EDIT_CF_BOTTOM GUI_TA_BOTTOM |
alejandroRL | 0:dd702039127a | 80 | |
alejandroRL | 0:dd702039127a | 81 | // |
alejandroRL | 0:dd702039127a | 82 | // Color indices |
alejandroRL | 0:dd702039127a | 83 | // |
alejandroRL | 0:dd702039127a | 84 | #define EDIT_CI_DISABLED 0 |
alejandroRL | 0:dd702039127a | 85 | #define EDIT_CI_ENABLED 1 |
alejandroRL | 0:dd702039127a | 86 | #define EDIT_CI_CURSOR 2 |
alejandroRL | 0:dd702039127a | 87 | |
alejandroRL | 0:dd702039127a | 88 | // |
alejandroRL | 0:dd702039127a | 89 | // Signed or normal mode |
alejandroRL | 0:dd702039127a | 90 | // |
alejandroRL | 0:dd702039127a | 91 | #define GUI_EDIT_NORMAL (0 << 0) |
alejandroRL | 0:dd702039127a | 92 | #define GUI_EDIT_SIGNED (1 << 0) |
alejandroRL | 0:dd702039127a | 93 | #define GUI_EDIT_SUPPRESS_LEADING_ZEROES (1 << 1) |
alejandroRL | 0:dd702039127a | 94 | |
alejandroRL | 0:dd702039127a | 95 | // |
alejandroRL | 0:dd702039127a | 96 | // Cursor coloring |
alejandroRL | 0:dd702039127a | 97 | // |
alejandroRL | 0:dd702039127a | 98 | #define GUI_EDIT_SHOWCURSOR (1 << 2) |
alejandroRL | 0:dd702039127a | 99 | #define GUI_EDIT_CUSTCOLORMODE (1 << 3) |
alejandroRL | 0:dd702039127a | 100 | |
alejandroRL | 0:dd702039127a | 101 | // |
alejandroRL | 0:dd702039127a | 102 | // Edit modes |
alejandroRL | 0:dd702039127a | 103 | // |
alejandroRL | 0:dd702039127a | 104 | #define GUI_EDIT_MODE_INSERT 0 |
alejandroRL | 0:dd702039127a | 105 | #define GUI_EDIT_MODE_OVERWRITE 1 |
alejandroRL | 0:dd702039127a | 106 | |
alejandroRL | 0:dd702039127a | 107 | // |
alejandroRL | 0:dd702039127a | 108 | // Compatibility macros |
alejandroRL | 0:dd702039127a | 109 | // |
alejandroRL | 0:dd702039127a | 110 | #define EDIT_CI_DISABELD EDIT_CI_DISABLED |
alejandroRL | 0:dd702039127a | 111 | #define EDIT_CI_ENABELD EDIT_CI_ENABLED |
alejandroRL | 0:dd702039127a | 112 | |
alejandroRL | 0:dd702039127a | 113 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 114 | * |
alejandroRL | 0:dd702039127a | 115 | * Types |
alejandroRL | 0:dd702039127a | 116 | * |
alejandroRL | 0:dd702039127a | 117 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 118 | */ |
alejandroRL | 0:dd702039127a | 119 | typedef WM_HMEM EDIT_Handle; |
alejandroRL | 0:dd702039127a | 120 | typedef void tEDIT_AddKeyEx (EDIT_Handle hObj, int Key); |
alejandroRL | 0:dd702039127a | 121 | typedef void tEDIT_UpdateBuffer(EDIT_Handle hObj); |
alejandroRL | 0:dd702039127a | 122 | |
alejandroRL | 0:dd702039127a | 123 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 124 | * |
alejandroRL | 0:dd702039127a | 125 | * Create functions |
alejandroRL | 0:dd702039127a | 126 | */ |
alejandroRL | 0:dd702039127a | 127 | EDIT_Handle EDIT_Create (int x0, int y0, int xSize, int ySize, int Id, int MaxLen, int Flags); |
alejandroRL | 0:dd702039127a | 128 | EDIT_Handle EDIT_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int Id, int Flags, int MaxLen); |
alejandroRL | 0:dd702039127a | 129 | EDIT_Handle EDIT_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int MaxLen); |
alejandroRL | 0:dd702039127a | 130 | EDIT_Handle EDIT_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int MaxLen, int NumExtraBytes); |
alejandroRL | 0:dd702039127a | 131 | EDIT_Handle EDIT_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb); |
alejandroRL | 0:dd702039127a | 132 | |
alejandroRL | 0:dd702039127a | 133 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 134 | * |
alejandroRL | 0:dd702039127a | 135 | * The callback ... |
alejandroRL | 0:dd702039127a | 136 | * |
alejandroRL | 0:dd702039127a | 137 | * Do not call it directly ! It is only to be used from within an |
alejandroRL | 0:dd702039127a | 138 | * overwritten callback. |
alejandroRL | 0:dd702039127a | 139 | */ |
alejandroRL | 0:dd702039127a | 140 | void EDIT_Callback(WM_MESSAGE * pMsg); |
alejandroRL | 0:dd702039127a | 141 | |
alejandroRL | 0:dd702039127a | 142 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 143 | * |
alejandroRL | 0:dd702039127a | 144 | * Managing default values |
alejandroRL | 0:dd702039127a | 145 | * |
alejandroRL | 0:dd702039127a | 146 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 147 | */ |
alejandroRL | 0:dd702039127a | 148 | void EDIT_SetDefaultBkColor (unsigned int Index, GUI_COLOR Color); |
alejandroRL | 0:dd702039127a | 149 | void EDIT_SetDefaultFont (const GUI_FONT * pFont); |
alejandroRL | 0:dd702039127a | 150 | void EDIT_SetDefaultTextAlign(int Align); |
alejandroRL | 0:dd702039127a | 151 | void EDIT_SetDefaultTextColor(unsigned int Index, GUI_COLOR Color); |
alejandroRL | 0:dd702039127a | 152 | |
alejandroRL | 0:dd702039127a | 153 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 154 | * |
alejandroRL | 0:dd702039127a | 155 | * Individual member functions |
alejandroRL | 0:dd702039127a | 156 | */ |
alejandroRL | 0:dd702039127a | 157 | // |
alejandroRL | 0:dd702039127a | 158 | // Query preferences |
alejandroRL | 0:dd702039127a | 159 | // |
alejandroRL | 0:dd702039127a | 160 | GUI_COLOR EDIT_GetDefaultBkColor(unsigned int Index); |
alejandroRL | 0:dd702039127a | 161 | const GUI_FONT * EDIT_GetDefaultFont(void); |
alejandroRL | 0:dd702039127a | 162 | int EDIT_GetDefaultTextAlign(void); |
alejandroRL | 0:dd702039127a | 163 | GUI_COLOR EDIT_GetDefaultTextColor(unsigned int Index); |
alejandroRL | 0:dd702039127a | 164 | // |
alejandroRL | 0:dd702039127a | 165 | // Methods changing properties |
alejandroRL | 0:dd702039127a | 166 | // |
alejandroRL | 0:dd702039127a | 167 | void EDIT_AddKey (EDIT_Handle hObj, int Key); |
alejandroRL | 0:dd702039127a | 168 | void EDIT_EnableBlink (EDIT_Handle hObj, int Period, int OnOff); |
alejandroRL | 0:dd702039127a | 169 | GUI_COLOR EDIT_GetBkColor (EDIT_Handle hObj, unsigned int Index); |
alejandroRL | 0:dd702039127a | 170 | void EDIT_SetBkColor (EDIT_Handle hObj, unsigned int Index, GUI_COLOR color); |
alejandroRL | 0:dd702039127a | 171 | void EDIT_SetCursorAtChar (EDIT_Handle hObj, int Pos); |
alejandroRL | 0:dd702039127a | 172 | void EDIT_SetCursorAtPixel (EDIT_Handle hObj, int xPos); |
alejandroRL | 0:dd702039127a | 173 | void EDIT_SetFocussable (EDIT_Handle hObj, int State); |
alejandroRL | 0:dd702039127a | 174 | void EDIT_SetFont (EDIT_Handle hObj, const GUI_FONT * pFont); |
alejandroRL | 0:dd702039127a | 175 | int EDIT_SetInsertMode (EDIT_Handle hObj, int OnOff); |
alejandroRL | 0:dd702039127a | 176 | void EDIT_SetMaxLen (EDIT_Handle hObj, int MaxLen); |
alejandroRL | 0:dd702039127a | 177 | void EDIT_SetpfAddKeyEx (EDIT_Handle hObj, tEDIT_AddKeyEx * pfAddKeyEx); |
alejandroRL | 0:dd702039127a | 178 | void EDIT_SetpfUpdateBuffer(EDIT_Handle hObj, tEDIT_UpdateBuffer * pfUpdateBuffer); |
alejandroRL | 0:dd702039127a | 179 | void EDIT_SetText (EDIT_Handle hObj, const char * s); |
alejandroRL | 0:dd702039127a | 180 | void EDIT_SetTextAlign (EDIT_Handle hObj, int Align); |
alejandroRL | 0:dd702039127a | 181 | GUI_COLOR EDIT_GetTextColor(EDIT_Handle hObj, unsigned int Index); |
alejandroRL | 0:dd702039127a | 182 | void EDIT_SetTextColor (EDIT_Handle hObj, unsigned int Index, GUI_COLOR Color); |
alejandroRL | 0:dd702039127a | 183 | void EDIT_SetSel (EDIT_Handle hObj, int FirstChar, int LastChar); |
alejandroRL | 0:dd702039127a | 184 | int EDIT_SetUserData (EDIT_Handle hObj, const void * pSrc, int NumBytes); |
alejandroRL | 0:dd702039127a | 185 | int EDIT_EnableInversion (EDIT_Handle hObj, int OnOff); |
alejandroRL | 0:dd702039127a | 186 | // |
alejandroRL | 0:dd702039127a | 187 | // Get/Set user input |
alejandroRL | 0:dd702039127a | 188 | // |
alejandroRL | 0:dd702039127a | 189 | int EDIT_GetCursorCharPos (EDIT_Handle hObj); |
alejandroRL | 0:dd702039127a | 190 | void EDIT_GetCursorPixelPos (EDIT_Handle hObj, int * pxPos, int * pyPos); |
alejandroRL | 0:dd702039127a | 191 | float EDIT_GetFloatValue (EDIT_Handle hObj); |
alejandroRL | 0:dd702039127a | 192 | const GUI_FONT * EDIT_GetFont(EDIT_Handle hObj); |
alejandroRL | 0:dd702039127a | 193 | int EDIT_GetNumChars (EDIT_Handle hObj); |
alejandroRL | 0:dd702039127a | 194 | void EDIT_GetText (EDIT_Handle hObj, char * sDest, int MaxLen); |
alejandroRL | 0:dd702039127a | 195 | I32 EDIT_GetValue (EDIT_Handle hObj); |
alejandroRL | 0:dd702039127a | 196 | void EDIT_SetFloatValue (EDIT_Handle hObj, float Value); |
alejandroRL | 0:dd702039127a | 197 | int EDIT_GetUserData (EDIT_Handle hObj, void * pDest, int NumBytes); |
alejandroRL | 0:dd702039127a | 198 | void EDIT_SetValue (EDIT_Handle hObj, I32 Value); |
alejandroRL | 0:dd702039127a | 199 | |
alejandroRL | 0:dd702039127a | 200 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 201 | * |
alejandroRL | 0:dd702039127a | 202 | * Routines for editing values |
alejandroRL | 0:dd702039127a | 203 | * |
alejandroRL | 0:dd702039127a | 204 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 205 | */ |
alejandroRL | 0:dd702039127a | 206 | void EDIT_SetHexMode (EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max); |
alejandroRL | 0:dd702039127a | 207 | void EDIT_SetBinMode (EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max); |
alejandroRL | 0:dd702039127a | 208 | void EDIT_SetDecMode (EDIT_Handle hEdit, I32 Value, I32 Min, I32 Max, int Shift, U8 Flags); |
alejandroRL | 0:dd702039127a | 209 | void EDIT_SetFloatMode(EDIT_Handle hEdit, float Value, float Min, float Max, int Shift, U8 Flags); |
alejandroRL | 0:dd702039127a | 210 | void EDIT_SetTextMode (EDIT_Handle hEdit); |
alejandroRL | 0:dd702039127a | 211 | void EDIT_SetUlongMode(EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max); |
alejandroRL | 0:dd702039127a | 212 | |
alejandroRL | 0:dd702039127a | 213 | U32 GUI_EditHex (U32 Value, U32 Min, U32 Max, int Len, int xSize); |
alejandroRL | 0:dd702039127a | 214 | U32 GUI_EditBin (U32 Value, U32 Min, U32 Max, int Len, int xSize); |
alejandroRL | 0:dd702039127a | 215 | I32 GUI_EditDec (I32 Value, I32 Min, I32 Max, int Len, int xSize, int Shift, U8 Flags); |
alejandroRL | 0:dd702039127a | 216 | float GUI_EditFloat (float Value, float Min, float Max, int Len, int xSize, int Shift, U8 Flags); |
alejandroRL | 0:dd702039127a | 217 | void GUI_EditString (char * pString, int Len, int xSize); |
alejandroRL | 0:dd702039127a | 218 | |
alejandroRL | 0:dd702039127a | 219 | #if defined(__cplusplus) |
alejandroRL | 0:dd702039127a | 220 | } |
alejandroRL | 0:dd702039127a | 221 | #endif |
alejandroRL | 0:dd702039127a | 222 | |
alejandroRL | 0:dd702039127a | 223 | #endif // GUI_WINSUPPORT |
alejandroRL | 0:dd702039127a | 224 | #endif // EDIT_H |
alejandroRL | 0:dd702039127a | 225 | |
alejandroRL | 0:dd702039127a | 226 | /*************************** End of file ****************************/ |