Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSLayoutManager Class Reference

#include <CSLayoutManager.h>

Inheritance diagram for CSLayoutManager:

CSLayoutManagerBorder CSLayoutManagerStackHorizontal CSLayoutManagerStackVertical CSLayoutManagerXY

Public Member Functions

virtual std::string getType ()
 CSLayoutManager ()
virtual ~CSLayoutManager ()
void setHostingElement (CSGrafikElement *hostingElement)
virtual int getMinimumWidth (CSGrafikElement *element)=0
virtual int getMinimumHeight (CSGrafikElement *element)=0
void pack (CSGrafikElement *element)
void layout ()
 layout does not change the size of the component! (might change size of children!)

void setPropagateSizeChangesOnly (bool b)
bool getPropagateSizeChangesOnly ()
void buildArea (CSGrafikElement *element)

Static Public Attributes

const char * CLASS = "CSLayoutManager"

Protected Member Functions

CSGrafikElementgetHostingElement ()
CSGrafikElementgetParent (CSGrafikElement *element)
CSGrafikElementsgetElements (CSGrafikElement *element)
bool setLayout (CSGrafikElement *visitor, int x, int y, int width,int height)
CSLayoutDatagetLayoutData (CSGrafikElement *visitor)
int getViewportWidth (CSGrafikElement *element)
int getViewportHeight (CSGrafikElement *element)
int getWidth (CSGrafikElement *element)
int getHeight (CSGrafikElement *element)
int getMinWidth (CSGrafikElement *element)
int getMinHeight (CSGrafikElement *element)
int getParentWidth (CSGrafikElement *element)
int getParentHeight (CSGrafikElement *element)
int getBorderWidth (CSGrafikElement *element)
int getBorderHeight (CSGrafikElement *element)
int getInsetWidth (CSGrafikElement *element)
int getInsetHeight (CSGrafikElement *element)
virtual void layoutElements ()

Protected Attributes

bool mPropagateSizeChangesOnly

Constructor & Destructor Documentation

CSLayoutManager::CSLayoutManager  )  [inline]
 

Definition at line 120 of file CSLayoutManager.h.

References mPropagateSizeChangesOnly.

00121         {
00122             mHostingElement = 0;
00123             mPropagateSizeChangesOnly = false;
00124         }

virtual CSLayoutManager::~CSLayoutManager  )  [inline, virtual]
 

Definition at line 125 of file CSLayoutManager.h.

00125 {}


Member Function Documentation

CSGrafikElement* CSLayoutManager::getHostingElement  )  [inline, protected]
 

Definition at line 97 of file CSLayoutManager.h.

Referenced by layout(), CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), CSLayoutManagerBorder::layoutElements(), and CSLayoutManagerXY::layoutElements().

00097 {return mHostingElement;}

CSGrafikElement * CSLayoutManager::getParent CSGrafikElement element  )  [protected]
 

Definition at line 134 of file CSLayoutManager.cpp.

References CSGrafikElement::getParent().

00135 {
00136     element = element->getParent();
00137     return element;
00138 }

Here is the call graph for this function:

CSGrafikElements * CSLayoutManager::getElements CSGrafikElement element  )  [protected]
 

Definition at line 35 of file CSLayoutManager.cpp.

References CSGrafikElements, and CSGrafikElement::getElements().

Referenced by CSLayoutManagerBorder::getMinimumHeight(), CSLayoutManagerStackVertical::getMinimumHeight(), CSLayoutManagerXY::getMinimumHeight(), CSLayoutManagerStackHorizontal::getMinimumHeight(), CSLayoutManagerBorder::getMinimumWidth(), CSLayoutManagerStackVertical::getMinimumWidth(), CSLayoutManagerXY::getMinimumWidth(), CSLayoutManagerStackHorizontal::getMinimumWidth(), CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), CSLayoutManagerBorder::layoutElements(), and CSLayoutManagerXY::layoutElements().

00036 {
00037     if (element)
00038     {
00039         return element->getElements();
00040     }
00041     return 0;
00042 }

Here is the call graph for this function:

bool CSLayoutManager::setLayout CSGrafikElement visitor,
int  x,
int  y,
int  width,
int  height
[protected]
 

Definition at line 55 of file CSLayoutManager.cpp.

References buildArea(), CSGrafikElement::layoutChanged(), CSGrafikElement::mHeight, CSGrafikElement::mHeightSet, CSGrafikElement::mMinHeight, CSGrafikElement::mMinWidth, mPropagateSizeChangesOnly, CSGrafikElement::mWidth, CSGrafikElement::mWidthSet, CSGrafikElement::mX, and CSGrafikElement::mY.

Referenced by CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), CSLayoutManagerBorder::layoutElements(), and CSLayoutManagerXY::layoutElements().

00056 {
00057     bool pos = false;
00058     bool size = false;
00059     if ((x != -1) && (y != -1))
00060     {
00061         if ((visitor->mX != x) || (visitor->mY != y))
00062         {
00063             pos = true;
00064         }
00065         if (x != -1)
00066         {
00067             visitor->mX = x;
00068         }
00069         if (y != -1)
00070         {
00071             visitor->mY = y;
00072         }
00073     }
00074     if (width != -1)
00075     {
00076         if (width < visitor->mMinWidth) 
00077         {
00078             width = visitor->mMinWidth;
00079         }
00080         if (visitor->mWidth != width)
00081         {
00082             size = true;
00083             visitor->mWidth = width;
00084             visitor->mWidthSet = true;
00085         }
00086     }
00087     else
00088     {
00089         // not to be changed from layout!
00090         // visitor->mWidthSet = false;
00091     }
00092     if (height != -1)
00093     {
00094         if (height < visitor->mMinHeight) 
00095         {
00096             height = visitor->mMinHeight;
00097         }
00098         if (visitor->mHeight != height)
00099         {
00100             size = true;
00101             visitor->mHeight = height;
00102             visitor->mHeightSet = true;
00103         }
00104     }
00105     else
00106     {
00107         // not to be changed from layout!
00108         // visitor->mHeightSet = false;
00109     }
00110 
00111     if (pos | size)
00112     {
00113         buildArea(visitor);
00114         // init changes in other components
00115         if (size)
00116         {
00117             // this!
00118             visitor->layoutChanged(true);
00119         }
00120         // init changes in other components
00121         if ((pos) && (!mPropagateSizeChangesOnly))
00122         {
00123             visitor->layoutChanged();
00124         }
00125     }
00126     return pos | size;
00127 }

Here is the call graph for this function:

CSLayoutData * CSLayoutManager::getLayoutData CSGrafikElement visitor  )  [protected]
 

Definition at line 129 of file CSLayoutManager.cpp.

References CSGrafikElement::getLayoutDataInternal().

Referenced by CSLayoutManagerBorder::getMinimumHeight(), CSLayoutManagerStackVertical::getMinimumHeight(), CSLayoutManagerXY::getMinimumHeight(), CSLayoutManagerBorder::getMinimumWidth(), CSLayoutManagerStackVertical::getMinimumWidth(), CSLayoutManagerXY::getMinimumWidth(), CSLayoutManagerStackHorizontal::getMinimumWidth(), CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), CSLayoutManagerBorder::layoutElements(), and CSLayoutManagerXY::layoutElements().

00130 {
00131     return visitor->getLayoutDataInternal();
00132 }

Here is the call graph for this function:

int CSLayoutManager::getViewportWidth CSGrafikElement element  )  [protected]
 

Definition at line 160 of file CSLayoutManager.cpp.

References CSGrafikElement::getViewportWidth().

Referenced by CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), and CSLayoutManagerBorder::layoutElements().

00161 {
00162     return element->getViewportWidth();
00163 }

Here is the call graph for this function:

int CSLayoutManager::getViewportHeight CSGrafikElement element  )  [protected]
 

Definition at line 165 of file CSLayoutManager.cpp.

References CSGrafikElement::getViewportHeight().

Referenced by CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), and CSLayoutManagerBorder::layoutElements().

00166 {
00167     return element->getViewportHeight();
00168 }

Here is the call graph for this function:

int CSLayoutManager::getWidth CSGrafikElement element  )  [protected]
 

Definition at line 170 of file CSLayoutManager.cpp.

References CSGrafikElement::getWidth().

00171 {
00172     return element->getWidth();
00173 }

Here is the call graph for this function:

int CSLayoutManager::getHeight CSGrafikElement element  )  [protected]
 

Definition at line 175 of file CSLayoutManager.cpp.

References CSGrafikElement::getHeight().

00176 {
00177     return element->getHeight();
00178 }

Here is the call graph for this function:

int CSLayoutManager::getMinWidth CSGrafikElement element  )  [protected]
 

Definition at line 180 of file CSLayoutManager.cpp.

References CSGrafikElement::getMinWidth().

Referenced by CSLayoutManagerBorder::getMinimumWidth(), CSLayoutManagerStackVertical::getMinimumWidth(), CSLayoutManagerXY::getMinimumWidth(), and CSLayoutManagerStackHorizontal::getMinimumWidth().

00181 {
00182     return element->getMinWidth();
00183 }

Here is the call graph for this function:

int CSLayoutManager::getMinHeight CSGrafikElement element  )  [protected]
 

Definition at line 185 of file CSLayoutManager.cpp.

References CSGrafikElement::getMinHeight().

Referenced by CSLayoutManagerBorder::getMinimumHeight(), CSLayoutManagerStackVertical::getMinimumHeight(), CSLayoutManagerXY::getMinimumHeight(), and CSLayoutManagerStackHorizontal::getMinimumHeight().

00186 {
00187     return element->getMinHeight();
00188 }

Here is the call graph for this function:

int CSLayoutManager::getParentWidth CSGrafikElement element  )  [protected]
 

Definition at line 140 of file CSLayoutManager.cpp.

References CSGrafikElement::getParent(), and CSGrafikElement::getViewportWidth().

00141 {
00142     element = element->getParent();
00143     if (element)
00144     {
00145         return element->getViewportWidth();
00146     }
00147     return 0;
00148 }

Here is the call graph for this function:

int CSLayoutManager::getParentHeight CSGrafikElement element  )  [protected]
 

Definition at line 150 of file CSLayoutManager.cpp.

References CSGrafikElement::getParent(), and CSGrafikElement::getViewportHeight().

00151 {
00152     element = element->getParent();
00153     if (element)
00154     {
00155         return element->getViewportHeight();
00156     }
00157     return 0;
00158 }

Here is the call graph for this function:

int CSLayoutManager::getBorderWidth CSGrafikElement element  )  [protected]
 

Definition at line 190 of file CSLayoutManager.cpp.

References CSGrafikElement::getBorder(), and CSBorder::getTotalWidth().

Referenced by buildArea(), CSLayoutManagerBorder::getMinimumWidth(), CSLayoutManagerStackVertical::getMinimumWidth(), CSLayoutManagerXY::getMinimumWidth(), and CSLayoutManagerStackHorizontal::getMinimumWidth().

00191 {
00192     return element->getBorder()->getTotalWidth();
00193 }

Here is the call graph for this function:

int CSLayoutManager::getBorderHeight CSGrafikElement element  )  [protected]
 

Definition at line 195 of file CSLayoutManager.cpp.

References CSGrafikElement::getBorder(), and CSBorder::getTotalHeight().

Referenced by buildArea(), CSLayoutManagerBorder::getMinimumHeight(), CSLayoutManagerStackVertical::getMinimumHeight(), CSLayoutManagerXY::getMinimumHeight(), and CSLayoutManagerStackHorizontal::getMinimumHeight().

00196 {
00197     return element->getBorder()->getTotalHeight();
00198 }

Here is the call graph for this function:

int CSLayoutManager::getInsetWidth CSGrafikElement element  )  [protected]
 

Definition at line 200 of file CSLayoutManager.cpp.

References CSGrafikElement::getInsetInternal(), and CSInset::getTotalWidth().

Referenced by buildArea(), CSLayoutManagerBorder::getMinimumWidth(), CSLayoutManagerStackVertical::getMinimumWidth(), CSLayoutManagerXY::getMinimumWidth(), and CSLayoutManagerStackHorizontal::getMinimumWidth().

00201 {
00202     return element->getInsetInternal()->getTotalWidth();
00203 }

Here is the call graph for this function:

int CSLayoutManager::getInsetHeight CSGrafikElement element  )  [protected]
 

Definition at line 205 of file CSLayoutManager.cpp.

References CSGrafikElement::getInsetInternal(), and CSInset::getTotalHeight().

Referenced by buildArea(), CSLayoutManagerBorder::getMinimumHeight(), CSLayoutManagerStackVertical::getMinimumHeight(), CSLayoutManagerXY::getMinimumHeight(), and CSLayoutManagerStackHorizontal::getMinimumHeight().

00206 {
00207     return element->getInsetInternal()->getTotalHeight();
00208 }

Here is the call graph for this function:

virtual void CSLayoutManager::layoutElements  )  [inline, protected, virtual]
 

Reimplemented in CSLayoutManagerXY, CSLayoutManagerStackHorizontal, CSLayoutManagerStackVertical, and CSLayoutManagerBorder.

Definition at line 114 of file CSLayoutManager.h.

Referenced by layout().

00114 {}

virtual std::string CSLayoutManager::getType  )  [inline, virtual]
 

Reimplemented in CSLayoutManagerXY, CSLayoutManagerStackHorizontal, CSLayoutManagerStackVertical, and CSLayoutManagerBorder.

Definition at line 119 of file CSLayoutManager.h.

References CLASS.

Referenced by CSGrafikElement::layoutChanged(), and CSGrafikElement::setPosition().

00119 {return (std::string) CLASS;}

void CSLayoutManager::setHostingElement CSGrafikElement hostingElement  )  [inline]
 

Definition at line 126 of file CSLayoutManager.h.

Referenced by CSGrafikElement::setMainLayoutManager().

00126 {mHostingElement = hostingElement;}

virtual int CSLayoutManager::getMinimumWidth CSGrafikElement element  )  [pure virtual]
 

Implemented in CSLayoutManagerXY, CSLayoutManagerStackHorizontal, CSLayoutManagerStackVertical, and CSLayoutManagerBorder.

Referenced by CSLayoutManagerBorder::getMinimumWidth(), CSLayoutManagerStackVertical::getMinimumWidth(), CSLayoutManagerXY::getMinimumWidth(), CSLayoutManagerStackHorizontal::getMinimumWidth(), CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), CSLayoutManagerBorder::layoutElements(), CSLayoutManagerXY::layoutElements(), CSWindow::layoutSetupWindow(), and pack().

virtual int CSLayoutManager::getMinimumHeight CSGrafikElement element  )  [pure virtual]
 

Implemented in CSLayoutManagerXY, CSLayoutManagerStackHorizontal, CSLayoutManagerStackVertical, and CSLayoutManagerBorder.

Referenced by CSLayoutManagerBorder::getMinimumHeight(), CSLayoutManagerStackVertical::getMinimumHeight(), CSLayoutManagerXY::getMinimumHeight(), CSLayoutManagerStackHorizontal::getMinimumHeight(), CSLayoutManagerStackVertical::layoutElements(), CSLayoutManagerStackHorizontal::layoutElements(), CSLayoutManagerBorder::layoutElements(), CSLayoutManagerXY::layoutElements(), CSWindow::layoutSetupWindow(), and pack().

void CSLayoutManager::pack CSGrafikElement element  ) 
 

not all LayoutManagers support Packing! Packing changes the size of the element and possibly the size of stretching children it does not change the position of THIS element Packing is done AFTER layout is finished it cannot be called straight, but must be set with setPack(true);

Definition at line 210 of file CSLayoutManager.cpp.

References buildArea(), CSGrafikElement::getLayoutManager(), getMinimumHeight(), getMinimumWidth(), CSGrafikElement::mHeight, and CSGrafikElement::mWidth.

Referenced by CSMenu::openMenu().

00211 {
00212     static char *functionName="buildArea";
00213 
00214     if (element->mHeight < element->getLayoutManager()->getMinimumHeight(element)) 
00215     {
00216         element->mHeight = element->getLayoutManager()->getMinimumHeight(element);
00217     }
00218     if (element->mWidth < element->getLayoutManager()->getMinimumWidth(element)) 
00219     {
00220         element->mWidth = element->getLayoutManager()->getMinimumWidth(element);
00221     }
00222     buildArea(element);
00223 }

Here is the call graph for this function:

void CSLayoutManager::layout  ) 
 

layout does not change the size of the component! (might change size of children!)

Definition at line 44 of file CSLayoutManager.cpp.

References buildArea(), getHostingElement(), and layoutElements().

Referenced by CSGrafikElement::doLayout().

00045 {
00046     CSGrafikElement *host = getHostingElement();
00047     if (host == 0) 
00048     {
00049         return;
00050     }
00051     buildArea(host);
00052     layoutElements();
00053 }

Here is the call graph for this function:

void CSLayoutManager::setPropagateSizeChangesOnly bool  b  )  [inline]
 

Definition at line 138 of file CSLayoutManager.h.

References mPropagateSizeChangesOnly.

Referenced by CSScrollbar::CSScrollbar().

bool CSLayoutManager::getPropagateSizeChangesOnly  )  [inline]
 

Definition at line 139 of file CSLayoutManager.h.

References mPropagateSizeChangesOnly.

Referenced by CSGrafikElement::layoutChanged().

00139 {return mPropagateSizeChangesOnly;}

void CSLayoutManager::buildArea CSGrafikElement element  ) 
 

(Re) build the sizes of element, including viewports. Takes into account that children míght be non viewported and thus influence the sise of this viewoirt...

Definition at line 235 of file CSLayoutManager.cpp.

References CSGrafikElement::getBorder(), getBorderHeight(), getBorderWidth(), CSGrafikElement::getHeight(), getInsetHeight(), CSGrafikElement::getInsetInternal(), getInsetWidth(), CSGrafikElement::getLayoutDataInternal(), CSInset::getSizeNorth(), CSBorder::getSizeNorth(), CSInset::getSizeWest(), CSBorder::getSizeWest(), CSGrafikElement::getWidth(), CSGrafikElement::mElementArea, CSGrafikElement::mHeight, CSGrafikElement::mViewportArea, CSGrafikElement::mViewportHeight, CSGrafikElement::mViewportWidth, CSGrafikElement::mViewportX, CSGrafikElement::mViewportY, CSGrafikElement::mWidth, CSGrafikElement::mX, CSGrafikElement::mY, CSLayoutData::setX(), and CSLayoutData::setY().

Referenced by layout(), pack(), and setLayout().

00236 {
00237     static char *functionName="buildArea";
00238     if (element->mHeight < getBorderHeight(element) + getInsetHeight(element)) 
00239     {
00240         element->mHeight = getBorderHeight(element) + getInsetHeight(element);
00241     }
00242     if (element->mWidth < getBorderWidth(element) + getInsetWidth(element)) 
00243     {
00244         element->mWidth = getBorderWidth(element) + getInsetWidth(element);
00245     }
00246 
00247     element->mElementArea.x = element->mX;
00248     element->mElementArea.y = element->mY;
00249     element->mElementArea.h = element->mHeight;
00250     element->mElementArea.w = element->mWidth;
00251 
00252     element->mViewportX = element->getBorder()->getSizeWest() + element->getInsetInternal()->getSizeWest();
00253     element->mViewportY = element->getBorder()->getSizeNorth()  + element->getInsetInternal()->getSizeNorth();
00254     element->mViewportHeight = element->getHeight() - getBorderHeight(element) - getInsetHeight(element);
00255     element->mViewportWidth = element->getWidth() - getBorderWidth(element)  - getInsetWidth(element);
00256 
00257     if (element->mViewportHeight < 0) element->mViewportHeight = 0;
00258     if (element->mViewportWidth < 0) element->mViewportWidth = 0;
00259 
00260     element->mViewportArea.x = element->mViewportX;
00261     element->mViewportArea.y = element->mViewportY;
00262     element->mViewportArea.h = element->mViewportHeight;
00263     element->mViewportArea.w = element->mViewportWidth;
00264 
00265     element->getLayoutDataInternal()->setX(element->mX);
00266     element->getLayoutDataInternal()->setY(element->mY);
00267 }

Here is the call graph for this function:


Field Documentation

bool CSLayoutManager::mPropagateSizeChangesOnly [protected]
 

Definition at line 96 of file CSLayoutManager.h.

Referenced by CSLayoutManager(), getPropagateSizeChangesOnly(), setLayout(), and setPropagateSizeChangesOnly().

const char * CSLayoutManager::CLASS = "CSLayoutManager" [static]
 

Reimplemented in CSLayoutManagerXY, CSLayoutManagerStackHorizontal, CSLayoutManagerStackVertical, and CSLayoutManagerBorder.

Definition at line 9 of file CSLayoutManager.cpp.

Referenced by getType().


Generated on Wed Jul 14 00:44:38 2004 for CSLib by doxygen 1.3.6