CrystalSpace

Public API Reference

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

csbdrlay.h

00001 /*
00002     Copyright (C) Aleksandras Gluchovas
00003     CS port by Norman Krämer <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 "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     // for Western, top-to-bottom, left-to-right orientations
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__

Generated for Crystal Space by doxygen 1.2.14