* Added ItemAt() method that accepts column and row.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40154 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-01-08 16:14:13 +00:00
parent f6d3241dac
commit 24a77ea0be
2 changed files with 21 additions and 6 deletions

View File

@ -1,10 +1,11 @@
/*
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
* Copyright 2006-2011, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GRID_LAYOUT_H
#define _GRID_LAYOUT_H
#include <TwoDimensionalLayout.h>
@ -44,6 +45,8 @@ public:
float MaxRowHeight(int32 row) const;
void SetMaxRowHeight(int32 row, float height);
BLayoutItem* ItemAt(int32 column, int32 row) const;
virtual BLayoutItem* AddView(BView* child);
virtual BLayoutItem* AddView(int32 index, BView* child);
virtual BLayoutItem* AddView(BView* child, int32 column, int32 row,
@ -63,13 +66,13 @@ public:
virtual status_t ItemUnarchived(const BMessage* from,
BLayoutItem* item, int32 index);
protected:
protected:
virtual bool ItemAdded(BLayoutItem* item, int32 atIndex);
virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex);
virtual bool HasMultiColumnItems();
virtual bool HasMultiRowItems();
virtual int32 InternalCountColumns();
virtual int32 InternalCountRows();
virtual void GetColumnRowConstraints(
@ -79,11 +82,11 @@ protected:
virtual void GetItemDimensions(BLayoutItem* item,
Dimensions* dimensions);
private:
private:
class DummyLayoutItem;
class RowInfoArray;
struct ItemLayoutData;
bool _IsGridCellEmpty(int32 column, int32 row);
bool _AreGridCellsEmpty(int32 column, int32 row,
int32 columnCount, int32 rowCount);
@ -105,4 +108,5 @@ private:
int32 fMultiRowItems;
};
#endif // _GRID_LAYOUT_H

View File

@ -1,5 +1,5 @@
/*
* Copyright 2010, Haiku Inc.
* Copyright 2010-2011, Haiku Inc.
* Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@ -372,6 +372,17 @@ BGridLayout::SetMaxRowHeight(int32 row, float height)
}
BLayoutItem*
BGridLayout::ItemAt(int32 column, int32 row) const
{
if (column < 0 || column >= CountColumns()
|| row < 0 || row >= CountRows())
return NULL;
return fGrid[column][row];
}
BLayoutItem*
BGridLayout::AddView(BView* child)
{