RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FRAMEWIN.h Source File

FRAMEWIN.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - 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 to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File        : FRAMEWIN.h
00040 Purpose     : Frame window include
00041 --------------------END-OF-HEADER-------------------------------------
00042 */
00043 
00044 #ifndef FRAMEWIN_H
00045 #define FRAMEWIN_H
00046 
00047 #include "WM.h"
00048 #include "WIDGET.h"             /* Req. for WIDGET_DRAW_ITEM_FUNC */
00049 #if GUI_WINSUPPORT
00050 #include "DIALOG_Intern.h"      /* Req. for Create indirect data structure */
00051 
00052 #if defined(__cplusplus)
00053   extern "C" {     /* Make sure we have C-declarations in C++ programs */
00054 #endif
00055 
00056 /*********************************************************************
00057 *
00058 *       Defines
00059 *
00060 **********************************************************************
00061 */
00062 /*********************************************************************
00063 *
00064 *       Configuration
00065 */
00066 #ifndef   FRAMEWIN_ALLOW_DRAG_ON_FRAME
00067   #define FRAMEWIN_ALLOW_DRAG_ON_FRAME 1
00068 #endif
00069 
00070 /*********************************************************************
00071 *
00072 *       Color indices
00073 */
00074 #define FRAMEWIN_CI_INACTIVE 0
00075 #define FRAMEWIN_CI_ACTIVE   1
00076 
00077 /*********************************************************************
00078 *
00079 *       Create / Status flags
00080 */
00081 #define FRAMEWIN_CF_ACTIVE     (1<<3)
00082 #define FRAMEWIN_CF_MOVEABLE   (1<<4)
00083 #define FRAMEWIN_CF_TITLEVIS   (1<<5)
00084 #define FRAMEWIN_CF_MINIMIZED  (1<<6)
00085 #define FRAMEWIN_CF_MAXIMIZED  (1<<7)
00086 #define FRAMEWIN_CF_DRAGGING   (1<<8)
00087 
00088 #define FRAMEWIN_SF_ACTIVE     FRAMEWIN_CF_ACTIVE
00089 #define FRAMEWIN_SF_MOVEABLE   FRAMEWIN_CF_MOVEABLE
00090 #define FRAMEWIN_SF_TITLEVIS   FRAMEWIN_CF_TITLEVIS
00091 #define FRAMEWIN_SF_MINIMIZED  FRAMEWIN_CF_MINIMIZED
00092 #define FRAMEWIN_SF_MAXIMIZED  FRAMEWIN_CF_MAXIMIZED
00093 #define FRAMEWIN_SF_DRAGGING   FRAMEWIN_CF_DRAGGING
00094 
00095 /*********************************************************************
00096 *
00097 *       BUTTON Flags
00098 */
00099 #define FRAMEWIN_BUTTON_RIGHT   (1<<0)
00100 #define FRAMEWIN_BUTTON_LEFT    (1<<1)
00101 
00102 /*********************************************************************
00103 *
00104 *       Skinning property indices
00105 */
00106 #define FRAMEWIN_SKINFLEX_PI_ACTIVE   0
00107 #define FRAMEWIN_SKINFLEX_PI_INACTIVE 1
00108 
00109 /*********************************************************************
00110 *
00111 *       Getting border size
00112 */
00113 #define FRAMEWIN_BORDERSIZE_T 0
00114 #define FRAMEWIN_BORDERSIZE_L 1
00115 #define FRAMEWIN_BORDERSIZE_B 2
00116 #define FRAMEWIN_BORDERSIZE_R 3
00117 
00118 /*********************************************************************
00119 *
00120 *       Types
00121 *
00122 **********************************************************************
00123 */
00124 typedef WM_HMEM FRAMEWIN_Handle;
00125 
00126 typedef struct {
00127   GUI_COLOR aColorFrame[3];
00128   GUI_COLOR aColorTitle[2];
00129   int Radius;
00130   int SpaceX;
00131   int BorderSizeL;
00132   int BorderSizeR;
00133   int BorderSizeT;
00134   int BorderSizeB;
00135 } FRAMEWIN_SKINFLEX_PROPS;
00136 
00137 /*********************************************************************
00138 *
00139 *       Create functions
00140 *
00141 **********************************************************************
00142 */
00143 FRAMEWIN_Handle FRAMEWIN_Create        (const char * pTitle, WM_CALLBACK * cb, int Flags, int x0, int y0, int xSize, int ySize);
00144 FRAMEWIN_Handle FRAMEWIN_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, const char * pText, WM_CALLBACK * cb, int Flags);
00145 FRAMEWIN_Handle FRAMEWIN_CreateEx      (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, const char * pTitle, WM_CALLBACK * cb);
00146 FRAMEWIN_Handle FRAMEWIN_CreateUser    (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, const char * pTitle, WM_CALLBACK * cb, int NumExtraBytes);
00147 FRAMEWIN_Handle FRAMEWIN_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
00148 
00149 /*********************************************************************
00150 *
00151 *       The callback ...
00152 *
00153 * Do not call it directly ! It is only to be used from within an
00154 * overwritten callback.
00155 */
00156 void FRAMEWIN_Callback(WM_MESSAGE * pMsg);
00157 
00158 /*********************************************************************
00159 *
00160 *       Member functions: Set Properties
00161 *
00162 **********************************************************************
00163 */
00164 WM_HWIN FRAMEWIN_AddButton     (FRAMEWIN_Handle hObj, int Flags, int Off, int Id);
00165 WM_HWIN FRAMEWIN_AddCloseButton(FRAMEWIN_Handle hObj, int Flags, int Off);
00166 WM_HWIN FRAMEWIN_AddMaxButton  (FRAMEWIN_Handle hObj, int Flags, int Off);
00167 void    FRAMEWIN_AddMenu       (FRAMEWIN_Handle hObj, WM_HWIN hMenu);
00168 WM_HWIN FRAMEWIN_AddMinButton  (FRAMEWIN_Handle hObj, int Flags, int Off);
00169 void    FRAMEWIN_Minimize      (FRAMEWIN_Handle hObj);
00170 void    FRAMEWIN_Maximize      (FRAMEWIN_Handle hObj);
00171 void    FRAMEWIN_Restore       (FRAMEWIN_Handle hObj);
00172 void    FRAMEWIN_SetActive     (FRAMEWIN_Handle hObj, int State);
00173 void    FRAMEWIN_SetBarColor   (FRAMEWIN_Handle hObj, unsigned Index, GUI_COLOR Color);
00174 void    FRAMEWIN_SetBorderSize (FRAMEWIN_Handle hObj, unsigned Size);
00175 void    FRAMEWIN_SetClientColor(FRAMEWIN_Handle hObj, GUI_COLOR Color);
00176 void    FRAMEWIN_SetFont       (FRAMEWIN_Handle hObj, const GUI_FONT * pFont);
00177 void    FRAMEWIN_SetMoveable   (FRAMEWIN_Handle hObj, int State);
00178 void    FRAMEWIN_SetOwnerDraw  (FRAMEWIN_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawItem);
00179 void    FRAMEWIN_SetResizeable (FRAMEWIN_Handle hObj, int State);
00180 void    FRAMEWIN_SetText       (FRAMEWIN_Handle hObj, const char* s);
00181 void    FRAMEWIN_SetTextAlign  (FRAMEWIN_Handle hObj, int Align);
00182 void    FRAMEWIN_SetTextColor  (FRAMEWIN_Handle hObj, GUI_COLOR Color);
00183 void    FRAMEWIN_SetTextColorEx(FRAMEWIN_Handle hObj, unsigned Index, GUI_COLOR Color);
00184 void    FRAMEWIN_SetTitleVis   (FRAMEWIN_Handle hObj, int Show);
00185 int     FRAMEWIN_SetTitleHeight(FRAMEWIN_Handle hObj, int Height);
00186 int     FRAMEWIN_SetUserData   (FRAMEWIN_Handle hObj, const void * pSrc, int NumBytes);
00187 
00188 /*********************************************************************
00189 *
00190 *       Member functions: Skinning
00191 *
00192 **********************************************************************
00193 */
00194 void FRAMEWIN_GetSkinFlexProps     (FRAMEWIN_SKINFLEX_PROPS * pProps, int Index);
00195 void FRAMEWIN_SetSkinClassic       (FRAMEWIN_Handle hObj);
00196 void FRAMEWIN_SetSkin              (FRAMEWIN_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00197 int  FRAMEWIN_DrawSkinFlex         (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
00198 void FRAMEWIN_SetSkinFlexProps     (const FRAMEWIN_SKINFLEX_PROPS * pProps, int Index);
00199 void FRAMEWIN_SetDefaultSkinClassic(void);
00200 WIDGET_DRAW_ITEM_FUNC * FRAMEWIN_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
00201 
00202 #define FRAMEWIN_SKIN_FLEX    FRAMEWIN_DrawSkinFlex
00203 
00204 /*********************************************************************
00205 *
00206 *       Member functions: Get Properties
00207 *
00208 **********************************************************************
00209 */
00210 const GUI_FONT * FRAMEWIN_GetFont(FRAMEWIN_Handle hObj);
00211 
00212 int       FRAMEWIN_GetActive      (FRAMEWIN_Handle hObj);
00213 int       FRAMEWIN_GetTitleHeight (FRAMEWIN_Handle hObj);
00214 GUI_COLOR FRAMEWIN_GetBarColor    (FRAMEWIN_Handle hObj, unsigned Index);
00215 int       FRAMEWIN_GetBorderSize  (FRAMEWIN_Handle hObj);
00216 int       FRAMEWIN_GetBorderSizeEx(FRAMEWIN_Handle hObj, unsigned Edge);
00217 void      FRAMEWIN_GetText        (FRAMEWIN_Handle hObj, char * pBuffer, int MaxLen);
00218 int       FRAMEWIN_GetTextAlign   (FRAMEWIN_Handle hObj);
00219 int       FRAMEWIN_GetUserData    (FRAMEWIN_Handle hObj, void * pDest, int NumBytes);
00220 int       FRAMEWIN_IsMinimized    (FRAMEWIN_Handle hObj);
00221 int       FRAMEWIN_IsMaximized    (FRAMEWIN_Handle hObj);
00222 
00223 /*********************************************************************
00224 *
00225 *       Managing default values
00226 *
00227 **********************************************************************
00228 */
00229 GUI_COLOR        FRAMEWIN_GetDefaultBarColor   (unsigned Index);
00230 int              FRAMEWIN_GetDefaultBorderSize (void);
00231 int              FRAMEWIN_GetDefaultTitleHeight(void);
00232 GUI_COLOR        FRAMEWIN_GetDefaultClientColor(void);
00233 const GUI_FONT * FRAMEWIN_GetDefaultFont       (void);
00234 GUI_COLOR        FRAMEWIN_GetDefaultTextColor  (unsigned Index);
00235 int              FRAMEWIN_OwnerDraw            (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
00236 void             FRAMEWIN_SetDefaultBarColor   (unsigned Index, GUI_COLOR Color);
00237 void             FRAMEWIN_SetDefaultBorderSize (int DefaultBorderSize);
00238 void             FRAMEWIN_SetDefaultTitleHeight(int DefaultTitleHeight);
00239 void             FRAMEWIN_SetDefaultClientColor(GUI_COLOR Color);
00240 void             FRAMEWIN_SetDefaultFont       (const GUI_FONT * pFont);
00241 int              FRAMEWIN_SetDefaultTextAlign  (int TextAlign);
00242 void             FRAMEWIN_SetDefaultTextColor  (unsigned Index, GUI_COLOR Color);
00243 
00244 /*********************************************************************
00245 *
00246 *       Macros for compatibility
00247 *
00248 **********************************************************************
00249 */
00250 #define         FRAMEWIN_SetDefaultCaptionSize(Height)       FRAMEWIN_SetDefaultTitleHeight(Height)
00251 #define         FRAMEWIN_GetDefaultCaptionSize()             FRAMEWIN_GetDefaultTitleHeight()
00252 #define         FRAMEWIN_CreateButton(hObj, Flags, Off, Id)  FRAMEWIN_AddButton(hObj, Flags, Off, Id) 
00253 #define         FRAMEWIN_CreateCloseButton(hObj, Flags, Off) FRAMEWIN_AddCloseButton(hObj, Flags, Off)
00254 #define         FRAMEWIN_CreateMaxButton(hObj, Flags, Off)   FRAMEWIN_AddMaxButton(hObj, Flags, Off)  
00255 #define         FRAMEWIN_CreateMinButton(hObj, Flags, Off)   FRAMEWIN_AddMinButton(hObj, Flags, Off)  
00256 
00257 #if defined(__cplusplus)
00258   }
00259 #endif
00260 
00261 #endif  // GUI_WINSUPPORT
00262 #endif  // FRAMEWIN_H
00263 
00264 /*************************** End of file ****************************/