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

« back to all changes in this revision

Viewing changes to source/3rdparty/qmon/Xmt310/Xmt/XmScale.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:03  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/WidgetType.h>
 
23
#include <Xmt/QuarksP.h>
 
24
#include <Xm/Scale.h>
 
25
 
 
26
#if NeedFunctionPrototypes
 
27
static void setvalue(Widget w, XtPointer address, XrmQuark type, Cardinal size)
 
28
#else
 
29
static void setvalue(w, address, type, size)
 
30
Widget w;
 
31
XtPointer address;
 
32
XrmQuark type;
 
33
Cardinal size;
 
34
#endif
 
35
{
 
36
    int value;
 
37
 
 
38
    if ((type != XmtQCardinal) &&
 
39
        (type != XmtQDimension) &&
 
40
        (type != XmtQPosition) &&
 
41
        (type != XmtQInt) &&
 
42
        (type != XmtQShort) &&
 
43
        (type != XmtQUnsignedChar)) {
 
44
        XmtWarningMsg("XmtDialogSetDialogValues", "scale",
 
45
                      "Type mismatch: Widget '%s':\n\tCan't set widget value from a resource of type '%s'; scalar type expected.",
 
46
                      XtName(w), XrmQuarkToString(type));
 
47
        return;
 
48
    }
 
49
 
 
50
    if (size == sizeof(unsigned char))
 
51
        value = *(unsigned char *)address;
 
52
    else if (size == sizeof(unsigned short))
 
53
        value = *(unsigned short *)address;
 
54
    else if (size == sizeof(unsigned int))
 
55
        value = *(unsigned int *)address;
 
56
    else return;
 
57
 
 
58
    XmScaleSetValue(w, value);
 
59
}
 
60
 
 
61
#if NeedFunctionPrototypes
 
62
static void getvalue(Widget w, XtPointer address, XrmQuark type, Cardinal size)
 
63
#else
 
64
static void getvalue(w, address, type, size)
 
65
Widget w;
 
66
XtPointer address;
 
67
XrmQuark type;
 
68
Cardinal size;
 
69
#endif
 
70
{
 
71
    int value;
 
72
 
 
73
    if ((type != XmtQCardinal) &&
 
74
        (type != XmtQDimension) &&
 
75
        (type != XmtQPosition) &&
 
76
        (type != XmtQInt) &&
 
77
        (type != XmtQShort) &&
 
78
        (type != XmtQUnsignedChar)) {
 
79
        XmtWarningMsg("XmtDialogGetDialogValues", "scale",
 
80
                      "Type mismatch: Widget '%s':\n\tCan't set value on resource of type '%s'; scalar type expected.",
 
81
                      XtName(w), XrmQuarkToString(type));
 
82
        return;
 
83
    }
 
84
 
 
85
    XmScaleGetValue(w, &value);
 
86
 
 
87
    if (size == sizeof(unsigned char))
 
88
        *(unsigned char *)address = value;
 
89
    else if (size == sizeof(unsigned short))
 
90
        *(unsigned short *)address = value;
 
91
    else if (size == sizeof(unsigned int))
 
92
        *(unsigned int *)address = value;
 
93
}
 
94
 
 
95
static XmtWidgetType widget = {
 
96
    "XmScale",
 
97
    NULL,
 
98
    XmCreateScale,
 
99
    setvalue,
 
100
    getvalue
 
101
};
 
102
 
 
103
#if NeedFunctionPrototypes
 
104
void XmtRegisterXmScale(void)
 
105
#else
 
106
void XmtRegisterXmScale()
 
107
#endif
 
108
{
 
109
    _XmtInitQuarks();
 
110
    XmtRegisterWidgetTypes(&widget, 1);
 
111
}
 
112
 
 
113
 
 
114