1
/*---------------------------------------------------------------------
2
* $Date: 2009-08-18 15:23:20 $ $Revision: 1.2 $
3
*---------------------------------------------------------------------
5
* Copyright (c) 1990, Visual Edge Software Ltd.
7
* ALL RIGHTS RESERVED. Permission to use, copy, modify, and
8
* distribute this software and its documentation for any purpose
9
* and without fee is hereby granted, provided that the above
10
* copyright notice appear in all copies and that both that
11
* copyright notice and this permission notice appear in supporting
12
* documentation, and that the name of Visual Edge Software not be
13
* used in advertising or publicity pertaining to distribution of
14
* the software without specific, written prior permission. The year
15
* included in the notice is the year of the creation of the work.
16
*-------------------------------------------------------------------*/
27
#include <X11/StringDefs.h>
28
#include <X11/Intrinsic.h>
29
#include <X11/Shell.h>
31
#include <X11/X.h> /* included for the win gravity resource */
34
#include <Xm/MwmUtil.h>
39
#include "valuesOf.h" /* included just so the compiler will cross-check */
43
#include "scrBar.cl.h"
44
#endif /* MOTIF_WIDGETS */
55
#include "tkdefaults.h"
61
/* X/OPEN message catalog macros. These will make the code more compact. */
62
#define CGETS(ms,ds_ms) UxCatGets(MC_MISC1,ms,ds_ms)
65
extern int UxStrEqual();
66
extern void UxAddXValues(), UxAddUserDefEnumTypes();
70
/* string conversions in alphabetical order */
71
/* ------------------------------------------------------------------------*/
73
/*---------------------------------------------------------------
74
* Boolean and Bool have same Uimx strings, different X type
75
*---------------------------------------------------------------*/
77
static char *uBoolean[] = {
80
static unsigned char xBoolean[] = {
83
static int xBool[] = {
88
int UxValuesOfBoolean(ulist, n)
93
*n = XtNumber(uBoolean);
97
int UxValuesOfBool(ulist, n)
101
return UxValuesOfBoolean (ulist, n);
104
int UxValidateBoolean(rs, s)
108
int i, n=XtNumber(uBoolean);
113
if (UxStrEqual(s, uBoolean[i]))
118
int UxValidateBool(rs, s)
122
return UxValidateBoolean(rs, s);
124
#endif /* ! RUNTIME */
126
/* ------------------------------------------------------------------------*/
128
static char *uInitialWindowState[] = {
129
"DontCareState", "NormalState", "ZoomState",
130
"IconicState", "InactiveState"
132
static int xInitialWindowState[] = {
133
DontCareState, NormalState, ZoomState,
134
IconicState, InactiveState
138
int UxValuesOfInitialWindowState(ulist, n)
142
*ulist = uInitialWindowState;
143
*n = XtNumber(uInitialWindowState);
147
int UxValidateInitialWindowState(rs, s)
151
int i, n=XtNumber(uInitialWindowState);
156
if (UxStrEqual(s, uInitialWindowState[i]))
160
#endif /* ! RUNTIME */
162
/* ------------------------------------------------------------------------*/
165
static char *uWhichButton[] = {
166
"button1", "button2", "button3",
169
static unsigned char xWhichButton[] = {
170
Button1, Button2, Button3,
175
int UxValuesOfWhichButton(ulist, n)
179
*ulist = uWhichButton;
180
*n = XtNumber(uWhichButton);
184
int UxValidateWhichButton(rs, s)
188
int i, n=XtNumber(uWhichButton);
193
if (UxStrEqual(s, uWhichButton[i]))
197
#endif /* ! RUNTIME */
198
#endif /* VE_INTERNAL */
200
/* ------------------------------------------------------------------------*/
204
/** Resize recursion is a Compound resource;
205
** the X Values never actually put to use.
208
static char *uResizeRecursion[] = {
214
static int xResizeRecursion[] = {
218
int UxValuesOfResizeRecursion(ulist, n)
222
*ulist = uResizeRecursion;
223
*n = XtNumber(uResizeRecursion);
227
int UxValidateResizeRecursion(rs, s)
231
int i, n=XtNumber(uResizeRecursion);
234
if (UxStrEqual(s, uResizeRecursion[i]))
239
static char *uDragRecursion[] = {
244
static int xDragRecursion[] = {
248
int UxValuesOfDragRecursion(ulist, n)
252
*ulist = uDragRecursion;
253
*n = XtNumber(uDragRecursion);
257
int UxValidateDragRecursion(rs, s)
261
int i, n=XtNumber(uDragRecursion);
264
if (UxStrEqual(s, uDragRecursion[i]))
268
#endif /* ! RUNTIME */
270
/* ------------------------------------------------------------------------*/
272
static char *uAlignment[] = {
273
"alignment_center", "alignment_end",
274
"alignment_beginning"
277
static unsigned char xAlignment[] = {
278
XmALIGNMENT_CENTER, XmALIGNMENT_END,
279
XmALIGNMENT_BEGINNING
283
int UxValuesOfAlignment(ulist, n)
288
*n = XtNumber(uAlignment);
292
int UxValidateAlignment(rs, s)
296
int i, n=XtNumber(uAlignment);
301
if (UxStrEqual(s, uAlignment[i]))
305
#endif /* ! RUNTIME */
307
/* ------------------------------------------------------------------------*/
309
static char *uEntryVerticalAlignment[] = {
310
"alignment_baseline_bottom", "alignment_baseline_top",
311
"alignment_contents_bottom", "alignment_center",
312
"alignment_contents_top"
315
static unsigned char xEntryVerticalAlignment[] = {
316
XmALIGNMENT_BASELINE_BOTTOM, XmALIGNMENT_BASELINE_TOP,
317
XmALIGNMENT_CONTENTS_BOTTOM, XmALIGNMENT_CENTER,
318
XmALIGNMENT_CONTENTS_TOP
323
int UxValuesOfEntryVerticalAlignment(ulist, n)
327
*ulist = uEntryVerticalAlignment;
328
*n = XtNumber(uEntryVerticalAlignment);
332
int UxValidateEntryVerticalAlignment(rs, s)
336
int i, n=XtNumber(uEntryVerticalAlignment);
341
if (UxStrEqual(s, uEntryVerticalAlignment[i]))
345
#endif /* ! RUNTIME */
347
/* ------------------------------------------------------------------------*/
349
static char *uChildVerticalAlignment[] = {
350
"alignment_baseline_bottom", "alignment_baseline_top",
351
"alignment_widget_top", "alignment_center",
352
"alignment_widget_bottom"
355
static unsigned char xChildVerticalAlignment[] = {
356
XmALIGNMENT_BASELINE_BOTTOM, XmALIGNMENT_BASELINE_TOP,
357
XmALIGNMENT_WIDGET_TOP, XmALIGNMENT_CENTER,
358
XmALIGNMENT_WIDGET_BOTTOM
363
int UxValuesOfChildVerticalAlignment(ulist, n)
367
*ulist = uChildVerticalAlignment;
368
*n = XtNumber(uChildVerticalAlignment);
372
int UxValidateChildVerticalAlignment(rs, s)
376
int i, n=XtNumber(uChildVerticalAlignment);
381
if (UxStrEqual(s, uChildVerticalAlignment[i]))
385
#endif /* ! RUNTIME */
387
/* ------------------------------------------------------------------------*/
389
static char *uArrowDirection[] = {
390
"arrow_up", "arrow_down", "arrow_left",
394
static unsigned char xArrowDirection[] = {
395
XmARROW_UP, XmARROW_DOWN, XmARROW_LEFT,
400
int UxValuesOfArrowDirection(ulist, n)
404
*ulist = uArrowDirection;
405
*n = XtNumber(uArrowDirection);
409
int UxValidateArrowDirection(rs, s)
413
int i, n=XtNumber(uArrowDirection);
418
if (UxStrEqual(s, uArrowDirection[i]))
422
#endif /* ! RUNTIME */
424
/* ------------------------------------------------------------------------*/
426
static char *uAttachmentType[] = {
427
"attach_none", "attach_form",
428
"attach_opposite_form", "attach_widget",
429
"attach_opposite_widget", "attach_position",
432
static unsigned char xAttachmentType[] = {
433
XmATTACH_NONE, XmATTACH_FORM,
434
XmATTACH_OPPOSITE_FORM, XmATTACH_WIDGET,
435
XmATTACH_OPPOSITE_WIDGET, XmATTACH_POSITION,
440
int UxValuesOfAttachmentType(ulist, n)
444
static char *values[1];
446
static Boolean first_time = TRUE;
447
int nu = XtNumber(uAttachmentType);
448
int nv = XtNumber(values);
454
extern char *UxCopyString();
456
values[0] = UxCopyString(CGETS(MS_MISC_ATTACHMENT_MSG1,
457
DS_MS_MISC_ATTACHMENT_MSG1));
458
val = (char **) UxCalloc(nu+nv, sizeof(char *));
459
for (i=0; i< nu; i++)
460
val[i] = uAttachmentType[i];
461
for (i=nu; i< (nu+nv); i++)
462
val[i] = values[i-nu];
471
static int ValidateAttachmentType(rs, s, side)
476
int i, n=XtNumber(uAttachmentType);
481
if (UxStrEqual(s, uAttachmentType[i]))
483
if (UxCheckForAttachmentReferences (rs, side) != ERROR)
489
int UxValidateBottomAttachment(rs, s)
493
return ValidateAttachmentType(rs, s, XmNbottomAttachment);
496
int UxValidateTopAttachment(rs, s)
500
return ValidateAttachmentType(rs, s, XmNtopAttachment);
503
int UxValidateRightAttachment(rs, s)
507
return ValidateAttachmentType(rs, s, XmNrightAttachment);
510
int UxValidateLeftAttachment(rs, s)
514
return ValidateAttachmentType(rs, s, XmNleftAttachment);
516
#endif /* ! RUNTIME */
518
/* ------------------------------------------------------------------------*/
520
static char *uAudibleWarning[] = {
523
static unsigned char xAudibleWarning[] = {
528
int UxValuesOfAudibleWarning(ulist, n)
532
*ulist = uAudibleWarning;
533
*n = XtNumber(uAudibleWarning);
537
int UxValidateAudibleWarning(rs, s)
541
int i, n=XtNumber(uAudibleWarning);
546
if (UxStrEqual(s, uAudibleWarning[i]))
550
#endif /* ! RUNTIME */
552
/* ------------------------------------------------------------------------*/
554
static char *uChildType[] = {
555
"frame_title_child", "frame_workarea_child", "frame_generic_child"
557
static unsigned char xChildType[] = {
558
XmFRAME_TITLE_CHILD, XmFRAME_WORKAREA_CHILD, XmFRAME_GENERIC_CHILD
562
int UxValuesOfChildType(ulist, n)
567
*n = XtNumber(uChildType);
571
int UxValidateChildType(rs, s)
575
int i, n=XtNumber(uChildType);
580
if (UxStrEqual(s, uChildType[i]))
584
#endif /* ! RUNTIME */
586
/* ------------------------------------------------------------------------*/
588
static char *uCommandWindowLocation[] = {
589
"command_above_workspace", "command_below_workspace"
591
static unsigned char xCommandWindowLocation[] = {
592
XmCOMMAND_ABOVE_WORKSPACE, XmCOMMAND_BELOW_WORKSPACE
596
/******************************************************************************
597
NAME: int UxValuesOfCommandWindowLocation(lst, n)
601
DESCRIPTION: Displays the allowable values of CommandWindowLocation
602
CREATION: February 5 1991 (bug2045)
604
-----------------------------------------------------------------------------*/
605
int UxValuesOfCommandWindowLocation(ulist, n)
609
*ulist = uCommandWindowLocation;
610
*n = XtNumber(uCommandWindowLocation);
614
/******************************************************************************
615
NAME: int UxValidateCommandWindowLocation(rs, s)
619
DESCRIPTION: Validates a CommandWindowLocation
620
CREATION: February 5 1991 (bug2045)
622
-----------------------------------------------------------------------------*/
623
int UxValidateCommandWindowLocation(rs, s)
627
int i, n=XtNumber(uCommandWindowLocation);
632
if (UxStrEqual(s, uCommandWindowLocation[i]))
636
#endif /* ! RUNTIME */
638
/*----------------------------------------------------------*/
640
static char *uChildPlacement[] = {
641
"place_above_selection", "place_below_selection",
645
static unsigned char xChildPlacement[] = {
646
XmPLACE_ABOVE_SELECTION, XmPLACE_BELOW_SELECTION,
653
/* -----------------------------------------------------------------------
655
NAME: int UxValuesOfChildPlacement(lst, n)
659
DESCRIPTION: Specifies the placement of the work area child
660
CREATION: October 26 1992
661
REVISIONS: added for Motif1_2.2 support
662
-----------------------------------------------------------------------*/
664
int UxValuesOfChildPlacement(ulist, n)
668
*ulist = uChildPlacement;
669
*n = XtNumber(uChildPlacement);
674
int UxValidateChildPlacement(rs, s)
678
int i, n=XtNumber(uChildPlacement);
683
if (UxStrEqual(s, uChildPlacement[i]))
687
#endif /* ! RUNTIME */
690
/* ------------------------------------------------------------------------*/
692
static char *uDefaultButtonType[] = {
693
"dialog_cancel_button", "dialog_ok_button",
694
"dialog_help_button", "dialog_none"
696
static unsigned char xDefaultButtonType[] = {
697
XmDIALOG_CANCEL_BUTTON, XmDIALOG_OK_BUTTON,
698
XmDIALOG_HELP_BUTTON, XmDIALOG_NONE
702
int UxValuesOfDefaultButtonType(ulist, n)
706
*ulist = uDefaultButtonType;
707
*n = XtNumber(uDefaultButtonType);
711
int UxValidateDefaultButtonType(rs, s)
715
int i, n=XtNumber(uDefaultButtonType);
720
if (UxStrEqual(s, uDefaultButtonType[i]))
724
#endif /* ! RUNTIME */
726
/* ------------------------------------------------------------------------*/
728
static char *uDeleteResponse[] = {
729
"destroy", "unmap", "do_nothing"
731
static unsigned char xDeleteResponse[] = {
732
XmDESTROY, XmUNMAP, XmDO_NOTHING
736
int UxValuesOfDeleteResponse(ulist, n)
740
*ulist = uDeleteResponse;
741
*n = XtNumber(uDeleteResponse);
745
int UxValidateDeleteResponse(rs, s)
749
int i, n=XtNumber(uDeleteResponse);
754
if (UxStrEqual(s, uDeleteResponse[i]))
758
#endif /* ! RUNTIME */
760
/* ------------------------------------------------------------------------*/
763
static char *uDialogStyle[] = {
765
"dialog_primary_application_modal", "dialog_full_application_modal",
766
"dialog_system_modal", "dialog_work_area"
770
static unsigned char xDialogStyle[] = {
772
XmDIALOG_PRIMARY_APPLICATION_MODAL, XmDIALOG_FULL_APPLICATION_MODAL,
773
XmDIALOG_SYSTEM_MODAL, XmDIALOG_WORK_AREA
777
* For user widgets, dialog_system_modal, dialog_full_application_modal
778
* mapped to XmDIALOG_PRIMARY_APPLICATION_MODAL .
779
* UIM/X widgets use the true values.
781
static unsigned char xDialogStyle[] = {
783
XmDIALOG_PRIMARY_APPLICATION_MODAL, XmDIALOG_PRIMARY_APPLICATION_MODAL,
784
XmDIALOG_PRIMARY_APPLICATION_MODAL, XmDIALOG_WORK_AREA
786
static unsigned char xTrueDialogStyle[] = {
788
XmDIALOG_PRIMARY_APPLICATION_MODAL, XmDIALOG_FULL_APPLICATION_MODAL,
789
XmDIALOG_SYSTEM_MODAL, XmDIALOG_WORK_AREA
795
int UxValuesOfDialogStyle(ulist, n)
799
static char *values[1];
801
static Boolean first_time = TRUE;
802
int nu = XtNumber(uDialogStyle);
803
int nv = XtNumber(values);
808
extern char *UxCopyString();
810
values[0] = UxCopyString(CGETS(MS_MISC1_DIAG_STYLE_MSG,
811
DS_MS_MISC1_DIAG_STYLE_MSG));
812
val = (char **) UxCalloc(nu+nv, sizeof(char *));
813
for (i=0; i< nu; i++)
814
val[i] = uDialogStyle[i];
815
for (i=nu; i< (nu+nv); i++)
816
val[i] = values[i-nu];
825
int UxValidateDialogStyle(rs, s)
829
int i, dialog_shell, n=XtNumber(uDialogStyle);
835
* If dialog shell then the only valid choice is "dialog_work_area"
836
* otherwise "dialog_work_area" is not a valid choice.
838
dialog_shell = False;
840
if (UxIsDialogWidget( rs)) {
844
if (UxGetDefaultShellClass(rs) == xmDialogShellWidgetClass)
847
if (UxIsSubclass(UxGetParent(rs), UxC_dialogShell))
852
if (UxStrEqual(s, "dialog_work_area"))
855
if (! UxStrEqual(s, "dialog_work_area"))
860
if (UxStrEqual(s, uDialogStyle[i]))
865
#endif /* ! RUNTIME */
867
/* ------------------------------------------------------------------------*/
869
static char *uDialogType[] = {
872
"dialog_selection", "dialog_file_selection",
873
"dialog_work_area", "dialog_command"
876
static unsigned char xDialogType[] = {
879
XmDIALOG_SELECTION, XmDIALOG_FILE_SELECTION,
880
XmDIALOG_WORK_AREA, XmDIALOG_COMMAND
884
int UxValuesOfDialogType(ulist, n)
888
*ulist = uDialogType;
889
*n = XtNumber(uDialogType);
893
int UxValidateDialogType(rs, s)
897
int i, n=XtNumber(uDialogType);
902
if (UxStrEqual(s, uDialogType[i]))
906
#endif /* ! RUNTIME */
908
/* ------------------------------------------------------------------------*/
910
static char *uEditMode[] = {
911
"single_line_edit", "multi_line_edit"
913
static int xEditMode[] = {
914
(int) XmSINGLE_LINE_EDIT, (int) XmMULTI_LINE_EDIT
918
int UxValuesOfEditMode(ulist, n)
923
*n = XtNumber(uEditMode);
927
int UxValidateEditMode(rs, s)
931
int i, n=XtNumber(uEditMode);
936
if (UxStrEqual(s, uEditMode[i]))
940
#endif /* ! RUNTIME */
942
/* ------------------------------------------------------- */
944
static char * uFileTypeMask[] = {
945
"file_regular", "file_directory", "file_any_type"
947
static unsigned char xFileTypeMask[] = {
948
XmFILE_REGULAR, XmFILE_DIRECTORY, XmFILE_ANY_TYPE
952
/******************************************************************************
953
NAME: int UxValuesOfFileTypeMask(lst, n)
957
DESCRIPTION: Displays the allowable values of FileTypeMask
958
CREATION: January 29 1991 (bug2032)
960
-----------------------------------------------------------------------------*/
961
int UxValuesOfFileTypeMask(ulist, n)
965
*ulist = uFileTypeMask;
966
*n = XtNumber(uFileTypeMask);
970
/******************************************************************************
971
NAME: int UxValidateFileTypeMask(rs, s)
972
rswidget *rs; - rswidget
974
RETURN: ERROR or NO_ERROR
975
DESCRIPTION: Validates FileTypeMask
976
CREATION: January 29 1991 (bug2032)
978
-----------------------------------------------------------------------------*/
979
int UxValidateFileTypeMask(rs, s)
983
int i, n=XtNumber(uFileTypeMask);
988
if (UxStrEqual(s, uFileTypeMask[i]))
994
/* ------------------------------------------------------------------------*/
996
static char *uIndicatorType[] = {
997
"one_of_many", "n_of_many"
999
static unsigned char xIndicatorType[] = {
1000
XmONE_OF_MANY, XmN_OF_MANY
1004
int UxValuesOfIndicatorType(ulist, n)
1008
*ulist = uIndicatorType;
1009
*n = XtNumber(uIndicatorType);
1013
int UxValidateIndicatorType(rs, s)
1017
int i, n=XtNumber(uIndicatorType);
1022
if (UxStrEqual(s, uIndicatorType[i]))
1026
#endif /* ! RUNTIME */
1028
/* ------------------------------------------------------------------------*/
1030
static char *uKeyboardFocusPolicy[] = {
1031
"explicit", "pointer"
1033
static unsigned char xKeyboardFocusPolicy[] = {
1034
XmEXPLICIT, XmPOINTER
1038
int UxValuesOfKeyboardFocusPolicy(ulist, n)
1042
*ulist = uKeyboardFocusPolicy;
1043
*n = XtNumber(uKeyboardFocusPolicy);
1047
int UxValidateKeyboardFocusPolicy(rs, s)
1051
int i, n=XtNumber(uKeyboardFocusPolicy);
1056
if (UxStrEqual(s, uKeyboardFocusPolicy[i]))
1060
#endif /* ! RUNTIME */
1062
/* ------------------------------------------------------------------------*/
1064
static char *uLabelType[] = {
1067
static unsigned char xLabelType[] = {
1072
int UxValuesOfLabelType(ulist, n)
1076
*ulist = uLabelType;
1077
*n = XtNumber(uLabelType);
1081
int UxValidateLabelType(rs, s)
1085
int i, n=XtNumber(uLabelType);
1090
if (UxStrEqual(s, uLabelType[i]))
1094
#endif /* ! RUNTIME */
1096
/* ------------------------------------------------------------------------*/
1098
static char *uListSizePolicy[] = {
1099
"constant", "variable", "resize_if_possible"
1101
static unsigned char xListSizePolicy[] = {
1102
XmCONSTANT, XmVARIABLE, XmRESIZE_IF_POSSIBLE
1106
int UxValuesOfListSizePolicy(ulist, n)
1110
*ulist = uListSizePolicy;
1111
*n = XtNumber(uListSizePolicy);
1115
int UxValidateListSizePolicy(rs, s)
1119
int i, n=XtNumber(uListSizePolicy);
1124
if (UxStrEqual(s, uListSizePolicy[i]))
1128
#endif /* ! RUNTIME */
1130
/* ------------------------------------------------------------------------*/
1132
static char *uMsgDialogType[] = {
1134
"dialog_error", "dialog_information",
1135
"dialog_message", "dialog_question",
1136
"dialog_template", "dialog_warning",
1140
static unsigned char xMsgDialogType[] = {
1142
XmDIALOG_ERROR, XmDIALOG_INFORMATION,
1143
XmDIALOG_MESSAGE, XmDIALOG_QUESTION,
1144
XmDIALOG_TEMPLATE, XmDIALOG_WARNING,
1149
int UxValuesOfMsgDialogType(ulist, n)
1153
*ulist = uMsgDialogType;
1154
*n = XtNumber(uMsgDialogType);
1158
int UxValidateMsgDialogType(rs, s)
1162
int i, n=XtNumber(uMsgDialogType);
1167
if (UxStrEqual(s, uMsgDialogType[i]))
1171
#endif /* ! RUNTIME */
1173
/* ------------------------------------------------------------------------*/
1175
#ifdef MOTIF_WIDGETS
1176
static char * uMwmInputMode[] = {
1177
"-1", "mwm_input_modeless",
1178
"mwm_input_primary_application_modal",
1179
"mwm_input_system_modal", "mwm_input_full_application_modal"
1183
static int xMwmInputMode[] = {
1184
-1, MWM_INPUT_MODELESS, MWM_INPUT_PRIMARY_APPLICATION_MODAL,
1185
MWM_INPUT_SYSTEM_MODAL, MWM_INPUT_FULL_APPLICATION_MODAL
1188
static int xMwmInputMode[] = {
1189
-1, MWM_INPUT_MODELESS, MWM_INPUT_PRIMARY_APPLICATION_MODAL,
1190
MWM_INPUT_PRIMARY_APPLICATION_MODAL, MWM_INPUT_PRIMARY_APPLICATION_MODAL
1192
static int xTrueMwmInputMode[] = {
1193
-1, MWM_INPUT_MODELESS, MWM_INPUT_PRIMARY_APPLICATION_MODAL,
1194
MWM_INPUT_SYSTEM_MODAL, MWM_INPUT_FULL_APPLICATION_MODAL
1196
#endif /* RUNTIME */
1198
/******************************************************************************
1199
NAME: int UxValuesOfMwmInputMode(lst, n)
1203
DESCRIPTION: Displays the allowable values of MwmInputMode
1204
CREATION: February 4 1993 (bug1950)
1206
-----------------------------------------------------------------------------*/
1208
int UxValuesOfMwmInputMode(ulist, n)
1212
*ulist = uMwmInputMode;
1213
*n = XtNumber(uMwmInputMode);
1217
/******************************************************************************
1218
NAME: int UxValidateMwmInputMode(rs, s)
1219
rswidget *rs; - rswidget
1221
RETURN: ERROR or NO_ERROR
1222
DESCRIPTION: Validates MwmInputMode
1223
CREATION: February 4 1993 (bug1950)
1225
-----------------------------------------------------------------------------*/
1226
int UxValidateMwmInputMode(rs, s)
1230
int i, n=XtNumber(uMwmInputMode);
1235
if (UxStrEqual(s, uMwmInputMode[i]))
1242
/* ------------------------------------------------------------------------*/
1244
#ifdef MOTIF_WIDGETS
1245
static char * uMultiClick[] = {
1246
"multiclick_keep", "multiclick_discard"
1248
static unsigned char xMultiClick[] = {
1249
XmMULTICLICK_KEEP, XmMULTICLICK_DISCARD
1252
/******************************************************************************
1253
NAME: int UxValuesOfMultiClick(lst, n)
1257
DESCRIPTION: Displays the allowable values of MultiClick
1258
CREATION: January 29 1991 (bug2035)
1260
-----------------------------------------------------------------------------*/
1262
int UxValuesOfMultiClick(ulist, n)
1266
*ulist = uMultiClick;
1267
*n = XtNumber(uMultiClick);
1271
/******************************************************************************
1272
NAME: int UxValidateMultiClick(rs, s)
1273
rswidget *rs; - rswidget
1275
RETURN: ERROR or NO_ERROR
1276
DESCRIPTION: Validates MultiClick's
1277
CREATION: January 29 1991 (bug2035)
1279
-----------------------------------------------------------------------------*/
1280
int UxValidateMultiClick(rs, s)
1284
int i, n=XtNumber(uMultiClick);
1289
if (UxStrEqual(s, uMultiClick[i]))
1296
/* ------------------------------------------------------------------------*/
1298
#ifdef MOTIF_WIDGETS
1299
static char * uNavigationType[] = {
1300
"none", "tab_group", "sticky_tab_group", "exclusive_tab_group"
1302
static unsigned char xNavigationType[] = {
1303
XmNONE, XmTAB_GROUP, XmSTICKY_TAB_GROUP, XmEXCLUSIVE_TAB_GROUP
1306
/******************************************************************************
1307
NAME: int UxValuesOfNavigationType(lst, n)
1311
DESCRIPTION: Displays the allowable values of NavigationType
1312
CREATION: January 29 1991 (bug2035)
1314
-----------------------------------------------------------------------------*/
1316
int UxValuesOfNavigationType(ulist, n)
1320
*ulist = uNavigationType;
1321
*n = XtNumber(uNavigationType);
1325
/******************************************************************************
1326
NAME: int UxValidateNavigationType(rs, s)
1327
rswidget *rs; - rswidget
1329
RETURN: ERROR or NO_ERROR
1330
DESCRIPTION: Validates NavigationType's
1331
CREATION: January 29 1991 (bug2035)
1333
-----------------------------------------------------------------------------*/
1334
int UxValidateNavigationType(rs, s)
1338
int i, n=XtNumber(uNavigationType);
1343
if (UxStrEqual(s, uNavigationType[i]))
1350
/* ------------------------------------------------------------------------*/
1352
static char *uOrientation[] = {
1353
"vertical", "horizontal"
1355
static unsigned char xOrientation[] = {
1356
XmVERTICAL, XmHORIZONTAL
1360
int UxValuesOfOrientation(ulist, n)
1364
*ulist = uOrientation;
1365
*n = XtNumber(uOrientation);
1369
int UxValidateOrientation(rs, s)
1373
int i, n=XtNumber(uOrientation);
1378
if (UxStrEqual(s, uOrientation[i]))
1382
#endif /* ! RUNTIME */
1384
/* ------------------------------------------------------------------------*/
1386
static char *uPacking[] = {
1387
"pack_tight", "pack_column", "pack_none"
1389
static unsigned char xPacking[] = {
1390
XmPACK_TIGHT, XmPACK_COLUMN, XmPACK_NONE
1394
int UxValuesOfPacking(ulist, n)
1399
*n = XtNumber(uPacking);
1403
int UxValidatePacking(rs, s)
1407
int i, n=XtNumber(uPacking);
1412
if (UxStrEqual(s, uPacking[i]))
1416
#endif /* ! RUNTIME */
1418
/* ------------------------------------------------------------------------*/
1420
static char *uProcessingDirection[] = {
1421
"max_on_top", "max_on_bottom",
1422
"max_on_left", "max_on_right"
1424
static unsigned char xProcessingDirection[] = {
1425
XmMAX_ON_TOP, XmMAX_ON_BOTTOM,
1426
XmMAX_ON_LEFT, XmMAX_ON_RIGHT
1430
int UxValuesOfProcessingDirection(ulist, n)
1434
*ulist = uProcessingDirection;
1435
*n = XtNumber(uProcessingDirection);
1439
int UxValidateProcessingDirection(rs, s)
1444
char *hv = UX_DEFAULT_SB_ORIENTATION;
1446
(void) UxFindValue(rs, UxGetRD_orientation(rs), &hv);
1449
if (UxStrEqual(hv, "vertical") &&
1450
(UxStrEqual(s, "max_on_top") || UxStrEqual(s, "max_on_bottom")))
1452
if (UxStrEqual(hv, "horizontal") &&
1453
(UxStrEqual(s, "max_on_left") || UxStrEqual(s, "max_on_right")))
1457
#endif /* ! RUNTIME */
1459
/* ------------------------------------------------------------------------*/
1461
static char *uResizePolicy[] = {
1462
"resize_none", "resize_any",
1465
static unsigned char xResizePolicy[] = {
1466
XmRESIZE_NONE, XmRESIZE_ANY,
1471
int UxValuesOfResizePolicy(ulist, n)
1475
*ulist = uResizePolicy;
1476
*n = XtNumber(uResizePolicy);
1480
int UxValidateResizePolicy(rs, s)
1484
int i, n=XtNumber(uResizePolicy);
1489
if (UxStrEqual(s, uResizePolicy[i]))
1493
#endif /* ! RUNTIME */
1495
/* ------------------------------------------------------------------------*/
1497
static char *uRowColumnType[] = {
1498
"work_area", "menu_bar", "menu_pulldown",
1499
"menu_popup", "menu_option"
1501
static unsigned char xRowColumnType[] = {
1502
XmWORK_AREA, XmMENU_BAR, XmMENU_PULLDOWN,
1503
XmMENU_POPUP, XmMENU_OPTION
1507
int UxValuesOfRowColumnType(ulist, n)
1511
*ulist = uRowColumnType;
1512
*n = XtNumber(uRowColumnType);
1516
int UxValidateRowColumnType(rs, s)
1520
int i, n=XtNumber(uRowColumnType);
1525
if (UxStrEqual(s, uRowColumnType[i]))
1529
#endif /* ! RUNTIME */
1531
/* ------------------------------------------------------------------------*/
1533
static char *uScrollBarDisplayPolicy[] = {
1534
"as_needed", "static"
1536
static unsigned char xScrollBarDisplayPolicy[] = {
1537
XmAS_NEEDED, XmSTATIC
1541
int UxValuesOfScrollBarDisplayPolicy(ulist, n)
1545
*ulist = uScrollBarDisplayPolicy;
1546
*n = XtNumber(uScrollBarDisplayPolicy);
1550
int UxValidateScrollBarDisplayPolicy(rs, s)
1554
int i, n=XtNumber(uScrollBarDisplayPolicy);
1559
if (UxStrEqual(s, uScrollBarDisplayPolicy[i]))
1563
#endif /* ! RUNTIME */
1565
/* ------------------------------------------------------------------------*/
1567
static char *uScrollBarPlacement[] = {
1568
"top_left", "bottom_left", "top_right",
1571
static unsigned char xScrollBarPlacement[] = {
1572
XmTOP_LEFT, XmBOTTOM_LEFT, XmTOP_RIGHT,
1577
int UxValuesOfScrollBarPlacement(ulist, n)
1581
*ulist = uScrollBarPlacement;
1582
*n = XtNumber(uScrollBarPlacement);
1586
int UxValidateScrollBarPlacement(rs, s)
1590
int i, n=XtNumber(uScrollBarPlacement);
1595
if (UxStrEqual(s, uScrollBarPlacement[i]))
1599
#endif /* ! RUNTIME */
1601
/* ------------------------------------------------------------------------*/
1603
static char *uScrollingPolicy[] = {
1604
"automatic", "application_defined"
1606
static unsigned char xScrollingPolicy[] = {
1607
XmAUTOMATIC, XmAPPLICATION_DEFINED
1611
int UxValuesOfScrollingPolicy(ulist, n)
1615
*ulist = uScrollingPolicy;
1616
*n = XtNumber(uScrollingPolicy);
1620
int UxValidateScrollingPolicy(rs, s)
1624
int i, n=XtNumber(uScrollingPolicy);
1629
if (UxStrEqual(s, uScrollingPolicy[i]))
1633
#endif /* ! RUNTIME */
1635
/* ------------------------------------------------------------------------*/
1637
static char *uSelectionPolicy[] = {
1638
"single_select", "multiple_select",
1639
"extended_select", "browse_select"
1641
static unsigned char xSelectionPolicy[] = {
1642
XmSINGLE_SELECT, XmMULTIPLE_SELECT,
1643
XmEXTENDED_SELECT, XmBROWSE_SELECT
1647
int UxValuesOfSelectionPolicy(ulist, n)
1651
*ulist = uSelectionPolicy;
1652
*n = XtNumber(uSelectionPolicy);
1656
int UxValidateSelectionPolicy(rs, s)
1660
int i, n=XtNumber(uSelectionPolicy);
1665
if (UxStrEqual(s, uSelectionPolicy[i]))
1669
#endif /* ! RUNTIME */
1671
/* ------------------------------------------------------------------------*/
1673
static char *uSeparatorType[] = {
1674
"single_line", "double_line",
1675
"single_dashed_line", "double_dashed_line",
1676
"no_line", "shadow_etched_in",
1679
static unsigned char xSeparatorType[] = {
1680
XmSINGLE_LINE, XmDOUBLE_LINE,
1681
XmSINGLE_DASHED_LINE, XmDOUBLE_DASHED_LINE,
1682
XmNO_LINE, XmSHADOW_ETCHED_IN,
1687
int UxValuesOfSeparatorType(ulist, n)
1691
*ulist = uSeparatorType;
1692
*n = XtNumber(uSeparatorType);
1696
int UxValidateSeparatorType(rs, s)
1700
int i, n=XtNumber(uSeparatorType);
1705
if (UxStrEqual(s, uSeparatorType[i]))
1709
#endif /* ! RUNTIME */
1711
/* ------------------------------------------------------------------------*/
1713
static char *uShadowType[] = {
1714
"shadow_in", "shadow_out",
1715
"shadow_etched_in", "shadow_etched_out"
1717
static unsigned char xShadowType[] = {
1718
XmSHADOW_IN, XmSHADOW_OUT,
1719
XmSHADOW_ETCHED_IN, XmSHADOW_ETCHED_OUT
1723
int UxValuesOfShadowType(ulist, n)
1727
*ulist = uShadowType;
1728
*n = XtNumber(uShadowType);
1732
int UxValidateShadowType(rs, s)
1736
int i, n=XtNumber(uShadowType);
1741
if (UxStrEqual(s, uShadowType[i]))
1745
#endif /* ! RUNTIME */
1747
/* ------------------------------------------------------------------------*/
1749
static char *uStringDirection[] = {
1750
"string_direction_l_to_r", "string_direction_r_to_l"
1752
static unsigned char xStringDirection[] = {
1753
XmSTRING_DIRECTION_L_TO_R, XmSTRING_DIRECTION_R_TO_L
1757
int UxValuesOfStringDirection(ulist, n)
1761
*ulist = uStringDirection;
1762
*n = XtNumber(uStringDirection);
1766
int UxValidateStringDirection(rs, s)
1770
int i, n=XtNumber(uStringDirection);
1775
if (UxStrEqual(s, uStringDirection[i]))
1779
#endif /* ! RUNTIME */
1781
/* ------------------------------------------------------------------------*/
1784
static char *uTearOffModel[] = {
1785
"tear_off_enabled", "tear_off_disabled"
1787
static unsigned char xTearOffModel[] = {
1788
XmTEAR_OFF_ENABLED, XmTEAR_OFF_DISABLED
1792
int UxValuesOfTearOffModel(ulist, n)
1796
*ulist = uTearOffModel;
1797
*n = XtNumber(uTearOffModel);
1801
int UxValidateTearOffModel(rs, s)
1805
int i, n=XtNumber(uTearOffModel);
1810
if (UxStrEqual(s, uTearOffModel[i]))
1814
#endif /* ! RUNTIME */
1817
/* ------------------------------------------------------------------------*/
1819
static char *uUnitType[] = {
1820
"pixels", "100th_millimeters",
1821
"1000th_inches", "100th_points",
1824
static unsigned char xUnitType[] = {
1825
XmPIXELS, Xm100TH_MILLIMETERS,
1826
Xm1000TH_INCHES, Xm100TH_POINTS,
1831
int UxValuesOfUnitType(ulist, n)
1836
*n = XtNumber(uUnitType);
1840
int UxValidateUnitType(rs, s)
1844
int i, n=XtNumber(uUnitType);
1849
if (UxStrEqual(s, uUnitType[i]))
1853
#endif /* ! RUNTIME */
1855
/* ------------------------------------------------------------------------*/
1857
static char *uVisualPolicy[] = {
1858
"constant", "variable"
1860
static unsigned char xVisualPolicy[] = {
1861
XmCONSTANT, XmVARIABLE
1865
int UxValuesOfVisualPolicy(ulist, n)
1869
*ulist = uVisualPolicy;
1870
*n = XtNumber(uVisualPolicy);
1874
int UxValidateVisualPolicy(rs, s)
1878
int i, n=XtNumber(uVisualPolicy);
1883
if (UxStrEqual(s, uVisualPolicy[i]))
1887
#endif /* ! RUNTIME */
1889
/* ------------------------------------------------------------------------*/
1891
static char *uWinGravity[] = {
1892
"forget_gravity", "north_west_gravity", "north_gravity",
1893
"north_east_gravity", "west_gravity", "center_gravity",
1894
"east_gravity", "south_west_gravity", "south_gravity",
1895
"south_east_gravity", "static_gravity"
1898
static int xWinGravity[] = {
1899
ForgetGravity, NorthWestGravity, NorthGravity,
1900
NorthEastGravity, WestGravity, CenterGravity,
1901
EastGravity, SouthWestGravity, SouthGravity,
1902
SouthEastGravity, StaticGravity
1907
int UxValuesOfWinGravity(ulist, n)
1911
*ulist = uWinGravity;
1912
*n = XtNumber(uWinGravity);
1916
int UxValidateWinGravity(rs, s)
1920
int i, n=XtNumber(uWinGravity);
1925
if (UxStrEqual(s, uWinGravity[i]))
1929
#endif /* ! RUNTIME */
1932
/******************************************************************************
1933
NAME: UxStringToCharEnum (sw, udata, xdata, flag, XT_type)
1934
INPUT: swidget sw - swidget
1935
char **udata - UIMX string representation
1936
char *xdata - Motif enumerated value
1937
int flag - TO_UIMX or TO_X
1938
int XT_type - the type identifier
1939
RETURN: int - ERROR/NO_ERROR
1940
DESCRIPTION: Performs the conversion DIRECTLY using the 'conversion' records
1941
defined above. This function is for Widget properties that do
1942
not have resource converters.
1943
CREATION: Jul 4/1989
1945
-----------------------------------------------------------------------------*/
1947
int UxStringToCharEnum (sw, udata, xdata, flag, XT_type)
1950
unsigned char *xdata;
1954
int i, match, err = 0;
1955
char **uconv = UxStr_conv[XT_type].strings;
1956
unsigned char *xconv = UxStr_conv[XT_type].values;
1957
int n = UxStr_conv[XT_type].size;
1959
if (flag == TO_UIMX)
1961
for (i=0, match=0; i<n; i++)
1962
if (*xdata == xconv[i])
1972
else if (flag == TO_X)
1974
for (i=0, match=0; i<n; i++)
1976
if (UxStrEqual(*udata, uconv[i]))
1989
UxStandardError(CGETS( MS_MISC_WRONG_FLAG, DS_MS_MISC_WRONG_FLAG));
1996
UxStandardError(CGETS( MS_MISC_NO_MATCH, DS_MS_MISC_NO_MATCH));
2001
/******************************************************************************
2002
NAME: int string_dialogStyle
2003
INPUT: swidget sw - swidget
2004
char **udata - UIMX string representation
2005
char *xdata - Motif enumerated value
2006
int flag - TO_UIMX or TO_X
2007
int XT_type - the type identifier
2008
RETURN: ERROR/NO_ERROR
2009
DESCRIPTION: This routine converts between strings and dialogStyle values.
2010
If UIMX is in design mode the conversion to X always uses
2011
"dialog_modeless", Otherwise the normal conversion occurs.
2012
LAST REV: Apr 93 fix 4119 pass true values to UIM/X widgets.
2013
-----------------------------------------------------------------------------*/
2015
static int string_dialogStyle(sw, udata, xdata, flag, XT_type)
2018
unsigned char *xdata;
2024
/*-------------------------------------------------------------
2025
* USER widgets are NEVER modal in Design Mode, only Test Mode.
2026
*-------------------------------------------------------------*/
2029
&& (sw == NULL || UxGetClassification(sw) != UIMX_WIDGET))
2031
char *newdata= "dialog_modeless";
2033
if(UxStrEqual(*udata, "dialog_work_area"))
2034
return(UxStringToCharEnum(sw, udata, xdata,
2037
return(UxStringToCharEnum(sw, &newdata, xdata,
2041
/*-----------------------------------------------------
2042
* UIM/X widgets get real values, not the safe subset.
2043
*-----------------------------------------------------*/
2046
UxGetClassification(sw) == UIMX_WIDGET)
2049
int n = XtNumber(uDialogStyle);
2051
for (i=0; i<n; i++) {
2052
if (UxStrEqual(*udata, uDialogStyle[i])) {
2053
*xdata = xTrueDialogStyle[i];
2057
*xdata = XmDIALOG_MODELESS;
2061
#endif /* RUNTIME */
2062
/*----------------------------------------------------------
2063
* Correct name for dialog_modeless depends on the widget.
2064
*----------------------------------------------------------*/
2065
if (flag == TO_UIMX)
2067
int st = UxStringToCharEnum(sw, udata, xdata, flag, XT_type);
2069
if (st == NO_ERROR && UxStrEqual(*udata, "dialog_modeless"))
2073
w = UxGetWidget(sw);
2075
|| (wp = XtParent(w)) == NULL
2076
|| ! XmIsDialogShell(wp))
2078
*udata = "dialog_work_area";
2085
return(UxStringToCharEnum(sw, udata, xdata, flag, XT_type));
2088
/******************************************************************************
2089
NAME: int string_inputMode(sw, udata, xdata, flag,
2091
INPUT: swidget sw - swidget
2092
char **udata - UIMX string representation
2093
int *xdata - Motif enumerated value
2094
int flag - TO_UIMX or TO_X
2095
int XT_type - the type identifier
2096
RETURN: ERROR/NO_ERROR
2097
DESCRIPTION: Converts between strings and inputMode values.
2099
In design time, the values for user widgets are mapped to the
2100
harmless subset of values, so that USER widgets don't interfere with
2101
interactions. For UIM/X widgets, we override that.
2103
LAST REV: fix4119 Created.
2104
-----------------------------------------------------------------------------*/
2106
static int string_mwmInputMode(sw, udata, xdata, flag, XT_type)
2114
/*--------------------------------------------------------
2115
* UIM/X widgets get the true values, not the safe subset.
2116
*--------------------------------------------------------*/
2119
UxGetClassification(sw) == UIMX_WIDGET)
2122
int n = XtNumber(uMwmInputMode);
2124
for (i=0; i < n; i++)
2126
if (UxStrEqual(*udata, uMwmInputMode[i])) {
2127
*xdata = xTrueMwmInputMode[i];
2131
*xdata = MWM_INPUT_MODELESS;
2135
#endif /* RUNTIME */
2137
return UxStringToIntEnum(sw, udata, xdata, flag, XT_type);
2141
/******************************************************************************
2142
NAME: int string_UIMXconversion (sw, udata, xdata, flag, XT_type)
2143
INPUT: swidget sw - swidget
2144
char **udata - UIMX string representation
2145
int *xdata - Motif enumerated value
2146
int flag - TO_UIMX or TO_X
2147
int XT_type - the type identifier
2148
RETURN: ERROR/NO_ERROR
2149
DESCRIPTION: Performs the conversion DIRECTLY using the 'conversion' records
2150
defined above. This function is for Widget properties that do
2151
not have resource converters.
2152
CREATION: Jul 4/1989
2154
-----------------------------------------------------------------------------*/
2156
static int string_UIMXconversion (sw, udata, xdata, flag, XT_type)
2163
int i, match, err = 0;
2164
char **uconv = UxStr_conv[XT_type].strings;
2165
int *xconv = (int *) UxStr_conv[XT_type].values;
2166
int n = UxStr_conv[XT_type].size;
2169
if (flag == TO_UIMX)
2172
real_xdata = * xdata;
2174
for (i = 0, match = 0; i<n; i++)
2175
if (real_xdata == (int) xconv[i])
2185
else if (flag == TO_X)
2187
for (i=0, match=0; i<n; i++)
2188
if (UxStrEqual (*udata, uconv[i]))
2194
*xdata = (int)xconv[i];
2200
UxStandardError (CGETS( MS_MISC_WRONG_FLAG, DS_MS_MISC_WRONG_FLAG));
2207
UxStandardError (CGETS( MS_MISC_NO_MATCH, DS_MS_MISC_NO_MATCH));
2211
#endif /* RUNTIME */
2213
/******************************************************************************
2214
NAME: UxStringToIntEnum (sw, udata, xdata, flag, XT_type)
2215
INPUT: swidget sw - swidget
2216
char **udata - UIMX string representation
2217
char *xdata - Motif enumerated value
2218
int flag - TO_UIMX or TO_X
2219
int XT_type - the type identifier
2220
RETURN: int - ERROR/NO_ERROR
2221
DESCRIPTION: Performs the conversion DIRECTLY using the 'conversion' records
2223
CREATION: Jul 4/1989
2225
-----------------------------------------------------------------------------*/
2227
int UxStringToIntEnum (sw, udata, xdata, flag, XT_type)
2236
return string_UIMXconversion(sw, udata, xdata, flag, XT_type);
2238
if (flag == TO_UIMX)
2240
for (i=0, match=0; i<n; i++)
2241
if (*xdata == (int) xconv[i])
2251
else if (flag == TO_X)
2253
for (i=0, match=0; i<n; i++)
2255
if (UxStrEqual(*udata, uconv[i]))
2262
*xdata = (int) xconv[i];
2268
UxStandardError(CGETS( MS_MISC_WRONG_FLAG, DS_MS_MISC_WRONG_FLAG));
2275
UxStandardError(CGETS( MS_MISC_NO_MATCH, DS_MS_MISC_NO_MATCH));
2278
#endif /* RUNTIME */
2281
/***************************************************************************
2282
NAME: add_enum_type( name, xt_size, xt_vals, uimx_vals, num_vals,
2283
convertor, xt_variable )
2284
INPUT: char *name : name of resource type
2285
int xt_size : sizeof(Xt value)
2286
unsigned char *xt_vals : array of Xt values
2287
char **uimx_vals : array of uimx values
2288
int num_vals : number of array elements
2289
UIMX_conv convertor : convertor function to be used
2290
OUTPUT: int *xt_variable : the UxXT_ variable to be set
2292
DESCRIPTION: Installs the arrays of possible values and the convertor for an
2293
Xt resource type that takes on one of a small set of values.
2294
Note that most resources are of Xt type 'unsigned char'
2295
and use the convertor 'UxStringToCharEnum()',
2296
but there are a few exceptions.
2297
EXT REFERENCES: Relies on the UxUT_string variable already being initialized.
2300
REVISIONS: 21 Mars 1991 bug 2118
2301
-- Changed name of function to be compliant to VE style
2302
for user delivery. UxAddXtype and UxAddConv
2304
---------------------------------------------------------------------------*/
2305
static void add_enum_type( name, xt_size, xt_vals, uimx_vals, num_vals,
2306
convertor, xt_variable )
2309
unsigned char *xt_vals;
2312
UIMX_conv convertor;
2315
*xt_variable = UxAddXtype( name, xt_size );
2316
UxAddXValues( *xt_variable, uimx_vals, xt_vals, num_vals );
2317
UxAddConv( UxUT_string, *xt_variable, convertor );
2320
/***************************************************************************
2321
NAME: UxAddEnumType( name, xt_size, xt_vals, uimx_vals, xdef_vals,
2322
num_vals, convertor )
2323
INPUT: char *name : name of resource type
2324
int xt_size : sizeof(Xt value)
2325
unsigned char *xt_vals : array of Xt values
2326
char **uimx_vals : array of uimx values
2327
char **xdef_vals : array of Xt defined constants
2328
int num_vals : number of array elements
2329
UIMX_conv convertor : convertor function to be used
2331
RETURN: int : the id of the new xtype
2332
DESCRIPTION: Installs the arrays of possible values and the convertor for an
2333
Xt resource type that takes on one of a small set of values.
2334
The return value is the id of the new xtype and should be stored
2335
in a UxXT_ global variable.
2336
Note that most resources are of Xt type 'unsigned char'
2337
and use the convertor 'UxStringToCharEnum()',
2338
but there are a few exceptions.
2340
This function is presently not used in the standard UIM/X
2341
- it is provided for use by the users who are extending UIM/X.
2342
Note that the parameter 'xdef_vals' is not used in this
2343
version of the function but there is another version of this
2344
function in cgen/enum.c where 'xdef_vals' is used and so we
2345
retain it here so that both versions have the same parameters.
2347
EXT REFERENCES: Relies on the UxUT_string variable already being initialized.
2349
CREATION: Jan 16/90 Visual Edge Software
2351
---------------------------------------------------------------------------*/
2352
int UxAddEnumType( name, xt_size, xt_vals, uimx_vals, xdef_vals,
2353
num_vals, convertor )
2356
unsigned char *xt_vals;
2360
UIMX_conv convertor;
2364
add_enum_type( name, xt_size, xt_vals, uimx_vals, num_vals, convertor,
2370
/***************************************************************************
2371
NAME: UxInitEnumTypes()
2375
DESCRIPTION: Adds the Xt types and registers the convertors and arrays of
2376
values for the enumerated-type resources.
2377
EXT REFERENCES: Relies on the UxUT_string variable already being initialized.
2378
EXT EFFECTS: Initializes the UxXT_ variables for the enumerated types.
2381
---------------------------------------------------------------------------*/
2382
void UxInitEnumTypes()
2384
/* in alphabetical order */
2386
add_enum_type( "Alignment", sizeof(unsigned char),
2387
xAlignment, uAlignment, XtNumber(uAlignment),
2388
UxStringToCharEnum, &UxXT_Alignment );
2390
add_enum_type( "ChildPlacement", sizeof(unsigned char),
2391
xChildPlacement, uChildPlacement,
2392
XtNumber(uChildPlacement),
2393
UxStringToCharEnum, &UxXT_ChildPlacement );
2395
add_enum_type( "ChildVerticalAlignment", sizeof(unsigned char),
2396
xChildVerticalAlignment, uChildVerticalAlignment,
2397
XtNumber(uChildVerticalAlignment),
2398
UxStringToCharEnum, &UxXT_ChildVerticalAlignment);
2399
add_enum_type( "EntryVerticalAlignment", sizeof(unsigned
2401
xEntryVerticalAlignment, uEntryVerticalAlignment,
2402
XtNumber(uEntryVerticalAlignment),
2403
UxStringToCharEnum, &UxXT_EntryVerticalAlignment);
2406
add_enum_type( "ArrowDirection", sizeof(unsigned char),
2407
xArrowDirection, uArrowDirection, XtNumber(uArrowDirection),
2408
UxStringToCharEnum, &UxXT_ArrowDirection );
2410
add_enum_type( "AttachmentType", sizeof(unsigned char),
2411
xAttachmentType, uAttachmentType, XtNumber(uAttachmentType),
2412
UxStringToCharEnum, &UxXT_AttachmentType );
2414
add_enum_type( "AudibleWarning", sizeof(unsigned char),
2415
xAudibleWarning, uAudibleWarning, XtNumber(uAudibleWarning),
2416
UxStringToCharEnum, &UxXT_AudibleWarning );
2418
add_enum_type( "Bool", sizeof(Bool),
2419
xBool, uBoolean, XtNumber(uBoolean),
2420
UxStringToIntEnum, &UxXT_Bool );
2422
add_enum_type( "Boolean", sizeof(Boolean),
2423
xBoolean, uBoolean, XtNumber(uBoolean),
2424
UxStringToCharEnum, &UxXT_Boolean );
2426
add_enum_type( "ChildType", sizeof(unsigned char),
2427
xChildType, uChildType,
2428
XtNumber(uChildType),
2429
UxStringToCharEnum, &UxXT_ChildType );
2431
add_enum_type( "CommandWindowLocation", sizeof(unsigned char),
2432
xCommandWindowLocation, uCommandWindowLocation,
2433
XtNumber(uCommandWindowLocation),
2434
UxStringToCharEnum, &UxXT_CommandWindowLocation );
2436
add_enum_type( "DefaultButtonType", sizeof(unsigned char),
2437
xDefaultButtonType, uDefaultButtonType,
2438
XtNumber(uDefaultButtonType),
2439
UxStringToCharEnum, &UxXT_DefaultButtonType );
2441
add_enum_type( "DeleteResponse", sizeof(unsigned char),
2442
xDeleteResponse, uDeleteResponse, XtNumber(uDeleteResponse),
2443
UxStringToCharEnum, &UxXT_DeleteResponse );
2445
add_enum_type( "DialogStyle", sizeof(unsigned char),
2446
xDialogStyle, uDialogStyle, XtNumber(uDialogStyle),
2447
string_dialogStyle, &UxXT_DialogStyle );
2449
add_enum_type( "DialogType", sizeof(unsigned char),
2450
xDialogType, uDialogType, XtNumber(uDialogType),
2451
UxStringToCharEnum, &UxXT_DialogType );
2453
add_enum_type( "EditMode", sizeof(int),
2454
(unsigned char *)xEditMode, uEditMode, XtNumber(uEditMode),
2455
UxStringToIntEnum, &UxXT_EditMode );
2457
add_enum_type( "FileTypeMask", sizeof(unsigned char),
2458
xFileTypeMask, uFileTypeMask, XtNumber(uFileTypeMask),
2459
UxStringToCharEnum, &UxXT_FileTypeMask );
2461
add_enum_type( "IndicatorType", sizeof(unsigned char),
2462
xIndicatorType, uIndicatorType, XtNumber(uIndicatorType),
2463
UxStringToCharEnum, &UxXT_IndicatorType );
2465
add_enum_type( "InitialWindowState", sizeof(int),
2466
(unsigned char *)xInitialWindowState, uInitialWindowState,
2467
XtNumber(uInitialWindowState),
2468
UxStringToIntEnum, &UxXT_InitialWindowState );
2470
add_enum_type( "KeyboardFocusPolicy", sizeof(unsigned char),
2471
xKeyboardFocusPolicy, uKeyboardFocusPolicy,
2472
XtNumber(uKeyboardFocusPolicy),
2473
UxStringToCharEnum, &UxXT_KeyboardFocusPolicy );
2475
add_enum_type( "LabelType", sizeof(unsigned char),
2476
xLabelType, uLabelType, XtNumber(uLabelType),
2477
UxStringToCharEnum, &UxXT_LabelType );
2479
add_enum_type( "ListSizePolicy", sizeof(unsigned char),
2480
xListSizePolicy, uListSizePolicy, XtNumber(uListSizePolicy),
2481
UxStringToCharEnum, &UxXT_ListSizePolicy );
2483
add_enum_type( "MsgDialogType", sizeof(unsigned char),
2484
xMsgDialogType, uMsgDialogType, XtNumber(uMsgDialogType),
2485
UxStringToCharEnum, &UxXT_MsgDialogType );
2487
add_enum_type( "MwmInputMode", sizeof(int),
2488
xMwmInputMode, uMwmInputMode, XtNumber(uMwmInputMode),
2489
string_mwmInputMode, &UxXT_MwmInputMode );
2491
add_enum_type( "MultiClick", sizeof(unsigned char),
2492
xMultiClick, uMultiClick, XtNumber(uMultiClick),
2493
UxStringToCharEnum, &UxXT_MultiClick );
2495
add_enum_type( "NavigationType", sizeof(unsigned char),
2496
xNavigationType, uNavigationType, XtNumber(uNavigationType),
2497
UxStringToCharEnum, &UxXT_NavigationType );
2499
add_enum_type( "Orientation", sizeof(unsigned char),
2500
xOrientation, uOrientation, XtNumber(uOrientation),
2501
UxStringToCharEnum, &UxXT_Orientation );
2503
add_enum_type( "Packing", sizeof(unsigned char),
2504
xPacking, uPacking, XtNumber(uPacking),
2505
UxStringToCharEnum, &UxXT_Packing );
2507
add_enum_type( "ProcessingDirection", sizeof(unsigned char),
2508
xProcessingDirection, uProcessingDirection,
2509
XtNumber(uProcessingDirection),
2510
UxStringToCharEnum, &UxXT_ProcessingDirection );
2512
add_enum_type( "ResizePolicy", sizeof(unsigned char),
2513
xResizePolicy, uResizePolicy, XtNumber(uResizePolicy),
2514
UxStringToCharEnum, &UxXT_ResizePolicy );
2516
add_enum_type( "RowColumnType", sizeof(unsigned char),
2517
xRowColumnType, uRowColumnType, XtNumber(uRowColumnType),
2518
UxStringToCharEnum, &UxXT_RowColumnType );
2520
add_enum_type( "ScrollBarDisplayPolicy", sizeof(unsigned char),
2521
xScrollBarDisplayPolicy, uScrollBarDisplayPolicy,
2522
XtNumber(uScrollBarDisplayPolicy),
2523
UxStringToCharEnum, &UxXT_ScrollBarDisplayPolicy );
2525
add_enum_type( "ScrollBarPlacement", sizeof(unsigned char),
2526
xScrollBarPlacement, uScrollBarPlacement,
2527
XtNumber(uScrollBarPlacement),
2528
UxStringToCharEnum, &UxXT_ScrollBarPlacement );
2530
add_enum_type( "ScrollingPolicy", sizeof(unsigned char),
2531
xScrollingPolicy, uScrollingPolicy, XtNumber(uScrollingPolicy),
2532
UxStringToCharEnum, &UxXT_ScrollingPolicy );
2534
add_enum_type( "SelectionPolicy", sizeof(unsigned char),
2535
xSelectionPolicy, uSelectionPolicy, XtNumber(uSelectionPolicy),
2536
UxStringToCharEnum, &UxXT_SelectionPolicy );
2538
add_enum_type( "SeparatorType", sizeof(unsigned char),
2539
xSeparatorType, uSeparatorType, XtNumber(uSeparatorType),
2540
UxStringToCharEnum, &UxXT_SeparatorType );
2542
add_enum_type( "ShadowType", sizeof(unsigned char),
2543
xShadowType, uShadowType, XtNumber(uShadowType),
2544
UxStringToCharEnum, &UxXT_ShadowType );
2546
add_enum_type( "StringDirection", sizeof(unsigned char),
2547
xStringDirection, uStringDirection, XtNumber(uStringDirection),
2548
UxStringToCharEnum, &UxXT_StringDirection );
2550
add_enum_type( "TearOffModel", sizeof(unsigned char),
2551
xTearOffModel, uTearOffModel, XtNumber(uTearOffModel),
2552
UxStringToCharEnum, &UxXT_TearOffModel );
2554
add_enum_type( "UnitType", sizeof(unsigned char),
2555
xUnitType, uUnitType, XtNumber(uUnitType),
2556
UxStringToCharEnum, &UxXT_UnitType );
2558
add_enum_type( "VisualPolicy", sizeof(unsigned char),
2559
xVisualPolicy, uVisualPolicy, XtNumber(uVisualPolicy),
2560
UxStringToCharEnum, &UxXT_VisualPolicy );
2562
add_enum_type( "WinGravity", sizeof(int),
2563
xWinGravity, uWinGravity, XtNumber(uWinGravity),
2564
UxStringToIntEnum, &UxXT_WinGravity );
2566
/* Now add any enumerated-resource types that the user has defined */
2567
UxAddUserDefEnumTypes();