| 
 
论坛元老  
 
	积分3751金钱3751 注册时间2015-4-19在线时间397 小时 | 
 
 发表于 2020-11-20 09:51:21
|
显示全部楼层 
| 复制代码/*********************************************************************
*                                                                    *
*                SEGGER Microcontroller GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
*                                                                    *
**********************************************************************
*                                                                    *
* C-file generated by:                                               *
*                                                                    *
*        GUI_Builder for emWin version 5.30                          *
*        Compiled Jul  1 2015, 10:50:32                              *
*        (c) 2015 Segger Microcontroller GmbH & Co. KG               *
*                                                                    *
**********************************************************************
*                                                                    *
*        Internet: www.segger.com  Support: support@segger.com       *
*                                                                    *
**********************************************************************
*/
// USER START (Optionally insert additional includes)
// USER END
#include "DIALOG.h"
/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
//#define ID_TEXT_0 (GUI_ID_USER + 0x01)
#define ID_BUTTON_0 (GUI_ID_USER + 0x02)
// USER START (Optionally insert additional defines)
// USER END
/*********************************************************************
*
*       Static data
*
**********************************************************************
*/
// USER START (Optionally insert additional static data)
// USER END
/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  { FRAMEWIN_CreateIndirect, "FramewinMain", ID_FRAMEWIN_0, 0, 0, 320, 240, 0, 0x0, 0 },
  //{ TEXT_CreateIndirect, "Text", ID_TEXT_0, 2, 0, 300, 16, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Return", ID_BUTTON_0, 115, 170, 80, 30, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};
/*********************************************************************
*
*       Static code
*
**********************************************************************
*/
/*
// USER START (Optionally insert additional static code)
static void GUI_renew_gui_memory(WM_HWIN hParent, int textID)
{
  char buff[48];
  sprintf(buff, "Memory used: %dKBytes  free: %dKBytes", GUI_ALLOC_GetNumUsedBytes()/1024, GUI_ALLOC_GetNumFreeBytes()/1024);
  //TEXT_SetTextColor(WM_GetDialogItem(hParent, textID), (0x008000FF));
  TEXT_SetText(WM_GetDialogItem(hParent, textID), buff);
}*/
// USER END
/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
  WM_HWIN hItem, hWinOld;
  int     NCode;
  int     Id;
  // USER START (Optionally insert additional variables)
  static GUI_HMEM hMem[3] = {0, 0, 0};
  // USER END
  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'FramewinMain'
    //
    //hItem = pMsg->hWin;
    //FRAMEWIN_SetTitleHeight(hItem, 16);
    //
    // Initialization of 'Text'
    //
   // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
    //TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
    // USER START (Optionally insert additional code for further widget initialization)
   // FRAMEWIN_SetMoveable(pMsg->hWin, 1);
   // FRAMEWIN_SetTitleHeight(pMsg->hWin, 16);
   // FRAMEWIN_AddCloseButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0);
   // FRAMEWIN_AddMaxButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0);
   // FRAMEWIN_AddMinButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0);
    //不能重复创建,否则内存越占越多(比如不能放在WM_PAINT消息中)
//    if(!hMem[0]) hMem[0] = GUI_QR_Create("http://www.neqee.com/", 4, GUI_QR_ECLEVEL_L, 0);   //(1):屏蔽此段而保留下面的 WM_PAINT:下的显示函数,二维码显示不成功;得出必须同时保留这两部分才能显示,
//    if(!hMem[1]) hMem[1] = GUI_QR_Create("http://www.baidu.com/", 3, GUI_QR_ECLEVEL_L, 0);
//    if(!hMem[2]) hMem[2] = GUI_QR_Create("http://www.segger.com/", 2, GUI_QR_ECLEVEL_L, 0);
    //GUI_renew_gui_memory(pMsg->hWin, ID_TEXT_0);//Update memory usage. Note: It also needs to be executed where memory changes.
    // USER END
    break;
  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Return'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
          //GUI_EndDialog(pMsg->hWin, 0);          //2020-9-18 结束本对话框
          //CreateWindowBkgd(WM_HBKWIN);           //2020-9-18
           
              //hWinOld = WM_SelectWindow(WM_GetClientWindow(pMsg->hWin)); 
              hMem[0] = GUI_QR_Create("http://www.baidu.com/", 4, GUI_QR_ECLEVEL_L, 0);  
              GUI_QR_Draw(hMem[0], 10, 30);
              //WM_SelectWindow(hWinOld);
          
                    GUI_EndDialog(pMsg->hWin, 0);          //2020-9-18 结束本对话框
               CreateFramewin();  
          // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  //窗口重绘消息,这个比较难说明白,反正在Framewin或Window窗口之中我们一般是用控件,如果要在Framewin或Window窗口之中显示文字或绘制直线、矩形、圆等在这里实现.
  //Window redraw message, this is difficult to explain,anyway,we usually use widget in framewin or windows,If we want to draw lines,rectangles,circles,etc. in framewin or windows,we can do it here.
  
    case WM_PAINT:                                         //2020-11-17 (2):屏蔽此段保留上面的创建,就不显示二维码了
    GUI_SetColor(GUI_BLUE);
    GUI_DispStringAt("http://www.baidu.com/", 2, 18);
    GUI_QR_Draw(hMem[0], 10, 30);
//    GUI_SetColor(GUI_GREEN);
//    GUI_DispStringAt("http://www.baidu.com/", 170, 18);
//    GUI_QR_Draw(hMem[1], 190, 30);
//    GUI_SetColor(GUI_RED);
//    GUI_DispStringAt("http://www.segger.com/", 170, 135);
//    GUI_QR_Draw(hMem[2], 210, 148);
    break;  
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}
/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateFramewinMain
*/
WM_HWIN CreateFramewinQRCode(void);
WM_HWIN CreateFramewinQRCode(void) {
  WM_HWIN hWin;
  hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  return hWin;
}
// USER START (Optionally insert additional public code)
// USER END
/*************************** End of file ****************************/
 | 
 |