File: widgets.c

package info (click to toggle)
xgobi 19980302-1
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 3,344 kB
  • ctags: 4,179
  • sloc: ansic: 48,103; makefile: 843
file content (86 lines) | stat: -rw-r--r-- 2,089 bytes parent folder | download | duplicates (2)
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
/***************************************************************************

  This file defines all the widgets used in the control panel
  for yourprog, and some sample callback routines, which are
  called when some appropriately registered button or key action
  takes place.  A few simple ones are given as examples.

  You can find some more general sample widget code
  under the source tree for X11, under src/contrib/examples/Xaw.

*************************************************************************** */

#include <sys/types.h>
#include <stdio.h>
#include "xincludes.h"
#include "xgobitypes.h"
#include "xgobivars.h"
#include <X11/keysym.h>
#include "prog.h"

extern XtCallbackProc run_cback();
extern XtCallbackProc Quit();
extern Boolean RunWorkProcs();

Widget form0, run_cmd, exit_cmd;

/* ARGSUSED */
XtCallbackProc
run_cback(w, client_data, cback_data)
  Widget w;
  XtPointer client_data;
  XtPointer cback_data;
/*
 * This callback defines the actions associated with the run button.
*/
{
  is_running = !is_running;

  if (is_running)
    (void) XtAppAddWorkProc(app_con, RunWorkProcs, NULL);
}

/* ARGSUSED */
XtCallbackProc
Quit(w, client_data, cback_data)
  Widget w;
  XtPointer client_data;
  XtPointer cback_data;
/*
 * This callback defines the actions associated with the 'exit' button.
*/
{
  void exit();

  exit(0);
}

make_prog_widgets()
{
  form0 = XtVaCreateManagedWidget("Form0",
    formWidgetClass, shell,
    XtNfont, panel_data.Font,
    NULL);

/* Run */
  run_cmd = XtVaCreateManagedWidget("Command",
    toggleWidgetClass, form0,
    XtNlabel, (String) "Run",
    XtNstate, (Boolean) False,
    NULL);
  if (mono) set_mono(run_cmd);
  XtAddCallback(run_cmd, XtNcallback,
    (XtCallbackProc) run_cback, (XtPointer) NULL);

/* Exit */
  exit_cmd = XtVaCreateManagedWidget("Command",
    commandWidgetClass, form0,
    XtNlabel, (String) "Exit",
    XtNfromVert, (Widget) run_cmd,
    XtNvertDistance, (int) 10,
    NULL);
  if (mono) set_mono(exit_cmd);
  XtAddCallback(exit_cmd, XtNcallback,
    (XtCallbackProc) Quit, (XtPointer) NULL);

}