NuMaker emWin HMI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MENU_Private.h Source File

MENU_Private.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        : MENU_Private.h
00040 Purpose     : Internal header file
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 #ifndef MENU_PRIVATE_H
00045 #define MENU_PRIVATE_H
00046 
00047 #include "WIDGET.h"
00048 #include "MENU.h"
00049 #include "GUI_ARRAY.h"
00050 
00051 #if GUI_WINSUPPORT
00052 
00053 /*********************************************************************
00054 *
00055 *       Defines
00056 *
00057 **********************************************************************
00058 */
00059 /*********************************************************************
00060 *
00061 *       Status flags
00062 */
00063 #define MENU_SF_HORIZONTAL              MENU_CF_HORIZONTAL
00064 #define MENU_SF_VERTICAL                MENU_CF_VERTICAL
00065 #define MENU_SF_OPEN_ON_POINTEROVER     MENU_CF_OPEN_ON_POINTEROVER
00066 #define MENU_SF_CLOSE_ON_SECOND_CLICK   MENU_CF_CLOSE_ON_SECOND_CLICK
00067 #define MENU_SF_HIDE_DISABLED_SEL       MENU_CF_HIDE_DISABLED_SEL
00068 
00069 #define MENU_SF_ACTIVE                  (1 << 6)  // Internal flag only
00070 #define MENU_SF_POPUP                   (1 << 7)  // Internal flag only
00071 #define MENU_SF_ARROW                   (1 << 8)  // Internal flag only
00072 
00073 /*********************************************************************
00074 *
00075 *       Types
00076 *
00077 **********************************************************************
00078 */
00079 //
00080 // MENU_SKIN_PRIVATE
00081 //
00082 typedef struct {
00083   WIDGET_DRAW_ITEM_FUNC * pfDrawSkin;
00084 } MENU_SKIN_PRIVATE;
00085 
00086 //
00087 // MENU_ITEM
00088 //
00089 typedef struct {
00090   MENU_Handle hSubmenu;
00091   U16         Id;
00092   U16         Flags;
00093   int         TextWidth;
00094   char        acText[1];
00095 } MENU_ITEM;
00096 
00097 //
00098 // MENU_PROPS
00099 //
00100 typedef struct {
00101   GUI_COLOR           aTextColor[5];
00102   GUI_COLOR           aBkColor[5];
00103   U8                  aBorder[4];
00104   const GUI_FONT    * pFont;
00105   MENU_SKIN_PRIVATE   SkinPrivate;
00106 } MENU_PROPS;
00107 
00108 //
00109 // MENU_Obj
00110 //
00111 typedef struct {
00112   WIDGET              Widget;
00113   MENU_PROPS          Props;
00114   GUI_ARRAY           ItemArray;
00115   WM_HWIN             hOwner;
00116   U16                 Flags;
00117   char                IsSubmenuActive;
00118   int                 Width;
00119   int                 Height;
00120   int                 Sel;
00121   unsigned            ArrowAreaWidth;
00122   WIDGET_SKIN const * pWidgetSkin;
00123 } MENU_Obj;
00124 
00125 /*********************************************************************
00126 *
00127 *       Macros for internal use
00128 *
00129 **********************************************************************
00130 */
00131 #if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
00132   #define MENU_INIT_ID(pObj)  (pObj->Widget.DebugId = MENU_ID)
00133 #else
00134   #define MENU_INIT_ID(pObj)
00135 #endif
00136 
00137 #if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
00138   MENU_Obj * MENU_LockH(MENU_Handle hObj);
00139   #define MENU_LOCK_H(hObj)   MENU_LockH(hObj)
00140 #else
00141   #define MENU_LOCK_H(hObj)   (MENU_Obj *)GUI_LOCK_H(hObj)
00142 #endif
00143 
00144 /*********************************************************************
00145 *
00146 *       Public data (internal defaults)
00147 *
00148 **********************************************************************
00149 */
00150 
00151 extern MENU_PROPS            MENU__DefaultProps;
00152 extern const WIDGET_EFFECT * MENU__pDefaultEffect;
00153 
00154 extern const WIDGET_SKIN     MENU__SkinClassic;
00155 extern       WIDGET_SKIN     MENU__Skin;
00156 
00157 extern WIDGET_SKIN const   * MENU__pSkinDefault;
00158 
00159 /*********************************************************************
00160 *
00161 *       Private functions
00162 *
00163 **********************************************************************
00164 */
00165 int       MENU__CalcMenuSizeX         (MENU_Handle hObj);
00166 int       MENU__CalcMenuSizeY         (MENU_Handle hObj);
00167 int       MENU__FindItem              (MENU_Handle hObj, U16 ItemId, MENU_Handle* phMenu);
00168 int       MENU__GetEffectSize         (MENU_Handle hObj);
00169 int       MENU__GetItemHeight         (MENU_Handle hObj, unsigned Index);
00170 int       MENU__GetItemWidth          (MENU_Handle hObj, unsigned Index);
00171 unsigned  MENU__GetNumItems           (MENU_Obj * pObj);
00172 int       MENU__HasEffect             (MENU_Handle hObj, MENU_Obj * pObj);
00173 void      MENU__InvalidateItem        (MENU_Handle hObj, unsigned Index);
00174 void      MENU__RecalcTextWidthOfItems(MENU_Obj * pObj);
00175 void      MENU__ResizeMenu            (MENU_Handle hObj);
00176 int       MENU__SendMenuMessage       (MENU_Handle hObj, WM_HWIN hDestWin, U16 MsgType, U16 ItemId);
00177 char      MENU__SetItem               (MENU_Handle hObj, unsigned Index, const MENU_ITEM_DATA* pItemData);
00178 void      MENU__SetItemFlags          (MENU_Obj * pObj, unsigned Index, U16 Mask, U16 Flags);
00179 
00180 #endif  // GUI_WINSUPPORT
00181 #endif  // MENU_PRIVATE_H
00182 
00183 /*************************** End of file ****************************/