コード例 #1
0
ファイル: k_menu.c プロジェクト: 451506709/automated_machine
/**
  * @brief  The function opens a popup menu at the given position. It returns
  *         immediately after creation. On the first call it creates the menu.
  * @param  hParent:    pointer to the handle of the parent
  * @param  pMenuItems: pointer to menu items 
  * @param  NumItems:   number of menu items 
  * @param  x:          x position of the popup
  * @param  y:          y position of the popup 
  * @retval None
  */
static void _OpenPopup(WM_HWIN hParent, MENU_ITEM * pMenuItems, int NumItems, int x, int y) 
{
  static MENU_Handle hMenu;
  if (!hMenu) {
    int i;
    /* Create the popup window only one time */
    hMenu = MENU_CreateEx(0, 0, 0, 0, WM_UNATTACHED, 0, MENU_CF_VERTICAL, 0);
    MENU_SetFont(hMenu, GUI_FONT_16_ASCII);
    MENU_SetBkColor(hMenu, MENU_CI_SELECTED, GUI_LIGHTBLUE);
    
    for (i = 0; i < NumItems; i++) {
      _AddMenuItem(hMenu, 0, pMenuItems[i].sText, pMenuItems[i].Id, pMenuItems[i].Flags);
    }
  }

  MENU_Popup(hMenu, hParent, x, y, 0, 0, 0);
}
コード例 #2
0
/**
  * @brief  Opens a popup menu at the given position.
  * @note   It returns immediately after creation. 
  *         On the first call it creates the menu
  * @param  hParent:    pointer to the handle of the parent
  * @param  pMenuItems: pointer to menu items 
  * @param  NumItems:   number of menu items 
  * @param  x:          x position of the popup
  * @param  y:          y position of the popup 
  * @retval None
  */
static void _OpenPopup(WM_HWIN hParent, MENU_ITEM * pMenuItems, int NumItems, int x, int y) 
{
  static MENU_Handle hMenu;
  if (!hMenu) {
    int i;
    /* Create the popup window only one time */
    hMenu = MENU_CreateEx(0, 0, 0, 0, WM_UNATTACHED, 0, MENU_CF_VERTICAL, 0);
    MENU_SetFont(hMenu, GUI_FONT_16_ASCII);
    MENU_SetBkColor(hMenu, MENU_CI_SELECTED, GUI_LIGHTBLUE);


    for (i = 0; i < NumItems; i++) {
      _AddMenuItem(hMenu, 0, pMenuItems[i].sText, pMenuItems[i].Id, pMenuItems[i].Flags);
    }
  }
  /* Open the popup menu. After opening the menu the function returns immediately.
   * After selecting menu item or after touching the display outside the menu the 
   * popup menu will be closed, but not deleted.
   */
  MENU_Popup(hMenu, hParent, x, y, 0, 0, 0);
}
コード例 #3
0
ファイル: PrintWin.c プロジェクト: zkan51/NEVTEX
//
// PrintWinSetMenuText
//
static void PrintSetItemText(WM_HWIN hWin,int ID)
{
			switch (ID)
			{
				 case ID_PrintMenu:
						    if (Language ==  0)
											   MENU_SetFont(hWin,&GUI_Font30);
										else MENU_SetFont(hWin,&GUI_Font20_1);
						    _SetMenuItem(hWin,0,pLanguage->PrintMenu[0],ID_Print_All,0);
					     _SetMenuItem(hWin,0,pLanguage->PrintMenu[1],ID_Print_Showing,0);
					     _SetMenuItem(hWin,hFre,pLanguage->PrintMenu[2],ID_Print_Frequency,0);
					     _SetMenuItem(hWin,hSite,pLanguage->PrintMenu[3],ID_Print_Site,0);
					     _SetMenuItem(hWin,hInfo,pLanguage->PrintMenu[4],ID_Print_Info,0);
          break;	
					
     case ID_Print_Frequency:
						    if (Language ==  0)
											   MENU_SetFont(hWin,&GUI_Font30);
										else MENU_SetFont(hWin,&GUI_Font20_1);
										_SetMenuItem(hWin,0,pLanguage->Frequency[0],ID_Print_Fre_Int,0);
										_SetMenuItem(hWin,0,pLanguage->Frequency[1],ID_Print_Fre_Loc1,0);
										_SetMenuItem(hWin,0,pLanguage->Frequency[2],ID_Print_Fre_Loc2,0);
										_SetMenuItem(hWin,0,pLanguage->Frequency[3],ID_Print_Fre_Chs,0);
          break;
					
     case ID_Print_Site:
						    if (Language ==  0)
											   MENU_SetFont(hWin,&GUI_Font30);
										else MENU_SetFont(hWin,&GUI_Font20_1);
						    _SetMenuItem(hWin,0,pLanguage->StaTion[0],ID_Print_Site_Prt,0);
					     _SetMenuItem(hWin,hSiteSet,pLanguage->StaTion[1],ID_Print_Site_SiteSet,0);
          break;
					
     case ID_Print_Info:
						    if (Language ==  0)
											   MENU_SetFont(hWin,&GUI_Font30);
										else MENU_SetFont(hWin,&GUI_Font20_1);
										_SetMenuItem(hWin,0,pLanguage->InfoType[0],ID_Print_Info_Prt,0);
									 _SetMenuItem(hWin,hInfoSet,pLanguage->InfoType[1],ID_Print_Info_InfoSet,0);
          break;
					
     case ID_Print_Site_SiteSet:
						    if (Language ==  0)
											   MENU_SetFont(hWin,&GUI_Font30);
										else MENU_SetFont(hWin,&GUI_Font20_1);
						    _SetMenuItem(hWin,0,pLanguage->IsPrint[0],ID_Print_Site_SiteSet_Prt_0,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[1],ID_Print_Site_SiteSet_Prt_1,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[2],ID_Print_Site_SiteSet_Prt_2,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[3],ID_Print_Site_SiteSet_Prt_3,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[4],ID_Print_Site_SiteSet_Prt_4,0);
										break;
					case ID_Print_Info_InfoSet:
						    if (Language ==  0)
											   MENU_SetFont(hWin,&GUI_Font30);
										else MENU_SetFont(hWin,&GUI_Font20_1);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[0],ID_Print_Info_InfoSet_Prt_0,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[1],ID_Print_Info_InfoSet_Prt_1,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[2],ID_Print_Info_InfoSet_Prt_2,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[3],ID_Print_Info_InfoSet_Prt_3,0);
										_SetMenuItem(hWin,0,pLanguage->IsPrint[4],ID_Print_Info_InfoSet_Prt_4,0);
						    break;
			}
}