FLTK Utility Library and Widget Collection (FLU): Flu_GL_Window.h Source File

Main Page | Class Hierarchy | Class List | File List | Class Members

# Flu_GL_Window.h

    00001 // $Id: Flu_GL_Window.h,v 1.12 2004/09/23 19:24:39 jbryan Exp $
    00002
    00003 /***************************************************************
    00004  *                FLU - FLTK Utility Widgets
    00005  *  Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University
    00006  *
    00007  * This file and its content is protected by a software license.
    00008  * You should have received a copy of this license with this file.
    00009  * If not, please contact the Ohio Supercomputer Center immediately:
    00010  * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212
    00011  *
    00012  ***************************************************************/
    00013
    00014
    00015
    00016 #ifndef _FLU_GL_WINDOW_H
    00017 #define _FLU_GL_WINDOW_H
    00018
    00019 #include <stdio.h>
    00020
    00021 /* fltk includes */
    00022 #include <FL/Fl.H>
    00023 #include <FL/Fl_Gl_Window.H>
    00024
    00025 #include "FLU/Flu_Enumerations.h"
    00026
    00028 class FLU_EXPORT  Flu_GL_Window : public Fl_Gl_Window
    00029 {
    00030
    00031  public:
    00032
    00034   Flu_GL_Window( int x, int y, int w, int h, const char *label = 0 );
    00035
    00037   Flu_GL_Window( int w, int h, const char *label = 0 );
    00038
    00040   virtual ~Flu_GL_Window();
    00041
    00043   void redraw();
    00044
    00046
    00048   inline bool is_context_valid()
    00049     { return( can_do() > 0 ); }
    00050
    00052
    00053   inline void cartesianInput( bool b )
    00054     { _cartesian = b; }
    00055
    00057   inline bool cartesianInput() const
    00058     { return _cartesian; }
    00059
    00064
    00066   inline void setInitFunc( void (*cb)(void*), void* cbd = NULL )
    00067     { _initCB = cb; _initCBD = cbd; }
    00068
    00070
    00071   inline void setResizeFunc( void (*cb)(int, int, void*), void* cbd = NULL )
    00072     { _resizeCB = cb; _resizeCBD = cbd; }
    00073
    00075   inline void setDrawFunc( void (*cb)(void*), void* cbd = NULL )
    00076     { _drawCB = cb; _drawCBD = cbd; }
    00077
    00079
    00081   inline void setMouseWheelFunc( void (*cb)(int, int, int, int, void*), void* cbd = NULL )
    00082     { _mouseWheelCB = cb; _mouseWheelCBD = cbd; }
    00083
    00085
    00087   inline void setMouseDownFunc( void (*cb)(int, int, int, void*), void* cbd = NULL )
    00088     { _mouseDownCB = cb; _mouseDownCBD = cbd; }
    00089
    00091
    00093   inline void setMouseUpFunc( void (*cb)(int, int, int, void*), void* cbd = NULL )
    00094     { _mouseUpCB = cb; _mouseUpCBD = cbd; }
    00095
    00097
    00098   inline void setMouseDragFunc( void (*cb)(int, int, void*), void* cbd = NULL )
    00099     { _mouseDragCB = cb; _mouseDragCBD = cbd; }
    00100
    00102
    00103   inline void setMouseMoveFunc( void (*cb)(int, int, void*), void* cbd = NULL )
    00104     { _mouseMoveCB = cb; _mouseMoveCBD = cbd; }
    00105
    00107   inline void setMouseEnterFunc( void (*cb)(void*), void* cbd = NULL )
    00108     { _enterCB = cb; _enterCBD = cbd; }
    00109
    00111   inline void setMouseExitFunc( void (*cb)(void*), void* cbd = NULL )
    00112     { _exitCB = cb; _exitCBD = cbd; }
    00113
    00115
    00117   inline void setKeyboardFunc( void (*cb)(int, int, int, void*), void* cbd = NULL )
    00118     { _keyboardCB = cb; _keyboardCBD = cbd; }
    00119
    00121
    00123
    00125   inline static void setAllInitFunc( void (*cb)(void*), void* cbd = NULL )
    00126     { allInitCB = cb; allInitCBD = cbd; }
    00127
    00128  protected:
    00129
    00130   void (*_drawCB)(void*);
    00131   void* _drawCBD;
    00132
    00133   void (*_resizeCB)(int, int, void*);
    00134   void* _resizeCBD;
    00135
    00136   void (*_initCB)(void*);
    00137   void* _initCBD;
    00138
    00139   void (*_mouseWheelCB)(int, int, int, int, void*);
    00140   void* _mouseWheelCBD;
    00141
    00142   void (*_mouseDownCB)(int, int, int, void*);
    00143   void* _mouseDownCBD;
    00144
    00145   void (*_mouseUpCB)(int, int, int, void*);
    00146   void* _mouseUpCBD;
    00147
    00148   void (*_mouseDragCB)(int, int, void*);
    00149   void* _mouseDragCBD;
    00150
    00151   void (*_mouseMoveCB)(int, int, void*);
    00152   void* _mouseMoveCBD;
    00153
    00154   void (*_keyboardCB)(int, int, int, void*);
    00155   void* _keyboardCBD;
    00156
    00157   void (*_enterCB)(void*);
    00158   void* _enterCBD;
    00159
    00160   void (*_exitCB)(void*);
    00161   void* _exitCBD;
    00162
    00163  private:
    00164
    00165   typedef void (*AllInitProto)(void*);
    00166
    00167   static AllInitProto allInitCB;
    00168   static void* allInitCBD;
    00169
    00170   bool _firstDraw;
    00171   bool _cartesian;
    00172
    00173   /* overridden from Fl_Gl_Window */
    00174   int handle( int event );
    00175   void draw();
    00176
    00177 };
    00178
    00179 #endif