📄 test53.c
字号:
XmNbottomWidget, this->vLabel, XmNbottomOffset, 5, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 5, XmNalignment, XmALIGNMENT_CENTER, NULL); this->separator3 = XtVaCreateManagedWidget("separator3", xmSeparatorGadgetClass, form, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 5, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, this->spaceLabel, XmNbottomOffset, 10, NULL); n = 0; XtSetArg(arg[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(arg[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(arg[n], XmNbottomAttachment, XmATTACH_WIDGET); n++; XtSetArg(arg[n], XmNbottomWidget, this->separator3); n++; XtSetArg(arg[n], XmNleftOffset, 3); n++; XtSetArg(arg[n], XmNrightOffset, 3); n++; XtSetArg(arg[n], XmNbottomOffset, 10); n++; this->gc_rc = XmCreateRadioBox(form, "gridType", arg, n); XtManageChild(this->gc_rc); this->noneTButton = XtVaCreateManagedWidget("noneTButton", xmToggleButtonWidgetClass, this->gc_rc, XmNshadowThickness, 0, NULL); this->oneDhTButton = XtVaCreateManagedWidget("oneDhTButton", xmToggleButtonWidgetClass, this->gc_rc, XmNshadowThickness, 0, NULL); this->oneDvTButton = XtVaCreateManagedWidget("oneDvTButton", xmToggleButtonWidgetClass, this->gc_rc, XmNshadowThickness, 0, NULL); this->twoDTButton = XtVaCreateManagedWidget("twoDTButton", xmToggleButtonWidgetClass, this->gc_rc, XmNshadowThickness, 0, NULL); label = XtVaCreateManagedWidget("typeLabel", xmLabelWidgetClass, form, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, this->gc_rc, XmNbottomOffset, 5, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 5, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 5, XmNalignment, XmALIGNMENT_CENTER, NULL); XtAddCallback(this->noneTButton, XmNvalueChangedCallback, (XtCallbackProc)GridDialog_DimensionCB, (XtPointer)this); XtAddCallback(this->oneDvTButton, XmNvalueChangedCallback, (XtCallbackProc)GridDialog_DimensionCB, (XtPointer)this); XtAddCallback(this->oneDhTButton, XmNvalueChangedCallback, (XtCallbackProc)GridDialog_DimensionCB, (XtPointer)this); XtAddCallback(this->twoDTButton, XmNvalueChangedCallback, (XtCallbackProc)GridDialog_DimensionCB, (XtPointer)this); XtManageChild(form); return form;}void GridDialog_DimensionCB(Widget widget, XtPointer clientData, XtPointer callData){ Boolean right, lower, center; GridDialog *dialog = (GridDialog*) clientData; if(!XmToggleButtonGetState(widget)) return; lower = right = center = False; if(XmToggleButtonGetState(dialog->lowerbtn)) {lower = True;}; if(XmToggleButtonGetState(dialog->rightbtn)) {right = True;}; if(XmToggleButtonGetState(dialog->lrbtn)) {lower = True; right = True;} if(XmToggleButtonGetState(dialog->llbtn)) {lower = True;} if(XmToggleButtonGetState(dialog->urbtn)) {right = True;}; if(XmToggleButtonGetState(dialog->ctbtn)) {center = True;}; if(widget == dialog->noneTButton) { XtSetSensitive(dialog->hspacing, False); XtSetSensitive(dialog->vspacing, False); XtVaSetValues(dialog->separator2, XmNbottomWidget, dialog->ok, NULL); XtUnmanageChild(dialog->align_form); } else if(widget == dialog->oneDvTButton) { XtSetSensitive(dialog->hspacing, False); XtSetSensitive(dialog->vspacing, True); XtManageChild(dialog->upperbtn); XtManageChild(dialog->lowerbtn); XtVaSetValues(dialog->alignLabel, XmNbottomWidget, dialog->upperbtn, NULL); XtVaSetValues(dialog->ctbtn, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, dialog->lowerbtn, NULL); XtUnmanageChild(dialog->ulbtn); XtUnmanageChild(dialog->urbtn); XtUnmanageChild(dialog->llbtn); XtUnmanageChild(dialog->lrbtn); XtUnmanageChild(dialog->leftbtn); XtUnmanageChild(dialog->rightbtn); XtManageChild(dialog->align_form); XtVaSetValues(dialog->separator2, XmNbottomWidget, dialog->align_form,NULL); if(lower) XmToggleButtonSetState(dialog->lowerbtn, True, False); else if(center) XmToggleButtonSetState(dialog->ctbtn, True, False); else XmToggleButtonSetState(dialog->upperbtn, True, False); XtVaSetValues (dialog->align_form, XmNheight, 0, NULL); } else if(widget == dialog->oneDhTButton) { XtSetSensitive(dialog->hspacing, True); XtSetSensitive(dialog->vspacing, False); XtManageChild(dialog->leftbtn); XtManageChild(dialog->rightbtn); XtVaSetValues(dialog->alignLabel, XmNbottomWidget, dialog->ctbtn, NULL); XtVaSetValues(dialog->ctbtn, XmNbottomAttachment, XmATTACH_FORM, NULL); XtUnmanageChild(dialog->ulbtn); XtUnmanageChild(dialog->urbtn); XtUnmanageChild(dialog->llbtn); XtUnmanageChild(dialog->lrbtn); XtUnmanageChild(dialog->upperbtn); XtUnmanageChild(dialog->lowerbtn); XtManageChild(dialog->align_form); XtVaSetValues(dialog->separator2, XmNbottomWidget, dialog->align_form,NULL); if(right) XmToggleButtonSetState(dialog->rightbtn, True, False); else if(center) XmToggleButtonSetState(dialog->ctbtn, True, False); else XmToggleButtonSetState(dialog->leftbtn, True, False); /* make the form widget recalc its height requirement. In the 1dH case, the align_form widget is getting too tall. Changing from 1dH to either 2d or 1dV, then makes a mess on the screen.*/ XtVaSetValues (dialog->align_form, XmNheight, 0, NULL); } else if(widget == dialog->twoDTButton) { XtSetSensitive(dialog->hspacing, True); XtSetSensitive(dialog->vspacing, True); XtManageChild(dialog->ulbtn); XtManageChild(dialog->urbtn); XtManageChild(dialog->llbtn); XtManageChild(dialog->lrbtn); XtVaSetValues(dialog->alignLabel, XmNbottomWidget, dialog->ulbtn, NULL); XtVaSetValues(dialog->ctbtn, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, dialog->llbtn, NULL); XtUnmanageChild(dialog->leftbtn); XtUnmanageChild(dialog->rightbtn); XtUnmanageChild(dialog->upperbtn); XtUnmanageChild(dialog->lowerbtn); XtManageChild(dialog->align_form); XtVaSetValues(dialog->separator2, XmNbottomWidget, dialog->align_form,NULL); if(lower) if(right) XmToggleButtonSetState(dialog->lrbtn, True, False); else XmToggleButtonSetState(dialog->llbtn, True, False); else if(center) XmToggleButtonSetState(dialog->ctbtn, True, False); else if(right) XmToggleButtonSetState(dialog->urbtn, True, False); else XmToggleButtonSetState(dialog->ulbtn, True, False); XtVaSetValues (dialog->align_form, XmNheight, 0, NULL); }}#if 0boolean GridDialog::okCallback(Dialog *d){ int width, height; Boolean upper_left, upper_right, center, lower_left, lower_right, snap; Boolean upper, lower, right, left; unsigned int x_align; unsigned int y_align; WorkSpaceInfo *wsinfo = this->workSpace->getInfo(); Boolean align_horizontal; Boolean align_vertical; align_horizontal = align_vertical = False; if(XmToggleButtonGetState(this->twoDTButton)) align_horizontal = align_vertical = True; else if(XmToggleButtonGetState(this->oneDvTButton)) align_vertical = True; else if(XmToggleButtonGetState(this->oneDhTButton)) align_horizontal = True; XtVaGetValues(this->ulbtn, XmNset, &upper_left, NULL); XtVaGetValues(this->urbtn, XmNset, &upper_right, NULL); XtVaGetValues(this->ctbtn, XmNset, ¢er, NULL); XtVaGetValues(this->llbtn, XmNset, &lower_left, NULL); XtVaGetValues(this->lrbtn, XmNset, &lower_right, NULL); XtVaGetValues(this->rightbtn, XmNset, &right, NULL); XtVaGetValues(this->leftbtn, XmNset, &left, NULL); XtVaGetValues(this->upperbtn, XmNset, &upper, NULL); XtVaGetValues(this->lowerbtn, XmNset, &lower, NULL); if(align_horizontal) { if (upper_left || lower_left || left) x_align = XmALIGNMENT_BEGINNING; else if (center) x_align = XmALIGNMENT_CENTER; else x_align = XmALIGNMENT_END; } else x_align = XmALIGNMENT_NONE; if(align_vertical) { if (upper_left || upper_right || upper) y_align = XmALIGNMENT_BEGINNING; else if (center) y_align = XmALIGNMENT_CENTER; else y_align = XmALIGNMENT_END; } else y_align = XmALIGNMENT_NONE; wsinfo->setGridAlignment(x_align, y_align); wsinfo->setGridActive(align_horizontal || align_vertical); XtVaGetValues(this->hspacing, XmNiValue, &width, NULL); XtVaGetValues(this->vspacing, XmNiValue, &height, NULL); wsinfo->setGridSpacing(width, height); this->workSpace->installInfo(NULL); return TRUE;}void GridDialog::resetToggleBtn(){ XtVaSetValues(this->ulbtn, XmNset, False, NULL);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -