NuMaker emWin HMI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BUTTON.h Source File

BUTTON.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        : BUTTON.h
00040 Purpose     : BUTTON public header file (API)
00041 --------------------END-OF-HEADER-------------------------------------
00042 */
00043 
00044 #ifndef BUTTON_H
00045 #define BUTTON_H
00046 
00047 #include "WM.h"
00048 #include "DIALOG_Intern.h"      /* Req. for Create indirect data structure */
00049 #include "WIDGET.h"
00050 
00051 #if GUI_WINSUPPORT
00052 
00053 #if defined(__cplusplus)
00054   extern "C" {     /* Make sure we have C-declarations in C++ programs */
00055 #endif
00056 
00057 /*********************************************************************
00058 *
00059 *       Create flags
00060 */
00061 /* For compatibility only ! */
00062 #define BUTTON_CF_HIDE   WM_CF_HIDE
00063 #define BUTTON_CF_SHOW   WM_CF_SHOW
00064 #define BUTTON_CF_MEMDEV WM_CF_MEMDEV
00065 
00066 /*********************************************************************
00067 *
00068 *       Color indices
00069 */
00070 #define BUTTON_CI_UNPRESSED 0
00071 #define BUTTON_CI_PRESSED   1
00072 #define BUTTON_CI_DISABLED  2
00073 
00074 /*********************************************************************
00075 *
00076 *       Bitmap indices
00077 */
00078 #define BUTTON_BI_UNPRESSED 0
00079 #define BUTTON_BI_PRESSED   1
00080 #define BUTTON_BI_DISABLED  2
00081 
00082 /*********************************************************************
00083 *
00084 *       States
00085 */
00086 #define BUTTON_STATE_FOCUS      WIDGET_STATE_FOCUS
00087 #define BUTTON_STATE_PRESSED    WIDGET_STATE_USER0
00088 
00089 /*********************************************************************
00090 *
00091 *       Skinning property indices
00092 */
00093 #define BUTTON_SKINFLEX_PI_PRESSED     0
00094 #define BUTTON_SKINFLEX_PI_FOCUSED     1
00095 #define BUTTON_SKINFLEX_PI_ENABLED     2
00096 #define BUTTON_SKINFLEX_PI_DISABLED    3
00097 
00098 #define BUTTON_SKINFLEX_PI_FOCUSSED BUTTON_SKINFLEX_PI_FOCUSED
00099 
00100 /*********************************************************************
00101 *
00102 *       Types
00103 *
00104 **********************************************************************
00105 */
00106 typedef WM_HMEM BUTTON_Handle;
00107 
00108 typedef struct {
00109   GUI_COLOR aColorFrame[3];
00110   GUI_COLOR aColorUpper[2];
00111   GUI_COLOR aColorLower[2];
00112   int Radius;
00113 } BUTTON_SKINFLEX_PROPS;
00114 
00115 /*********************************************************************
00116 *
00117 *       Create function(s)
00118 
00119   Note: the parameters to a create function may vary.
00120          Some widgets may have multiple create functions
00121 */
00122 
00123 BUTTON_Handle BUTTON_Create        (int x0, int y0, int xSize, int ySize, int ID, int Flags);
00124 BUTTON_Handle BUTTON_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int Id, int Flags);
00125 BUTTON_Handle BUTTON_CreateEx      (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id);
00126 BUTTON_Handle BUTTON_CreateUser    (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes);
00127 BUTTON_Handle BUTTON_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
00128 
00129 /*********************************************************************
00130 *
00131 *       Managing default values
00132 *
00133 **********************************************************************
00134 */
00135 GUI_COLOR        BUTTON_GetDefaultBkColor   (unsigned Index);
00136 const GUI_FONT * BUTTON_GetDefaultFont      (void);
00137 int              BUTTON_GetDefaultTextAlign (void);
00138 GUI_COLOR        BUTTON_GetDefaultTextColor (unsigned Index);
00139 void             BUTTON_SetDefaultBkColor   (GUI_COLOR Color, unsigned Index);
00140 GUI_COLOR        BUTTON_SetDefaultFocusColor(GUI_COLOR Color);
00141 void             BUTTON_SetDefaultFont      (const GUI_FONT * pFont);
00142 void             BUTTON_SetDefaultTextAlign (int Align);
00143 void             BUTTON_SetDefaultTextColor (GUI_COLOR Color, unsigned Index);
00144 
00145 /*********************************************************************
00146 *
00147 *       The callback ...
00148 *
00149 * Do not call it directly ! It is only to be used from within an
00150 * overwritten callback.
00151 */
00152 void BUTTON_Callback(WM_MESSAGE *pMsg);
00153 
00154 /*********************************************************************
00155 *
00156 *       Member functions
00157 *
00158 **********************************************************************
00159 */
00160 GUI_COLOR          BUTTON_GetBkColor         (BUTTON_Handle hObj, unsigned int Index);
00161 const GUI_BITMAP * BUTTON_GetBitmap          (BUTTON_Handle hObj,unsigned int Index);
00162 const GUI_FONT   * BUTTON_GetFont            (BUTTON_Handle hObj);
00163 GUI_COLOR          BUTTON_GetFrameColor      (BUTTON_Handle hObj);
00164 WIDGET           * BUTTON_GetpWidget         (BUTTON_Handle hObj);
00165 void               BUTTON_GetText            (BUTTON_Handle hObj, char * pBuffer, int MaxLen);
00166 GUI_COLOR          BUTTON_GetTextColor       (BUTTON_Handle hObj, unsigned int Index);
00167 int                BUTTON_GetTextAlign       (BUTTON_Handle hObj);
00168 int                BUTTON_GetUserData        (BUTTON_Handle hObj, void * pDest, int NumBytes);
00169 unsigned           BUTTON_IsPressed          (BUTTON_Handle hObj);
00170 void               BUTTON_SetBitmap          (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap);
00171 void               BUTTON_SetBitmapEx        (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap, int x, int y);
00172 void               BUTTON_SetBkColor         (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color);
00173 void               BUTTON_SetBMP             (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap);
00174 void               BUTTON_SetBMPEx           (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap, int x, int y);
00175 void               BUTTON_SetFont            (BUTTON_Handle hObj, const GUI_FONT * pfont);
00176 void               BUTTON_SetFrameColor      (BUTTON_Handle hObj, GUI_COLOR Color);
00177 void               BUTTON_SetState           (BUTTON_Handle hObj, int State);                                    /* Not to be doc. */
00178 void               BUTTON_SetPressed         (BUTTON_Handle hObj, int State);
00179 GUI_COLOR          BUTTON_SetFocusColor      (BUTTON_Handle hObj, GUI_COLOR Color);
00180 void               BUTTON_SetStreamedBitmap  (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap);
00181 void               BUTTON_SetStreamedBitmapEx(BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap, int x, int y);
00182 int                BUTTON_SetText            (BUTTON_Handle hObj, const char* s);
00183 void               BUTTON_SetTextAlign       (BUTTON_Handle hObj, int Align);
00184 void               BUTTON_SetTextColor       (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color);
00185 void               BUTTON_SetTextOffset      (BUTTON_Handle hObj, int xPos, int yPos);
00186 void               BUTTON_SetSelfDrawEx      (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw, int x, int y); /* Not to be doc. */
00187 void               BUTTON_SetSelfDraw        (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw);               /* Not to be doc. */
00188 void               BUTTON_SetReactOnLevel    (void);
00189 void               BUTTON_SetReactOnTouch    (void);
00190 int                BUTTON_SetUserData        (BUTTON_Handle hObj, const void * pSrc, int NumBytes);
00191 
00192 #define BUTTON_SetFocussable BUTTON_SetFocusable
00193 #define BUTTON_SetFocusable  WIDGET_SetFocusable
00194 
00195 /*********************************************************************
00196 *
00197 *       Member functions: Skinning
00198 *
00199 **********************************************************************
00200 */
00201 void BUTTON_GetSkinFlexProps     (BUTTON_SKINFLEX_PROPS * pProps, int Index);
00202 void BUTTON_SetSkinClassic       (BUTTON_Handle hObj);
00203 void BUTTON_SetSkin              (BUTTON_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00204 int  BUTTON_DrawSkinFlex         (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
00205 void BUTTON_SetSkinFlexProps     (const BUTTON_SKINFLEX_PROPS * pProps, int Index);
00206 void BUTTON_SetDefaultSkinClassic(void);
00207 WIDGET_DRAW_ITEM_FUNC * BUTTON_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00208 
00209 #define BUTTON_SKIN_FLEX    BUTTON_DrawSkinFlex
00210 
00211 #if defined(__cplusplus)
00212   }
00213 #endif
00214 
00215 #endif   // GUI_WINSUPPORT
00216 #endif   // BUTTON_H
00217 
00218 /*************************** End of file ****************************/