1 /* 2 * gauche-glut.h - Gauche GLUT binding 3 * 4 * Copyright (c) 2001-2014 Shiro Kawai <shiro@acm.org> 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * 3. Neither the name of the authors nor the names of its contributors 18 * may be used to endorse or promote products derived from this 19 * software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 27 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef GAUCHE_GLUT_H 35 #define GAUCHE_GLUT_H 36 37 /* opaque pointer for glut font */ 38 typedef struct ScmGlutFontRec { 39 SCM_HEADER; 40 void *font; 41 } ScmGlutFont; 42 43 SCM_CLASS_DECL(Scm_GlutFontClass); 44 #define SCM_CLASS_GLUT_FONT (&Scm_GlutFontClass) 45 #define SCM_GLUT_FONT_P(obj) (SCM_XTYPEP(obj, SCM_CLASS_GLUT_FONT)) 46 #define SCM_GLUT_FONT(obj) ((ScmGlutFont*)(obj)) 47 48 /* glut callback table */ 49 enum { 50 /* per-window callbacks */ 51 SCM_GLUT_CB_DISPLAY, 52 SCM_GLUT_CB_OVERLAY_DISPLAY, 53 SCM_GLUT_CB_RESHAPE, 54 SCM_GLUT_CB_KEYBOARD, 55 SCM_GLUT_CB_MOUSE, 56 SCM_GLUT_CB_MOTION, 57 SCM_GLUT_CB_PASSIVE_MOTION, 58 SCM_GLUT_CB_VISIBILITY, 59 SCM_GLUT_CB_ENTRY, 60 SCM_GLUT_CB_SPECIAL, 61 SCM_GLUT_CB_SPACEBALL_MOTION, 62 SCM_GLUT_CB_SPACEBALL_ROTATE, 63 SCM_GLUT_CB_SPACEBALL_BUTTON, 64 SCM_GLUT_CB_BUTTON_BOX, 65 SCM_GLUT_CB_DIALS, 66 SCM_GLUT_CB_TABLET_MOTION, 67 SCM_GLUT_CB_TABLET_BUTTON, 68 SCM_GLUT_CB_MENU_STATUS, 69 SCM_GLUT_CB_WINDOW_STATUS, /* freeglut addition (glut API version 4) */ 70 SCM_GLUT_CB_KEYBOARD_UP, /* freeglut addition (glut API version 4) */ 71 SCM_GLUT_CB_SPECIAL_UP, /* freeglut addition (glut API version 4) */ 72 SCM_GLUT_CB_JOYSTICK, /* freeglut addition (glut API version 4) */ 73 74 SCM_GLUT_NUM_WINDOW_CBS, /* marker */ 75 76 /* global callbacks */ 77 SCM_GLUT_CB_IDLE = SCM_GLUT_NUM_WINDOW_CBS, 78 SCM_GLUT_CB_TIMER, 79 80 SCM_GLUT_NUM_CBS 81 }; 82 83 extern void Scm_GlutRegisterCallback(int type, ScmObj closure, 84 int xtra1, int xtra2); 85 86 #endif /*GAUCHE_GLUT_H */ 87 88