Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

glut_winsys.H

Go to the documentation of this file.
00001 
00002 #ifndef GLUT_WINSYS_H_IS_INCLUDED
00003 #define GLUT_WINSYS_H_IS_INCLUDED
00004 
00005 #include "std/support.H"
00006 #include "std/iostream.H"
00007 #include "geom/winsys.H"
00008 
00009 #include <GL/glut.h>
00010 
00011 class GLUT_MOUSE;
00012 class GLUIFileSelect;
00013 class GLUIAlertBox;
00014 
00015 /**********************************************************************
00016  * GLUT_WINSYS
00017  **********************************************************************/
00018 
00019 class GLUT_WINSYS : public WINSYS {
00020    /******** STATIC MEMBER VARIABLES ********/
00021  protected:
00022    static ARRAY<GLUT_WINSYS*>   _windows;
00023 
00024    /******** STATIC MEMBER METHODS ********/
00025  public:
00026    static GLUT_WINSYS*  instance() { return _windows.empty() ? 0 : _windows[0];}
00027    static GLUT_WINSYS*  window()   { return _windows[glutGetWindow()]; }
00028 
00029  protected:
00030    //GLUT Callbacks
00031    static void    idle_cb();   
00032    static void    display_cb();
00033    static void    visibility_cb(int state);          
00034    static void    reshape_cb(int width, int height);
00035 
00036    /******** MEMBER VARIABLES ********/
00037    
00038    int               _id;            
00039    str_ptr           _name;
00040    int               _width;         
00041    int               _height;        
00042    int               _init_x;        
00043    int               _init_y;        
00044    bool              _map_pending;   
00045    bool              _show_special_cursor;
00046    mlib::XYpt              _cursor_pt;  
00047    GLUT_MOUSE*       _mouse;         
00048    DEVhandler*       _curpush;       
00049    GLUIFileSelect*   _file_select;
00050    GLUIAlertBox*     _alert_box;
00051 
00052 public:
00053    /******** CONSTRUCTOR/DECONSTRUCTOR *******/
00054    GLUT_WINSYS(int &argc, char **argv);
00055    virtual ~GLUT_WINSYS();
00056 
00057    //******** METHODS ********
00058    void              block();
00059    void              unblock();
00060 
00061    //******** UTILITY METHODS ********
00062    void              push_cursor(mlib::CXYpt& pt);
00063    void              show_special_cursor(bool b)    { _show_special_cursor = b; }
00064 
00065    //******** WINSYS METHODS ********
00066 
00067    virtual int       id() const              { return _id; }
00068 
00069    virtual void      set_context()           { glutSetWindow(_id);  }
00070    virtual int       needs_context()         { return ((_id != glutGetWindow())?(1):(0)); }
00071 
00072    virtual void      set_focus();
00073 
00074    virtual void      display();
00075    virtual void      setup(CVIEWptr &v);
00076 
00077    virtual int       draw();   
00078    virtual void      set_cursor(int);
00079    virtual int       get_cursor();
00080    virtual void      swap_buffers();
00081    virtual void      size(int& w, int& h);
00082    virtual void      position(int &x, int &y);
00083    virtual void      size_manually(int w, int h);
00084    virtual void      position_manually(int x, int y);
00085 
00086    virtual WINSYS*      copy()                     { return new GLUT_WINSYS(*this); }
00087    virtual Mouse*       mouse();
00088    virtual DEVhandler*  curspush();
00089    virtual MoveMenu*    menu(Cstr_ptr & name);
00090    virtual FileSelect*  file_select();
00091    virtual AlertBox*    alert_box();
00092    virtual void         stereo(VIEW::stereo_mode)  { cerr << "GLUT_WINSYS::stereo() - *DUMMY*\n"; }
00093    
00094    virtual uint   red_bits() const         { GLint ret; glGetIntegerv(GL_RED_BITS, &ret); return (uint)ret; }
00095    virtual uint   green_bits() const       { GLint ret; glGetIntegerv(GL_GREEN_BITS, &ret); return (uint)ret; }
00096    virtual uint   blue_bits() const        { GLint ret; glGetIntegerv(GL_BLUE_BITS, &ret); return (uint)ret; }
00097    virtual uint   alpha_bits() const       { GLint ret; glGetIntegerv(GL_ALPHA_BITS, &ret); return (uint)ret; }
00098    virtual uint   accum_red_bits() const   { GLint ret; glGetIntegerv(GL_ACCUM_RED_BITS, &ret); return (uint)ret; }
00099    virtual uint   accum_green_bits() const { GLint ret; glGetIntegerv(GL_ACCUM_GREEN_BITS, &ret); return (uint)ret; }
00100    virtual uint   accum_blue_bits() const  { GLint ret; glGetIntegerv(GL_ACCUM_BLUE_BITS, &ret); return (uint)ret; }
00101    virtual uint   accum_alpha_bits() const { GLint ret; glGetIntegerv(GL_ACCUM_ALPHA_BITS, &ret); return (uint)ret; }
00102    virtual uint   stencil_bits() const     { GLint ret; glGetIntegerv(GL_STENCIL_BITS, &ret); return (uint)ret; }
00103    virtual uint   depth_bits() const       { GLint ret; glGetIntegerv(GL_DEPTH_BITS, &ret); return (uint)ret; }
00104 
00105    virtual void      lock()   {}
00106    virtual void      unlock() {}
00107 
00108    virtual STDdstream &    operator<<(STDdstream &ds);
00109    virtual STDdstream &    operator>>(STDdstream &ds);
00110 
00111 };
00112 
00113 #endif // GLUT_WINSYS_H_IS_INCLUDED
00114 
00115 /* end of file glut_winsys.H */

Generated on Mon Sep 18 11:39:31 2006 for jot by  doxygen 1.4.4