File: ext18list.c

package info (click to toggle)
motif 2.3.8-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,432 kB
  • sloc: ansic: 452,643; sh: 4,613; makefile: 2,030; yacc: 1,604; lex: 352; cpp: 348
file content (191 lines) | stat: -rw-r--r-- 5,578 bytes parent folder | download | duplicates (4)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
 * Copyright 1994, Integrated Computer Solutions, Inc.
 *
 * All Rights Reserved.
 *
 * Author: Rick Umali
 *
 * MultiList.c
 *
 */

/**************************************************************
 *		INCLUDE FILES
 **************************************************************/
#include <stdio.h>

#include <Xm/Xm.h>
#include <Xm/Text.h>
#include <Xm/PushB.h>
#include <Xm/ToggleB.h>
#include <Xm/MultiList.h>
#include "extlist.h"
#include <pixmaps/crab.xpm>
#include <pixmaps/stopsign.xpm>
#include <pixmaps/porsche.xpm>
#include <pixmaps/clown.xbm>


/**************************************************************
External functions
**************************************************************/
#ifdef NeedFunctionPrototypes
#define ARGLIST(p)	(
#define ARG(a, b)	a b,
#define GRA(a, b)	a b)
#else
#define ARGLIST(p)	p
#define ARG(a, b)	a b;
#define GRA(a, b)	a b;
#endif
extern Pixmap XPM_PIXMAP
ARGLIST((w, pixmapName))
ARG(Widget, w)
GRA(char **, pixmapName);

/**************************************************************
 *		GLOBALS
 **************************************************************/
Widget G_extlist = NULL;
Pixmap porsche_pix;
Pixmap stopsign_pix; 
Pixmap crab_pix;
Pixmap clown_pix;
 
PlayerData players[] = {
/*   Name      AB   R    H   RBI   AVG   HR */
{ PPORSCHE, "Mo Vaughn", 159, 30,  55, 33, 346, 11 },
{ PCLOWN, "Tim Naehring", 133, 25, 43, 27, 323, 6 },
{ PSTOP, "Scott Cooper", 139, 24, 43, 30, 309, 9 },
{ PCLOWN, "John Valentin", 78, 12, 22, 11, 282, 2 },
{ PSTOP, "Carlos Rodriguez", 39, 2, 11, 4, 282, 1},
{ PCLOWN, "Otis Nixon", 148, 23, 41, 13, 277, 0},    
{ PSTOP, "Scott Fletcher", 80, 13, 21, 8, 263, 2},
{ PCLOWN, "Andre Dawson", 134, 19, 33, 27, 246, 10},
{ PPORSCHE, "Damon Berryhill", 72, 4, 17, 6, 236, 1},
{ PPORSCHE, "Billy Hatcher", 139, 23, 32, 15, 230, 1},
{ PCLOWN, "Mike Greenwell", 151, 31, 35, 25, 232, 7},
{ PSTOP, "Rich Rowland", 28, 1, 6, 6, 214, 1},
{ PCLOWN, "Lee Tinsley", 34, 10, 7, 2, 206, 0},
{ PPORSCHE, "Dave Valle", 72, 5, 11, 4, 153, 1},
};

/**************************************************************
 *		FORWARD DECLARATIONS
 **************************************************************/
Widget Createform(Widget, DemoInfo);
static void QuitCB(Widget, XtPointer, XtPointer);

/**************************************************************
 *		DEFINES
 **************************************************************/

/**************************************************************
 *		FALLBACKS
 **************************************************************/
static String fallbacks[] = {
    /*
     * General fallback resources.
     */
    "*background: grey",
    "*rightPane*background: grey",
    "*fontList: -*-helvetica-medium-r-*-*-*-140-*-*-*-*-*-*",
    "*explain_label*fontList: -*-helvetica-bold-r-*-*-*-140-*-*-*-*-*-*",
    "*explain_label*marginWidth: 10",
    "*explain_label*marginHeight: 10",
    "*rem_label.alignment: XmALIGNMENT_BEGINNING",
    "*rem_label.labelString: Remove Player",
    "*add_label.labelString: Add Player   ",
    "*add_label.alignment: XmALIGNMENT_BEGINNING",
    "*rem_pb.labelString: No Selected Player",
    "*unsel_pb.labelString: Unselect Current",
    "*firstRowCol.labelString: Go to Row 2, 1",
    "*toggleFind.labelString: Toggle Finder",
    "*quit_pb.labelString: Quit",
    "*MultiList.title: Red Sox Line Up Card",
    "*multilistWidget*title: Line Up",
    "*playerone.labelString: Mo Vaughn",
    "*playertwo.labelString: Tim Naehring",
    "*playerthree.labelString: Scott Cooper",
    "*playerfour.labelString: John Valentin",
    "*playerfive.labelString: Carlos Rodriguez",
    "*playersix.labelString: Otis Nixon",
    "*playerseven.labelString: Scott Fletcher",
    "*playereight.labelString: Andre Dawon",
    "*playernine.labelString: Damon Berryhill",
    "*playerten.labelString: Billy Hatcher",
    "*playereleven.labelString: Mike Greenwell",
    "*playertwelve.labelString: Rich Rowland",
    "*playerthirteen.labelString: Lee Tinsley",
    "*playerfourteen.labelString: Dave Valle",
    "*ext18listWidget*background: White",
    "*list*background: White",
    NULL,
};

/**************************************************************
 *		CALLBACKS
 **************************************************************/
/*
 * Function Name: InitializeData
 * Description:   
 * Arguments:     
 * Returns:       nothing
 *
 */
void
InitializeData(shell )
Widget shell;
{
  porsche_pix = XPM_PIXMAP(shell, porsche);
  crab_pix = XPM_PIXMAP(shell, crab);
  stopsign_pix = XPM_PIXMAP(shell, stopsign);
  clown_pix = XCreateBitmapFromData(XtDisplay(shell),
				RootWindowOfScreen(XtScreen(shell)),
				(char *)clown_bits, clown_width, clown_height);

}

/**************************************************************
 *		PUBLIC (GLOBAL) CODE
 **************************************************************/
/*
 * Function Name: main
 * Description:   
 * Arguments:     the usual suspects
 * Returns:       nothing
 *
 */
int
main(int argc, char **argv)
{
    Widget top, demo;
    XtAppContext app;
    DemoInfo demo_info = (DemoInfo)XtMalloc( sizeof(DemoStruct));

    XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); 

    
    top = XtOpenApplication(
            &app, 
            "MultiList", 
            NULL, 
            0,
            &argc, 
            argv, 
            fallbacks,
            sessionShellWidgetClass,
            NULL, 0);

    demo = Createform(top, demo_info);

    XtManageChild(demo);

    InitializeData(top);

    XtRealizeWidget(top);

    XtAppMainLoop(app);
    return(0);
}