00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_CSBORDERLAYOUT_H__
00021 #define __CS_CSBORDERLAYOUT_H__
00022
00023 #include "cslayout.h"
00024
00034 class csBorderConstraint : public csLayoutConstraint
00035 {
00036 public:
00037 int mAlign;
00038 public:
00047 csBorderConstraint (int align): mAlign( align ) {}
00049 csBorderConstraint (const csBorderConstraint &c) :
00050 csLayoutConstraint (c.comp)
00051 { mAlign = c.mAlign; }
00052 virtual csLayoutConstraint *Clone ();
00053 };
00054
00090 class csBorderLayout : public csLayout2
00091 {
00092 public:
00093 csBorderLayout (csComponent *pParent);
00098 csBorderLayout (csComponent *pParent, int hgap, int vgap);
00099
00100 ~csBorderLayout();
00101
00113 virtual csLayoutConstraint *AddLayoutComponent (csComponent* comp);
00115 virtual void RemoveLayoutComponent (csComponent* comp);
00116
00117 virtual void SuggestSize (int &w, int &h);
00118
00120 virtual void LayoutContainer ();
00121
00122 virtual void MaximumLayoutSize (int &w, int &h);
00123 virtual float GetLayoutAlignmentX ();
00124 virtual float GetLayoutAlignmentY ();
00125
00126 public:
00127
00128 csBorderConstraint c;
00129
00131 CS_DECLARE_STATIC_CLASSVAR (CENTER, GetCenter, csBorderConstraint)
00132 CS_DECLARE_STATIC_CLASSVAR (EAST, GetEast, csBorderConstraint)
00133 CS_DECLARE_STATIC_CLASSVAR (NORTH, GetNorth, csBorderConstraint)
00134 CS_DECLARE_STATIC_CLASSVAR (SOUTH, GetSouth, csBorderConstraint)
00135 CS_DECLARE_STATIC_CLASSVAR (WEST, GetWest, csBorderConstraint)
00136 CS_DECLARE_STATIC_CLASSVAR (AFTER_LAST_LINE, GetAfterLastLine, csBorderConstraint)
00137 CS_DECLARE_STATIC_CLASSVAR (AFTER_LINE_ENDS, GetAfterLineEnds, csBorderConstraint)
00138 CS_DECLARE_STATIC_CLASSVAR (BEFORE_FIRST_LINE, GetBeforeFirstLine, csBorderConstraint)
00139 CS_DECLARE_STATIC_CLASSVAR (BEFORE_LINE_BEGINS, GetBeforeLineBegins, csBorderConstraint)
00140
00141 protected:
00142
00143 enum ALIGNMENT_ENUM_INTERNAL
00144 {
00145 _CENTER = 0,
00146 _EAST = 1,
00147 _NORTH = 2,
00148 _SOUTH = 3,
00149 _WEST = 4,
00150
00151
00152
00153 _AFTER_LAST_LINE = _SOUTH,
00154 _AFTER_LINE_ENDS = _EAST,
00155 _BEFORE_FIRST_LINE = _NORTH,
00156 _BEFORE_LINE_BEGINS = _WEST
00157 };
00158
00159 protected:
00160 void DistributeSizes( int& left, int& center,
00161 int& right, int totalWidth, int gap,
00162 bool hasLeft, bool hasCenter, bool hasRight );
00163
00164 int GetWidthSum( int left, int center, int right, int gap,
00165 bool hasLeft, bool hasCenter, bool hasRight );
00166
00167 int Hgap (csComponent* pComp);
00168 int Vgap (csComponent* pComp);
00169
00170 protected:
00171 int mHgap;
00172 int mVgap;
00173
00174 };
00175
00178 #endif // __CS_CSBORDERLAYOUT_H__