2010-07-29 02:28:51 +04:00
|
|
|
/*
|
2011-01-08 19:14:13 +03:00
|
|
|
* Copyright 2006-2011, Haiku, Inc. All rights reserved.
|
2010-07-29 02:28:51 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _GRID_LAYOUT_H
|
|
|
|
#define _GRID_LAYOUT_H
|
|
|
|
|
2011-01-08 19:14:13 +03:00
|
|
|
|
2010-07-29 02:28:51 +04:00
|
|
|
#include <TwoDimensionalLayout.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BGridLayout : public BTwoDimensionalLayout {
|
|
|
|
public:
|
2010-09-03 02:58:24 +04:00
|
|
|
BGridLayout(float horizontal
|
|
|
|
= B_USE_DEFAULT_SPACING,
|
|
|
|
float vertical = B_USE_DEFAULT_SPACING);
|
2010-07-29 02:28:51 +04:00
|
|
|
BGridLayout(BMessage* from);
|
|
|
|
virtual ~BGridLayout();
|
|
|
|
|
|
|
|
int32 CountColumns() const;
|
|
|
|
int32 CountRows() const;
|
|
|
|
|
|
|
|
float HorizontalSpacing() const;
|
|
|
|
float VerticalSpacing() const;
|
|
|
|
|
|
|
|
void SetHorizontalSpacing(float spacing);
|
|
|
|
void SetVerticalSpacing(float spacing);
|
|
|
|
void SetSpacing(float horizontal, float vertical);
|
|
|
|
|
|
|
|
float ColumnWeight(int32 column) const;
|
|
|
|
void SetColumnWeight(int32 column, float weight);
|
|
|
|
|
|
|
|
float MinColumnWidth(int32 column) const;
|
|
|
|
void SetMinColumnWidth(int32 column, float width);
|
|
|
|
|
|
|
|
float MaxColumnWidth(int32 column) const;
|
|
|
|
void SetMaxColumnWidth(int32 column, float width);
|
|
|
|
|
|
|
|
float RowWeight(int32 row) const;
|
|
|
|
void SetRowWeight(int32 row, float weight);
|
|
|
|
|
|
|
|
float MinRowHeight(int row) const;
|
|
|
|
void SetMinRowHeight(int32 row, float height);
|
|
|
|
|
|
|
|
float MaxRowHeight(int32 row) const;
|
|
|
|
void SetMaxRowHeight(int32 row, float height);
|
|
|
|
|
2011-01-08 19:14:13 +03:00
|
|
|
BLayoutItem* ItemAt(int32 column, int32 row) const;
|
|
|
|
|
2010-07-29 02:28:51 +04:00
|
|
|
virtual BLayoutItem* AddView(BView* child);
|
|
|
|
virtual BLayoutItem* AddView(int32 index, BView* child);
|
|
|
|
virtual BLayoutItem* AddView(BView* child, int32 column, int32 row,
|
|
|
|
int32 columnCount = 1, int32 rowCount = 1);
|
|
|
|
|
|
|
|
virtual bool AddItem(BLayoutItem* item);
|
|
|
|
virtual bool AddItem(int32 index, BLayoutItem* item);
|
|
|
|
virtual bool AddItem(BLayoutItem* item, int32 column,
|
|
|
|
int32 row, int32 columnCount = 1,
|
|
|
|
int32 rowCount = 1);
|
|
|
|
|
|
|
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
|
|
|
static BArchivable* Instantiate(BMessage* from);
|
|
|
|
|
2011-12-02 07:45:50 +04:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual status_t AllArchived(BMessage* into) const;
|
|
|
|
virtual status_t AllUnarchived(const BMessage* from);
|
2010-07-29 02:28:51 +04:00
|
|
|
virtual status_t ItemArchived(BMessage* into,
|
|
|
|
BLayoutItem* item, int32 index) const;
|
|
|
|
virtual status_t ItemUnarchived(const BMessage* from,
|
|
|
|
BLayoutItem* item, int32 index);
|
|
|
|
|
2010-07-30 06:28:17 +04:00
|
|
|
virtual bool ItemAdded(BLayoutItem* item, int32 atIndex);
|
|
|
|
virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex);
|
2010-07-29 02:28:51 +04:00
|
|
|
|
|
|
|
virtual bool HasMultiColumnItems();
|
|
|
|
virtual bool HasMultiRowItems();
|
2011-01-08 19:14:13 +03:00
|
|
|
|
2010-07-29 02:28:51 +04:00
|
|
|
virtual int32 InternalCountColumns();
|
|
|
|
virtual int32 InternalCountRows();
|
|
|
|
virtual void GetColumnRowConstraints(
|
2013-07-09 02:27:55 +04:00
|
|
|
orientation orientation,
|
2010-07-29 02:28:51 +04:00
|
|
|
int32 index,
|
|
|
|
ColumnRowConstraints* constraints);
|
|
|
|
virtual void GetItemDimensions(BLayoutItem* item,
|
|
|
|
Dimensions* dimensions);
|
2011-01-08 19:14:13 +03:00
|
|
|
private:
|
2010-07-29 02:28:51 +04:00
|
|
|
class DummyLayoutItem;
|
|
|
|
class RowInfoArray;
|
|
|
|
struct ItemLayoutData;
|
2011-01-08 19:14:13 +03:00
|
|
|
|
2010-07-29 02:28:51 +04:00
|
|
|
bool _IsGridCellEmpty(int32 column, int32 row);
|
|
|
|
bool _AreGridCellsEmpty(int32 column, int32 row,
|
|
|
|
int32 columnCount, int32 rowCount);
|
|
|
|
|
|
|
|
bool _InsertItemIntoGrid(BLayoutItem* item);
|
|
|
|
bool _ResizeGrid(int32 columnCount, int32 rowCount);
|
|
|
|
|
|
|
|
ItemLayoutData* _LayoutDataForItem(BLayoutItem* item) const;
|
|
|
|
|
|
|
|
private:
|
2011-11-02 10:29:33 +04:00
|
|
|
|
|
|
|
// FBC padding
|
|
|
|
virtual void _ReservedGridLayout1();
|
|
|
|
virtual void _ReservedGridLayout2();
|
|
|
|
virtual void _ReservedGridLayout3();
|
|
|
|
virtual void _ReservedGridLayout4();
|
|
|
|
virtual void _ReservedGridLayout5();
|
|
|
|
virtual void _ReservedGridLayout6();
|
|
|
|
virtual void _ReservedGridLayout7();
|
|
|
|
virtual void _ReservedGridLayout8();
|
|
|
|
virtual void _ReservedGridLayout9();
|
|
|
|
virtual void _ReservedGridLayout10();
|
|
|
|
|
2011-11-05 08:23:22 +04:00
|
|
|
// forbidden methods
|
|
|
|
BGridLayout(const BGridLayout&);
|
|
|
|
void operator =(const BGridLayout&);
|
|
|
|
|
2010-07-29 02:28:51 +04:00
|
|
|
BLayoutItem*** fGrid;
|
|
|
|
int32 fColumnCount;
|
|
|
|
int32 fRowCount;
|
|
|
|
|
|
|
|
RowInfoArray* fRowInfos;
|
|
|
|
RowInfoArray* fColumnInfos;
|
|
|
|
|
|
|
|
int32 fMultiColumnItems;
|
|
|
|
int32 fMultiRowItems;
|
2011-11-02 10:29:33 +04:00
|
|
|
|
|
|
|
uint32 _reserved[5];
|
2010-07-29 02:28:51 +04:00
|
|
|
};
|
|
|
|
|
2011-01-08 19:14:13 +03:00
|
|
|
|
2010-07-29 02:28:51 +04:00
|
|
|
#endif // _GRID_LAYOUT_H
|