Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

SixView2DWindow.h

Go to the documentation of this file.
00001 /*
00002  * Author: Richard van Balen
00003  */
00004 #ifndef OglGui_SixView2DWindow_h
00005 #define OglGui_SixView2DWindow_h
00006 
00007 #include "OglGui/Window.h"
00008 
00009 namespace OglGui
00010 {
00011 
00012 class SixView2DWindow : public Window
00013 {
00014 public:
00015 
00016     SixView2DWindow(int x, int y, int w, int h) :
00017         Window(x, y, w, h)
00018     {
00019         Init();
00020     }
00021 
00022     SixView2DWindow(Window* parent, int x, int y, int w, int h) :
00023         Window(parent, x, y, w, h)
00024     {
00025         Init();
00026     }
00027 
00028     SixView2DWindow(Window* parent, int w, int h) :
00029         Window(parent, w, h)
00030     {
00031         Init();
00032     }
00033 
00034     enum {
00035         ONE_BIG_5_SMALL     = 0,
00036         BIG2_LEFT           = 1,
00037         BIG2_UP             = 2,
00038         GRID_3_2            = 3,
00039         GRID_2_3            = 4
00040     };
00041 
00042     void SetLayoutNr(int idx)
00043     {
00044         if (idx < 0 || idx > 4)
00045             return;
00046         mLayout = idx;
00047     }
00048 
00049     void SetImage(OGLIMAGE *oglIm, int vNr)
00050     {
00051         if(vNr < 0 || vNr > 6) return;
00052 
00053         viewSys.SetImage(mView[vNr], oglIm);
00054     }
00055 
00056     OGLVIEW* GetView(int vNr)
00057     {
00058         if(vNr < 0 || vNr > 6) return NULL;
00059 
00060         return mView[vNr];
00061     }
00062 
00063     virtual void DisplayFunc()
00064     {
00065         int bInfo[3];
00066         // Blending mode to allow for transparent view background
00067         oglSys.StartBlend(bInfo);
00068 
00069         Window::DisplayFunc();
00070 
00071         oglSys.EndBlend(bInfo);
00072     }
00073 
00074     virtual void ViewportFunc(int w, int h)
00075     {
00076         Window::ViewportFunc(w, h);
00077         void (*SetDims)(OGLVIEW*, int, int, int, int) = viewSys.SetDimensions;
00078         if(mLayout == ONE_BIG_5_SMALL)
00079         {
00080             SetDims(mView[0], 3, 3+h-(2*h)/3, (2*w)/3-6, (2*h)/3-6);
00081             SetDims(mView[1], 3+(2*w)/3, 3+h-h/3, w/3-7, h/3-6);
00082             SetDims(mView[2], 3+(2*w)/3, 3+h-(2*h)/3, w/3-7, h/3-6);
00083             for(int i=0; i<3; i++)
00084                 SetDims(mView[3+i], 3+i*w/3, 3, w/3-6-i/2, h/3-4);
00085         }
00086         if(mLayout == BIG2_LEFT)
00087         {
00088             SetDims(mView[0], 3, 3+h/2, (2*w)/3-6, h/2-6);
00089             SetDims(mView[1], 3, 3, (2*w)/3-6, h/2-6);
00090             for(int i=0; i<4; i++)
00091                 SetDims(mView[2+i], 3+(2*w)/3, 3+(i*h)/4, w/3-7, h/4-5);
00092                 //SetDims(mView[2+i], 3+(2*w)/3, 3+(i*h)/4, w/3-5, (h-6)/4-3);
00093         }
00094         if(mLayout == BIG2_UP)
00095         {
00096             SetDims(mView[0], 3, 3+h-(2*h)/3, w/2-6, (2*h)/3-6);
00097             SetDims(mView[1], 3+w/2, 3+h-(2*h)/3, w/2-7, (2*h)/3-6);
00098             for(int i=0; i<4; i++)
00099                 SetDims(mView[2+i], 3+i*w/4, 3, w/4-6-i/2, h/3-3);
00100         }
00101         if(mLayout == GRID_3_2)
00102             for(int i=0; i<6; i++)
00103                 SetDims(mView[i], 3+(i%3)*w/3, 3+(i/3)*h/2, w/3-7, h/2-6);
00104         if(mLayout == GRID_2_3)
00105             for(int i=0; i<6; i++)
00106                 SetDims(mView[i], 3+(i/3)*w/2, 3+(i%3)*h/3, w/2-7, h/3-6);
00107     }
00108 
00109     virtual void KeyboardFunc(INT c, INT state)
00110     {
00111         if(c == '*')
00112             mLayout = ++mLayout % 5;
00113 
00114         Window::KeyboardFunc(c, state);
00115     }
00116 
00117 private:
00118 
00119     void Init()
00120     {
00121         int     i;
00122 
00123         for(i=0; i<6; i++){
00124             mView[i] = viewSys.View2D(mOglWnd, NULL, 0, 0, 100, 100);
00125             viewSys.SetTags(mView[i], FlexViewTags);
00126             viewSys.SetTexturing(mView[i], 1);
00127             mView[i]->bgCol = 0x0;
00128         }
00129         mLayout = 0;
00130         SetBorderType(BEV_ETCHED);
00131         mOglWnd->clipRounded = 1;
00132         oglSys.AllowPicking(mOglWnd, 1, 0);
00133     }
00134 
00135     OGLVIEW      *mView[6];
00136     int          mLayout;
00137 };
00138 
00139 } // namespace OglGui
00140 #endif

Generated on Fri Mar 19 09:31:38 2010 for ImpalaSrc by  doxygen 1.5.1