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

📄 menu.c

📁 This source code has been tested under OpenWindows 2.0, Sun s X11/NeWS server. For Xlib programs th
💻 C
字号:
/*************************************************************************                                                                    ****  menu.c                                                            ****                                                                    ****  Text Editor -- Menubar Module                                     ****                                                                    *************************************************************************/#include <string.h>#include <Xm/RowColumn.h>#include <Xm/CascadeB.h>#include <Xm/Label.h>#include <Xm/PushB.h>#include <Xm/Separator.h>#include "textedit.h"/*************************************************************************                                                                    ****               F O R W A R D   D E F I N I T I O N S                ****                                                                    *************************************************************************/static	void	InitFileMenu();static	void	InitEditMenu();static	void	InitViewMenu();static	void	InitOptionMenu();static	void	InitHelpMenu();/*************************************************************************                                                                    ****                    L O C A L   V A R I A B L E S                   ****                                                                    *************************************************************************//*************************************************************************                                                                    ****  InitMenuBar()                                                     ****                                                                    ****  This function creates the menu bar and all pulldown menus. The    ****  menu bar is created as the child of the main window.              ****                                                                    ****  This function modifies the global "menubar", and accesses the     ****  global "mainwin".                                                 ****                                                                    *************************************************************************/void	InitMenuBar(){    menubar = XmCreateMenuBar( mainwin, "MenuBar", NULL, 0 );    XtManageChild( menubar );    InitFileMenu();    InitEditMenu();    InitViewMenu();    InitOptionMenu();    InitHelpMenu();}/*************************************************************************                                                                    ****  InitFileMenu()                                                    ****                                                                    ****  Creates the File menu: cascade button, pull-down menu pane, and   ****  all menu-pane choices. Attaches callbacks to menu-pane choices.   ****                                                                    *************************************************************************/static void InitFileMenu(){    Widget	topic;    topic = XmCreateCascadeButton( menubar, "FileTopic", NULL, 0 );    XtManageChild( topic );}/*************************************************************************                                                                    ****  InitEditMenu()                                                    ****                                                                    ****  Creates the Edit menu: cascade button, pull-down menu pane, and   ****  all menu-pane choices. Attaches callbacks to menu-pane choices.   ****                                                                    *************************************************************************/static void InitEditMenu(){    Widget	topic;    topic = XmCreateCascadeButton( menubar, "EditTopic", NULL, 0 );    XtManageChild( topic );}/*************************************************************************                                                                    ****  InitViewMenu()                                                    ****                                                                    ****  Creates the View menu: cascade button, pull-down menu pane, and   ****  all menu-pane choices. Attaches callbacks to menu-pane choices.   ****                                                                    *************************************************************************/static void InitViewMenu(){    Widget	topic;    topic = XmCreateCascadeButton( menubar, "ViewTopic", NULL, 0 );    XtManageChild( topic );}/*************************************************************************                                                                    ****  InitOptionMenu()                                                  ****                                                                    ****  Creates the Option menu: cascade button, pull-down menu pane, and ****  all menu-pane choices. Attaches callbacks to menu-pane choices.   ****                                                                    *************************************************************************/static void InitOptionMenu(){    Widget	topic;    topic = XmCreateCascadeButton( menubar, "OptionTopic", NULL, 0 );    XtManageChild( topic );}/*************************************************************************                                                                    ****  InitHelpMenu()                                                    ****                                                                    ****  Creates the Help menu: cascade button, pull-down menu pane, and   ****  all menu-pane choices. Attaches callbacks to menu-pane choices.   ****                                                                    *************************************************************************/static void InitHelpMenu(){    Widget	topic;    topic = XmCreateCascadeButton( menubar, "HelpTopic", NULL, 0 );    XtManageChild( topic );    XtSetArg( arglist[0], XmNmenuHelpWidget, topic );    XtSetValues( menubar, arglist, 1 );}

⌨️ 快捷键说明

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