~ubuntu-branches/ubuntu/quantal/mesa-glw/quantal

« back to all changes in this revision

Viewing changes to src/glut/beos/glutCallback.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Morten Kjeldgaard
  • Date: 2008-05-06 16:19:15 UTC
  • Revision ID: james.westby@ubuntu.com-20080506161915-uynz7nftmfixu6bq
Tags: upstream-7.0.3
ImportĀ upstreamĀ versionĀ 7.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************
 
2
 *      Copyright (C) 1997, Be Inc.  Copyright (C) 1999, Jake Hamby.
 
3
 *
 
4
 * This program is freely distributable without licensing fees
 
5
 * and is provided without guarantee or warrantee expressed or
 
6
 * implied. This program is -not- in the public domain.
 
7
 *
 
8
 *
 
9
 *  FILE:       glutCallback.cpp
 
10
 *
 
11
 *      DESCRIPTION:    put all the callback setting routines in
 
12
 *              one place
 
13
 ***********************************************************/
 
14
 
 
15
/***********************************************************
 
16
 *      Headers
 
17
 ***********************************************************/
 
18
#include <GL/glut.h>
 
19
#include "glutint.h"
 
20
#include "glutState.h"
 
21
 
 
22
/***********************************************************
 
23
 *      Window related callbacks
 
24
 ***********************************************************/
 
25
void APIENTRY 
 
26
glutDisplayFunc(GLUTdisplayCB displayFunc)
 
27
{
 
28
  /* XXX Remove the warning after GLUT 3.0. */
 
29
  if (!displayFunc)
 
30
    __glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code.");
 
31
  gState.currentWindow->display = displayFunc;
 
32
}
 
33
 
 
34
void APIENTRY 
 
35
glutKeyboardFunc(GLUTkeyboardCB keyboardFunc)
 
36
{
 
37
  gState.currentWindow->keyboard = keyboardFunc;
 
38
}
 
39
 
 
40
void APIENTRY 
 
41
glutSpecialFunc(GLUTspecialCB specialFunc)
 
42
{
 
43
  gState.currentWindow->special = specialFunc;
 
44
}
 
45
 
 
46
void APIENTRY 
 
47
glutMouseFunc(GLUTmouseCB mouseFunc)
 
48
{
 
49
  gState.currentWindow->mouse = mouseFunc;
 
50
}
 
51
 
 
52
void APIENTRY 
 
53
glutMotionFunc(GLUTmotionCB motionFunc)
 
54
{
 
55
  gState.currentWindow->motion = motionFunc;
 
56
}
 
57
 
 
58
void APIENTRY 
 
59
glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc)
 
60
{
 
61
  gState.currentWindow->passive = passiveMotionFunc;
 
62
}
 
63
 
 
64
void APIENTRY 
 
65
glutEntryFunc(GLUTentryCB entryFunc)
 
66
{
 
67
  gState.currentWindow->entry = entryFunc;
 
68
  if (!entryFunc) {
 
69
    gState.currentWindow->entryState = -1;
 
70
  }
 
71
}
 
72
 
 
73
void APIENTRY
 
74
glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc)
 
75
{
 
76
  gState.currentWindow->windowStatus = windowStatusFunc;
 
77
}
 
78
 
 
79
static void
 
80
visibilityHelper(int status)
 
81
{
 
82
  if (status == GLUT_HIDDEN || status == GLUT_FULLY_COVERED)
 
83
    gState.currentWindow->visibility(GLUT_NOT_VISIBLE);
 
84
  else
 
85
    gState.currentWindow->visibility(GLUT_VISIBLE);
 
86
}
 
87
 
 
88
void APIENTRY 
 
89
glutVisibilityFunc(GLUTvisibilityCB visibilityFunc)
 
90
{
 
91
  gState.currentWindow->visibility = visibilityFunc;
 
92
  if (visibilityFunc)
 
93
    glutWindowStatusFunc(visibilityHelper);
 
94
  else
 
95
    glutWindowStatusFunc(NULL);
 
96
}
 
97
 
 
98
void APIENTRY 
 
99
glutReshapeFunc(GLUTreshapeCB reshapeFunc)
 
100
{
 
101
  if (reshapeFunc) {
 
102
    gState.currentWindow->reshape = reshapeFunc;
 
103
  } else {
 
104
    gState.currentWindow->reshape = __glutDefaultReshape;
 
105
  }
 
106
}
 
107
 
 
108
/***********************************************************
 
109
 *      General callbacks (timer callback in glutEvent.cpp)
 
110
 ***********************************************************/
 
111
/* DEPRICATED, use glutMenuStatusFunc instead. */
 
112
void APIENTRY
 
113
glutMenuStateFunc(GLUTmenuStateCB menuStateFunc)
 
114
{
 
115
  gState.menuStatus = (GLUTmenuStatusCB) menuStateFunc;
 
116
}
 
117
 
 
118
void APIENTRY
 
119
glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc)
 
120
{
 
121
  gState.menuStatus = menuStatusFunc;
 
122
}
 
123
 
 
124
void APIENTRY
 
125
glutIdleFunc(GLUTidleCB idleFunc)
 
126
{
 
127
  gState.idle = idleFunc;
 
128
}
 
129
 
 
130
/***********************************************************
 
131
 *      Unsupported callbacks
 
132
 ***********************************************************/
 
133
void APIENTRY
 
134
glutOverlayDisplayFunc(GLUTdisplayCB displayFunc)
 
135
{
 
136
}
 
137
 
 
138
void APIENTRY
 
139
glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc)
 
140
{
 
141
}
 
142
 
 
143
void APIENTRY
 
144
glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc)
 
145
{
 
146
}
 
147
 
 
148
void APIENTRY
 
149
glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc)
 
150
{
 
151
}
 
152
 
 
153
void APIENTRY
 
154
glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc)
 
155
{
 
156
}
 
157
 
 
158
void APIENTRY
 
159
glutDialsFunc(GLUTdialsCB dialsFunc)
 
160
{
 
161
}
 
162
 
 
163
void APIENTRY
 
164
glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc)
 
165
{
 
166
}
 
167
 
 
168
void APIENTRY
 
169
glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc)
 
170
{
 
171
}