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