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 glutSpecialFunc(GLUTspecialCB specialFunc
)
43 gState
.currentWindow
->special
= specialFunc
;
47 glutMouseFunc(GLUTmouseCB mouseFunc
)
49 gState
.currentWindow
->mouse
= mouseFunc
;
53 glutMotionFunc(GLUTmotionCB motionFunc
)
55 gState
.currentWindow
->motion
= motionFunc
;
59 glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc
)
61 gState
.currentWindow
->passive
= passiveMotionFunc
;
65 glutEntryFunc(GLUTentryCB entryFunc
)
67 gState
.currentWindow
->entry
= entryFunc
;
69 gState
.currentWindow
->entryState
= -1;
74 glutWindowStatusFunc(GLUTwindowStatusCB windowStatusFunc
)
76 gState
.currentWindow
->windowStatus
= windowStatusFunc
;
80 visibilityHelper(int status
)
82 if (status
== GLUT_HIDDEN
|| status
== GLUT_FULLY_COVERED
)
83 gState
.currentWindow
->visibility(GLUT_NOT_VISIBLE
);
85 gState
.currentWindow
->visibility(GLUT_VISIBLE
);
89 glutVisibilityFunc(GLUTvisibilityCB visibilityFunc
)
91 gState
.currentWindow
->visibility
= visibilityFunc
;
93 glutWindowStatusFunc(visibilityHelper
);
95 glutWindowStatusFunc(NULL
);
99 glutReshapeFunc(GLUTreshapeCB reshapeFunc
)
102 gState
.currentWindow
->reshape
= reshapeFunc
;
104 gState
.currentWindow
->reshape
= __glutDefaultReshape
;
108 /***********************************************************
109 * General callbacks (timer callback in glutEvent.cpp)
110 ***********************************************************/
111 /* DEPRICATED, use glutMenuStatusFunc instead. */
113 glutMenuStateFunc(GLUTmenuStateCB menuStateFunc
)
115 gState
.menuStatus
= (GLUTmenuStatusCB
) menuStateFunc
;
119 glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc
)
121 gState
.menuStatus
= menuStatusFunc
;
125 glutIdleFunc(GLUTidleCB idleFunc
)
127 gState
.idle
= idleFunc
;
130 /***********************************************************
131 * Unsupported callbacks
132 ***********************************************************/
134 glutOverlayDisplayFunc(GLUTdisplayCB displayFunc
)
139 glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc
)
144 glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc
)
149 glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc
)
154 glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc
)
159 glutDialsFunc(GLUTdialsCB dialsFunc
)
164 glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc
)
169 glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc
)