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 88d9b6ef4SClemens Zeidler #include <AbstractLayout.h> 98d9b6ef4SClemens Zeidler #include <File.h> 108d9b6ef4SClemens Zeidler #include <List.h> 118d9b6ef4SClemens Zeidler #include <Size.h> 128d9b6ef4SClemens Zeidler #include <SupportDefs.h> 138d9b6ef4SClemens Zeidler #include <View.h> 148d9b6ef4SClemens Zeidler 158d9b6ef4SClemens Zeidler #include "Area.h" 168d9b6ef4SClemens Zeidler #include "Column.h" 178d9b6ef4SClemens Zeidler #include "LinearSpec.h" 188d9b6ef4SClemens Zeidler #include "Row.h" 198d9b6ef4SClemens Zeidler #include "XTab.h" 208d9b6ef4SClemens Zeidler #include "YTab.h" 218d9b6ef4SClemens Zeidler 228d9b6ef4SClemens Zeidler 238d9b6ef4SClemens Zeidler namespace BALM { 248d9b6ef4SClemens Zeidler 258d9b6ef4SClemens Zeidler /** 268d9b6ef4SClemens Zeidler * A GUI layout engine using the ALM. 278d9b6ef4SClemens Zeidler */ 288d9b6ef4SClemens Zeidler class BALMLayout : public BAbstractLayout { 298d9b6ef4SClemens Zeidler public: 308d9b6ef4SClemens Zeidler BALMLayout(); 318d9b6ef4SClemens Zeidler virtual ~BALMLayout(); 328d9b6ef4SClemens Zeidler 338d9b6ef4SClemens Zeidler XTab* AddXTab(); 348d9b6ef4SClemens Zeidler YTab* AddYTab(); 358d9b6ef4SClemens Zeidler Row* AddRow(); 368d9b6ef4SClemens Zeidler Row* AddRow(YTab* top, YTab* bottom); 378d9b6ef4SClemens Zeidler Column* AddColumn(); 388d9b6ef4SClemens Zeidler Column* AddColumn(XTab* left, XTab* right); 398d9b6ef4SClemens Zeidler 408d9b6ef4SClemens Zeidler Area* AddArea(XTab* left, YTab* top, XTab* right, 418d9b6ef4SClemens Zeidler YTab* bottom, BView* content, BSize minContentSize); 428d9b6ef4SClemens Zeidler Area* AddArea(Row* row, Column* column, 438d9b6ef4SClemens Zeidler BView* content, BSize minContentSize); 448d9b6ef4SClemens Zeidler Area* AddArea(XTab* left, YTab* top, XTab* right, 458d9b6ef4SClemens Zeidler YTab* bottom, BView* content); 468d9b6ef4SClemens Zeidler Area* AddArea(Row* row, Column* column, 478d9b6ef4SClemens Zeidler BView* content); 488d9b6ef4SClemens Zeidler Area* AreaOf(BView* control); 498d9b6ef4SClemens Zeidler 508d9b6ef4SClemens Zeidler XTab* Left() const; 518d9b6ef4SClemens Zeidler XTab* Right() const; 528d9b6ef4SClemens Zeidler YTab* Top() const; 538d9b6ef4SClemens Zeidler YTab* Bottom() const; 548d9b6ef4SClemens Zeidler 555f15562eSClemens Zeidler virtual BSize BaseMinSize(); 565f15562eSClemens Zeidler virtual BSize BaseMaxSize(); 575f15562eSClemens Zeidler virtual BSize BasePreferredSize(); 585f15562eSClemens Zeidler virtual BAlignment BaseAlignment(); 598d9b6ef4SClemens Zeidler 608d9b6ef4SClemens Zeidler virtual void InvalidateLayout(bool children = false); 618d9b6ef4SClemens Zeidler 628d9b6ef4SClemens Zeidler virtual bool ItemAdded(BLayoutItem* item, int32 atIndex); 638d9b6ef4SClemens Zeidler virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex); 648d9b6ef4SClemens Zeidler virtual void DerivedLayoutItems(); 658d9b6ef4SClemens Zeidler 668d9b6ef4SClemens Zeidler char* PerformancePath() const; 678d9b6ef4SClemens Zeidler void SetPerformancePath(char* path); 688d9b6ef4SClemens Zeidler 698d9b6ef4SClemens Zeidler LinearSpec* Solver(); 708d9b6ef4SClemens Zeidler 718d9b6ef4SClemens Zeidler private: 72*0871de7bSClemens Zeidler void _SolveLayout(); 73*0871de7bSClemens Zeidler 748d9b6ef4SClemens Zeidler Area* _AreaForItem(BLayoutItem* item) const; 758d9b6ef4SClemens Zeidler void _UpdateAreaConstraints(); 768d9b6ef4SClemens Zeidler 77*0871de7bSClemens Zeidler BSize _CalculateMinSize(); 78*0871de7bSClemens Zeidler BSize _CalculateMaxSize(); 79*0871de7bSClemens Zeidler BSize _CalculatePreferredSize(); 808d9b6ef4SClemens Zeidler 818d9b6ef4SClemens Zeidler 828d9b6ef4SClemens Zeidler LinearSpec fSolver; 838d9b6ef4SClemens Zeidler 848d9b6ef4SClemens Zeidler XTab* fLeft; 858d9b6ef4SClemens Zeidler XTab* fRight; 868d9b6ef4SClemens Zeidler YTab* fTop; 878d9b6ef4SClemens Zeidler YTab* fBottom; 888d9b6ef4SClemens Zeidler BSize fMinSize; 898d9b6ef4SClemens Zeidler BSize fMaxSize; 908d9b6ef4SClemens Zeidler BSize fPreferredSize; 918d9b6ef4SClemens Zeidler char* fPerformancePath; 928d9b6ef4SClemens Zeidler }; 938d9b6ef4SClemens Zeidler 948d9b6ef4SClemens Zeidler } // namespace BALM 958d9b6ef4SClemens Zeidler 968d9b6ef4SClemens Zeidler using BALM::BALMLayout; 978d9b6ef4SClemens Zeidler 988d9b6ef4SClemens Zeidler #endif // ALM_LAYOUT_H 99