window.hpp

Go to the documentation of this file.
00001 /*
00002     RenderStack  Support library for OpenGL 3+
00003     Copyright (C) 2010  Timo Suoranta
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00027 #ifndef WINDOW_HPP
00028 #define WINDOW_HPP
00029 
00030 #include "renderstack/rs.h"
00031 #include "renderstack/rs_window.h"
00032 #include "renderstack/rectangle.hpp"
00033 #include <exception>
00034 
00035 namespace renderstack {
00036 
00037 class realize_failed_exception
00038 :   public std::exception
00039 {
00040 };
00041 
00042 
00043 class make_current_failed_exception
00044 :   public std::exception
00045 {
00046 };
00047 
00049 class window
00050 {
00051 public:
00052     window();
00053     ~window();
00054 
00055     static void fullscreen(int &width, int &height);
00056 
00057     void    realize       ();
00058     void    show          ();
00059     void    hide          ();
00060     void    swap_buffers  ();
00061     void    reshape       ();
00062     void    make_current  ();
00063 
00064     rectangle       &client_area ()       { return m_client_area; }
00065     rectangle const &client_area () const { return m_client_area; }
00066     rectangle       &window_frame()       { return m_window_frame; }
00067     rectangle const &window_frame() const { return m_window_frame; }
00068 
00069     void set_fullscreen       (bool i) { m_window_low.fullscreen        = i ? 1 : 0; }
00070     void set_hide_mouse       (bool i) { m_window_low.hide_mouse        = i ? 1 : 0; }
00071     void set_red_size         (int i) { m_window_low.red_size          = i; }
00072     void set_green_size       (int i) { m_window_low.green_size        = i; }
00073     void set_blue_size        (int i) { m_window_low.blue_size         = i; }
00074     void set_alpha_size       (int i) { m_window_low.alpha_size        = i; }
00075     void set_buffer_size      (int i) { m_window_low.buffer_size       = i; }
00076     void set_depth_size       (int i) { m_window_low.depth_size        = i; }
00077     void set_stencil_size     (int i) { m_window_low.stencil_size      = i; }
00078     void set_msaa_sample_count(int i) { m_window_low.msaa_sample_count = i; }
00079     void set_swap_control     (int i) { m_window_low.swap_control      = i; }
00080     void set_srgb_capable     (bool i) { m_window_low.srgb_capable      = i ? 1 : 0; }
00081 
00082     bool fullscreen          () const { return m_window_low.fullscreen != 0   ; }
00083     bool hide_mouse          () const { return m_window_low.hide_mouse != 0   ; }
00084     int  red_size            () const { return m_window_low.red_size          ; }
00085     int  green_size          () const { return m_window_low.green_size        ; }
00086     int  blue_size           () const { return m_window_low.blue_size         ; }
00087     int  alpha_size          () const { return m_window_low.alpha_size        ; }
00088     int  buffer_size         () const { return m_window_low.buffer_size       ; }
00089     int  depth_size          () const { return m_window_low.depth_size        ; }
00090     int  stencil_size        () const { return m_window_low.stencil_size      ; }
00091     int  msaa_sample_count   () const { return m_window_low.msaa_sample_count ; }
00092     int  swap_control        () const { return m_window_low.swap_control      ; }
00093     bool srgb_capable        () const { return m_window_low.srgb_capable != 0 ; }
00094 
00095 
00096 private:
00097     ::rs_window m_window_low;
00098     rectangle   m_client_area;
00099     rectangle   m_window_frame;
00100 
00101 private:
00102     window(window const &);
00103     window &operator=(window const&);
00104 };
00105 
00106 }
00107 
00108 #endif
00109 
Generated on Sun Apr 11 12:23:09 2010 for RenderStack by  doxygen 1.6.3