NuMaker emWin HMI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EDIT.h Source File

EDIT.h

00001 /*********************************************************************
00002 *                 SEGGER Software 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 by SEGGER Software GmbH to Nuvoton Technology Corporationat the address: No. 4, Creation Rd. III, Hsinchu Science Park, Taiwan
00019 for the purposes  of  creating  libraries  for its 
00020 Arm Cortex-M and  Arm9 32-bit microcontrollers, commercialized and distributed by Nuvoton Technology Corporation
00021 under  the terms and conditions  of  an  End  User  
00022 License  Agreement  supplied  with  the libraries.
00023 Full source code is available at: www.segger.com
00024 
00025 We appreciate your understanding and fairness.
00026 ----------------------------------------------------------------------
00027 Licensing information
00028 Licensor:                 SEGGER Software GmbH
00029 Licensed to:              Nuvoton Technology Corporation, No. 4, Creation Rd. III, Hsinchu Science Park, 30077 Hsinchu City, Taiwan
00030 Licensed SEGGER software: emWin
00031 License number:           GUI-00735
00032 License model:            emWin License Agreement, signed February 27, 2018
00033 Licensed platform:        Cortex-M and ARM9 32-bit series microcontroller designed and manufactured by or for Nuvoton Technology Corporation
00034 ----------------------------------------------------------------------
00035 Support and Update Agreement (SUA)
00036 SUA period:               2018-03-26 - 2019-03-27
00037 Contact to extend SUA:    sales@segger.com
00038 ----------------------------------------------------------------------
00039 File        : EDIT.h
00040 Purpose     : EDIT include
00041 --------------------END-OF-HEADER-------------------------------------
00042 */
00043 
00044 #ifndef EDIT_H
00045 #define EDIT_H
00046 
00047 #include "WM.h"
00048 #include "DIALOG_Intern.h" // Required for Create indirect data structure
00049 
00050 #if GUI_WINSUPPORT
00051 
00052 #if defined(__cplusplus)
00053   extern "C" {             // Make sure we have C-declarations in C++ programs
00054 #endif
00055 
00056 /*********************************************************************
00057 *
00058 *       Defaults for configuration switches
00059 *
00060 *  The following are defaults for config switches which affect the
00061 *  interface specified in this module
00062 *
00063 **********************************************************************
00064 */
00065 /*********************************************************************
00066 *
00067 *       Defines
00068 *
00069 **********************************************************************
00070 */
00071 //
00072 // Create / Status flags
00073 //
00074 #define EDIT_CF_LEFT    GUI_TA_LEFT
00075 #define EDIT_CF_RIGHT   GUI_TA_RIGHT
00076 #define EDIT_CF_HCENTER GUI_TA_HCENTER
00077 #define EDIT_CF_VCENTER GUI_TA_VCENTER
00078 #define EDIT_CF_TOP     GUI_TA_TOP
00079 #define EDIT_CF_BOTTOM  GUI_TA_BOTTOM
00080 
00081 //
00082 // Color indices
00083 //
00084 #define EDIT_CI_DISABLED 0
00085 #define EDIT_CI_ENABLED  1
00086 #define EDIT_CI_CURSOR   2
00087 
00088 //
00089 // Signed or normal mode
00090 //
00091 #define GUI_EDIT_NORMAL                  (0 << 0)
00092 #define GUI_EDIT_SIGNED                  (1 << 0)
00093 #define GUI_EDIT_SUPPRESS_LEADING_ZEROES (1 << 1)
00094 
00095 //
00096 // Cursor coloring
00097 //
00098 #define GUI_EDIT_SHOWCURSOR              (1 << 2)
00099 #define GUI_EDIT_CUSTCOLORMODE           (1 << 3)
00100 #define GUI_EDIT_CURSORBLINK             (1 << 4)
00101 
00102 //
00103 // Edit modes
00104 //
00105 #define GUI_EDIT_MODE_INSERT    0
00106 #define GUI_EDIT_MODE_OVERWRITE 1
00107 
00108 //
00109 // Compatibility macros
00110 //
00111 #define EDIT_CI_DISABELD EDIT_CI_DISABLED
00112 #define EDIT_CI_ENABELD  EDIT_CI_ENABLED
00113 
00114 /*********************************************************************
00115 *
00116 *       Types
00117 *
00118 **********************************************************************
00119 */
00120 typedef WM_HMEM EDIT_Handle;
00121 typedef void tEDIT_AddKeyEx    (EDIT_Handle hObj, int Key);
00122 typedef void tEDIT_UpdateBuffer(EDIT_Handle hObj);
00123 
00124 /*********************************************************************
00125 *
00126 *             Create functions
00127 */
00128 EDIT_Handle EDIT_Create        (int x0, int y0, int xSize, int ySize, int Id, int MaxLen, int Flags);
00129 EDIT_Handle EDIT_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int Id, int Flags, int MaxLen);
00130 EDIT_Handle EDIT_CreateEx      (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int MaxLen);
00131 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);
00132 EDIT_Handle EDIT_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
00133 
00134 /*********************************************************************
00135 *
00136 *       The callback ...
00137 *
00138 * Do not call it directly ! It is only to be used from within an
00139 * overwritten callback.
00140 */
00141 void EDIT_Callback(WM_MESSAGE * pMsg);
00142 
00143 /*********************************************************************
00144 *
00145 *       Managing default values
00146 *
00147 **********************************************************************
00148 */
00149 void EDIT_SetDefaultBkColor  (unsigned int Index, GUI_COLOR Color);
00150 void EDIT_SetDefaultFont     (const GUI_FONT * pFont);
00151 void EDIT_SetDefaultTextAlign(int Align);
00152 void EDIT_SetDefaultTextColor(unsigned int Index, GUI_COLOR Color);
00153 
00154 /*********************************************************************
00155 *
00156 *             Individual member functions
00157 */
00158 //
00159 // Query preferences
00160 //
00161 GUI_COLOR        EDIT_GetDefaultBkColor(unsigned int Index);
00162 const GUI_FONT * EDIT_GetDefaultFont(void);
00163 int              EDIT_GetDefaultTextAlign(void);
00164 GUI_COLOR        EDIT_GetDefaultTextColor(unsigned int Index);
00165 //
00166 // Methods changing properties
00167 //
00168 void EDIT_AddKey           (EDIT_Handle hObj, int Key);
00169 void EDIT_EnableBlink      (EDIT_Handle hObj, int Period, int OnOff);
00170 GUI_COLOR EDIT_GetBkColor  (EDIT_Handle hObj, unsigned int Index);
00171 void EDIT_SetBkColor       (EDIT_Handle hObj, unsigned int Index, GUI_COLOR color);
00172 void EDIT_SetCursorAtChar  (EDIT_Handle hObj, int Pos);
00173 void EDIT_SetCursorAtPixel (EDIT_Handle hObj, int xPos);
00174 void EDIT_SetFont          (EDIT_Handle hObj, const GUI_FONT * pFont);
00175 int  EDIT_SetInsertMode    (EDIT_Handle hObj, int OnOff);
00176 void EDIT_SetMaxLen        (EDIT_Handle hObj, int MaxLen);
00177 void EDIT_SetpfAddKeyEx    (EDIT_Handle hObj, tEDIT_AddKeyEx * pfAddKeyEx);
00178 void EDIT_SetpfUpdateBuffer(EDIT_Handle hObj, tEDIT_UpdateBuffer * pfUpdateBuffer);
00179 void EDIT_SetText          (EDIT_Handle hObj, const char * s);
00180 void EDIT_SetTextAlign     (EDIT_Handle hObj, int Align);
00181 GUI_COLOR EDIT_GetTextColor(EDIT_Handle hObj, unsigned int Index);
00182 void EDIT_SetTextColor     (EDIT_Handle hObj, unsigned int Index, GUI_COLOR Color);
00183 void EDIT_SetSel           (EDIT_Handle hObj, int FirstChar, int LastChar);
00184 int  EDIT_SetUserData      (EDIT_Handle hObj, const void * pSrc, int NumBytes);
00185 int  EDIT_EnableInversion  (EDIT_Handle hObj, int OnOff);
00186 //
00187 // Get/Set user input
00188 //
00189 int   EDIT_GetCursorCharPos  (EDIT_Handle hObj);
00190 void  EDIT_GetCursorPixelPos (EDIT_Handle hObj, int * pxPos, int * pyPos);
00191 float EDIT_GetFloatValue     (EDIT_Handle hObj);
00192 const GUI_FONT * EDIT_GetFont(EDIT_Handle hObj);
00193 int   EDIT_GetNumChars       (EDIT_Handle hObj);
00194 void  EDIT_GetText           (EDIT_Handle hObj, char * sDest, int MaxLen);
00195 int   EDIT_GetTextAlign      (EDIT_Handle hObj);
00196 I32   EDIT_GetValue          (EDIT_Handle hObj);
00197 void  EDIT_SetFloatValue     (EDIT_Handle hObj, float Value);
00198 int   EDIT_GetUserData       (EDIT_Handle hObj, void * pDest, int NumBytes);
00199 void  EDIT_SetValue          (EDIT_Handle hObj, I32 Value);
00200 
00201 #define EDIT_SetFocussable EDIT_SetFocusable
00202 #define EDIT_SetFocusable  WIDGET_SetFocusable
00203 
00204 /*********************************************************************
00205 *
00206 *             Routines for editing values
00207 *
00208 **********************************************************************
00209 */
00210 void  EDIT_SetHexMode  (EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max);
00211 void  EDIT_SetBinMode  (EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max);
00212 void  EDIT_SetDecMode  (EDIT_Handle hEdit, I32 Value, I32 Min, I32 Max, int Shift, U8 Flags);
00213 void  EDIT_SetFloatMode(EDIT_Handle hEdit, float Value, float Min, float Max, int Shift, U8 Flags);
00214 void  EDIT_SetTextMode (EDIT_Handle hEdit);
00215 void  EDIT_SetUlongMode(EDIT_Handle hEdit, U32 Value, U32 Min, U32 Max);
00216 
00217 U32   GUI_EditHex      (U32 Value, U32 Min, U32 Max, int Len, int xSize);
00218 U32   GUI_EditBin      (U32 Value, U32 Min, U32 Max, int Len, int xSize);
00219 I32   GUI_EditDec      (I32 Value, I32 Min, I32 Max, int Len, int xSize, int Shift, U8 Flags);
00220 float GUI_EditFloat    (float Value, float Min, float Max, int Len, int xSize, int Shift, U8 Flags);
00221 void  GUI_EditString   (char * pString, int Len, int xSize);
00222 
00223 #if defined(__cplusplus)
00224   }
00225 #endif
00226 
00227 #endif  // GUI_WINSUPPORT
00228 #endif  // EDIT_H
00229 
00230 /*************************** End of file ****************************/