mFES - molecular Finite Element Solver  0.4
togl_1_7.h
Go to the documentation of this file.
00001 /* $Id: togl.h,v 1.28 2005/10/27 07:45:48 gregcouch Exp $ */
00002 
00003 /* vi:set sw=4: */
00004 
00005 /* 
00006  * Togl - a Tk OpenGL widget
00007  *
00008  * Copyright (C) 1996-1998  Brian Paul and Ben Bederson
00009  * See the LICENSE file for copyright details.
00010  */
00011 
00012 
00013 #ifndef TOGL_H
00014 #  define TOGL_H
00015 
00016 #  include "togl_ws.h"
00017 
00018 #  ifdef TOGL_WGL
00019 #    define WIN32_LEAN_AND_MEAN
00020 #    include <windows.h>
00021 #    undef WIN32_LEAN_AND_MEAN
00022 #    if defined(_MSC_VER)
00023 #       define DllEntryPoint DllMain
00024 #    endif
00025 #  endif
00026 
00027 #  ifdef _WIN32
00028 #    define TOGL_EXTERN __declspec(dllexport) extern
00029 #  else
00030 #    define TOGL_EXTERN extern
00031 #  endif /* _WIN32 */
00032 
00033 #  ifdef TOGL_AGL_CLASSIC
00034 #    ifndef MAC_TCL
00035 #      define MAC_TCL 1
00036 #    endif
00037 #  endif
00038 
00039 #  ifdef TOGL_AGL
00040 #    ifndef MAC_OSX_TCL
00041 #      define MAC_OSX_TCL 1
00042 #    endif
00043 #    ifndef MAC_OSX_TK
00044 #      define MAC_OSX_TK 1
00045 #    endif
00046 #  endif
00047 
00048 #  include <tcl.h>
00049 #  include <tk.h>
00050 #  if defined(TOGL_AGL) || defined(TOGL_AGL_CLASSIC)
00051 #    include <OpenGL/gl.h>
00052 #  else
00053 #    include <GL/gl.h>
00054 #  endif
00055 
00056 #  ifdef __sgi
00057 #    include <GL/glx.h>
00058 #    include <X11/extensions/SGIStereo.h>
00059 #  endif
00060 
00061 #  ifndef CONST84
00062 #    define CONST84
00063 #  endif
00064 
00065 #  ifndef NULL
00066 #    define NULL 0
00067 #  endif
00068 
00069 #  ifndef TOGL_USE_FONTS
00070 #    define TOGL_USE_FONTS 1    /* needed for demos */
00071 #  endif
00072 
00073 #  ifdef __cplusplus
00074 /* *INDENT-OFF* */
00075 extern "C" {
00076 /* *INDENT-ON* */
00077 #  endif
00078 
00079 #  define TOGL_VERSION "1.7"
00080 #  define TOGL_MAJOR_VERSION 1
00081 #  define TOGL_MINOR_VERSION 7
00082 
00083 /* 
00084  * "Standard" fonts which can be specified to Togl_LoadBitmapFont()
00085  */
00086 #  define TOGL_BITMAP_8_BY_13           ((char *) 1)
00087 #  define TOGL_BITMAP_9_BY_15           ((char *) 2)
00088 #  define TOGL_BITMAP_TIMES_ROMAN_10    ((char *) 3)
00089 #  define TOGL_BITMAP_TIMES_ROMAN_24    ((char *) 4)
00090 #  define TOGL_BITMAP_HELVETICA_10      ((char *) 5)
00091 #  define TOGL_BITMAP_HELVETICA_12      ((char *) 6)
00092 #  define TOGL_BITMAP_HELVETICA_18      ((char *) 7)
00093 
00094 /* 
00095  * Normal and overlay plane constants
00096  */
00097 #  define TOGL_NORMAL   1
00098 #  define TOGL_OVERLAY  2
00099 
00100 struct Togl;
00101 typedef struct Togl Togl;
00102 
00103 typedef void (Togl_Callback) (Togl *togl);
00104 typedef int (Togl_CmdProc) (Togl *togl, int argc, CONST84 char *argv[]);
00105 
00106 TOGL_EXTERN int Togl_Init(Tcl_Interp *interp);
00107 
00108 /* 
00109  * Default/initial callback setup functions
00110  */
00111 
00112 TOGL_EXTERN void Togl_CreateFunc(Togl_Callback *proc);
00113 TOGL_EXTERN void Togl_DisplayFunc(Togl_Callback *proc);
00114 TOGL_EXTERN void Togl_ReshapeFunc(Togl_Callback *proc);
00115 TOGL_EXTERN void Togl_DestroyFunc(Togl_Callback *proc);
00116 TOGL_EXTERN void Togl_TimerFunc(Togl_Callback *proc);
00117 TOGL_EXTERN void Togl_ResetDefaultCallbacks(void);
00118 
00119 /* 
00120  * Change callbacks for existing widget
00121  */
00122 
00123 TOGL_EXTERN void Togl_SetCreateFunc(Togl *togl, Togl_Callback *proc);
00124 TOGL_EXTERN void Togl_SetDisplayFunc(Togl *togl, Togl_Callback *proc);
00125 TOGL_EXTERN void Togl_SetReshapeFunc(Togl *togl, Togl_Callback *proc);
00126 TOGL_EXTERN void Togl_SetDestroyFunc(Togl *togl, Togl_Callback *proc);
00127 TOGL_EXTERN void Togl_SetTimerFunc(Togl *togl, Togl_Callback *proc);
00128 
00129 /* 
00130  * Miscellaneous
00131  */
00132 
00133 TOGL_EXTERN int Togl_Configure(Tcl_Interp *interp, Togl *togl,
00134         int argc, const char *argv[], int flags);
00135 TOGL_EXTERN void Togl_MakeCurrent(const Togl *togl);
00136 TOGL_EXTERN void Togl_CreateCommand(char *cmd_name, Togl_CmdProc *cmd_proc);
00137 TOGL_EXTERN void Togl_PostRedisplay(Togl *togl);
00138 TOGL_EXTERN void Togl_SwapBuffers(const Togl *togl);
00139 
00140 /* 
00141  * Query functions
00142  */
00143 
00144 TOGL_EXTERN const char *Togl_Ident(const Togl *togl);
00145 TOGL_EXTERN int Togl_Width(const Togl *togl);
00146 TOGL_EXTERN int Togl_Height(const Togl *togl);
00147 TOGL_EXTERN Tcl_Interp *Togl_Interp(const Togl *togl);
00148 TOGL_EXTERN Tk_Window Togl_TkWin(const Togl *togl);
00149 
00150 /* 
00151  * Color Index mode
00152  */
00153 
00154 TOGL_EXTERN unsigned long Togl_AllocColor(const Togl *togl, float red,
00155         float green, float blue);
00156 TOGL_EXTERN void Togl_FreeColor(const Togl *togl, unsigned long index);
00157 TOGL_EXTERN void Togl_SetColor(const Togl *togl, unsigned long index,
00158         float red, float green, float blue);
00159 
00160 #  if TOGL_USE_FONTS == 1
00161 /* 
00162  * Bitmap fonts
00163  */
00164 
00165 TOGL_EXTERN GLuint Togl_LoadBitmapFont(const Togl *togl, const char *fontname);
00166 TOGL_EXTERN void Togl_UnloadBitmapFont(const Togl *togl, GLuint fontbase);
00167 
00168 #  endif
00169 /* 
00170  * Overlay functions
00171  */
00172 
00173 TOGL_EXTERN void Togl_UseLayer(Togl *togl, int layer);
00174 TOGL_EXTERN void Togl_ShowOverlay(Togl *togl);
00175 TOGL_EXTERN void Togl_HideOverlay(Togl *togl);
00176 TOGL_EXTERN void Togl_PostOverlayRedisplay(Togl *togl);
00177 TOGL_EXTERN void Togl_OverlayDisplayFunc(Togl_Callback *proc);
00178 TOGL_EXTERN int Togl_ExistsOverlay(const Togl *togl);
00179 TOGL_EXTERN int Togl_GetOverlayTransparentValue(const Togl *togl);
00180 TOGL_EXTERN int Togl_IsMappedOverlay(const Togl *togl);
00181 TOGL_EXTERN unsigned long Togl_AllocColorOverlay(const Togl *togl,
00182         float red, float green, float blue);
00183 TOGL_EXTERN void Togl_FreeColorOverlay(const Togl *togl, unsigned long index);
00184 
00185 /* 
00186  * User client data
00187  */
00188 
00189 TOGL_EXTERN void Togl_ClientData(ClientData clientData);
00190 TOGL_EXTERN ClientData Togl_GetClientData(const Togl *togl);
00191 TOGL_EXTERN void Togl_SetClientData(Togl *togl, ClientData clientData);
00192 
00193 #  ifdef TOGL_X11
00194 /* 
00195  * X11-only commands.
00196  * Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
00197  */
00198 
00199 TOGL_EXTERN Display *Togl_Display(const Togl *togl);
00200 TOGL_EXTERN Screen *Togl_Screen(const Togl *togl);
00201 TOGL_EXTERN int Togl_ScreenNumber(const Togl *togl);
00202 TOGL_EXTERN Colormap Togl_Colormap(const Togl *togl);
00203 
00204 #  endif
00205 #  ifdef __sgi
00206 /* 
00207  * SGI stereo-only commands.
00208  * Contributed by Ben Evans (Ben.Evans@anusf.anu.edu.au)
00209  */
00210 
00211 TOGL_EXTERN void Togl_OldStereoDrawBuffer(GLenum mode);
00212 TOGL_EXTERN void Togl_OldStereoClear(GLbitfield mask);
00213 #  endif
00214 
00215 TOGL_EXTERN void Togl_StereoFrustum(GLfloat left, GLfloat right, GLfloat bottom,
00216         GLfloat top, GLfloat near, GLfloat far, GLfloat eyeDist,
00217         GLfloat eyeOffset);
00218 
00219 /* 
00220  * Generate EPS file.
00221  * Contributed by Miguel A. De Riera Pasenau (miguel@DALILA.UPC.ES)
00222  */
00223 
00224 TOGL_EXTERN int Togl_DumpToEpsFile(const Togl *togl, const char *filename,
00225         int inColor, void (*user_redraw) (const Togl *));
00226 
00227 #  ifdef TOGL_AGL_CLASSIC
00228 /* 
00229  * Mac-specific setup functions
00230  */
00231 extern int Togl_MacInit(void);
00232 extern int Togl_MacSetupMainInterp(Tcl_Interp *interp);
00233 #  endif
00234 
00235 #  ifdef __cplusplus
00236 /* *INDENT-OFF* */
00237 }
00238 /* *INDENT-ON* */
00239 #  endif
00240 
00241 
00242 #endif