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

« back to all changes in this revision

Viewing changes to source/3rdparty/qmon/Xbae/Clip.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
 * Copyright(c) 1992 Bell Communications Research, Inc. (Bellcore)
 
3
 *                        All rights reserved
 
4
 * Permission to use, copy, modify and distribute this material for
 
5
 * any purpose and without fee is hereby granted, provided that the
 
6
 * above copyright notice and this permission notice appear in all
 
7
 * copies, and that the name of Bellcore not be used in advertising
 
8
 * or publicity pertaining to this material without the specific,
 
9
 * prior written permission of an authorized representative of
 
10
 * Bellcore.
 
11
 *
 
12
 * BELLCORE MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES, EX-
 
13
 * PRESS OR IMPLIED, WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
 
14
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 
15
 * FITNESS FOR ANY PARTICULAR PURPOSE, AND THE WARRANTY AGAINST IN-
 
16
 * FRINGEMENT OF PATENTS OR OTHER INTELLECTUAL PROPERTY RIGHTS.  THE
 
17
 * SOFTWARE IS PROVIDED "AS IS", AND IN NO EVENT SHALL BELLCORE OR
 
18
 * ANY OF ITS AFFILIATES BE LIABLE FOR ANY DAMAGES, INCLUDING ANY
 
19
 * LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES RELAT-
 
20
 * ING TO THE SOFTWARE.
 
21
 *
 
22
 * ClipWidget Author: Andrew Wason, Bellcore, aw@bae.bellcore.com
 
23
 *
 
24
 * $Id$
 
25
 */
 
26
 
 
27
/*
 
28
 * Clip.c - private child of Matrix - used to clip Matrix's textField child
 
29
 */
 
30
 
 
31
#ifdef HAVE_CONFIG_H
 
32
#include <config.h>
 
33
#endif
 
34
 
 
35
#include <X11/StringDefs.h>
 
36
#include <Xm/XmP.h>
 
37
#include "Macros.h"
 
38
#include "ClipP.h"
 
39
 
 
40
static char defaultTranslations[] =
 
41
    "<FocusIn>:                        FocusIn()";
 
42
 
 
43
static XtResource resources[] = {
 
44
    { XmNexposeProc, XmCFunction, XtRFunction, sizeof(XtExposeProc),
 
45
      XtOffsetOf(XbaeClipRec, clip.expose_proc),
 
46
      XtRFunction, (XtPointer) NULL },
 
47
    { XmNfocusCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
 
48
      XtOffsetOf(XbaeClipRec, clip.focus_callback),
 
49
      XtRImmediate, (XtPointer) NULL },
 
50
};
 
51
 
 
52
/*
 
53
 * Declaration of methods
 
54
 */
 
55
static void ClassPartInitialize P((XbaeClipWidgetClass));
 
56
static void Realize P((XbaeClipWidget, XtValueMask *,
 
57
                        XSetWindowAttributes *));
 
58
static void Redisplay P((XbaeClipWidget, XEvent *, Region));
 
59
static void Resize P((Widget));
 
60
static void Redraw P((XbaeClipWidget));
 
61
 
 
62
/*
 
63
 * Public convenience function
 
64
 */
 
65
void XbaeClipRedraw P((Widget w));
 
66
 
 
67
/*
 
68
 * Clip actions
 
69
 */
 
70
static void FocusInACT P((XbaeClipWidget, XEvent *, String *, Cardinal *));
 
71
 
 
72
static XtActionsRec actions[] =
 
73
{
 
74
    {"FocusIn", (XtActionProc)FocusInACT},
 
75
};
 
76
 
 
77
XbaeClipClassRec xbaeClipClassRec = {
 
78
    {
 
79
    /* core_class fields */
 
80
        /* superclass                */ (WidgetClass) &xmPrimitiveClassRec,
 
81
        /* class_name                */ "XbaeClip",
 
82
        /* widget_size                */ sizeof(XbaeClipRec),
 
83
        /* class_initialize        */ NULL,
 
84
        /* class_part_initialize*/ (XtWidgetClassProc)ClassPartInitialize,
 
85
        /* class_inited                */ False,
 
86
        /* initialize                */ NULL,
 
87
        /* initialize_hook        */ NULL,
 
88
        /* realize                */ (XtRealizeProc)Realize,
 
89
        /* actions                */ actions,
 
90
        /* num_actions                */ XtNumber(actions),
 
91
        /* resources                */ resources,
 
92
        /* num_resources        */ XtNumber(resources),
 
93
        /* xrm_class                */ NULLQUARK,
 
94
        /* compress_motion        */ True,
 
95
        /* compress_exposure        */ XtExposeCompressSeries |
 
96
                                       XtExposeGraphicsExpose |
 
97
                                       XtExposeNoExpose,
 
98
        /* compress_enterleave        */ True,
 
99
        /* visible_interest        */ False,
 
100
        /* destroy                */ NULL,
 
101
        /* resize                */ Resize,
 
102
        /* expose                */ (XtExposeProc)Redisplay,
 
103
        /* set_values                */ NULL,
 
104
        /* set_values_hook        */ NULL,
 
105
        /* set_values_almost        */ XtInheritSetValuesAlmost,
 
106
        /* get_values_hook        */ NULL,
 
107
        /* accept_focus                */ NULL,
 
108
        /* version                */ XtVersion,
 
109
        /* callback_private        */ NULL,
 
110
        /* tm_table                */ defaultTranslations,
 
111
        /* query_geometry        */ NULL,
 
112
        /* display_accelerator        */ NULL,
 
113
        /* extension                */ NULL
 
114
    },
 
115
    /* primitive_class fields */
 
116
    {
 
117
        /* border_highlight        */ NULL,
 
118
        /* border_unhighlight        */ NULL,
 
119
        /* translations                */ NULL,
 
120
        /* arm_and_activate        */ NULL,
 
121
        /* syn_resources        */ NULL,
 
122
        /* num_syn_resources        */ 0,
 
123
        /* extension                */ NULL
 
124
    },
 
125
    /* clip_class fields */
 
126
    {
 
127
        /* redraw                */ (XbaeClipRedrawProc)Redraw,
 
128
        /* extension                */ NULL,
 
129
    }
 
130
};
 
131
 
 
132
WidgetClass xbaeClipWidgetClass = (WidgetClass) & xbaeClipClassRec;
 
133
 
 
134
 
 
135
static void
 
136
ClassPartInitialize(cwc)
 
137
XbaeClipWidgetClass cwc;
 
138
{
 
139
    register XbaeClipWidgetClass super =
 
140
        (XbaeClipWidgetClass) cwc->core_class.superclass;
 
141
 
 
142
    /*
 
143
     * Allow subclasses to inherit our redraw method
 
144
     */
 
145
    if (cwc->clip_class.redraw == XbaeInheritRedraw)
 
146
        cwc->clip_class.redraw = super->clip_class.redraw;
 
147
}
 
148
 
 
149
static void
 
150
Realize(cw, valueMask, attributes)
 
151
XbaeClipWidget cw;
 
152
XtValueMask *valueMask;
 
153
XSetWindowAttributes *attributes;
 
154
{
 
155
    /*
 
156
     * Don't call our superclasses realize method, because Primitive sets
 
157
     * bit_gravity and do_not_propagate
 
158
     */
 
159
    XtCreateWindow((Widget)cw, InputOutput, CopyFromParent,
 
160
                   *valueMask, attributes);
 
161
}
 
162
 
 
163
/* ARGSUSED */
 
164
static void
 
165
Redisplay(cw, event, region)
 
166
XbaeClipWidget cw;
 
167
XEvent *event;
 
168
Region region;
 
169
{
 
170
    if (cw->clip.expose_proc)
 
171
        cw->clip.expose_proc((Widget)cw, event, region);
 
172
}
 
173
 
 
174
/* ARGSUSED */
 
175
static void
 
176
Resize(w)
 
177
Widget w;
 
178
{
 
179
    /*
 
180
     * Xt will call the expose method when this method returns.
 
181
     * So we won't have to do any exposure stuff here, which 
 
182
     * means the Matrix's  SetValues method only needs to force a
 
183
     * redraw when a redisplay is needed, not when a relayout is performed.
 
184
     */
 
185
}
 
186
 
 
187
/*
 
188
 * Clip redraw method
 
189
 */
 
190
/* ARGSUSED */
 
191
static void
 
192
Redraw(cw)
 
193
XbaeClipWidget cw;
 
194
{
 
195
    if (XtIsRealized((Widget)cw))
 
196
        XClearArea(XtDisplay(cw), XtWindow(cw), 0, 0, 0, 0, True);
 
197
}
 
198
 
 
199
/*
 
200
 * Public interface to redraw method
 
201
 */
 
202
void
 
203
XbaeClipRedraw(w)
 
204
Widget w;
 
205
{
 
206
    /*
 
207
     * Make sure w is a Clip or a subclass
 
208
     */
 
209
    XtCheckSubclass(w, xbaeClipWidgetClass, NULL);
 
210
 
 
211
    /*
 
212
     * Call the redraw method
 
213
     */
 
214
    if (XtIsRealized(w))
 
215
        (*((XbaeClipWidgetClass) XtClass(w))->clip_class.redraw)
 
216
            ((Widget)w);
 
217
}
 
218
 
 
219
/* ARGSUSED */
 
220
static void
 
221
FocusInACT(cw, event, params, nparams)
 
222
XbaeClipWidget cw;
 
223
XEvent *event;
 
224
String *params;
 
225
Cardinal *nparams;
 
226
{
 
227
    if (event->xany.type != FocusIn || !event->xfocus.send_event)
 
228
        return;
 
229
 
 
230
    if (cw->clip.focus_callback)
 
231
        XtCallCallbackList((Widget)cw, cw->clip.focus_callback, NULL);
 
232
}