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
13 ***********************************************************/
15 /***********************************************************
17 ***********************************************************/
20 #include "glutState.h"
22 /***********************************************************
23 * Window related callbacks
24 ***********************************************************/
26 glutDisplayFunc(GLUTdisplayCB displayFunc
)
28 /* XXX Remove the warning after GLUT 3.0. */
30 __glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code.");
31 gState
.currentWindow
->display
= displayFunc
;
35 glutKeyboardFunc(GLUTkeyboardCB keyboardFunc
)
37 gState
.currentWindow
->keyboard
= keyboardFunc
;
41 glutKeyboardUpFunc(GLUTkeyboardCB keyboardUpFunc
)
43 gState
.currentWindow
->keyboardUp
= keyboardUpFunc
;
47 glutSpecialFunc(GLUTspecialCB specialFunc
)
49 gState
.currentWindow
->special
= specialFunc
;
53 glutSpecialUpFunc(GLUTspecialCB specialUpFunc
)
55 gState
.currentWindow
->specialUp
= specialUpFunc
;
59 glutMouseFunc(GLUTmouseCB mouseFunc
)
61 gState
.currentWindow
->mouse
= mouseFunc
;
65 glutMotionFunc(GLUTmotionCB motionFunc
)
67 gState
.currentWindow
->motion
= motionFunc
;
71 glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc
)
73 gState
.currentWindow
->passive
= passiveMotionFunc
;
77 glutEntryFunc(GLUTentryCB entryFunc
)
79 gState
.currentWindow
->entry
= entryFunc
;
81 gState
.currentWindow
->entryState
= -1;
86 glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc
)
88 gState
.currentWindow
->windowStatus
= windowStatusFunc
;
92 visibilityHelper(int status
)
94 if (status
== GLUT_HIDDEN
|| status
== GLUT_FULLY_COVERED
)
95 gState
.currentWindow
->visibility(GLUT_NOT_VISIBLE
);
97 gState
.currentWindow
->visibility(GLUT_VISIBLE
);
101 glutVisibilityFunc(GLUTvisibilityCB visibilityFunc
)
103 gState
.currentWindow
->visibility
= visibilityFunc
;
105 glutWindowStatusFunc(visibilityHelper
);
107 glutWindowStatusFunc(NULL
);
111 glutReshapeFunc(GLUTreshapeCB reshapeFunc
)
114 gState
.currentWindow
->reshape
= reshapeFunc
;
116 gState
.currentWindow
->reshape
= __glutDefaultReshape
;
120 /***********************************************************
121 * General callbacks (timer callback in glutEvent.cpp)
122 ***********************************************************/
123 /* DEPRICATED, use glutMenuStatusFunc instead. */
125 glutMenuStateFunc(GLUTmenuStateCB menuStateFunc
)
127 gState
.menuStatus
= (GLUTmenuStatusCB
) menuStateFunc
;
131 glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc
)
133 gState
.menuStatus
= menuStatusFunc
;
137 glutIdleFunc(GLUTidleCB idleFunc
)
139 gState
.idle
= idleFunc
;
142 /***********************************************************
143 * Unsupported callbacks
144 ***********************************************************/
146 glutOverlayDisplayFunc(GLUTdisplayCB displayFunc
)
151 glutJoystickFunc(GLUTjoystickCB joystickFunc
, int pollInterval
)
156 glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc
)
161 glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc
)
166 glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc
)
171 glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc
)
176 glutDialsFunc(GLUTdialsCB dialsFunc
)
181 glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc
)
186 glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc
)