LICENSE at the root; the 103 files new in ext/src/mcde (none was in the CDE import) carry the CNCL line instead of the LGPL notice. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
70 lines
1.7 KiB
C
70 lines
1.7 KiB
C
/*
|
|
* menuscale.c -- dtbar: a slider in a Motif menu
|
|
*
|
|
* License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
*
|
|
* A Motif menu takes as entry a widget whose class carries the trait
|
|
* XmQTmenuSavvy, and warns "Attempt to add wrong child type to a menu"
|
|
* otherwise (lib/Xm/RowColumn.c, InsertChild; motif-2.3.8). Labels and
|
|
* buttons carry it (Label.c, LabelG.c); XmScale does not. Here XmScale gets
|
|
* it the way Motif gives it to its own classes, XmeTraitSet(3): no mnemonic,
|
|
* no accelerator, and valueChanged as the callback a menu's entryCallback
|
|
* stands in for (RCMenu.c asks getActivateCBName for it). Nothing in Motif
|
|
* changes; the trait is on the class within this program.
|
|
*
|
|
* C99, POSIX, Xt and Motif only (ext/src/mcde/AGENTS.md).
|
|
*/
|
|
|
|
#include <X11/Intrinsic.h>
|
|
#include <Xm/Xm.h>
|
|
#include <Xm/MenuT.h>
|
|
#include <Xm/Scale.h>
|
|
#include <Xm/TraitP.h>
|
|
|
|
#include "dtbar.h"
|
|
|
|
static void
|
|
Disable(Widget w, XmActivateState state)
|
|
{
|
|
(void) w;
|
|
(void) state; /* a scale has no activate callback to defer */
|
|
}
|
|
|
|
static char *
|
|
Accelerator(Widget w)
|
|
{
|
|
(void) w;
|
|
return NULL;
|
|
}
|
|
|
|
static KeySym
|
|
Mnemonic(Widget w)
|
|
{
|
|
(void) w;
|
|
return NoSymbol;
|
|
}
|
|
|
|
static char *
|
|
ActivateName(void)
|
|
{
|
|
return XmNvalueChangedCallback;
|
|
}
|
|
|
|
static XmMenuSavvyTraitRec scaleSavvy = {
|
|
0, Disable, Accelerator, Mnemonic, ActivateName
|
|
};
|
|
|
|
Widget
|
|
MenuScale(Widget menu, const char *name, Arg *args, Cardinal n)
|
|
{
|
|
static Boolean done;
|
|
|
|
if (!done) {
|
|
XtInitializeWidgetClass(xmScaleWidgetClass);
|
|
(void) XmeTraitSet((XtPointer) xmScaleWidgetClass, XmQTmenuSavvy,
|
|
(XtPointer) &scaleSavvy);
|
|
done = True;
|
|
}
|
|
return XtCreateManagedWidget(name, xmScaleWidgetClass, menu, args, n);
|
|
}
|