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

LayoutComponent.h

Go to the documentation of this file.
00001 #ifndef LayoutComponent_h
00002 #define LayoutComponent_h
00003 
00004 #ifndef OglGui_SetGetDimensions2dIntI_h
00005 #include "OglGui/SetGetDimensions2dIntI.h"
00006 #endif
00007 
00008 #ifndef OglGui_vector_included
00009 #include <vector>
00010 #define OglGui_vector_included
00011 #endif
00012 
00013 namespace OglGui
00014 {
00015 
00016 class LayoutListener;
00017 
00018 const int TPARENT = 0x01000000;
00019 const int L2L = 0x1;
00020 const int L2R = 0x2;
00021 const int T2T = 0x4;
00022 const int T2B = 0x8;
00023 const int R2L = 0x10;
00024 const int R2R = 0x20;
00025 const int B2T = 0x40;
00026 const int B2B = 0x80;
00027 const int W2W = 0x100;
00028 const int H2H = 0x200;
00029 
00030 const int TOLEFTRIGHT   = L2L | R2R;
00031 const int TOTOPBOTTOM   = T2T | B2B;
00032 const int ALLSIDES      = L2L | R2R | T2T | B2B;
00033 
00034 const int TOBOTTOM      = T2B | B2B;
00035 const int TOTOP         = T2T | B2T;
00036 const int TORIGHT       = L2R | R2R;
00037 const int TOLEFT        = L2L | R2L;
00038 
00039 const int TOBOTTOMLEFT  = TOBOTTOM | TOLEFT;
00040 const int TOBOTTOMRIGHT = TOBOTTOM | TORIGHT;
00041 const int TOTOPLEFT             = TOTOP | TOLEFT;
00042 const int TOTOPRIGHT    = TOTOP | TORIGHT;
00043 
00044 const int NoHorizontal = 0x1;
00045 const int NoVertical = 0x2;
00046 const int NoHeight = 0x4;
00047 const int NoWidth = 0x8;
00048 
00049 class LayoutComponent : public SetGetDimensions2dIntI
00050 {
00051 public:
00052 
00053     virtual ~LayoutComponent()
00054     {
00055         StopLayoutListening();
00056     }
00057 
00058     //virtual void GetDimensions(int& x, int& y, int& w, int& h) = 0;
00059 
00060     //virtual void SetDimensions(int x, int y, int w, int h) = 0;
00061 
00062     virtual void OnLayoutChange() = 0;
00063 
00064     void StopLayoutListening();
00065 
00066     void AddLayoutFollower(LayoutListener* listener)
00067     {
00068         mLayoutFollowers.push_back(listener);
00069     }
00070 
00071     void AddLayoutLeader(LayoutListener* listener)
00072     {
00073         mLayoutLeaders.push_back(listener);
00074     }
00075 
00076     void RemoveLayoutFollower(LayoutListener* listener)
00077     {
00078         for (unsigned int i=0 ; i<mLayoutFollowers.size() ; i++)
00079         {
00080             if (mLayoutFollowers[i] == listener)
00081             {
00082                 mLayoutFollowers.erase(mLayoutFollowers.begin() + i);
00083                 break;
00084             }
00085         }
00086     }
00087 
00088     void RemoveLayoutLeader(LayoutListener* listener)
00089     {
00090         for (unsigned int i=0 ; i<mLayoutLeaders.size() ; i++)
00091         {
00092             if (mLayoutLeaders[i] == listener)
00093             {
00094                 mLayoutLeaders.erase(mLayoutLeaders.begin() + i);
00095                 break;
00096             }
00097         }
00098     }
00099 
00100 protected:
00101     std::vector<LayoutListener*> mLayoutFollowers;
00102     std::vector<LayoutListener*> mLayoutLeaders;
00103 };
00104 
00105 } // namespace OglGui
00106 
00107 #endif // LayoutComponent_h

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