⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basic_face2.c

📁 2410GUI项目菜单设计
💻 C
字号:
/*
*********************************************************************************************************
*                                                uC/GUI
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : BASIC_Hello1.c
Purpose     : Simple demo drawing "Hello world"
----------------------------------------------------------------------
*/

#include "GUI.H"
#include "WM.H"
#include "framewin.h"
#include "listbox.h"
#include <stddef.h>
#include "button.h"
extern GUI_FLASH const GUI_FONT GUI_FontHZ_LiSu_64;
extern GUI_FLASH const GUI_FONT GUI_FontHZ_FZShuTi_16; /*点菜中*/
extern GUI_FLASH const GUI_FONT GUI_FontHZ_SimSun_24;//湖北菜福建菜广东菜潮州菜四川菜山东菜
extern GUI_FLASH const GUI_FONT GUI_FontHZ_NewSimSun_16;
/*
八宝姜米鸭鲍贝烩豆瓣虾米榨菜蒸豆腐夏日田园鲜果桔油大虾酱汁
猪蹄泡椒鹅肠麻辣鹅肠拌五香牛肉猪肉骨头汤苦瓜炒鸡蛋花生猪尾汤
一品官燕泡菜参蟹芙蓉鸡片海鲜拌甜椒荔枝炒鸡丁梅菜扣肉木耳炒牛肉
西芹松子虾仁炒葱椒鸡果汁鱼块蚝油蘑菇荷包水鱼辣炒猪肉豆腐兰度鸽脯
玫瑰豉油鸡美味猪爪冻三色龙虾香芋扣肉八宝海参糍粑鱼豆皮肉卷精武鸭颈
橘瓣鱼丸扣三丝麒麟鳜鱼六味豆腐清汤全家福手抓羊排松仁烧鹿筋自制血肠 0123456789
*/
extern GUI_FLASH const GUI_FONT GUI_FontHZ_LiSu_21;//您已选定的菜 16

/*******************************************************************
*
*                 MainTask
*
********************************************************************
*/

static const GUI_ConstString _ListBox1[] = {
  "八宝海参     100", "糍粑鱼       20", "豆皮肉卷     20","精武鸭颈     20","橘瓣鱼丸     20","扣三丝       32","麒麟鳜鱼     40",NULL
};


static const GUI_ConstString _ListBox2[] = {
  "炒葱椒鸡     100", "果汁鱼块     20", "蚝油蘑菇     20","荷包水鱼     20","辣炒猪肉豆腐 20","兰度鸽脯     32","三色龙虾     40",NULL
};

static const GUI_ConstString _ListBox3[] = {
  "海鲜拌甜椒   100", "荔枝炒鸡丁   20", "梅菜扣肉     20","木耳炒牛肉   20","西芹松子虾仁 20",NULL
};

static const GUI_ConstString _ListBox4[] = {
  "六味豆腐     100", "清汤全家福   20", "手抓羊排     20","松仁烧鹿筋   20","自制血肠     20",NULL
};

static const GUI_ConstString _ListBox5[] = {
	"拌五香牛肉   100", "芙蓉鸡片     20", "花生猪尾汤   20","一品官燕     20","酱汁猪蹄     20","苦瓜炒鸡蛋   32","麻辣鹅肠     40","泡椒鹅肠     20","泡菜参蟹     30","猪肉骨头汤   20",NULL
};

static const GUI_ConstString _ListBox6[] = {
	"八宝姜米鸭   100", "鲍贝烩豆瓣   20", "虾米榨菜蒸豆腐20","夏日田园     20","鲜果桔油大虾 20",NULL
};


static const GUI_ConstString _ListBox7[20]={
NULL};

void   InterFace_2(void) {
    GUI_SetFont(&GUI_FontHZ_LiSu_64);
    GUI_DispStringAt("醉江月欢迎您",120,10);
    GUI_DrawVLine(639,0,480);
    GUI_DrawHLine(479,0,640);
    GUI_DrawHLine(1,0,640);
    GUI_DrawVLine(1,0,480);
    GUI_DrawHLine(79,0,640);
	   //	GUI_SetFont(&GUI_FontHZ_FZShuTi_16);
		//GUI_SetColor(GUI_GREEN);
		//GUI_DispStringAt("点菜中",540,50);
    GUI_SetFont(&GUI_Font8_1);
	GUI_DispStringAt(". . .",585,62);
    GUI_SetFont(&GUI_FontHZ_FZShuTi_16);
    GUI_SetColor(GUI_RED);
    GUI_DispStringAt("点菜中",540,50);

}


static void ListBox1_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("湖北菜", NULL, WM_CF_SHOW, 0, 80, 160, 200);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_SimSun_24);
  FRAMEWIN_SetTextColor(hFrame,GUI_RED);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_GREEN);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox1, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_YELLOW);
  WM_Exec();

}

static void ListBox2_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("广东菜", NULL, WM_CF_SHOW, 160, 80, 160, 200);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_SimSun_24);
  FRAMEWIN_SetTextColor(hFrame,GUI_RED);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_GREEN);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox2, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_YELLOW);
  WM_Exec();

}


static void ListBox3_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("福建菜", NULL, WM_CF_SHOW, 320, 80, 160, 200);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_SimSun_24);
  FRAMEWIN_SetTextColor(hFrame,GUI_RED);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_GREEN);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox3, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_YELLOW);
  WM_Exec();

}

static void ListBox4_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("山东菜", NULL, WM_CF_SHOW, 0, 280, 160, 200);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_SimSun_24);
  FRAMEWIN_SetTextColor(hFrame,GUI_RED);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_GREEN);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox4, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_YELLOW);
  WM_Exec();

}



static void ListBox5_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("四川菜", NULL, WM_CF_SHOW, 160, 280, 160, 200);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_SimSun_24);
  FRAMEWIN_SetTextColor(hFrame,GUI_RED);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_GREEN);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox5, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_YELLOW);
  WM_Exec();

}

static void ListBox6_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("潮州菜", NULL, WM_CF_SHOW, 320, 280, 160, 200);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_SimSun_24);
  FRAMEWIN_SetTextColor(hFrame,GUI_RED);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_GREEN);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox6, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_YELLOW);
  WM_Exec();

}


static void ListBox7_AsChild(void){
  FRAMEWIN_Handle hFrame;
  LISTBOX_Handle hListBox;
  hFrame = FRAMEWIN_Create("您已选定的菜", NULL, WM_CF_SHOW, 480, 80, 160, 348);
  FRAMEWIN_SetFont(hFrame,&GUI_FontHZ_LiSu_21);
  FRAMEWIN_SetTextColor(hFrame,GUI_WHITE);
  FRAMEWIN_SetBarColor(hFrame,1,GUI_LIGHTRED);
  FRAMEWIN_SetBarColor(hFrame,0,GUI_MAGENTA);
  FRAMEWIN_SetTextAlign(hFrame,GUI_TA_HCENTER);
  hListBox = LISTBOX_CreateAsChild(_ListBox7, hFrame, 0, 0, 0, 0, WM_CF_SHOW);
  WM_SetFocus(hListBox);
  LISTBOX_SetFont(hListBox, &GUI_FontHZ_NewSimSun_16);
  SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
  LISTBOX_SetBackColor(hListBox,0,GUI_GREEN);
  WM_Exec();

}


static void InterFace2_Button(void) {
  BUTTON_Handle hButton;
  /* Create the button*/
  hButton = BUTTON_Create(481, 429, 157, 48, GUI_ID_OK, WM_CF_SHOW);
  /* Set the button text */
  BUTTON_SetFont(hButton,&GUI_FontHZ_LiSu_21);
  BUTTON_SetTextColor(hButton,1,GUI_BLUE);
  BUTTON_SetTextColor(hButton,0,GUI_WHITE);
  BUTTON_SetText(hButton, "发送");
  /* Let window manager handle the button */
  BUTTON_SetBkColor(hButton,0,GUI_BLUE);
  BUTTON_SetBkColor(hButton,1,GUI_GREEN);
  
  GUI_Delay(1000);
}

void MainTask(void) {
  GUI_Init();
  GUI_SetBkColor(GUI_BLUE);
  GUI_Clear();
  InterFace_2();
  ListBox1_AsChild();
  ListBox2_AsChild();
  ListBox3_AsChild();
  ListBox4_AsChild();
  ListBox5_AsChild();
  ListBox6_AsChild();
  ListBox7_AsChild();
  InterFace2_Button();
  while(1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -