This source code has been tested under OpenWindows 2.0, Sun s X11/NeWS server. For Xlib programs th

源代码在线查看: template2.c

软件大小: 141 K
上传用户: zhangyan
关键词: OpenWindows programs source server
下载地址: 免注册下载 普通下载 VIP

相关代码

				/***********************************************************************				**                                                                    **				**  template2.c                                                       **				**                                                                    **				**  Sample program template for non-trivial programs.                 **				**                                                                    **				***********************************************************************/												#include 												/***********************************************************************				**                                                                    **				**               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       */					horzscroll,			/* MainWindow Horizontal Scrl */					vertscroll;			/* MainWindow Vertical Scroll */				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_5", NULL, 0, &argc, argv );								    InitMainWindow();				    InitMenuBar();				    InitWorkWindow();								    XmMainWindowSetAreas( mainwin, menubar, NULL, 				                                   horzscroll, vertscroll, 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 globals "mainwin", "horzscroll", and   **				**  "vertscroll". It accesses "appshell".                             **				**                                                                    **				***********************************************************************/								void	InitMainWindow()				{				    mainwin = XmCreateMainWindow( appshell, "MainWin", NULL, 0 );				    XtManageChild( mainwin );								/** Use this code to create scrollbars separately				    horzscroll = XmCreateScrollBar( mainwin, "HScroll", NULL,  0 );				    XtManageChild( horzscroll );				    vertscroll = XmCreateScrollBar( mainwin, "VScroll", NULL,  0 );				    XtManageChild( vertscroll );				**/								/** Use this code to access automatically-created scrollbars				    XtSetValues( arglist[0], XmNhorizontalScrollBar, &horzscroll );				    XtSetValues( arglist[1], XmNverticalScrollBar,   &vertscroll );				    XtGetValues( mainwin, arglist, 2 );				**/				}												/***********************************************************************				**                                                                    **				**  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()				{				}												/***********************************************************************				**                                                                    **				**  InitOther()                                                       **				**                                                                    **				**  This function performs other program initialization, such as      **				**  loading any default data.                                         **				**                                                                    **				***********************************************************************/								void	InitOther()				{				}							

相关资源