📄 test56.c
字号:
FakeFormWidget Form = (FakeFormWidget)(w); printf("/* change_managed - begin %s */\n", XtName(w)); if (Form->fake_form.expected_index < Form->fake_form.expected_count) { if (Form->fake_form.expected[Form->fake_form.expected_index].type != ChangeManaged) { printf("Wrong method (%s)\n", Type2String(Form->fake_form.expected[Form->fake_form.expected_index].type)); GlobalErrors++; } else { printf("Right method\n"); } Form->fake_form.expected_index++; } else { printf("{ChangeManaged},\n"); } for (i = 0; i < ((CompositeWidget)w)->composite.num_children; i++) { PrintConstraints(((CompositeWidget)w)->composite.children[i]); } (((CompositeWidgetClass)XtClass(w)->core_class.superclass)->composite_class.change_managed)(w); printf("\n"); for (i = 0; i < ((CompositeWidget)w)->composite.num_children; i++) { PrintConstraints(((CompositeWidget)w)->composite.children[i]); } printf("/* change_managed - end %s */\n", XtName(w)); return;}static XtGeometryResultgeometry_manager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply){XtGeometryResult result;int i;FakeFormWidget Form = (FakeFormWidget)XtParent(w); printf("/* geometry_manager - begin %s %s */\n", XtName(XtParent(w)), XtName(w)); if (Form->fake_form.expected_index < Form->fake_form.expected_count) { if (Form->fake_form.expected[Form->fake_form.expected_index].type != GeometryManager) { printf("Wrong method (%s)\n", Type2String(Form->fake_form.expected[Form->fake_form.expected_index].type)); GlobalErrors++; } else { printf("Right method\n"); } Form->fake_form.expected_index++; } else { printf("{GeometryManager},\n"); } printf("/* request (%s) reply (%s) */\n", XdbWidgetGeometry2String(request), XdbWidgetGeometry2String(reply)); for (i = 0; i < ((CompositeWidget)XtParent(w))->composite.num_children; i++) { PrintConstraints(((CompositeWidget)XtParent(w))->composite.children[i]); } result = (((CompositeWidgetClass)XtClass(XtParent(w))->core_class.superclass)->composite_class.geometry_manager)(w, request, reply); for (i = 0; i < ((CompositeWidget)XtParent(w))->composite.num_children; i++) { PrintConstraints(((CompositeWidget)XtParent(w))->composite.children[i]); } printf("/* request (%s) reply (%s) answer %s */\n", XdbWidgetGeometry2String(request), XdbWidgetGeometry2String(reply), XdbGeometryResult2String(result)); printf("/* geometry_manager - end %s %s */\n", XtName(XtParent(w)), XtName(w)); return(result);}static XtGeometryResultquery_geometry(Widget w, XtWidgetGeometry *proposed, XtWidgetGeometry *desired){XtGeometryResult result;int i;FakeFormWidget Form = (FakeFormWidget)(w); printf("/* query_geometry - begin %s */\n", XtName(w)); if (Form->fake_form.expected_index < Form->fake_form.expected_count) { if (Form->fake_form.expected[Form->fake_form.expected_index].type != QueryGeometry) { printf("Wrong method (%s)\n", Type2String(Form->fake_form.expected[Form->fake_form.expected_index].type)); GlobalErrors++; } else { printf("Right method\n"); } Form->fake_form.expected_index++; } else { printf("{QueryGeometry},\n"); } printf("/* proposed (%s) desired (%s) */\n", XdbWidgetGeometry2String(proposed), XdbWidgetGeometry2String(desired)); PrintGeometry(w, proposed); PrintGeometry(w, desired); for (i = 0; i < ((CompositeWidget)(w))->composite.num_children; i++) { PrintConstraints(((CompositeWidget)(w))->composite.children[i]); } result = (((CompositeWidgetClass)XtClass(w)->core_class.superclass)->core_class.query_geometry)(w, proposed, desired); for (i = 0; i < ((CompositeWidget)(w))->composite.num_children; i++) { PrintConstraints(((CompositeWidget)(w))->composite.children[i]); } PrintGeometry(w, proposed); PrintGeometry(w, desired); printf("/* proposed (%s) desired (%s) result (%s) */\n", XdbWidgetGeometry2String(proposed), XdbWidgetGeometry2String(desired), XdbGeometryResult2String(result)); printf("/* query_geometry - end %s */\n", XtName(w)); return(result);}static voidinitialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args){ ((FakeFormWidget)new_w)->fake_form.expected_index = 0; (((CompositeWidgetClass)XtClass(new_w)->core_class.superclass)->core_class.initialize)(request, new_w, args, num_args);}#define Offset(field) XtOffsetOf(FakeFormRec, fake_form.field)static XtResource resources[] ={ { expectedItems, ExpectedItems, XtRPointer, sizeof(XtPointer), Offset(expected), XmRImmediate, NULL }, { expectedCount, ExpectedCount, XmRInt, sizeof(int), Offset(expected_count), XmRImmediate, (XtPointer)0 },};#undef Offset/* *INDENT-OFF* */FakeFormClassRec fakeFormClassRec = { /* Core Class Part */ { /* superclass */ (WidgetClass) & xmFormClassRec, /* class_name */ "FakeForm", /* widget_size */ sizeof(FakeFormRec), /* class_initialize */ NULL, /* class_part_initialize */ NULL, /* class_inited */ False, /* initialize */ initialize, /* initialize_hook */ NULL, /* realize */ XtInheritRealize, /* actions */ NULL, /* num_actions */ 0, /* resources */ resources, /* num_resources */ XtNumber(resources), /* xrm_class */ NULLQUARK, /* compress_motion */ True, /* compress_exposure */ XtExposeCompressMultiple, /* compress_enterleave */ True, /* visible_interest */ True, /* destroy */ NULL, /* resize */ XtInheritResize, /* expose */ XtInheritExpose, /* set_values */ NULL, /* set_values_hook */ NULL, /* set_values_almost */ XtInheritSetValuesAlmost, /* get_values_hook */ NULL, /* accept_focus */ NULL, /* version */ XtVersion, /* callback offsets */ NULL, /* tm_table */ XtInheritTranslations, /* query_geometry */ query_geometry, /* display_accelerator */ XtInheritDisplayAccelerator, /* extension */ NULL, }, /* Composite Class Part */ { /* geometry manager */ geometry_manager, /* change_managed */ change_managed, /* insert_child */ XtInheritInsertChild, /* delete_child */ XtInheritDeleteChild, /* extension */ NULL, }, /* Constraint Class Part */ { /* subresources */ NULL, /* subresource_count */ 0, /* constraint_size */ sizeof(XmFormConstraintRec), /* initialize */ constraint_initialize, /* destroy */ NULL, /* set_values */ constraint_set_values, /* extension */ NULL, }, /* Manager Class Part */ { /* translations */ XmInheritTranslations, /* syn_resources */ NULL, /* num_syn_resources */ 0, /* syn_constraint_res */ NULL, /* num_syn_constraint_res */ 0, /* parent_process */ XmInheritParentProcess, /* extension */ NULL, }, /* XmBulletinBoard part */ { /* always_install_accelerators */ False, /* geo_matrix_create */ NULL, /* focus_moved_proc */ XmInheritFocusMovedProc, /* extension */ NULL, }, /* XmForm part */ { /* extension */ NULL, }, /* FakeForm Class Part */ { /* extension */ NULL, }};/* *INDENT-ON* */WidgetClass fakeFormWidgetClass = (WidgetClass)&fakeFormClassRec;WidgetCreateFakeForm(Widget parent, char *name, Arg *arglist, Cardinal argCount){ return XtCreateWidget(name, fakeFormWidgetClass, parent, arglist, argCount);}/* Fake Form.c *//* Fake Form sub-class */intmain(int argc, char **argv){ XtAppContext app; Widget Shell; Widget Form; Widget TopLabel, BottomLabel; Arg args[10]; int n; ExpectedResults expected[] = {/* constraint_initialize - begin MyForm TopLabelTopLabel */{ConstraintInitialize},/* request */{FormConstraint, "TopLabelTopLabel", 0, 0, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 0, 0, 0, 0},/* new_w */{FormConstraint, "TopLabelTopLabel", 0, 0, 100, 17, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},/* constraint_initialize - end MyForm TopLabelTopLabel *//* constraint_initialize - begin MyForm BottomLabel */{ConstraintInitialize},/* request */{FormConstraint, "BottomLabel", 0, 0, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 0, 0, 0, 0},/* new_w */{FormConstraint, "BottomLabel", 0, 0, 70, 17, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},/* constraint_initialize - end MyForm BottomLabel *//* constraint_set_values - begin MyForm TopLabelTopLabel */{ConstraintSetValues},{FormConstraint, "TopLabelTopLabel", 0, 0, 100, 17, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},{FormConstraint, "TopLabelTopLabel", 0, 0, 100, 17, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},{FormConstraint, "TopLabelTopLabel", 0, 0, 100, 17, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},/* constraint_set_values - end MyForm TopLabelTopLabel *//* constraint_set_values - begin MyForm BottomLabel */{ConstraintSetValues},{FormConstraint, "BottomLabel", 0, 0, 70, 17, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},{FormConstraint, "BottomLabel", 0, 0, 70, 40, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_WIDGET, "TopLabelTopLabel", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},{FormConstraint, "BottomLabel", 0, 0, 70, 40, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_WIDGET, "TopLabelTopLabel", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, "", False, True, 65535, 40, 0, 0},/* constraint_set_values - end MyForm BottomLabel *//* change_managed - begin MyForm */{ChangeManaged},{FormConstraint, "TopLabelTopLabel", 0, 0, 100, 17, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 0, 0, "", False, True, 65535, 65535, 0, 0},{FormConstraint, "BottomLabel", 0, 0, 70, 40, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_WIDGET, "TopLabelTopLabel", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 0, 0, "", False, True, 65535, 40, 0, 0},{FormConstraint, "TopLabelTopLabel", 0, 0, 100, 17, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 102, 102, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_NONE, "", 0, 65535, 19, 19, "BottomLabel", True, True, 100, 17, 102, 61},{FormConstraint, "BottomLabel", 0, 19, 100, 40, XmATTACH_FORM, "", 0, 65535, 0, 0, XmATTACH_FORM, "", 0, 65535, 102, 102, XmATTACH_WIDGET, "TopLabelTopLabel", 0, 65535, 19, 19, XmATTACH_FORM, "", 0, 65535, 61, 61, "", True, True, 70, 40, 102, 61},/* change_managed - end MyForm */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -