~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/3rdparty/qmon/Xmt310/Xmt/Dialogs.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Motif Tools Library, Version 3.1
 
3
 * $Id$
 
4
 * 
 
5
 * Written by David Flanagan.
 
6
 * Copyright (c) 1992-2001 by David Flanagan.
 
7
 * All Rights Reserved.  See the file COPYRIGHT for details.
 
8
 * This is open source software.  See the file LICENSE for details.
 
9
 * There is no warranty for this software.  See NO_WARRANTY for details.
 
10
 *
 
11
 * $Log$
 
12
 * Revision 1.1.1.1  2001/07/18 11:06:02  root
 
13
 * Initial checkin.
 
14
 *
 
15
 * Revision 1.2  2001/06/12 16:25:28  andre
 
16
 * *** empty log message ***
 
17
 *
 
18
 *
 
19
 */
 
20
 
 
21
#include <Xmt/Xmt.h>
 
22
#include <Xmt/ScreenP.h>
 
23
#include <Xmt/DialogsP.h>
 
24
#include <X11/IntrinsicP.h>
 
25
#include <X11/CompositeP.h>
 
26
 
 
27
/* ARGSUSED */
 
28
#if NeedFunctionPrototypes
 
29
void _XmtOkCallback(Widget w, XtPointer tag, XtPointer call_data)
 
30
#else
 
31
void _XmtOkCallback(w, tag, call_data)
 
32
Widget w;
 
33
XtPointer tag;
 
34
XtPointer call_data;
 
35
#endif
 
36
{
 
37
    XmtPerScreenInfo *info = (XmtPerScreenInfo *)tag;
 
38
    info->blocked = False;
 
39
    info->button = XmtOkButton;
 
40
}
 
41
 
 
42
/* ARGSUSED */
 
43
#if NeedFunctionPrototypes
 
44
void _XmtYesCallback(Widget w, XtPointer tag, XtPointer call_data)
 
45
#else
 
46
void _XmtYesCallback(w, tag, call_data)
 
47
Widget w;
 
48
XtPointer tag;
 
49
XtPointer call_data;
 
50
#endif
 
51
{
 
52
    XmtPerScreenInfo *info = (XmtPerScreenInfo *)tag;
 
53
    info->blocked = False;
 
54
    info->button = XmtYesButton;
 
55
}
 
56
 
 
57
/* ARGSUSED */
 
58
#if NeedFunctionPrototypes
 
59
void _XmtNoCallback(Widget w, XtPointer tag, XtPointer call_data)
 
60
#else
 
61
void _XmtNoCallback(w, tag, call_data)
 
62
Widget w;
 
63
XtPointer tag;
 
64
XtPointer call_data;
 
65
#endif
 
66
{
 
67
    XmtPerScreenInfo *info = (XmtPerScreenInfo *)tag;
 
68
    info->blocked = False;
 
69
    info->button = XmtNoButton;
 
70
}
 
71
 
 
72
/* ARGSUSED */
 
73
#if NeedFunctionPrototypes
 
74
void _XmtCancelCallback(Widget w, XtPointer tag, XtPointer call_data)
 
75
#else
 
76
void _XmtCancelCallback(w, tag, call_data)
 
77
Widget w;
 
78
XtPointer tag;
 
79
XtPointer call_data;
 
80
#endif
 
81
{
 
82
    XmtPerScreenInfo *info = (XmtPerScreenInfo *)tag;
 
83
    
 
84
    info->blocked = False;
 
85
    info->button = XmtCancelButton;
 
86
}
 
87
 
 
88
/* ARGSUSED */
 
89
#if NeedFunctionPrototypes
 
90
void _XmtHelpCallback(Widget w, XtPointer tag, XtPointer call_data)
 
91
#else
 
92
void _XmtHelpCallback(w, tag, call_data)
 
93
Widget w;
 
94
XtPointer tag;
 
95
XtPointer call_data;
 
96
#endif
 
97
{
 
98
    XmtPerScreenInfo *info = (XmtPerScreenInfo *)tag;
 
99
 
 
100
    /*
 
101
     * Display a help dialog.
 
102
     * Use NULL dialog name and NULL title so we get the default.
 
103
     * We make this a modal dialog, even though info dialogs are generally
 
104
     * modeless because if we use a modeless one the user can't pop it down
 
105
     * until the modal dialog underneath is popped down.  I don't know if
 
106
     * this is a bug in motif, or is because the help dialog is not a child
 
107
     * of the modal dialog underneath, but it is bad behavior, so we work
 
108
     * around it by using a modal help dialog.  Also, this is good because
 
109
     * we don't have to arrange to automatically pop down the help dialog when
 
110
     * the modal underneath is popped down; the user can't pop down the modal
 
111
     * until he dismisses the help.
 
112
     */
 
113
    (void) _XmtDisplayMessage(w, NULL, NULL, info->help_text, NULL,
 
114
                              NULL, NULL, None,
 
115
                              XmDIALOG_INFORMATION,
 
116
                              XmDIALOG_PRIMARY_APPLICATION_MODAL);
 
117
}
 
118
 
 
119
/* ARGSUSED */
 
120
#if NeedFunctionPrototypes
 
121
void _XmtDialogPopdownCallback(Widget w, XtPointer tag, XtPointer data)
 
122
#else
 
123
void _XmtDialogPopdownCallback(w, tag, data)
 
124
Widget w;
 
125
XtPointer tag;
 
126
XtPointer data;
 
127
#endif
 
128
{
 
129
    XmtDialogCache *cache = (XmtDialogCache *)tag;
 
130
    Widget dialog;
 
131
 
 
132
    /*
 
133
     * if there is already a free dialog, destroy this one
 
134
     * and remove it from the cache.  Otherwise, just note that
 
135
     * we now have one free.
 
136
     */
 
137
    if (cache->in_use < cache->num) {
 
138
        int i;
 
139
 
 
140
        /*
 
141
         * w is the shell.  Get the dialog child
 
142
         */
 
143
        dialog = ((CompositeWidget)w)->composite.children[0];
 
144
        for(i=0; i < cache->num; i++)
 
145
            if (cache->dialogs[i] == dialog) break;
 
146
 
 
147
        XtDestroyWidget(dialog);
 
148
 
 
149
        /* now compress the remaining array elements */
 
150
        for(; i < cache->num-1; i++) cache->dialogs[i] = cache->dialogs[i+1];
 
151
 
 
152
        cache->num--;
 
153
    }
 
154
    
 
155
    cache->in_use--;
 
156
}
 
157