Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / libs / glut / glutCallback.cpp
blobb4afc82639a8fbc7a315b5c24f290c7e08a32b96
1 /***********************************************************
2 * Copyright (C) 1997, Be Inc. Copyright (C) 1999, Jake Hamby.
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.
9 * FILE: glutCallback.cpp
11 * DESCRIPTION: put all the callback setting routines in
12 * one place
13 ***********************************************************/
15 /***********************************************************
16 * Headers
17 ***********************************************************/
18 #include <GL/glut.h>
19 #include "glutint.h"
20 #include "glutState.h"
22 /***********************************************************
23 * Window related callbacks
24 ***********************************************************/
25 void APIENTRY
26 glutDisplayFunc(GLUTdisplayCB displayFunc)
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;
34 void APIENTRY
35 glutKeyboardFunc(GLUTkeyboardCB keyboardFunc)
37 gState.currentWindow->keyboard = keyboardFunc;
40 void APIENTRY
41 glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc)
43 gState.currentWindow->keyboardUp = keyboardUpFunc;
46 void APIENTRY
47 glutSpecialFunc(GLUTspecialCB specialFunc)
49 gState.currentWindow->special = specialFunc;
52 void APIENTRY
53 glutSpecialUpFunc(GLUTspecialCB specialUpFunc)
55 gState.currentWindow->specialUp = specialUpFunc;
58 void APIENTRY
59 glutMouseFunc(GLUTmouseCB mouseFunc)
61 gState.currentWindow->mouse = mouseFunc;
64 void APIENTRY
65 glutMotionFunc(GLUTmotionCB motionFunc)
67 gState.currentWindow->motion = motionFunc;
70 void APIENTRY
71 glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc)
73 gState.currentWindow->passive = passiveMotionFunc;
76 void APIENTRY
77 glutEntryFunc(GLUTentryCB entryFunc)
79 gState.currentWindow->entry = entryFunc;
80 if (!entryFunc) {
81 gState.currentWindow->entryState = -1;
85 void APIENTRY
86 glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc)
88 gState.currentWindow->windowStatus = windowStatusFunc;
91 static void
92 visibilityHelper(int status)
94 if (status == GLUT_HIDDEN || status == GLUT_FULLY_COVERED)
95 gState.currentWindow->visibility(GLUT_NOT_VISIBLE);
96 else
97 gState.currentWindow->visibility(GLUT_VISIBLE);
100 void APIENTRY
101 glutVisibilityFunc(GLUTvisibilityCB visibilityFunc)
103 gState.currentWindow->visibility = visibilityFunc;
104 if (visibilityFunc)
105 glutWindowStatusFunc(visibilityHelper);
106 else
107 glutWindowStatusFunc(NULL);
110 void APIENTRY
111 glutReshapeFunc(GLUTreshapeCB reshapeFunc)
113 if (reshapeFunc) {
114 gState.currentWindow->reshape = reshapeFunc;
115 } else {
116 gState.currentWindow->reshape = __glutDefaultReshape;
120 /***********************************************************
121 * General callbacks (timer callback in glutEvent.cpp)
122 ***********************************************************/
123 /* DEPRICATED, use glutMenuStatusFunc instead. */
124 void APIENTRY
125 glutMenuStateFunc(GLUTmenuStateCB menuStateFunc)
127 gState.menuStatus = (GLUTmenuStatusCB) menuStateFunc;
130 void APIENTRY
131 glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc)
133 gState.menuStatus = menuStatusFunc;
136 void APIENTRY
137 glutIdleFunc(GLUTidleCB idleFunc)
139 gState.idle = idleFunc;
142 /***********************************************************
143 * Unsupported callbacks
144 ***********************************************************/
145 void APIENTRY
146 glutOverlayDisplayFunc(GLUTdisplayCB displayFunc)
150 void APIENTRY
151 glutJoystickFunc(GLUTjoystickCB joystickFunc, int pollInterval)
155 void APIENTRY
156 glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc)
160 void APIENTRY
161 glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc)
165 void APIENTRY
166 glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc)
170 void APIENTRY
171 glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc)
175 void APIENTRY
176 glutDialsFunc(GLUTdialsCB dialsFunc)
180 void APIENTRY
181 glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc)
185 void APIENTRY
186 glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc)