#include <CSLayoutManager.h>
Inheritance diagram for CSLayoutManagerStackVertical:
Public Member Functions | |
virtual std::string | getType () |
CSLayoutManagerStackVertical () | |
virtual | ~CSLayoutManagerStackVertical () |
virtual int | getMinimumWidth (CSGrafikElement *element) |
virtual int | getMinimumHeight (CSGrafikElement *element) |
Static Public Attributes | |
const char * | CLASS = "CSLayoutManagerStackVertical" |
Protected Member Functions | |
virtual void | layoutElements () |
|
Definition at line 188 of file CSLayoutManager.h.
00188 {} |
|
Definition at line 189 of file CSLayoutManager.h.
00189 {} |
|
Only layout elements, which have position: POSITION_ORDER_TOP, or POSITION_ORDER_BOTTOM Only horizontal Center / horizontal/vertical stretch allowed! Center Vertical NOT respected! Reimplemented from CSLayoutManager. Definition at line 995 of file CSLayoutManager.cpp. References CSGrafikElements, CSLayoutData::getCenteredHorizontal(), CSLayoutManager::getElements(), CSGrafikElement::getHeight(), CSLayoutManager::getHostingElement(), CSLayoutManager::getLayoutData(), CSGrafikElement::getLayoutManager(), CSLayoutManager::getMinimumHeight(), CSLayoutManager::getMinimumWidth(), CSLayoutData::getPackedHorizontal(), CSLayoutData::getPackedVertical(), CSLayoutData::getPosition(), CSLayoutData::getSpacing(), CSLayoutData::getStretchedHorizontal(), CSLayoutData::getStretchedVertical(), CSLayoutManager::getViewportHeight(), CSLayoutManager::getViewportWidth(), CSGrafikElement::getVisible(), CSGrafikElement::getWidth(), POSITION_ORDER_BOTTOM, POSITION_ORDER_TOP, and CSLayoutManager::setLayout().
00996 { 00997 CSGrafikElement *host = getHostingElement(); 00998 if (host == 0) 00999 { 01000 return; 01001 } 01002 CSGrafikElements *elements = getElements(host); 01003 01004 int verticalSpacing; 01005 int horizontalSpacing; 01006 01007 CSLayoutData *layoutData = getLayoutData(host); 01008 layoutData->getSpacing(verticalSpacing, horizontalSpacing); 01009 int width; 01010 int height; 01011 width = getViewportWidth(host); 01012 height = getViewportHeight(host); 01013 01014 int x = 0; 01015 int y; 01016 int w, h; 01017 int stretchCounter = 0; 01018 int nonStretchSize = 0; 01019 01020 int packCounter = 0; 01021 int packSize = 0; 01022 01023 int verticalMinimum = 0; 01024 int horizontalMinimum = 0; 01025 int verticalSpacingCollect = 0; 01026 int count = 0; 01027 CSGrafikElements::iterator iter = elements->begin(); 01028 while (iter != elements->end()) 01029 { 01030 CSGrafikElement *visitor = *iter; 01031 if (!visitor->getVisible()) 01032 { 01033 iter++; 01034 continue; 01035 } 01036 CSLayoutData *visitorLayoutData = getLayoutData(visitor); 01037 h = visitor->getHeight(); 01038 if (visitorLayoutData->getStretchedVertical()) 01039 { 01040 stretchCounter++; 01041 } 01042 else if (visitorLayoutData->getPackedVertical()) 01043 { 01044 packSize += visitor->getLayoutManager()->getMinimumHeight(visitor); 01045 } 01046 else 01047 { 01048 nonStretchSize += h; 01049 } 01050 01051 verticalMinimum += visitor->getLayoutManager()->getMinimumHeight(visitor); 01052 if (horizontalMinimum < visitor->getLayoutManager()->getMinimumWidth(visitor)) 01053 { 01054 horizontalMinimum = visitor->getLayoutManager()->getMinimumWidth(visitor); 01055 } 01056 if (count != 0) 01057 { 01058 verticalMinimum += verticalSpacing; 01059 verticalSpacingCollect += verticalSpacing; 01060 if (visitorLayoutData->getPackedVertical()) 01061 { 01062 packSize += verticalSpacing; 01063 } 01064 } 01065 count++; 01066 iter++; 01067 } 01068 01069 if (height < verticalMinimum) 01070 { 01071 height = verticalMinimum; 01072 } 01073 if (width < horizontalMinimum) 01074 { 01075 width = horizontalMinimum; 01076 } 01077 int oneStretchedSize = 0; 01078 int yMax; 01079 int yMin; 01080 yMin = getViewportHeight(host); 01081 yMax = 0; 01082 if (stretchCounter) 01083 { 01084 oneStretchedSize = ((height-verticalSpacingCollect)-nonStretchSize-packSize) / stretchCounter; 01085 } 01086 int stretchCounterNew = 0; 01087 count = 0; 01088 int topCount = 0; 01089 int bottomCount = 0; 01090 iter = elements->begin(); 01091 while (iter != elements->end()) 01092 { 01093 CSGrafikElement *visitor = *iter; 01094 if (!visitor->getVisible()) 01095 { 01096 iter++; 01097 continue; 01098 } 01099 CSLayoutData *visitorLayoutData = getLayoutData(visitor); 01100 x = 0; 01101 w = visitor->getWidth(); 01102 h = visitor->getHeight(); 01103 if (visitorLayoutData->getStretchedVertical()) 01104 { 01105 h = oneStretchedSize; 01106 stretchCounterNew++; 01107 if (stretchCounterNew < (height- verticalSpacingCollect-nonStretchSize-packSize) - oneStretchedSize * stretchCounter) 01108 { 01109 h++; 01110 } 01111 } 01112 else if (visitorLayoutData->getPackedVertical()) 01113 { 01114 if (visitorLayoutData->getPosition() == POSITION_ORDER_TOP) 01115 { 01116 h = visitor->getLayoutManager()->getMinimumHeight(visitor); 01117 } 01118 if (visitorLayoutData->getPosition() == POSITION_ORDER_BOTTOM) 01119 { 01120 h = visitor->getLayoutManager()->getMinimumHeight(visitor); 01121 } 01122 } 01123 else 01124 { 01125 int h2 = visitor->getLayoutManager()->getMinimumHeight(visitor); 01126 if (h < h2) 01127 { 01128 h = h2; 01129 } 01130 } 01131 01132 if (visitorLayoutData->getStretchedHorizontal()) 01133 { 01134 w = width; 01135 } 01136 else if (visitorLayoutData->getPackedHorizontal()) 01137 { 01138 w = visitor->getLayoutManager()->getMinimumWidth(visitor); 01139 } 01140 else 01141 { 01142 int w2 = visitor->getLayoutManager()->getMinimumWidth(visitor); 01143 if (w < w2) 01144 { 01145 w = w2; 01146 } 01147 } 01148 if (visitorLayoutData->getCenteredHorizontal()) 01149 { 01150 x = width/2 - w/2; 01151 } 01152 if (visitorLayoutData->getPosition() == POSITION_ORDER_TOP) 01153 { 01154 if (topCount) 01155 { 01156 yMax += verticalSpacing; 01157 } 01158 topCount++; 01159 y = yMax; 01160 yMax += h; 01161 } 01162 else if (visitorLayoutData->getPosition() == POSITION_ORDER_BOTTOM) 01163 { 01164 if (bottomCount) 01165 { 01166 yMin -= verticalSpacing; 01167 } 01168 bottomCount++; 01169 yMin -= h; 01170 y = yMin; 01171 } 01172 else // centered if (visitorLayoutData->getCenteredVertical()) 01173 { 01174 y = height/2 - h/2; 01175 } 01176 setLayout(visitor, x, y, w, h); 01177 count++; 01178 iter++; 01179 } 01180 } |
Here is the call graph for this function:
|
Reimplemented from CSLayoutManager. Definition at line 187 of file CSLayoutManager.h. References CLASS.
00187 {return (std::string) CLASS;} |
|
Implements CSLayoutManager. Definition at line 1552 of file CSLayoutManager.cpp. References CSGrafikElements, CSLayoutManager::getBorderWidth(), CSLayoutManager::getElements(), CSLayoutManager::getInsetWidth(), CSLayoutManager::getLayoutData(), CSGrafikElement::getLayoutManager(), CSLayoutManager::getMinimumWidth(), CSLayoutManager::getMinWidth(), CSLayoutData::getSpacing(), and CSGrafikElement::getVisible().
01553 { 01554 if (element == 0) 01555 { 01556 return 0; 01557 } 01558 if (!element->getVisible()) 01559 { 01560 return 0; 01561 } 01562 int width = getMinWidth(element); 01563 CSGrafikElements *elements = getElements(element); 01564 01565 int verticalSpacing; 01566 int horizontalSpacing; 01567 01568 01569 CSLayoutData *layoutData = getLayoutData(element); 01570 layoutData->getSpacing(verticalSpacing, horizontalSpacing); 01571 01572 if (!elements == 0) 01573 { 01574 int neededWidth = 0; 01575 CSGrafikElements::iterator iter = elements->begin(); 01576 while (iter != elements->end()) 01577 { 01578 CSGrafikElement *visitor = *iter; 01579 if (!visitor->getVisible()) 01580 { 01581 iter++; 01582 continue; 01583 } 01584 01585 int visitorWidth = visitor->getLayoutManager()->getMinimumWidth(visitor); 01586 01587 if (visitorWidth > neededWidth) 01588 { 01589 neededWidth = visitorWidth; 01590 } 01591 iter++; 01592 } 01593 if (neededWidth > width) 01594 { 01595 width = neededWidth; 01596 } 01597 } 01598 01599 width += getInsetWidth(element) + getBorderWidth(element); 01600 return width; 01601 } |
Here is the call graph for this function:
|
Implements CSLayoutManager. Definition at line 1264 of file CSLayoutManager.cpp. References CSGrafikElements, CSLayoutManager::getBorderHeight(), CSLayoutManager::getElements(), CSLayoutManager::getInsetHeight(), CSLayoutManager::getLayoutData(), CSGrafikElement::getLayoutManager(), CSLayoutManager::getMinHeight(), CSLayoutManager::getMinimumHeight(), CSLayoutData::getSpacing(), and CSGrafikElement::getVisible().
01265 { 01266 if (element == 0) 01267 { 01268 return 0; 01269 } 01270 if (!element->getVisible()) 01271 { 01272 return 0; 01273 } 01274 int height = getMinHeight(element); 01275 CSGrafikElements *elements = getElements(element); 01276 01277 int verticalSpacing; 01278 int horizontalSpacing; 01279 01280 CSLayoutData *layoutData = getLayoutData(element); 01281 layoutData->getSpacing(verticalSpacing, horizontalSpacing); 01282 01283 if (!elements == 0) 01284 { 01285 int neededHeight = 0; 01286 int count = 0; 01287 CSGrafikElements::iterator iter = elements->begin(); 01288 while (iter != elements->end()) 01289 { 01290 CSGrafikElement *visitor = *iter; 01291 if (!visitor->getVisible()) 01292 { 01293 iter++; 01294 continue; 01295 } 01296 CSLayoutData *visitorLayoutData = getLayoutData(visitor); 01297 01298 int visitorHeight = visitor->getLayoutManager()->getMinimumHeight(visitor); 01299 if (count != 0) 01300 { 01301 visitorHeight += verticalSpacing; 01302 } 01303 01304 neededHeight += visitorHeight; 01305 iter++; 01306 count++; 01307 } 01308 if (neededHeight > height) 01309 { 01310 height = neededHeight; 01311 } 01312 } 01313 01314 height += getInsetHeight(element) + getBorderHeight(element); 01315 return height; 01316 } |
Here is the call graph for this function:
|
Reimplemented from CSLayoutManager. Definition at line 12 of file CSLayoutManager.cpp. Referenced by getType(). |