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

📄 initgui.c

📁 一个很好的SDL建立应用程序界面的例子
💻 C
📖 第 1 页 / 共 4 页
字号:
	btn = newButton(0, 0, 0, 0, 0, 0, "   Save");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &SaveHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, "   Save as");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &SaveAsHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, "   Save configuration");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &SaveConfigHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, "   Exit");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &ExitHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, "   Close menu");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &CloseMenuHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Serial Port");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &serialPortHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Enable Programmer");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &enableHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Device");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &deviceHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Read");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &readHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Program");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &programHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Erase");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &eraseHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Verify");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &verifyHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Blank Check");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &blankHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Help");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &HelpHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " About");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &AboutHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Edit configuration bits");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &configBitsHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Edit ID locations");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &IdHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Disasm");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &DisasmHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, " Display mode");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &DisplayModeHelpCB);	addButton(helpMenu, btn, FALSE);	btn = newButton(0, 0, 0, 0, 0, 0, "Close help menu             ");	attachCallBack(btn, SDL_MOUSEBUTTONDOWN, (void *) &helpMenuCB);	addButton(helpMenu, btn, TRUE);	FileHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(FileHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                    File Button "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " The File Button brings up a submenu in which you can "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " open a file, save the current program or data memory "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " to a file, save the current configuration (serial port "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " and PIC device type), or exit the program. "), FALSE);	addButton(FileHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	OpenHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(OpenHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                       Open Button "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Brings up a file selector in which you choose a file to "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " read into program or data memory. You can navigate through "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " directories by clicking the mouse once on an entry in the "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " directories list. To select a file, click once on an entry "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " in the file list, then click the OK button (or the Cancel "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " button to exit the file selector without choosing a file). "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Double-clicking or right-clicking an entry in the file list "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " will open the file without having to click the OK button. "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Files displayed in the file selector will be all files in "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " the current directory that have a file extension of 'hex'. "), FALSE);	addButton(OpenHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	SaveHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(SaveHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                    Save Button "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Use the Save Button to write the currently displayed "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " program or data memory to the file displayed on the "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " file status line. The existing file will be overwritten "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " with the current data. "), FALSE);	addButton(SaveHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	SaveAsHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(SaveAsHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                      Save as Button "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " The Save as Button will pop up a dialog box in which you "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " enter the name of the file in which to save the currently "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " displayed program or data memory. "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " If you do not enter a file extension, the extension "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " '.hex' will be automatically appended to the file name. "), FALSE);	addButton(SaveAsHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	SaveConfigHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(SaveConfigHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, "             Save Configuration Button "), FALSE);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Saves currently selected serial port and device "), FALSE);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, " information in the file 'gpicp.cfg'. This file "), FALSE);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, " is read whenever gpicp is started. "), FALSE);	addButton(SaveConfigHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	ExitHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(ExitHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(ExitHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(ExitHelpMenu, newButton(0, 0, 0, 0, 0, 0, "         Exit Button "), FALSE);	addButton(ExitHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(ExitHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Exit the Picstart programmer. "), FALSE);	addButton(ExitHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	CloseMenuHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(CloseMenuHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(CloseMenuHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(CloseMenuHelpMenu, newButton(0, 0, 0, 0, 0, 0, "     Close menu Button "), FALSE);	addButton(CloseMenuHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(CloseMenuHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Closes the file submenu. "), FALSE);	addButton(CloseMenuHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	HelpHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(HelpHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                   Help Button "), FALSE);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Brings up this help menu. Click on the 'Help' button in the "), FALSE);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, " main menu a second time, or click on the 'Close help menu' "), FALSE);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, " button to exit the help menu."), FALSE);	addButton(HelpHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	AboutHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(AboutHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, "              About Button "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Displays information about this program. "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Click the mouse a second time on the About "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " button, or click on the About display window "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " to close the About display window. "), FALSE);	addButton(AboutHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	serialPortHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(serialPortHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, "               Select serial port     "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Select a serial port to communicate with the "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " PICSTART or Warp-13 programmer. You must have "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " read/write permissions for the selected serial "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " port. "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Running this program as root is NOT recommended. "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Use chmod to allow users to access the serial "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " port to which the PICSTART or Warp-13 is connected. "), FALSE);	addButton(serialPortHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	enableHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(enableHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                  Enable programmer       "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Once you have selected a serial port and PIC device "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " type, click this button to initialize the PICSTART "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " or Warp-13 programmer. The programmer firmware version "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " will appear on the \"Programmer:\" status line. "), FALSE);	addButton(enableHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	deviceHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(deviceHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                 Select PIC device"), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Clicking on the Device Button will bring up a "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " device selection menu. Use the scroll bar to "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " scan through the list of available PIC devices. "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Click the mouse on the device you wish to use, "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " then click on either the OK or Cancel Button. "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " You may double-click or right-click on the device "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " type to select it without clicking the OK Button. "), FALSE);	addButton(deviceHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	readHelpMenu = newVMenu(HELP_X, HELP_Y, 0, 0, black, lgreen, white, green);	attachCallBack(readHelpMenu, SDL_MOUSEBUTTONDOWN, (void *) &CloseHelpMenu);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, "                        Read Button "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Clicking the Read Button brings up a submenu in which "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " you select what to read from the PIC device. You can "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " select program space, data space, ID locations or "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " configuration bits. Reading ID locations or configuration "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " bits will display them in the highlighted status line. "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Reading code or data space will display the program or "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " data memory in the main display window. "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, "  "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " Program or data memory will not be saved in a file unless "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " you select Save or Save As from the File menu. If no file "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " name appears in the display, clicking on Save is equivalent "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " to clicking on Save As. "), FALSE);	addButton(readHelpMenu, newButton(0, 0, 0, 0, 0, 0, " "), FALSE);

⌨️ 快捷键说明

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