2 /* Copyright (c) Mark J. Kilgard, 1998. */
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. */
8 /* I appreciate the guidance from William Mitchell
9 (mitchell@cam.nist.gov) in developing this friend interface
10 for use by the f90gl package. See ../../README.fortran */
14 /* FCB stands for Fortran CallBack. */
16 /* There is only one idleFunc, menuStateFunc, and menuStatusFunc, so they
17 can be saved in the wrappers for Fortran rather than the C structures. */
19 /* Set a Fortran callback function. */
22 __glutSetFCB(int which
, GLUTproc func
)
24 #ifdef SUPPORT_FORTRAN
26 case GLUT_FCB_DISPLAY
:
27 __glutCurrentWindow
->fdisplay
= (GLUTdisplayFCB
) func
;
29 case GLUT_FCB_RESHAPE
:
30 __glutCurrentWindow
->freshape
= (GLUTreshapeFCB
) func
;
33 __glutCurrentWindow
->fmouse
= (GLUTmouseFCB
) func
;
36 __glutCurrentWindow
->fmotion
= (GLUTmotionFCB
) func
;
38 case GLUT_FCB_PASSIVE
:
39 __glutCurrentWindow
->fpassive
= (GLUTpassiveFCB
) func
;
42 __glutCurrentWindow
->fentry
= (GLUTentryFCB
) func
;
44 case GLUT_FCB_KEYBOARD
:
45 __glutCurrentWindow
->fkeyboard
= (GLUTkeyboardFCB
) func
;
47 case GLUT_FCB_KEYBOARD_UP
:
48 __glutCurrentWindow
->fkeyboardUp
= (GLUTkeyboardFCB
) func
;
50 case GLUT_FCB_WINDOW_STATUS
:
51 __glutCurrentWindow
->fwindowStatus
= (GLUTwindowStatusFCB
) func
;
53 case GLUT_FCB_VISIBILITY
:
54 __glutCurrentWindow
->fvisibility
= (GLUTvisibilityFCB
) func
;
56 case GLUT_FCB_SPECIAL
:
57 __glutCurrentWindow
->fspecial
= (GLUTspecialFCB
) func
;
59 case GLUT_FCB_SPECIAL_UP
:
60 __glutCurrentWindow
->fspecialUp
= (GLUTspecialFCB
) func
;
62 case GLUT_FCB_BUTTON_BOX
:
63 __glutCurrentWindow
->fbuttonBox
= (GLUTbuttonBoxFCB
) func
;
66 __glutCurrentWindow
->fdials
= (GLUTdialsFCB
) func
;
68 case GLUT_FCB_SPACE_MOTION
:
69 __glutCurrentWindow
->fspaceMotion
= (GLUTspaceMotionFCB
) func
;
71 case GLUT_FCB_SPACE_ROTATE
:
72 __glutCurrentWindow
->fspaceRotate
= (GLUTspaceRotateFCB
) func
;
74 case GLUT_FCB_SPACE_BUTTON
:
75 __glutCurrentWindow
->fspaceButton
= (GLUTspaceButtonFCB
) func
;
77 case GLUT_FCB_TABLET_MOTION
:
78 __glutCurrentWindow
->ftabletMotion
= (GLUTtabletMotionFCB
) func
;
80 case GLUT_FCB_TABLET_BUTTON
:
81 __glutCurrentWindow
->ftabletButton
= (GLUTtabletButtonFCB
) func
;
84 case GLUT_FCB_JOYSTICK
:
85 __glutCurrentWindow
->fjoystick
= (GLUTjoystickFCB
) func
;
88 case GLUT_FCB_OVERLAY_DISPLAY
:
89 __glutCurrentWindow
->overlay
->fdisplay
= (GLUTdisplayFCB
) func
;
92 __glutCurrentMenu
->fselect
= (GLUTselectFCB
) func
;
95 __glutNewTimer
->ffunc
= (GLUTtimerFCB
) func
;
101 /* Get a Fortran callback function. */
104 __glutGetFCB(int which
)
106 #ifdef SUPPORT_FORTRAN
108 case GLUT_FCB_DISPLAY
:
109 return __glutCurrentWindow
->fdisplay
;
110 case GLUT_FCB_RESHAPE
:
111 return __glutCurrentWindow
->freshape
;
113 return __glutCurrentWindow
->fmouse
;
114 case GLUT_FCB_MOTION
:
115 return __glutCurrentWindow
->fmotion
;
116 case GLUT_FCB_PASSIVE
:
117 return __glutCurrentWindow
->fpassive
;
119 return __glutCurrentWindow
->fentry
;
120 case GLUT_FCB_KEYBOARD
:
121 return __glutCurrentWindow
->fkeyboard
;
122 case GLUT_FCB_KEYBOARD_UP
:
123 return __glutCurrentWindow
->fkeyboardUp
;
124 case GLUT_FCB_WINDOW_STATUS
:
125 return __glutCurrentWindow
->fwindowStatus
;
126 case GLUT_FCB_VISIBILITY
:
127 return __glutCurrentWindow
->fvisibility
;
128 case GLUT_FCB_SPECIAL
:
129 return __glutCurrentWindow
->fspecial
;
130 case GLUT_FCB_SPECIAL_UP
:
131 return __glutCurrentWindow
->fspecialUp
;
132 case GLUT_FCB_BUTTON_BOX
:
133 return __glutCurrentWindow
->fbuttonBox
;
135 return __glutCurrentWindow
->fdials
;
136 case GLUT_FCB_SPACE_MOTION
:
137 return __glutCurrentWindow
->fspaceMotion
;
138 case GLUT_FCB_SPACE_ROTATE
:
139 return __glutCurrentWindow
->fspaceRotate
;
140 case GLUT_FCB_SPACE_BUTTON
:
141 return __glutCurrentWindow
->fspaceButton
;
142 case GLUT_FCB_TABLET_MOTION
:
143 return __glutCurrentWindow
->ftabletMotion
;
144 case GLUT_FCB_TABLET_BUTTON
:
145 return __glutCurrentWindow
->ftabletButton
;
146 case GLUT_FCB_JOYSTICK
:
148 return __glutCurrentWindow
->fjoystick
;
152 case GLUT_FCB_OVERLAY_DISPLAY
:
153 return __glutCurrentWindow
->overlay
->fdisplay
;
154 case GLUT_FCB_SELECT
:
155 return __glutCurrentMenu
->fselect
;
157 return __glutTimerList
? __glutTimerList
->ffunc
: NULL
;