File: appInspectorMotif.c

package info (click to toggle)
ted 2.11-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 11,064 kB
  • ctags: 13,935
  • sloc: ansic: 120,446; makefile: 7,469; sh: 253
file content (148 lines) | stat: -rw-r--r-- 3,492 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#   include	"appFrameConfig.h"

#   include	<stdlib.h>
#   include	<stdio.h>
#   include	<appDebugon.h>

#   include	"appFrame.h"
#   include	"appSystem.h"
#   include	<appGeoString.h>

#   ifdef USE_MOTIF

#   include	<Xm/PanedW.h>
#   include	<Xm/Form.h>

void appInspectorMakePageParent(	AppInspector *	ai )
    {
    Arg			al[20];
    int			ac= 0;

    ac= 0;
    XtSetArg( al[ac],	XmNallowResize,		True ); ac++;
    XtSetArg( al[ac],	XmNskipAdjust,		False ); ac++;
    ai->aiPageParent= XmCreateForm( ai->aiPaned, WIDGET_NAME, al, ac );

    XtManageChild( ai->aiPageParent );

    appMotifTurnOfSashTraversal( ai->aiPaned );

    return;
    }

void appInspectorChoosePage(	AppInspector *		ai,
				int			andMenu,
				int			pageNumber )
    {
    WidgetList		children;
    Cardinal		childCount= 0;

    int			i;

    childCount= 0;
    XtVaGetValues( ai->aiPageParent,
		    XmNchildren,	&children,
		    XmNnumChildren,	&childCount,
		    NULL );

    for ( i= 0; i < childCount; i++ )
	{
	XtVaSetValues( children[i],
			XmNmappedWhenManaged, i == pageNumber,
			NULL );
	}

    if  ( andMenu )
	{ appSetOptionmenu( &(ai->aiSubjectOptionmenu), pageNumber );	}

    return;
    }

static void appInspectorPageChosen(	APP_WIDGET	w,
					void *		vai,
					void *		call_data )
    {
    AppInspector *	ai= (AppInspector *)vai;

    short		pageNumber= -1;

    const int		andMenu= False;

    XtVaGetValues( w,
		    XmNpositionIndex,	&pageNumber,
		    NULL );

    if  ( pageNumber < 0 )
	{ LDEB(pageNumber); return;	}

    appInspectorChoosePage( ai, andMenu, pageNumber );

    ai->aiCurrentSubject= pageNumber;

    return;
    }

void appMakeVerticalInspectorPage(	APP_WIDGET *	pPage,
					APP_WIDGET *	pMenuitem,
					AppInspector *	ai,
					const char *	label )
    {
    Widget		item;
    Widget		page;

    Arg			al[20];
    int			ac= 0;

    ac= 0;
    XtSetArg( al[ac],	XmNleftAttachment,	XmATTACH_FORM ); ac++;
    XtSetArg( al[ac],	XmNrightAttachment,	XmATTACH_FORM ); ac++;
    XtSetArg( al[ac],	XmNtopAttachment,	XmATTACH_FORM ); ac++;
    XtSetArg( al[ac],	XmNbottomAttachment,	XmATTACH_FORM ); ac++;

    XtSetArg( al[ac],	XmNsashWidth,		1 ); ac++;
    XtSetArg( al[ac],	XmNsashHeight,		1 ); ac++;
    XtSetArg( al[ac],	XmNseparatorOn,		False ); ac++;
    XtSetArg( al[ac],	XmNmarginWidth,		5 ); ac++;
    XtSetArg( al[ac],	XmNmarginHeight,	5 ); ac++;
    XtSetArg( al[ac],	XmNspacing,		5 ); ac++;

    page= XmCreatePanedWindow( ai->aiPageParent, WIDGET_NAME, al, ac );
    XtManageChild( page );

    item= appAddItemToOptionmenu( &(ai->aiSubjectOptionmenu), label,
				    appInspectorPageChosen, (void *)ai );

    *pPage= page; *pMenuitem= item; return;
    }

void appInspectorEnablePage(	AppInspector *	ai,
				int		pageNumber,
				int		enabled )
    {
    WidgetList		children;
    Cardinal		childCount= 0;

    childCount= 0;
    XtVaGetValues( ai->aiSubjectOptionmenu.aomPulldown,
		    XmNchildren,	&children,
		    XmNnumChildren,	&childCount,
		    NULL );

    if  ( pageNumber < 0 || pageNumber >= childCount )
	{ LLDEB(pageNumber,childCount);				}
    else{ XtSetSensitive( children[pageNumber], enabled != 0 );	}

    childCount= 0;
    XtVaGetValues( ai->aiPageParent,
		    XmNchildren,	&children,
		    XmNnumChildren,	&childCount,
		    NULL );

    if  ( pageNumber < 0 || pageNumber >= childCount )
	{ LLDEB(pageNumber,childCount);				}
    else{ XtSetSensitive( children[pageNumber], enabled != 0 );	}

    return;
    }

#   endif /*  USE_MOTIF	*/