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

LayoutConnect.h

Go to the documentation of this file.
00001 #ifndef OglGui_LayoutConnect_h
00002 #define OglGui_LayoutConnect_h
00003 
00004 #include "OglGui/LayoutComponent.h"
00005 
00006 namespace OglGui
00007 {
00008 
00009 class LayoutConnect : public LayoutListener
00010 {
00011 public:
00012 
00013     LayoutConnect(LayoutComponent* leader, LayoutComponent* follower, int mode):
00014         LayoutListener(leader, follower)
00015     {
00016         mMode = mode;
00017         mOffL = 0;
00018         mOffR = 0;
00019         mOffT = 0;
00020         mOffB = 0;
00021         mOffW = 0;
00022         mOffH = 0;
00023         int lx,ly,lw,lh;
00024         leader->GetDimensions(lx,ly,lw,lh);
00025         int fx,fy,fw,fh;
00026         follower->GetDimensions(fx,fy,fw,fh);
00027 
00028         if(mMode & TPARENT){
00029             lx = 0; ly = 0;
00030         }
00031 
00032         if(mode & L2L)
00033             mOffL = (fx)-(lx);
00034         if(mode & L2R)
00035             mOffL = (fx)-(lx+lw);
00036         if(mode & T2T)
00037             mOffT = (fy+fh)-(ly+lh);
00038         if(mode & T2B)
00039             mOffT = (fy+fh)-(ly);
00040         if(mode & R2L)
00041             mOffR = (fx+fw)-(lx);
00042         if(mode & R2R)
00043             mOffR = (fx+fw)-(lx+lw);
00044         if(mode & B2T)
00045             mOffB = (fy)-(ly+lh);
00046         if(mode & B2B)
00047             mOffB = (fy)-(ly);
00048         if(mode & W2W)
00049             mOffW = (fw)-(lw);
00050         if(mode & H2H)
00051             mOffH = (fh)-(lh);
00052         
00053     }
00054 
00055     virtual void
00056     OnLayoutChange()
00057     {
00058         int nL, nR, nT, nB, nW, nH;
00059         int lx, ly, lw, lh;
00060         int fx, fy, fw, fh;
00061         mLeader->GetDimensions(lx, ly, lw, lh);
00062         mFollower->GetDimensions(fx, fy, fw, fh);
00063 
00064         if(mMode & TPARENT){
00065             lx = 0; ly = 0;
00066         }
00067 
00068         nL = fx;
00069         nR = fx + fw;
00070         nB = fy;
00071         nT = fy + fh;
00072         nW = fw;
00073         nH = fh;
00074 
00075         if(mMode & L2L)
00076             nL = lx + mOffL;
00077         if(mMode & L2R)
00078             nL = (lx+lw) + mOffL;
00079         if(mMode & T2T)
00080             nT = ly+lh + mOffT;
00081         if(mMode & T2B)
00082             nT = ly + mOffT;
00083         if(mMode & R2L)
00084             nR = lx + mOffR;
00085         if(mMode & R2R)
00086             nR = lx+lw + mOffR;
00087         if(mMode & B2T)
00088             nB = ly+lh + mOffB;
00089         if(mMode & B2B)
00090             nB = ly + mOffB;
00091         if(mMode & W2W){
00092             nW = lw + mOffW;
00093             nR = nL + nW;
00094         }
00095         if(mMode & H2H){
00096             nH = lh + mOffH;
00097             nB = nT - nH;
00098         }
00099 
00100         mFollower->SetDimensions(nL, nB, nR-nL, nT-nB);
00101     }
00102 
00103 protected:
00104     int mMode;
00105     int mOffL;
00106     int mOffR;
00107     int mOffT;
00108     int mOffB;
00109     int mOffW;
00110     int mOffH;
00111 };
00112 
00113 } // namespace OglGui
00114 
00115 #endif // LayoutConnect_h

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