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ample.visualClass: TrueColor
$B$N$h$&$K!"5/F0;~$K$O(Bownvisual -depth 24 -visual TrueColor
$B$N$h$&$K$7$F!"%G%U%)%k%H$H0[$J$k%S%8%e%"%k$r;XDj$9$k$3$H$,$G$-$k!#(B
Widget dialogBox, drawingArea;
...
Widget wlist[2];
wlist[0] = drawingArea;
wlist[1] = XtParent(dialogBox);
XtSetWMColormapWindows(wlist[1], wlist, 2);
$B$3$N4X?t$r
$B$N$$$:$l$+$G
/* $B%]%$%s%?F~=P<+$NF0:n$r5-=R(B */
char *action_table = "<Enter>: SetCm(0)\n <Leave>: SetCm(1)\n";
/* $B%"%/%7%g%s$H4X?t$r7k$SIU$1$k(B */
void SetCM(Widget w, XEvent *ev, String *args, Cardinal *num);
static XtActionsRec actions[] =
{
{ "SetCm", SetCM },
};
...
/* $B%"%/%7%g%s$NEPO?(B */
XtAppAddActions(app, actions, XtNumber(actions));
/* $BF0:n$r(BDrawingArea$B$K;E9~$`(B */
XtOverrideTranslations(draw_area, XtParseTranslationTable(action_table));
...
void
SetCM(Widget w, XEvent *ev, String *args, Cardinal *num)
{
Widget wlist[2];
if (args[0][0] == '0') {
/* DrawingArea$B$N%+%i!<%^%C%W$rM%@h(B */
wlist[0] = w;
wlist[1] = shell;
} else {
/* $B%G%U%)%k%H$N%+%i!<%^%C%W$rM%@h(B */
wlist[0] = shell;
wlist[1] = w;
}
XtSetWMColormapWindows(shell, wlist, 2);
}
$B%&%#%s%I%&%^%M!<%8%c$NCf$K$O!"2?$b$7$J$/$F$b$3$N%W%m%0%i%`$HF1$8F0(B
$B:n$r$9$k$b$N$b$"$k!#$^$?!"(BSGI$B
$BF~NO(B
rc = XmCreateRowColumn(top, "rc", NULL, 0);
XtManageChild(rc);
text[0] = XmCreateTextField(rc, "text1", NULL, 0);
text[1] = XmCreateTextField(rc, "text2", NULL, 0);
text[2] = XmCreateTextField(rc, "text3", NULL, 0);
XtManageChildren(text, 3);
for (i = 0; i < 3; i++)
XtAddCallback(text[i], XmNactivateCallback,
(XtCallbackProc)XmProcessTraversal,
(XtPointer)XmTRAVERSE_NEXT_TAB_GROUP);
$B%W%m%0%i%`A4BN(B
#include <Xm/AtomMgr.h> /* XmInternAtom() */
typedef struct {
Boolean is_text;
Time time;
} SelectionInfo;
/* $BCM$,F@$i$l$?$H$-$K8F$S=P$5$l$k%3!<%k%P%C%/4X?t(B */
void get_selectionCB(Widget w, SelectionInfo *p,
Atom *selection, Atom *type,
XtPointer value, unsigned long *n, int *form);
void
pasteCB(Widget w, XtPointer *p, XmPushButtonCallbackStruct *s)
{
Atom text = XmInternAtom(XtDisplay(w), "TEXT", False);
static SelectionInfo info;
/* Primary$B%;%l%/%7%g%s$N(Bowner$B$KJQ49MW5a$r=P$7!"(B
$BJQ497k2L$r
Primary$B%;%l%/%7%g%s$N>l9g$OCM$N7?$H$7$F(BTEXT$B7?$r;XDj$9$k!#(BTEXT$B7?$r;X(B
$BDj$9$k$H!"(BPrimary$B%;%l%/%7%g%s$r;}$D%"%W%j%1!<%7%g%s$,!"(BLattin-1$BJ8;z(B
$BNs$rI=8=$G$-$k(BSTRING$B7?$+!"B?8@8lJ8;zNs$rI=8=$G$-$k(B
COMPOUND_TEXT$B7?$G!"$=$NFbMF$rJV$7$F$/$l$k!#MW5a$NH/@8;~9o(B
$B$K$O!"(BICCCM$B$K=>$C$F!"%$%Y%s%H9=B$BN$K3JG<$5$l$F$$$k;~9o0u$r;XDj$9$k!#(B
void
get_selectionCB(Widget w, SelectionInfo *info,
Atom *selection, Atom *type,
XtPointer value, unsigned long *n, int *form)
{
Atom ctext = XmInternAtom(XtDisplay(w), "COMPOUND_TEXT", False);
String str;
XmString xms;
char **items = NULL;
int nitems;
if (*type == 0 /* $BJQ49$K<:GT(B */|| *n == 0 /* $B%G!<%?$,$J$$(B */) {
if (info->is_text) {
info->is_text = False;
/* $BJ8;zNs7?$r;XDj$7$F$d$jD>$7(B */
XtGetSelectionValue(w,
XA_PRIMARY,
XA_STRING,
(XtSelectionCallbackProc)get_selectionCB,
info,
info->time);
return;
}
/* $B%;%l%/%7%g%s$,;XDj$5$l$F$$$J$$(B */
str = "Empty";
...
$BFbMF$N
...
} else if (*type == ctext) {
XTextProperty prop = {value, ctext, 8, strlen(value)};
/* $B%^%k%A%P%$%HJ8;zNs$KJQ49(B */
if (XmbTextPropertyToTextList(XtDisplay(w),
&prop, &items, &nitems) != Success)
/* $B2x$7$$(BCOMPUND_TEXT$B$@$C$?(B */
str = "Error";
else
str = items[0];
} else {
/* *type == XA_STRING */
str = value;
}
xms = XmStringCreateLtoR(str, XmFONTLIST_DEFAULT_TAG);
if (value) XFree(value);
if (items) XFreeStringList(items);
...
$BF@$i$l$?7k2L$,!"(BCOMPOUND_TEXT$B7?$@$C$?>l9g$K$O!"J#9gJ8;zNs(B
$B$KJQ49$9$k$?$a$K!"$$$C$?$s%^%k%A%P%$%HJ8;zNs$KJQ49$9$kI,MW$,$"$k!#(B
Motif 1.2$B$K$O!"(BCOMPOUND_TEXT$B$rJ#9gJ8;zNs$KD>@\JQ49$9$k!"(B
XmCvtCTToXmString$B$H$$$&4X?t$,MQ0U$5$l$F$$$k$,!"$$$^$$$A?.(B
$BMQ$G$-$J$$$N$GMQ$$$F$$$J$$!#(B
$B%$%Y%s%H=hM}(B
...
id = XtAppAddTimeOut(ctxt, 0, timeHandler, widget);
((struct timeval *)id)->tv_sec = 0;
...
$B%W%m%0%i%`A4BN(B
$BG[CV4IM}(B
Arg dialog_args[] = {
{ XmNnoResize, True }
};
...
dialog = XmCreateMessageDialog(top, "message",
dialog_args, XtNumber(dialog_args));
XmCreateMessageDialog()$B$,!"(BDialogShell$B$H(BMessageBox$B$r:n@.$9(B
$B$k$3$H!"(BXmNnoResize$B$N;XDj$,(BMessageBox$B$KEO$5$l$k$3$H$KCm0U(B
$B$7$F$[$7$$!#(B
top = XtAppInitialize(&app, "Sample", NULL, 0, &ac, av,
NULL, NULL, 0);
/* $B%a%$%s%&%#%s%I%&$N%j%5%$%:$r6X;_(B */
XtVaSetValues(top,
XmNmwmFunctions, MWM_FUNC_ALL | MWM_FUNC_RESIZE,
NULL);
XmNmwmFunctions$B$K$D$$$F$O(BVendorShell$B$N(Bman$B%Z!<%8$r;2>H$7$F(B
$B$[$7$$!#$A$J$_$K!"(B Motif
$B%W%m%0%i%_%s%0%^%K%e%"%k(B$B$N(B17.3$B@a$N(BMWM_FUNC_ALL$B$N@bL@$O(B
$BE,@Z$G$O$J$$!#(B
#include <X11/Xos.h>
void
VisibleEH(Widget w, XtPointer p, XVisibilityEvent *ev, Boolean *cont)
{
if (ev->state == VisibilityUnobscured)
return;
XRaiseWindow(XtDisplay(w), XtWindow(w));
return;
}
XtAddEventHandler()$B$G(BDialogShell$B$K;E9~$a$P$h$$!#(BMessageBox
$B$G$O$J$/!"$=$N?F$N(BDialogShell$B$K;E9~$^$J$$$H!"(BVisibleEH()$B$N(B
XRaiseWindow()$B$,@5$7$/5!G=$7$J$$$N$GMWCm0U!#(B
dialog = XmCreateMessageDialog(top, "box1", arg, 1);
XtAddEventHandler(XtParent(dialog), VisibilityChangeMask,
False, (XtEventHandler)VisibleEH, NULL);
$BFCDj$N%&%#%s%I%&$r>o$K
$B$=$NB>(B
$B$^$@$^$@A}$($kM=Dj$G$9!#(B
Motif$B%W%m%0%i%_%s%0$NIt20(B$B$X(B
/
$BF#;^$N%[!<%`%Z!<%8(B$B$X(B
Last modified: 2006/02/14 15:30:06 JST