Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers About.c Source File

About.c

00001 /*********************************************************************
00002 *                SEGGER Microcontroller 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 to  Cypress Semiconductor Corporation,
00019 whose registered  office is situated  at 198 Champion Ct. San Jose, CA 
00020 95134 USA  solely for the  purposes of creating  libraries for Cypress
00021 PSoC3 and  PSoC5 processor-based devices,  sublicensed and distributed
00022 under  the  terms  and  conditions  of  the  Cypress  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 Licensor:                 SEGGER Microcontroller Systems LLC
00030 Licensed to:              Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA
00031 Licensed SEGGER software: emWin
00032 License number:           GUI-00319
00033 License model:            Services and License Agreement, signed June 10th, 2009
00034 Licensed platform:        Any Cypress platform (Initial targets are: PSoC3, PSoC5)
00035 ----------------------------------------------------------------------
00036 Support and Update Agreement (SUA)
00037 SUA period:               2009-06-12 - 2022-07-27
00038 Contact to extend SUA:    sales@segger.com
00039 ----------------------------------------------------------------------
00040 File        : About.c
00041 Purpose     : TBD
00042 ---------------------------END-OF-HEADER------------------------------
00043 */
00044 
00045 #include <stddef.h>
00046 #include "GUI.h"
00047 #include "DIALOG.h"
00048 #include "Main.h"
00049 
00050 /*********************************************************************
00051 *
00052 *       Defines
00053 *
00054 **********************************************************************
00055 */
00056 /*********************************************************************
00057 *
00058 *       Dialog IDs
00059 */
00060 #define ID_FRAMEWIN              1
00061 
00062 /*********************************************************************
00063 *
00064 *       Static data
00065 *
00066 **********************************************************************
00067 */
00068 static WM_HWIN _hPrevWin;
00069 
00070 static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
00071   { FRAMEWIN_CreateIndirect, "About", ID_FRAMEWIN,   0, 480, 320, 240, 0},
00072   { BUTTON_CreateIndirect,   "OK",    GUI_ID_OK,   230, 140,  60,  20 },
00073 };
00074 
00075 static const char _aExplain[] = {
00076   "This sample shows how to use the virtual screen\n"
00077   "support for switching between different screens.\n"
00078   "It can be used as a starting point for developing\n"
00079   "your own application."
00080 };
00081 
00082 /*********************************************************************
00083 *
00084 *       Static code
00085 *
00086 **********************************************************************
00087 */
00088 /*********************************************************************
00089 *
00090 *       _cbCallback
00091 */
00092 static void _cbCallback(WM_MESSAGE * pMsg) {
00093   WM_HWIN hDlg, hWinSrc;
00094   int Id, NCode;
00095   GUI_RECT Rect;
00096   Rect.x0 = 10;
00097   Rect.y0 = 10;
00098   Rect.x1 = 300;
00099   Rect.y1 = 200;
00100   hWinSrc = pMsg->hWinSrc;
00101   hDlg = pMsg->hWin;
00102   switch (pMsg->MsgId) {
00103   case WM_INIT_DIALOG:
00104     WM_MakeModal(hDlg);
00105     FRAMEWIN_SetFont(hDlg, &GUI_Font24B_ASCII);
00106     FRAMEWIN_SetTextAlign(hDlg, GUI_TA_HCENTER);
00107     FRAMEWIN_SetClientColor(hDlg, GUI_GREEN);
00108     break;
00109   case WM_PAINT:
00110     GUI_SetColor(GUI_BLACK);
00111     GUI_SetFont(&GUI_Font16_ASCII);
00112     GUI_DispStringInRect(&_aExplain[0], &Rect, GUI_TA_LEFT);
00113     break;
00114   case WM_NOTIFY_PARENT:
00115     Id    = WM_GetId(hWinSrc);                    /* Id of widget */
00116     NCode = pMsg->Data.v;                         /* Notification code */
00117     if (NCode == WM_NOTIFICATION_RELEASED) {      /* React only if released */
00118       if (Id == GUI_ID_OK) {                      /* OK Button */
00119         GUI_EndDialog(hDlg, 0);
00120         WM_SetFocus(_hPrevWin);
00121       }
00122     }
00123     break;
00124 
00125   default:
00126     WM_DefaultProc(pMsg);
00127   }
00128 }
00129 
00130 /*********************************************************************
00131 *
00132 *       ExecAbout
00133 */
00134 void ExecAbout(void) {
00135   _hPrevWin = WM_GetFocussedWindow();
00136   GUI_SetOrg(0, 480);
00137   GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0);
00138   GUI_SetOrg(0, 0);
00139 
00140 }
00141 
00142