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

📄 test6.c

📁 安装DDD之前
💻 C
字号:
/* $Header: /cvsroot/lesstif/lesstif/test/Xm/text/test6.c,v 1.6 2001/05/21 14:44:48 amai Exp $    A copy of test3.c without the double use of source *//* Extended to print some internals of the widget set *//*** Generated by X-Designer */#include <stdlib.h>#include <stdio.h>#include <X11/Xatom.h>#include <X11/Intrinsic.h>#include <X11/Shell.h>#include <Xm/Xm.h>#include <Xm/DialogS.h>#include <Xm/RowColumn.h>#include <Xm/ScrollBar.h>#include <Xm/Text.h>#include <Xm/TextP.h>#include "../../common/Test.h"Widget appshell = (Widget) NULL;Widget rowcol = (Widget) NULL;Widget text1_sw = (Widget) NULL;Widget text1 = (Widget) NULL;Widget text2_sw = (Widget) NULL;Widget text2 = (Widget) NULL;void Doit(Widget w, XtPointer client, XtPointer call){	XmTextWidget	tw = (XmTextWidget)w; 	XmTextLineTable	p;	int		i;	Line		l;	/* Print the Line Table */	p = tw->text.line_table;	fprintf(stderr, "Line Table (size %d index %d)\n",		tw->text.table_size,		tw->text.table_index);	for (i=0; i<tw->text.table_size; i++) {	    fprintf(stderr, "\tline %d start_pos %d virt_line %d\n",		i, p[i].start_pos, p[i].virt_line);	    if (i != 0 && p[i].start_pos == 0)		break;	}	/* Print Lines */	fprintf(stderr, "LineCount %d\n", tw->text.number_lines);	for (i=0; i<tw->text.number_lines; i++) {		l = &tw->text.line[i];		fprintf(stderr, "Line %d\tstart %d changed %d past_end %d",			i, (int)l->start, (int)l->changed, (int)l->past_end);		if (l->extra)			fprintf(stderr, " extra : width %d wrappedbychar %d",				l->extra->width, l->extra->wrappedbychar);		fprintf(stderr, "\n");	}}void create_appshell(Display *display,                     char *app_name,                     int app_argc,                     char **app_argv){	Arg al[64];                    /* Arg List */	register int ac = 0;           /* Arg Count */	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;	XtSetArg(al[ac], XmNtitle, "Text Sources"); ac++;	XtSetArg(al[ac], XmNargc, app_argc); ac++;	XtSetArg(al[ac], XmNargv, app_argv); ac++;	appshell = XtAppCreateShell ( app_name, "XApplication", applicationShellWidgetClass, display, al, ac );	ac = 0;	XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;	rowcol = XmCreateRowColumn ( appshell, "rowcol", al, ac );	ac = 0;	XtSetArg(al[ac], XmNcolumns, 38); ac++;	XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++;	XtSetArg(al[ac], XmNrows, 8); ac++;	XtSetArg(al[ac], XmNwordWrap, TRUE); ac++;	XtSetArg(al[ac], XmNscrollHorizontal, FALSE); ac++;	text1 = XmCreateScrolledText ( rowcol, "text1", al, ac );	ac = 0;	text1_sw = XtParent ( text1 );	XmTextSetString ( text1, "These two text widgets share a common text source\n\nThis means that any edits I make in one text widget will be automatically reflected in the other.\n\nThe text widgets can be displaying different parts of the source at the same time." );	XtManageChild(text1);	XtManageChild ( rowcol);	XtAddCallback(text1, XmNfocusCallback, Doit, NULL);}XtAppContext app_context;Display *display;       /*  Display             */int main (int  argc, char **argv){	XtSetLanguageProc ( (XtAppContext) NULL, (XtLanguageProc) NULL, (XtPointer) NULL );	XtToolkitInitialize ();	app_context = XtCreateApplicationContext ();	display = XtOpenDisplay (app_context, NULL, argv[0], "XApplication",	                         NULL, 0, &argc, argv);	if (!display)	{	    printf("%s: can't open display, exiting...\n", argv[0]);	    exit (-1);	}	create_appshell ( display, argv[0], argc, argv );	XtRealizeWidget (appshell);  {    static XtWidgetGeometry Expected[] = {   CWWidth | CWHeight            ,   56,   72,  271,  128, 0,0,0, /* rowcol */   CWWidth | CWHeight | CWX | CWY,    3,    3,  265,  122, 0,0,0, /* text1SW */   CWWidth | CWHeight | CWX | CWY,  250,    0,   15,  122, 0,0,0, /* VertScrollBar */   CWWidth | CWHeight | CWX | CWY,    0,    0,  246,  122, 0,0,0, /* text1 */     };    PrintDetails(appshell,Expected);};  LessTifTestMainLoop(appshell);	exit (0);}

⌨️ 快捷键说明

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