📄 listing_11_6.c
字号:
/************************************************************************* **** listing_11_6.c **** **** Text Editor, Revision 1. This program will be built in Chapters **** 11 to 14. At this point, it consists of an XmMainWindow widget, **** as the parent of a scrolled text "widget". **** *************************************************************************/#include <Xm/MainW.h>#include <Xm/Text.h>/************************************************************************* **** F O R W A R D D E F I N I T I O N S **** *************************************************************************/void InitMainWindow();void InitMenuBar();void InitWorkWindow();void InitOther();/************************************************************************* **** G L O B A L V A R I A B L E S **** *************************************************************************/Widget appshell, /* Application Shell */ mainwin, /* XmMainWindow */ menubar, /* MainWindow Menu Bar */ workwin; /* MainWindow Work Area */Arg arglist[16]; /* For programmatic rsrc stuf *//************************************************************************* **** main( argc, argv ) **** **** Program entry point. Creates shell, calls initialization funcs, **** and turns control over to event loop. **** *************************************************************************/void main( argc, argv ) int argc; char *argv[];{ appshell = XtInitialize( argv[0], "Listing_11_6", NULL, 0, &argc, argv ); InitMainWindow(); InitMenuBar(); InitWorkWindow(); XmMainWindowSetAreas( mainwin, menubar, NULL, NULL, NULL, workwin ); InitOther(); XtRealizeWidget( appshell ); XtMainLoop();}/************************************************************************* **** InitMainWindow() **** **** This function creates the main window widget and its scrollbars. **** The main window is created as a child of the application shell. **** The scrollbars are either created along with the main-window (if **** its "scrollingPolicy" resource contains TRUE) or separately. **** **** This function modifies the global "mainwin", and accesses the **** global "appshell". **** *************************************************************************/void InitMainWindow(){ mainwin = XmCreateMainWindow( appshell, "MainWin", NULL, 0 ); XtManageChild( mainwin );}/************************************************************************* **** 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(){}/************************************************************************* **** InitWorkWindow() **** **** This function creates the work window and its children. The **** work window is created as the child of the main window. **** **** This function modifies the global "workwin", and accesses the **** global "mainwin". **** *************************************************************************/void InitWorkWindow(){ Widget txtmp; txtmp = XmCreateScrolledText( mainwin, "WorkWin", NULL, 0 ); XtManageChild( txtmp ); workwin = XtParent( txtmp );}/************************************************************************* **** InitOther() **** **** This function performs other program initialization, such as **** loading any default data. **** *************************************************************************/void InitOther(){}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -