test9.c
来自「安装DDD之前」· C语言 代码 · 共 69 行
C
69 行
#include <stdio.h>#include <Xm/Xm.h>#include <Xm/DrawingA.h>#include <Xm/Label.h>static char *FallBack[] = { "*buttonbutton.background: red", NULL};intmain(int argc, char **argv){ XtAppContext theApp; Widget toplevel, drawingArea, button; toplevel = XtVaAppInitialize(&theApp, "drawingArea", NULL, 0, &argc, argv, FallBack, NULL); XtVaSetValues(toplevel, XmNallowShellResize, True, NULL); drawingArea= XtVaCreateManagedWidget("drawingArea", xmDrawingAreaWidgetClass, toplevel, XmNwidth, 100, XmNheight, 100, NULL); button = XtVaCreateManagedWidget("buttonbutton", xmLabelWidgetClass, drawingArea, NULL); XtRealizeWidget(toplevel);/* Note: the following values are the result of * querying the current geometry. */{static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 284, 552, 100, 100, 0,0,0, /* drawingArea */ CWWidth | CWHeight | CWX | CWY, 10, 10, 76, 17, 0,0,0, /* buttonbutton */ CWWidth | CWHeight , 284, 552, 106, 37, 0,0,0, /* drawingArea */ CWWidth | CWHeight | CWX | CWY, 20, 10, 76, 17, 0,0,0, /* buttonbutton */ CWWidth | CWHeight , 284, 552, 230, 37, 0,0,0, /* drawingArea */ CWWidth | CWHeight | CWX | CWY, 20, 10, 200, 17, 0,0,0, /* buttonbutton */};/* toplevel should be replaced with to correct applicationShell */ PrintDetails(toplevel, Expected);LessTifTestWaitForIt(toplevel); XtVaSetValues(button, XmNx, 20, NULL);PrintDetails(toplevel, Expected);LessTifTestWaitForIt(toplevel); XtVaSetValues(button, XmNwidth, 200, NULL);PrintDetails(toplevel, Expected);LessTifTestWaitForIt(toplevel);} LessTifTestMainLoop(toplevel); exit(0);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?