00001 #ifndef GLT_VIEWPORT_H
00002 #define GLT_VIEWPORT_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00043 #include <glt/config.h>
00044 #include <glt/gl.h>
00045
00046 #include <iosfwd>
00047
00053 typedef enum GltHorizontalAlignment
00054 {
00055 GLT_ALIGN_LEFT = 0,
00056 GLT_ALIGN_HCENTER,
00057 GLT_ALIGN_RIGHT
00058 } GltHorizontalAlignment;
00059
00065 typedef enum GltVerticalAlignment
00066 {
00067 GLT_ALIGN_TOP = 0,
00068 GLT_ALIGN_VCENTER,
00069 GLT_ALIGN_BOTTOM
00070 } GltVerticalAlignment;
00071
00072 class GltTexture;
00073
00081 class BoundingBox;
00082
00083 class GltViewport
00084 {
00085 public:
00086
00088 GltViewport(bool getIt = false);
00090 GltViewport(const GltViewport &viewport);
00092 GltViewport(const GLint x,const GLint y,const GLint width,const GLint height);
00094 ~GltViewport();
00095
00097 bool valid() const;
00098
00100 void get();
00101
00103 void set() const;
00105 void set(const GLint width,const GLint height);
00107 void set(const GLint x,const GLint y,const GLint width,const GLint height);
00108
00110 GLint &x();
00112 GLint &y();
00114 GLint &width();
00116 GLint &height();
00117
00119 const GLint &x() const;
00121 const GLint &y() const;
00123 const GLint &width() const;
00125 const GLint &height() const;
00126
00128 const GLint pixels() const;
00129
00131 operator GLint *();
00133 operator const GLint *() const;
00134
00136 bool resize(const GLint width,const GLint height);
00138 bool resize(const GLint x,const GLint y,const GLint width,const GLint height);
00140 bool resize(const GltTexture &texture);
00142 bool resize(const BoundingBox &box);
00143
00145 bool align(const GltHorizontalAlignment &align,const GltViewport &window);
00147 bool align(const GltVerticalAlignment &align,const GltViewport &window);
00148
00150 bool shrink(const GLint w);
00151
00152
00153
00155 GltViewport &operator=(const GltViewport &viewport);
00156
00158 bool operator==(const GltViewport &viewport) const;
00160 bool operator!=(const GltViewport &viewport) const;
00161
00162
00163
00165 void drawQuad() const;
00167 void drawLines() const;
00168
00169 private:
00170 GLint _viewport[4];
00171 };
00172
00173 #endif