1 /* 2 * Copyright 2006, Haiku Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef LAYOUTER_H 6 #define LAYOUTER_H 7 8 #include <SupportDefs.h> 9 10 namespace BPrivate { 11 namespace Layout { 12 13 class LayoutInfo { 14 public: 15 LayoutInfo(); 16 virtual ~LayoutInfo(); 17 18 virtual float ElementLocation(int32 element) = 0; 19 virtual float ElementSize(int32 element) = 0; 20 21 virtual float ElementRangeSize(int32 position, int32 length); 22 }; 23 24 25 class Layouter { 26 public: 27 Layouter(); 28 virtual ~Layouter(); 29 30 virtual void AddConstraints(int32 element, int32 length, 31 float min, float max, float preferred) = 0; 32 virtual void SetWeight(int32 element, float weight) = 0; 33 34 virtual float MinSize() = 0; 35 virtual float MaxSize() = 0; 36 virtual float PreferredSize() = 0; 37 38 virtual LayoutInfo* CreateLayoutInfo() = 0; 39 40 virtual void Layout(LayoutInfo* layoutInfo, float size) = 0; 41 42 virtual Layouter* CloneLayouter() = 0; 43 }; 44 45 46 } // namespace Layout 47 } // namespace BPrivate 48 49 using BPrivate::Layout::LayoutInfo; 50 using BPrivate::Layout::Layouter; 51 52 #endif // LAYOUTER_H 53