📄 readme
字号:
SmartMessageBox Widget-----------------------------------------------------------------------------This is the xmSmartMessageBoxWidget. The basic idea is that I decidedthat dialogs should be simpler in Motif programs, ie, you shouldn't haveto unmanage unwanted widgets just to have a dialog. Plus, the Templatedialog is more voodoo than anything else. The SmartMessagBox widgetmanages whatever you tell it to in 4 different ways: as a label, asa control widget, as a separator, or as an action widget. You canhave up to 1 label, up to 1 control, up to 1 separator, and as many action widgetsas you'd like. This is all handled throught constraint resources.The basic setup is: ------------------------------------ - Label | - - | Control - -----------| Area - - | _ - separator - ------------------------------------ - Action - - Area - ------------------------------------Although you don't need to have all of the different areas. When you create a child of a SmartMessageBoxWidget, it'sconstraint resource XmNchildType defaults to XmCHILD_ACTION, whichmeans for it to be managed in the action area. You can changethis resource so that it is managed in any of the 4 fields above.A basic dialog box would then look like: smb = XtCreateManagedWidget("SmartMessageBox", xmSmartMessageBoxWidgetClass, toplevel, NULL, 0); n = 0; XtSetArg(warg[n], XmNchildType, XmCHILD_LABEL); n++; XtCreateManagedWidget("Label", xmLabelWidgetClass, smb, warg, n); n = 0; XtSetArg(warg[n], XmNchildType, XmCHILD_SEPARATOR); n++; XtCreateManagedWidget("Separator", xmSeparatorWidgetClass, smb, warg, n); n = 0; XtSetArg(warg[n], XmNchildType, XmCHILD_CONTROL); n++; XtCreateManagedWidget("MessageLabel", xmLabelWidgetClass, smb, warg, n);/*** These default to the action area.*/ defButton = XtCreateManagedWidget("OK", xmPushButtonWidgetClass, smb, warg, n); XtCreateManagedWidget("Help", xmPushButtonWidgetClass, smb, NULL, 0); n = 0; XtSetArg(warg[n], XmNdefaultButton, defButton); n++; XtSetValues(smb, warg, n); The other resources are: XmNminimizeButtons: (Boolean) make all the widgets in the action area the smallest possible XmNdialogType: (XmDIALOG_INFORMATION, etc.) adds the appropriate bitmap to the dialog as a label automatically XmNdialogPositioning: positions the dialog on popups toXmDIALOG_POSITIONING_LEAVE_ALONE: let the window manager do whateverXmDIALOG_POSITIONING_INITIAL_CENTER: first time it pops up centered in the screen, afterwards it pops up wherever it was leftXmDIALOG_POSITIONING_ALWAYS_CENTER: always pops up in the center of the screenXmDIALOG_POSITIONING_DEFAULT_AT_POINTER: positions the dialog up so that the default button is centered on the pointerXmDIALOG_POSITIONING_CENTER_AT_POINTER: positions the dialog up so that the dialog is centered on the pointer To build the SmartMessageBoxWidget you will need Motif 1.2. Plusif you have a version < 1.2.3 you will need to #define NEED_BBCONSTRAINT 1since the Motif headers didn't have the Bulletin board constraint part likethey should have. That's about it. Let me know what you think, and if I get encouragedthen maybe I'll write some more...See copyright or source files fordistribution info... John L. Cwikla cwikla@wri.com Furthering "open software" into reality...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -