Changed to build libfreeglut.so.2.0.0
[freeglut] / src / freeglut_internal.h
1 /*
2  * freeglut_internal.h
3  *
4  * The freeglut library private include file.
5  *
6  * Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved.
7  * Written by Pawel W. Olszta, <olszta@sourceforge.net>
8  * Creation date: Thu Dec 2 1999
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  */
27
28 #ifndef  FREEGLUT_INTERNAL_H
29 #define  FREEGLUT_INTERNAL_H
30
31 /* XXX Update these for each release! */
32 #define  VERSION_MAJOR 2
33 #define  VERSION_MINOR 0
34 #define  VERSION_PATCH 0 
35
36 /*
37  * Freeglut is meant to be available under all Unix/X11 and Win32 platforms.
38  */
39 #if !defined(_WIN32)
40 #   define  TARGET_HOST_UNIX_X11    1
41 #   define  TARGET_HOST_WIN32       0
42 #else
43 #   define  TARGET_HOST_UNIX_X11    0
44 #   define  TARGET_HOST_WIN32       1
45 #endif
46
47 #define  FREEGLUT_MAX_MENUS         3
48 #define  FREEGLUT_DEBUG             1
49
50 #if FREEGLUT_DEBUG
51     #undef   G_DISABLE_ASSERT
52     #undef   G_DISABLE_CHECKS
53 #else
54     #define  G_DISABLE_ASSERT
55     #define  G_DISABLE_CHECKS
56 #endif
57
58 /*
59  * Somehow all Win32 include headers depend on this one:
60  */
61 #if TARGET_HOST_WIN32
62 #include <windows.h>
63 #include <windowsx.h>
64
65 #define strdup   _strdup
66 #endif
67
68 /*
69  * Those files should be available on every platform.
70  */
71 #include <GL/gl.h>
72 #include <GL/glu.h>
73 #include <stdio.h>
74 #include <string.h>
75 #include <math.h>
76 #include <stdlib.h>
77 #include <assert.h>
78 #include <stdarg.h>
79 #if TARGET_HOST_UNIX_X11
80 #include <sys/time.h>
81 #endif
82
83 /*
84  * The system-dependant include files should go here:
85  */
86 #if TARGET_HOST_UNIX_X11
87     #include <GL/glx.h>
88     #include <X11/Xlib.h>
89     #include <X11/Xatom.h>
90     #include <X11/keysym.h>
91
92     #ifndef __sgi
93     #include <X11/extensions/xf86vmode.h>
94     #endif
95 #endif
96
97 /*
98  * Microsoft VisualC++ 5.0's <math.h> does not define the PI
99  */
100 #ifndef M_PI
101 #    define  M_PI  3.14159265358979323846
102 #endif
103
104 #ifndef TRUE
105 #    define  TRUE  1
106 #endif
107
108 #ifndef FALSE
109 #    define  FALSE  0
110 #endif
111
112 /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */
113
114 /*
115  * Freeglut callbacks type definitions
116  */
117 typedef void (* FGCBdisplay       )( void );
118 typedef void (* FGCBreshape       )( int, int );
119 typedef void (* FGCBvisibility    )( int );
120 typedef void (* FGCBkeyboard      )( unsigned char, int, int );
121 typedef void (* FGCBspecial       )( int, int, int );
122 typedef void (* FGCBmouse         )( int, int, int, int );
123 typedef void (* FGCBmotion        )( int, int );
124 typedef void (* FGCBpassive       )( int, int );
125 typedef void (* FGCBentry         )( int );
126 typedef void (* FGCBwindowStatus  )( int );
127 typedef void (* FGCBselect        )( int, int, int );
128 typedef void (* FGCBjoystick      )( unsigned int, int, int, int );
129 typedef void (* FGCBkeyboardUp    )( unsigned char, int, int );
130 typedef void (* FGCBspecialUp     )( int, int, int );
131 typedef void (* FGCBoverlayDisplay)( void );
132 typedef void (* FGCBspaceMotion   )( int, int, int );
133 typedef void (* FGCBspaceRotate   )( int, int, int );
134 typedef void (* FGCBspaceButton   )( int, int );
135 typedef void (* FGCBdials         )( int, int );
136 typedef void (* FGCBbuttonBox     )( int, int );
137 typedef void (* FGCBtabletMotion  )( int, int );
138 typedef void (* FGCBtabletButton  )( int, int, int, int );
139 typedef void (* FGCBdestroy       )( void );
140
141 /*
142  * The global callbacks type definitions
143  */
144 typedef void (* FGCBidle          )( void );
145 typedef void (* FGCBtimer         )( int );
146 typedef void (* FGCBmenuState     )( int );
147 typedef void (* FGCBmenuStatus    )( int, int, int );
148
149 /*
150  * The callback used when creating/using menus
151  */
152 typedef void (* FGCBmenu          )( int );
153
154
155 /*
156  * A list structure
157  */
158 typedef struct tagSFG_List SFG_List;
159 struct tagSFG_List
160 {
161     void *First;
162     void *Last;
163 };
164
165 /*
166  * A list node structure
167  */
168 typedef struct tagSFG_Node SFG_Node;
169 struct tagSFG_Node
170 {
171     void *Next;
172     void *Prev;
173 };
174
175 /*
176  * A helper structure holding two ints and a boolean
177  */
178 typedef struct tagSFG_XYUse SFG_XYUse;
179 struct tagSFG_XYUse
180 {
181     GLint           X, Y;               /* The two integers...               */
182     GLboolean       Use;                /* ...and a single boolean.          */
183 };
184
185 /*
186  * A helper structure holding a timeval and a boolean
187  */
188 typedef struct tagSFG_Time SFG_Time;
189 struct tagSFG_Time
190 {
191 #ifdef WIN32
192     DWORD Value;
193 #else
194     struct timeval  Value;
195 #endif
196     GLboolean       Set;
197 };
198
199 /*
200  * An enumeration containing the state of the GLUT execution:  initializing, running, or stopping
201  */
202 typedef enum {
203   GLUT_EXEC_STATE_INIT,
204   GLUT_EXEC_STATE_RUNNING,
205   GLUT_EXEC_STATE_STOP
206 } fgExecutionState ;
207
208 /*
209  * This structure holds different freeglut settings
210  */
211 typedef struct tagSFG_State SFG_State;
212 struct tagSFG_State
213 {
214     SFG_XYUse        Position;             /* The default windows' position     */
215     SFG_XYUse        Size;                 /* The default windows' size         */
216     unsigned int     DisplayMode;          /* The display mode for new windows  */
217
218     GLboolean        ForceDirectContext;   /* Should we force direct contexts?  */
219     GLboolean        TryDirectContext;     /* What about giving a try to?       */
220
221     GLboolean        ForceIconic;          /* All new top windows are iconified */
222     GLboolean        UseCurrentContext;    /* New windows use current window's rendering context */
223
224     GLboolean        GLDebugSwitch;        /* OpenGL state debugging switch     */
225     GLboolean        XSyncSwitch;          /* X11 sync protocol switch          */
226
227     GLboolean        IgnoreKeyRepeat;      /* Whether to ignore key repeat...   */
228
229     GLuint           FPSInterval;          /* Interval between FPS printfs      */
230     GLuint           SwapCount;            /* Count of glutSwapBuffer calls     */
231     GLuint           SwapTime;             /* Time of last SwapBuffers          */
232
233     SFG_Time         Time;                 /* The time that glutInit was called */
234     SFG_List         Timers;               /* The freeglut timer hooks          */
235
236     FGCBidle         IdleCallback;         /* The global idle callback          */
237
238     FGCBmenuState    MenuStateCallback;    /* Menu callbacks are global         */
239     FGCBmenuStatus   MenuStatusCallback;
240
241     SFG_XYUse        GameModeSize;         /* The game mode screen's dimensions */
242     int              GameModeDepth;        /* The pixel depth for game mode     */
243     int              GameModeRefresh;      /* The refresh rate for game mode    */
244
245     int              ActionOnWindowClose ; /* Action when user clicks "x" on window header bar */
246
247     fgExecutionState ExecState ;           /* Current state of the GLUT execution */
248 };
249
250 /*
251  * The structure used by display initialization in freeglut_init.c
252  */
253 typedef struct tagSFG_Display SFG_Display;
254 struct tagSFG_Display
255 {
256 #if TARGET_HOST_UNIX_X11
257     Display*        Display;            /* The display we are being run in.  */
258     int             Screen;             /* The screen we are about to use.   */
259     Window          RootWindow;         /* The screen's root window.         */
260     int             Connection;         /* The display's connection number   */
261     Atom            DeleteWindow;       /* The window deletion atom          */
262
263 #ifdef X_XF86VidModeGetModeLine
264     /*
265      * XF86VidMode may be compilable even if it fails at runtime.  Therefore,
266      * the validity of the VidMode has to be tracked
267      */
268     int             DisplayModeValid;   /* Flag that indicates runtime status*/
269     XF86VidModeModeLine DisplayMode;    /* Current screen's display settings */
270     int             DisplayModeClock;   /* The display mode's refresh rate   */
271 #endif
272
273 #elif TARGET_HOST_WIN32
274     HINSTANCE        Instance;          /* The application's instance        */
275     DEVMODE         DisplayMode;        /* Desktop's display settings        */
276
277 #endif
278
279     int             ScreenWidth;        /* The screen's width in pixels      */
280     int             ScreenHeight;       /* The screen's height in pixels     */
281     int             ScreenWidthMM;      /* The screen's width in milimeters  */
282     int             ScreenHeightMM;     /* The screen's height in milimeters */
283 };
284
285
286 /*
287  * The user can create any number of timer hooks
288  */
289 typedef struct tagSFG_Timer SFG_Timer;
290 struct tagSFG_Timer
291 {
292     SFG_Node        Node;
293     int             ID;                 /* The timer ID integer              */
294     FGCBtimer       Callback;           /* The timer callback                */
295     long            TriggerTime;        /* The timer trigger time            */
296 };
297
298 /*
299  * A window and its OpenGL context. The contents of this structure
300  * are highly dependant on the target operating system we aim at...
301  */
302 typedef struct tagSFG_Context SFG_Context;
303 struct tagSFG_Context
304 {
305 #if TARGET_HOST_UNIX_X11
306     Window          Handle;             /* The window's handle                 */
307     GLXContext      Context;            /* The OpenGL context                  */
308     XVisualInfo*    VisualInfo;         /* The window's visual information     */
309
310 #elif TARGET_HOST_WIN32
311     HWND            Handle;             /* The window's handle                 */
312     HDC             Device;             /* The window's device context         */
313     HGLRC           Context;            /* The window's WGL context            */
314
315 #endif
316
317     int             DoubleBuffered;     /* Treat the window as double-buffered */
318 };
319
320 /*
321  * Window's state description. This structure should be kept portable.
322  */
323 typedef struct tagSFG_WindowState SFG_WindowState;
324 struct tagSFG_WindowState
325 {
326     int             Width;              /* Window's width in pixels          */
327     int             Height;             /* The same about the height         */
328
329     GLboolean       Redisplay;          /* Do we have to redisplay?          */
330     GLboolean       Visible;            /* Is the window visible now         */
331
332     int             Cursor;             /* The currently selected cursor     */
333     int             Modifiers;          /* The current ALT/SHIFT/CTRL state  */
334
335     long            JoystickPollRate;   /* The joystick polling rate         */
336     long            JoystickLastPoll;   /* When the last poll has happened   */
337
338     int             MouseX, MouseY;     /* The most recent mouse position    */
339
340     GLboolean       IsGameMode;         /* Is this the game mode window?     */
341
342 #if TARGET_HOST_WIN32
343     GLboolean       NeedToResize;       /* Do we need to explicitly resize?  */
344 #endif
345 };
346
347 /*
348  * The window callbacks the user can supply us with. Should be kept portable.
349  */
350 typedef struct tagSFG_WindowCallbacks SFG_WindowCallbacks;
351 struct tagSFG_WindowCallbacks
352 {
353     /*
354      * Following callbacks are fully supported right now
355      * and are ready to be tested for GLUT conformance:
356      */
357     FGCBdisplay         Display;
358     FGCBreshape         Reshape;
359     FGCBkeyboard        Keyboard;
360     FGCBkeyboardUp      KeyboardUp;
361     FGCBspecial         Special;
362     FGCBspecialUp       SpecialUp;
363     FGCBmouse           Mouse;
364     FGCBmotion          Motion;
365     FGCBpassive         Passive;
366     FGCBentry           Entry;
367     FGCBvisibility      Visibility;
368     FGCBwindowStatus    WindowStatus;
369     FGCBjoystick        Joystick;
370     FGCBdestroy         Destroy;
371
372     /*
373      * Those callbacks are being ignored for the moment
374      */
375     FGCBselect          Select;
376     FGCBoverlayDisplay  OverlayDisplay;
377     FGCBspaceMotion     SpaceMotion;
378     FGCBspaceRotate     SpaceRotation;
379     FGCBspaceButton     SpaceButton;
380     FGCBdials           Dials;
381     FGCBbuttonBox       ButtonBox;
382     FGCBtabletMotion    TabletMotion;
383     FGCBtabletButton    TabletButton;
384 };
385
386 /*
387  * This structure describes a menu
388  */
389 typedef struct tagSFG_Menu SFG_Menu;
390 struct tagSFG_Menu
391 {
392     SFG_Node            Node;
393     void               *UserData ;              /* A. Donev:  User data passed back at callback */
394     int                 ID;                     /* The global menu ID        */
395     SFG_List            Entries;                /* The menu entries list     */
396     FGCBmenu            Callback;               /* The menu callback         */
397     FGCBdestroy         Destroy;                /* A. Donev:  Destruction callback         */
398     GLboolean           IsActive;               /* Is the menu selected?     */
399     int                 Width;                  /* Menu box width in pixels  */
400     int                 Height;                 /* Menu box height in pixels */
401     int                 X, Y;                   /* Menu box raster position  */
402 };
403
404 /*
405  * This is a menu entry
406  */
407 typedef struct tagSFG_MenuEntry SFG_MenuEntry;
408 struct tagSFG_MenuEntry
409 {
410     SFG_Node            Node;
411     int                 ID;                     /* The menu entry ID (local) */
412     int                 Ordinal;                /* The menu's ordinal number */
413     char*               Text;                   /* The text to be displayed  */
414     SFG_Menu*           SubMenu;                /* Optional sub-menu tree    */
415     GLboolean           IsActive;               /* Is the entry highlighted? */
416     int                 Width;                  /* Label's width in pixels   */
417 };
418
419 /*
420  * A window, making part of freeglut windows hierarchy. Should be kept portable.
421  */
422 typedef struct tagSFG_Window SFG_Window;
423 struct tagSFG_Window
424 {
425     SFG_Node            Node;
426     int                 ID;                     /* Window's ID number        */
427
428     SFG_Context         Window;                 /* Window and OpenGL context */
429     SFG_WindowState     State;                  /* The window state          */
430     SFG_WindowCallbacks Callbacks;              /* The window callbacks      */
431     void               *UserData ;              /* A. Donev:  A pointer to user data used in rendering */
432
433     SFG_Menu*       Menu[ FREEGLUT_MAX_MENUS ]; /* Menus appended to window  */
434     SFG_Menu*       ActiveMenu;                 /* The window's active menu  */
435
436     SFG_Window*         Parent;                 /* The parent to this window */
437     SFG_List            Children;               /* The subwindows d.l. list  */
438 };
439
440 /*
441  * A linked list structure of windows
442  */
443 typedef struct tagSFG_WindowList SFG_WindowList ;
444 struct tagSFG_WindowList
445 {
446   SFG_Window *window ;
447   GLboolean needToClose ;
448   SFG_WindowList *next ;
449 } ;
450
451 /*
452  * This holds information about all the windows, menus etc.
453  */
454 typedef struct tagSFG_Structure SFG_Structure;
455 struct tagSFG_Structure
456 {
457     SFG_List            Windows;                /* The global windows list   */
458     SFG_List            Menus;                  /* The global menus list     */
459
460     SFG_Window*         Window;                 /* The currently active win. */
461     SFG_Menu*           Menu;                   /* Same, but menu...         */
462
463     SFG_Window*         GameMode;               /* The game mode window      */
464
465     int                 WindowID;               /* The new current window ID */
466     int                 MenuID;                 /* The new current menu ID   */
467 };
468
469 /*
470  * This structure is used for the enumeration purposes.
471  * You can easily extend its functionalities by declaring
472  * a structure containing enumerator's contents and custom
473  * data, then casting its pointer to (SFG_Enumerator *).
474  */
475 typedef struct tagSFG_Enumerator SFG_Enumerator;
476 struct tagSFG_Enumerator
477 {
478     GLboolean   found;                          /* Used to terminate search  */
479     void*       data;                           /* Custom data pointer       */
480 };
481 typedef void (* FGCBenumerator  )( SFG_Window *, SFG_Enumerator * );
482
483 /*
484  * The bitmap font structure
485  */
486 typedef struct tagSFG_Font SFG_Font;
487 struct tagSFG_Font
488 {
489     char*           Name;                       /* The source font name      */
490     int             Quantity;                   /* Number of chars in font   */
491     int             Height;                     /* Height of the characters  */
492     const GLubyte** Characters;                 /* The characters mapping    */
493
494     float           xorig, yorig ;              /* The origin of the character relative to the draw location */
495 };
496
497 /*
498  * The stroke font structures
499  */
500
501 typedef struct tagSFG_StrokeVertex SFG_StrokeVertex;
502 struct tagSFG_StrokeVertex
503 {
504     GLfloat         X, Y;
505 };
506
507 typedef struct tagSFG_StrokeStrip SFG_StrokeStrip;
508 struct tagSFG_StrokeStrip
509 {
510     int             Number;
511     const SFG_StrokeVertex* Vertices;
512 };
513
514 typedef struct tagSFG_StrokeChar SFG_StrokeChar;
515 struct tagSFG_StrokeChar
516 {
517     GLfloat         Right;
518     int             Number;
519     const SFG_StrokeStrip* Strips;
520 };
521
522 typedef struct tagSFG_StrokeFont SFG_StrokeFont;
523 struct tagSFG_StrokeFont
524 {
525     char*           Name;                       /* The source font name      */
526     int             Quantity;                   /* Number of chars in font   */
527     GLfloat         Height;                     /* Height of the characters  */
528     const SFG_StrokeChar** Characters;          /* The characters mapping    */
529 };
530
531 /* -- GLOBAL VARIABLES EXPORTS --------------------------------------------- */
532
533 /*
534  * Freeglut display related stuff (initialized once per session)
535  */
536 extern SFG_Display fgDisplay;
537
538 /*
539  * Freeglut internal structure
540  */
541 extern SFG_Structure fgStructure;
542
543 /*
544  * The current freeglut settings
545  */
546 extern SFG_State fgState;
547
548
549 /* -- PRIVATE FUNCTION DECLARATIONS ---------------------------------------- */
550
551 /*
552  * A call to this function makes us sure that the Display and Structure
553  * subsystems have been properly initialized and are ready to be used
554  */
555 #define  freeglut_assert_ready                      assert( fgState.Time.Set );
556
557 /*
558  * Following definitions are somewhat similiar to GLib's,
559  * but do not generate any log messages:
560  */
561 #define  freeglut_return_if_fail( expr )            if( !(expr) ) return;
562 #define  freeglut_return_val_if_fail( expr, val )   if( !(expr) ) return( val );
563
564 /*
565  * A call to those macros assures us that there is a current
566  * window and menu set, respectively:
567  */
568 #define  freeglut_assert_window                     assert( fgStructure.Window != NULL );
569 #define  freeglut_assert_menu                       assert( fgStructure.Menu != NULL );
570
571 /*
572  * The initialize and deinitialize functions get called on glutInit()
573  * and glutMainLoop() end respectively. They should create/clean up
574  * everything inside of the freeglut
575  */
576 void fgInitialize( const char* displayName );
577 void fgDeinitialize( void );
578
579 /*
580  * Those two functions are used to create/destroy the freeglut internal
581  * structures. This actually happens when calling glutInit() and when
582  * quitting the glutMainLoop() (which actually happens, when all windows
583  * have been closed).
584  */
585 void fgCreateStructure( void );
586 void fgDestroyStructure( void );
587
588 /*
589  * A helper function to check if a display mode is possible to use
590  */
591 #if TARGET_HOST_UNIX_X11
592 XVisualInfo* fgChooseVisual( void );
593 #endif
594
595 /*
596  * The window procedure for Win32 events handling
597  */
598 #if TARGET_HOST_WIN32
599 LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
600 GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned char layer_type );
601 #endif
602
603 /*
604  * Window creation, opening, closing and destruction.
605  * Defined in freeglut_structure.c, freeglut_window.c.
606  */
607 SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, int x, int y, int w, int h, GLboolean gameMode );
608 void        fgSetWindow ( SFG_Window *window ) ;
609 void        fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, int h, GLboolean gameMode, int isSubWindow );
610 void        fgCloseWindow( SFG_Window* window );
611 void        fgAddToWindowDestroyList ( SFG_Window* window, GLboolean needToClose ) ;
612 void        fgCloseWindows () ;
613 void        fgDestroyWindow( SFG_Window* window, GLboolean needToClose );
614
615 /*
616  * Menu creation and destruction. Defined in freeglut_structure.c
617  */
618 SFG_Menu*   fgCreateMenu( FGCBmenu menuCallback );
619 void        fgDestroyMenu( SFG_Menu* menu );
620
621 /*
622  * Joystick device management functions, defined in freeglut_joystick.c
623  */
624 void        fgJoystickInit( int ident );
625 void        fgJoystickClose( void );
626 void        fgJoystickPollWindow( SFG_Window* window );
627
628 /*
629  * Helper function to enumerate through all registered windows
630  * and one to enumerate all of a window's subwindows...
631  *
632  * The GFunc callback for those functions will be defined as:
633  *
634  *      void enumCallback( gpointer window, gpointer enumerator );
635  *
636  * where window is the enumerated (sub)window pointer (SFG_Window *),
637  * and userData is the a custom user-supplied pointer. Functions
638  * are defined and exported from freeglut_structure.c file.
639  */
640 void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator );
641 void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback, SFG_Enumerator* enumerator );
642
643 /*
644  * fgWindowByHandle returns a (SFG_Window *) value pointing to the
645  * first window in the queue matching the specified window handle.
646  * The function is defined in freeglut_structure.c file.
647  */
648 #if TARGET_HOST_UNIX_X11
649     SFG_Window* fgWindowByHandle( Window hWindow );
650 #elif TARGET_HOST_WIN32
651
652     SFG_Window* fgWindowByHandle( HWND hWindow );
653 #endif
654
655 /*
656  * This function is similiar to the previous one, except it is
657  * looking for a specified (sub)window identifier. The function
658  * is defined in freeglut_structure.c file.
659  */
660 SFG_Window* fgWindowByID( int windowID );
661
662 /*
663  * Looks up a menu given its ID. This is easier that fgWindowByXXX
664  * as all menus are placed in a single doubly linked list...
665  */
666 SFG_Menu* fgMenuByID( int menuID );
667
668 /*
669  * The menu activation and deactivation the code. This is the meat
670  * of the menu user interface handling code...
671  */
672 void fgActivateMenu( SFG_Window* window, int button );
673 void fgExecuteMenuCallback( SFG_Menu* menu ) ;
674 GLboolean fgCheckActiveMenu ( SFG_Window *window, SFG_Menu *menu ) ;
675 void fgDeactivateMenu( SFG_Window *window );
676
677 /*
678  * This function gets called just before the buffers swap, so that
679  * freeglut can display the pull-down menus via OpenGL. The function
680  * is defined in freeglut_menu.c file.
681  */
682 void fgDisplayMenu( void );
683
684 /*
685  * Display the mouse cursor using OpenGL calls. The function
686  * is defined in freeglut_cursor.c file.
687  */
688 void fgDisplayCursor( void );
689
690 /*
691  * Elapsed time as per glutGet(GLUT_ELAPSED_TIME).
692  */
693 long fgElapsedTime( void );
694
695 /*
696  * List functions
697  */
698 void fgListInit(SFG_List *list);
699 void fgListAppend(SFG_List *list, SFG_Node *node);
700 void fgListRemove(SFG_List *list, SFG_Node *node);
701 int fgListLength(SFG_List *list);
702
703 /*
704  * Error Messages functions
705  */
706 void fgError( const char *fmt, ... );
707 void fgWarning( const char *fmt, ... );
708
709 #endif /* FREEGLUT_INTERNAL_H */
710
711 /*** END OF FILE ***/