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

LayoutShift.h

Go to the documentation of this file.
00001 #ifndef OglGui_LayoutShift_h
00002 #define OglGui_LayoutShift_h
00003 
00004 // RvB: I get the feeling that this class is redundant
00005 // If I understand this class correctly then:
00006 //    layoutShift( l, f, L2R) 
00007 // is the same as:
00008 //    layoutConnect( l, f, L2R | R2R );
00009 
00010 #include "OglGui/LayoutConnect.h"
00011 
00012 namespace OglGui
00013 {
00014 
00015 class LayoutShift : public LayoutConnect
00016 {
00017 public:
00018 
00019     LayoutShift(LayoutComponent* leader, LayoutComponent* follower, int mode) :
00020         LayoutConnect(leader, follower, mode)
00021     {
00022     }
00023 
00024     virtual void
00025     OnLayoutChange()
00026     {
00027         int nL, nR, nT, nB, nW, nH;
00028         int lx, ly, lw, lh;
00029         int fx, fy, fw, fh;
00030         mLeader->GetDimensions(lx, ly, lw, lh);
00031         mFollower->GetDimensions(fx, fy, fw, fh);
00032 
00033         if(mMode & TPARENT){
00034             lx = 0; ly = 0;
00035         }
00036 
00037         nL = fx;
00038         nR = fx + fw;
00039         nB = fy;
00040         nT = fy + fh;
00041         nW = fw;
00042         nH = fh;
00043 
00044         if(mMode & L2L)
00045         {
00046             nL = lx + mOffL;
00047             nR = nL + fw;
00048         }
00049         if(mMode & L2R)
00050         {
00051             nL = (lx+lw) + mOffL;
00052             nR = nL + fw;
00053         }
00054         if(mMode & T2T)
00055         {
00056             nT = ly+lh + mOffT;
00057             nB = nT - fh;
00058         }
00059         if(mMode & T2B)
00060         {
00061             nT = ly + mOffT;
00062             nB = nT - fh;
00063         }
00064         if(mMode & R2L)
00065         {
00066             nR = lx + mOffR;
00067             nL = nR - fw;
00068         }
00069         if(mMode & R2R)
00070         {
00071             nR = lx+lw + mOffR;
00072             nL = nR - fw;
00073         }
00074         if(mMode & B2T)
00075         {
00076             nB = ly+lh + mOffB;
00077             nT = nB + fh;
00078         }
00079         if(mMode & B2B)
00080         {
00081             nB = ly + mOffB;
00082             nT = nB + fh;
00083         }
00084 
00085         mFollower->SetDimensions(nL, nB, nR-nL, nT-nB);
00086     }
00087 };
00088 
00089 } // namespace OglGui
00090 
00091 #endif

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