18d9b6ef4SClemens Zeidler /* 28d9b6ef4SClemens Zeidler * Copyright 2006 - 2010, Haiku, Inc. All rights reserved. 38d9b6ef4SClemens Zeidler * Distributed under the terms of the MIT License. 48d9b6ef4SClemens Zeidler */ 58d9b6ef4SClemens Zeidler #ifndef ALM_LAYOUT_H 68d9b6ef4SClemens Zeidler #define ALM_LAYOUT_H 78d9b6ef4SClemens Zeidler 8*9503cf19SClemens Zeidler 98d9b6ef4SClemens Zeidler #include <AbstractLayout.h> 108d9b6ef4SClemens Zeidler #include <File.h> 118d9b6ef4SClemens Zeidler #include <List.h> 128d9b6ef4SClemens Zeidler #include <Size.h> 138d9b6ef4SClemens Zeidler #include <SupportDefs.h> 148d9b6ef4SClemens Zeidler #include <View.h> 158d9b6ef4SClemens Zeidler 168d9b6ef4SClemens Zeidler #include "Area.h" 178d9b6ef4SClemens Zeidler #include "Column.h" 188d9b6ef4SClemens Zeidler #include "LinearSpec.h" 198d9b6ef4SClemens Zeidler #include "Row.h" 208d9b6ef4SClemens Zeidler #include "XTab.h" 218d9b6ef4SClemens Zeidler #include "YTab.h" 228d9b6ef4SClemens Zeidler 238d9b6ef4SClemens Zeidler 248d9b6ef4SClemens Zeidler namespace BALM { 258d9b6ef4SClemens Zeidler 26*9503cf19SClemens Zeidler /*! 27*9503cf19SClemens Zeidler * A GUI layout engine using the Auckland Layout Model (ALM). 288d9b6ef4SClemens Zeidler */ 298d9b6ef4SClemens Zeidler class BALMLayout : public BAbstractLayout { 308d9b6ef4SClemens Zeidler public: 318d9b6ef4SClemens Zeidler BALMLayout(); 328d9b6ef4SClemens Zeidler virtual ~BALMLayout(); 338d9b6ef4SClemens Zeidler 348d9b6ef4SClemens Zeidler XTab* AddXTab(); 358d9b6ef4SClemens Zeidler YTab* AddYTab(); 368d9b6ef4SClemens Zeidler Row* AddRow(); 378d9b6ef4SClemens Zeidler Row* AddRow(YTab* top, YTab* bottom); 388d9b6ef4SClemens Zeidler Column* AddColumn(); 398d9b6ef4SClemens Zeidler Column* AddColumn(XTab* left, XTab* right); 408d9b6ef4SClemens Zeidler 418d9b6ef4SClemens Zeidler Area* AddArea(XTab* left, YTab* top, XTab* right, 428d9b6ef4SClemens Zeidler YTab* bottom, BView* content); 438d9b6ef4SClemens Zeidler Area* AddArea(Row* row, Column* column, 448d9b6ef4SClemens Zeidler BView* content); 458d9b6ef4SClemens Zeidler Area* AreaOf(BView* control); 468d9b6ef4SClemens Zeidler 478d9b6ef4SClemens Zeidler XTab* Left() const; 488d9b6ef4SClemens Zeidler XTab* Right() const; 498d9b6ef4SClemens Zeidler YTab* Top() const; 508d9b6ef4SClemens Zeidler YTab* Bottom() const; 518d9b6ef4SClemens Zeidler 525f15562eSClemens Zeidler virtual BSize BaseMinSize(); 535f15562eSClemens Zeidler virtual BSize BaseMaxSize(); 545f15562eSClemens Zeidler virtual BSize BasePreferredSize(); 555f15562eSClemens Zeidler virtual BAlignment BaseAlignment(); 568d9b6ef4SClemens Zeidler 578d9b6ef4SClemens Zeidler virtual void InvalidateLayout(bool children = false); 588d9b6ef4SClemens Zeidler 598d9b6ef4SClemens Zeidler virtual bool ItemAdded(BLayoutItem* item, int32 atIndex); 608d9b6ef4SClemens Zeidler virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex); 618d9b6ef4SClemens Zeidler virtual void DerivedLayoutItems(); 628d9b6ef4SClemens Zeidler 638d9b6ef4SClemens Zeidler char* PerformancePath() const; 648d9b6ef4SClemens Zeidler void SetPerformancePath(char* path); 658d9b6ef4SClemens Zeidler 668d9b6ef4SClemens Zeidler LinearSpec* Solver(); 678d9b6ef4SClemens Zeidler 688d9b6ef4SClemens Zeidler private: 690871de7bSClemens Zeidler void _SolveLayout(); 700871de7bSClemens Zeidler 718d9b6ef4SClemens Zeidler Area* _AreaForItem(BLayoutItem* item) const; 728d9b6ef4SClemens Zeidler void _UpdateAreaConstraints(); 738d9b6ef4SClemens Zeidler 740871de7bSClemens Zeidler BSize _CalculateMinSize(); 750871de7bSClemens Zeidler BSize _CalculateMaxSize(); 760871de7bSClemens Zeidler BSize _CalculatePreferredSize(); 778d9b6ef4SClemens Zeidler 788d9b6ef4SClemens Zeidler 798d9b6ef4SClemens Zeidler LinearSpec fSolver; 808d9b6ef4SClemens Zeidler 818d9b6ef4SClemens Zeidler XTab* fLeft; 828d9b6ef4SClemens Zeidler XTab* fRight; 838d9b6ef4SClemens Zeidler YTab* fTop; 848d9b6ef4SClemens Zeidler YTab* fBottom; 858d9b6ef4SClemens Zeidler BSize fMinSize; 868d9b6ef4SClemens Zeidler BSize fMaxSize; 878d9b6ef4SClemens Zeidler BSize fPreferredSize; 888d9b6ef4SClemens Zeidler char* fPerformancePath; 898d9b6ef4SClemens Zeidler }; 908d9b6ef4SClemens Zeidler 918d9b6ef4SClemens Zeidler } // namespace BALM 928d9b6ef4SClemens Zeidler 938d9b6ef4SClemens Zeidler using BALM::BALMLayout; 948d9b6ef4SClemens Zeidler 958d9b6ef4SClemens Zeidler #endif // ALM_LAYOUT_H 96