CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csws/csbdrlay.h

00001 /*
00002     Copyright (C) Aleksandras Gluchovas
00003     CS port by Norman Kraemer <norman@users.sourceforge.net>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_CSBORDERLAYOUT_H__
00021 #define __CS_CSBORDERLAYOUT_H__
00022 
00023 #include "csextern.h"
00024  
00025 #include "cslayout.h"
00026 
00036 class CS_CSWS_EXPORT csBorderConstraint : public csLayoutConstraint
00037 {
00038  public:
00039   int mAlign;
00040  public:
00049   csBorderConstraint (int align): mAlign( align ) {}
00051   csBorderConstraint (const csBorderConstraint &c) :
00052     csLayoutConstraint (c.comp)
00053     { mAlign = c.mAlign; }
00054   virtual csLayoutConstraint *Clone ();
00055 };
00056 
00092 class CS_CSWS_EXPORT csBorderLayout : public csLayout2
00093 {
00094  public:
00095   csBorderLayout (csComponent *pParent);
00100   csBorderLayout (csComponent *pParent, int hgap, int vgap);
00101 
00102   ~csBorderLayout();
00103 
00115   virtual csLayoutConstraint *AddLayoutComponent (csComponent* comp);
00117   virtual void RemoveLayoutComponent (csComponent* comp);
00118 
00119   virtual void SuggestSize (int &w, int &h);
00120 
00122   virtual void LayoutContainer ();
00123 
00124   virtual void MaximumLayoutSize (int &w, int &h);
00125   virtual float GetLayoutAlignmentX ();
00126   virtual float GetLayoutAlignmentY ();
00127 
00128  public:
00129 
00130   csBorderConstraint c;
00131 
00133   CS_DECLARE_STATIC_CLASSVAR (CENTER, GetCenter, csBorderConstraint)
00134   CS_DECLARE_STATIC_CLASSVAR (EAST, GetEast, csBorderConstraint)
00135   CS_DECLARE_STATIC_CLASSVAR (NORTH, GetNorth, csBorderConstraint)
00136   CS_DECLARE_STATIC_CLASSVAR (SOUTH, GetSouth, csBorderConstraint)
00137   CS_DECLARE_STATIC_CLASSVAR (WEST, GetWest, csBorderConstraint)
00138   CS_DECLARE_STATIC_CLASSVAR (AFTER_LAST_LINE, GetAfterLastLine, csBorderConstraint)
00139   CS_DECLARE_STATIC_CLASSVAR (AFTER_LINE_ENDS, GetAfterLineEnds, csBorderConstraint)
00140   CS_DECLARE_STATIC_CLASSVAR (BEFORE_FIRST_LINE, GetBeforeFirstLine, csBorderConstraint)
00141   CS_DECLARE_STATIC_CLASSVAR (BEFORE_LINE_BEGINS, GetBeforeLineBegins, csBorderConstraint)
00142 
00143  protected:
00144 
00145   enum ALIGNMENT_ENUM_INTERNAL
00146   {
00147     _CENTER = 0,
00148     _EAST   = 1,
00149     _NORTH  = 2,
00150     _SOUTH  = 3,
00151     _WEST   = 4,
00152 
00153     // for Western, top-to-bottom, left-to-right orientations
00154 
00155     _AFTER_LAST_LINE    = _SOUTH,
00156     _AFTER_LINE_ENDS    = _EAST,
00157     _BEFORE_FIRST_LINE  = _NORTH,
00158     _BEFORE_LINE_BEGINS = _WEST
00159   };
00160 
00161  protected:
00162   void DistributeSizes( int& left, int& center,
00163                         int& right, int totalWidth, int gap,
00164                         bool hasLeft, bool hasCenter, bool hasRight );
00165 
00166   int GetWidthSum( int left, int center, int right, int gap,
00167                    bool hasLeft, bool hasCenter, bool hasRight );
00168 
00169   int Hgap (csComponent* pComp);
00170   int Vgap (csComponent* pComp);
00171 
00172  protected:
00173   int mHgap;
00174   int mVgap;
00175 
00176 };
00177 
00180 #endif // __CS_CSBORDERLAYOUT_H__

Generated for Crystal Space by doxygen 1.2.18