Steward
分享是一種喜悅、更是一種幸福
程式語言 - uC/GUI - Create Menu
參考資訊:
https://github.com/piyushpandey013/ucGUI
https://github.com/yongzhena/ucgui-linux
main.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include "GUI.h" #include "MENU.h" #include "FRAMEWIN.h" int main ( int argc, char *argv[]) { MENU_Handle hMenu = 0; MENU_ITEM_DATA item = { 0 }; GUI_Init (); GUI_SetBkColor ( GUI_GRAY ); GUI_Clear (); hMenu = MENU_CreateEx (10, 10, 110, 18, 0, WM_CF_SHOW , 0, 100); item.pText = "File" ; item.Id = 100; item.Flags = 0; item.hSubmenu = 0; MENU_AddItem (hMenu, &item); item.pText = "Edit" ; item.Id = 101; item.Flags = 0; item.hSubmenu = 0; MENU_AddItem (hMenu, &item); item.pText = "View" ; item.Id = 102; item.Flags = 0; item.hSubmenu = 0; MENU_AddItem (hMenu, &item); item.pText = "Help" ; item.Id = 103; item.Flags = 0; item.hSubmenu = 0; MENU_AddItem (hMenu, &item); GUI_Delay (3000); return 0; } |
編譯、執行
$ gcc main.c -o main libucgui.a -IGUI_X -IGUI/Core -IGUI/Widget -IGUI/WM -lSDL $ ./main