2006-08-26 16:21:15 +00:00
|
|
|
/*
|
2010-07-16 18:11:24 +00:00
|
|
|
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
|
2006-08-26 16:21:15 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _TWO_DIMENSIONAL_LAYOUT_H
|
|
|
|
#define _TWO_DIMENSIONAL_LAYOUT_H
|
|
|
|
|
2009-08-27 11:12:41 +00:00
|
|
|
|
2010-08-17 18:43:41 +00:00
|
|
|
#include <AbstractLayout.h>
|
2006-08-26 16:21:15 +00:00
|
|
|
|
|
|
|
class BLayoutContext;
|
|
|
|
|
|
|
|
|
2010-08-17 18:43:41 +00:00
|
|
|
class BTwoDimensionalLayout : public BAbstractLayout {
|
2006-08-26 16:21:15 +00:00
|
|
|
public:
|
|
|
|
BTwoDimensionalLayout();
|
2010-07-16 18:11:24 +00:00
|
|
|
BTwoDimensionalLayout(BMessage* from);
|
2006-08-26 16:21:15 +00:00
|
|
|
virtual ~BTwoDimensionalLayout();
|
|
|
|
|
|
|
|
void SetInsets(float left, float top, float right,
|
|
|
|
float bottom);
|
2011-06-09 20:58:52 +00:00
|
|
|
void SetInsets(float horizontal, float vertical);
|
|
|
|
void SetInsets(float insets);
|
2006-08-26 16:21:15 +00:00
|
|
|
void GetInsets(float* left, float* top, float* right,
|
2009-06-23 10:56:22 +00:00
|
|
|
float* bottom) const;
|
2006-08-26 16:21:15 +00:00
|
|
|
|
|
|
|
void AlignLayoutWith(BTwoDimensionalLayout* other,
|
2013-07-08 18:27:55 -04:00
|
|
|
orientation orientation);
|
2006-08-26 16:21:15 +00:00
|
|
|
|
2010-08-17 18:43:41 +00:00
|
|
|
virtual BSize BaseMinSize();
|
|
|
|
virtual BSize BaseMaxSize();
|
|
|
|
virtual BSize BasePreferredSize();
|
|
|
|
virtual BAlignment BaseAlignment();
|
2006-08-26 16:21:15 +00:00
|
|
|
|
|
|
|
virtual bool HasHeightForWidth();
|
|
|
|
virtual void GetHeightForWidth(float width, float* min,
|
|
|
|
float* max, float* preferred);
|
|
|
|
|
2010-08-17 18:43:41 +00:00
|
|
|
virtual void SetFrame(BRect frame);
|
2006-08-26 16:21:15 +00:00
|
|
|
|
2010-07-16 18:11:24 +00:00
|
|
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
2011-11-05 14:25:06 -06:00
|
|
|
|
2011-10-31 14:57:30 -06:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
|
|
|
|
2006-08-26 16:21:15 +00:00
|
|
|
protected:
|
|
|
|
struct ColumnRowConstraints {
|
|
|
|
float weight;
|
|
|
|
float min;
|
|
|
|
float max;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Dimensions {
|
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
int32 width;
|
|
|
|
int32 height;
|
|
|
|
};
|
|
|
|
|
2011-12-01 20:45:50 -07:00
|
|
|
virtual status_t AllArchived(BMessage* into) const;
|
|
|
|
virtual status_t AllUnarchived(const BMessage* from);
|
|
|
|
|
|
|
|
virtual status_t ItemArchived(BMessage* into, BLayoutItem* item,
|
|
|
|
int32 index) const;
|
|
|
|
virtual status_t ItemUnarchived(const BMessage* from,
|
|
|
|
BLayoutItem* item, int32 index);
|
2011-10-16 22:48:47 -06:00
|
|
|
virtual void LayoutInvalidated(bool children = false);
|
2011-12-01 20:45:50 -07:00
|
|
|
|
2011-09-09 15:20:01 -06:00
|
|
|
virtual void DoLayout();
|
2010-08-17 18:43:41 +00:00
|
|
|
|
2006-08-26 16:21:15 +00:00
|
|
|
BSize AddInsets(BSize size);
|
|
|
|
void AddInsets(float* minHeight, float* maxHeight,
|
|
|
|
float* preferredHeight);
|
|
|
|
BSize SubtractInsets(BSize size);
|
|
|
|
|
2013-07-08 18:27:55 -04:00
|
|
|
virtual void PrepareItems(orientation orientation);
|
2006-08-26 16:21:15 +00:00
|
|
|
virtual bool HasMultiColumnItems();
|
|
|
|
virtual bool HasMultiRowItems();
|
2009-06-23 10:56:22 +00:00
|
|
|
|
2006-08-26 16:21:15 +00:00
|
|
|
virtual int32 InternalCountColumns() = 0;
|
|
|
|
virtual int32 InternalCountRows() = 0;
|
|
|
|
virtual void GetColumnRowConstraints(
|
2013-07-08 18:27:55 -04:00
|
|
|
orientation orientation,
|
2006-08-26 16:21:15 +00:00
|
|
|
int32 index,
|
|
|
|
ColumnRowConstraints* constraints) = 0;
|
2010-07-16 18:11:24 +00:00
|
|
|
virtual void GetItemDimensions(BLayoutItem* item,
|
2006-08-26 16:21:15 +00:00
|
|
|
Dimensions* dimensions) = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
class CompoundLayouter;
|
|
|
|
class LocalLayouter;
|
|
|
|
class VerticalCompoundLayouter;
|
|
|
|
|
|
|
|
friend class LocalLayouter;
|
|
|
|
|
|
|
|
void _ValidateMinMax();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float fLeftInset;
|
|
|
|
float fRightInset;
|
|
|
|
float fTopInset;
|
|
|
|
float fBottomInset;
|
|
|
|
float fHSpacing;
|
|
|
|
float fVSpacing;
|
|
|
|
|
|
|
|
private:
|
2011-11-02 00:29:33 -06:00
|
|
|
|
|
|
|
// FBC padding
|
|
|
|
virtual void _ReservedTwoDimensionalLayout1();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout2();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout3();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout4();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout5();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout6();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout7();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout8();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout9();
|
|
|
|
virtual void _ReservedTwoDimensionalLayout10();
|
|
|
|
|
2011-11-04 22:23:22 -06:00
|
|
|
// forbidden methods
|
|
|
|
BTwoDimensionalLayout(
|
|
|
|
const BTwoDimensionalLayout&);
|
|
|
|
void operator =(const BTwoDimensionalLayout&);
|
|
|
|
|
2006-08-26 16:21:15 +00:00
|
|
|
LocalLayouter* fLocalLayouter;
|
2011-11-02 00:29:33 -06:00
|
|
|
|
|
|
|
uint32 _reserved[5];
|
2006-08-26 16:21:15 +00:00
|
|
|
};
|
|
|
|
|
2009-08-27 11:12:41 +00:00
|
|
|
#endif // _TWO_DIMENSIONAL_LAYOUT_H
|