- Add a alternative method to setup a group layout. BLayoutItem / BView are wrapped into a GroupItem. GroupItem overloads the | (horizontal tiling) and / (vertical tiling) operators. In this manner you can create a group layout using these operators, e.g. GroupItem item = GroupItem(button1) | (GroupItem(button2) / GroupItem(button3)); would layout button1 at the left and button2 and button3 at the right in a vertical layout. All the layout information is stored in the GroupItem item, to setup the final layout you have to call BuildLayout(item). If you like it it could also be added to the BGroupLayout.
- Add operator test app. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38877 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -69,6 +69,10 @@ public:
|
||||
YTab* BottomOf(const BView* view) const;
|
||||
YTab* BottomOf(const BLayoutItem* item) const;
|
||||
|
||||
void BuildLayout(GroupItem& item, XTab* left = NULL,
|
||||
YTab* top = NULL, XTab* right = NULL,
|
||||
YTab* bottom = NULL);
|
||||
|
||||
virtual BLayoutItem* AddView(BView* child);
|
||||
virtual BLayoutItem* AddView(int32 index, BView* child);
|
||||
virtual Area* AddView(BView* view, XTab* left, YTab* top,
|
||||
@@ -127,6 +131,8 @@ private:
|
||||
BSize _CalculateMaxSize();
|
||||
BSize _CalculatePreferredSize();
|
||||
|
||||
void _ParseGroupItem(GroupItem& item, XTab* left,
|
||||
YTab* top, XTab* right, YTab* bottom);
|
||||
|
||||
LinearSpec fSolver;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#define AREA_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <Alignment.h>
|
||||
#include <List.h>
|
||||
#include <Size.h>
|
||||
@@ -24,6 +26,35 @@ class Constraint;
|
||||
namespace BALM {
|
||||
|
||||
|
||||
class GroupItem {
|
||||
public:
|
||||
GroupItem(BLayoutItem* item);
|
||||
GroupItem(BView* view);
|
||||
|
||||
BLayoutItem* LayoutItem();
|
||||
BView* View();
|
||||
|
||||
const std::vector<GroupItem>& GroupItems();
|
||||
enum orientation Orientation();
|
||||
|
||||
GroupItem& operator|(const GroupItem& right);
|
||||
GroupItem& operator/(const GroupItem& bottom);
|
||||
private:
|
||||
GroupItem();
|
||||
|
||||
void _Init(BLayoutItem* item, BView* view,
|
||||
enum orientation orien = B_HORIZONTAL);
|
||||
GroupItem& _AddItem(const GroupItem& item,
|
||||
enum orientation orien);
|
||||
|
||||
BLayoutItem* fLayoutItem;
|
||||
BView* fView;
|
||||
|
||||
std::vector<GroupItem> fGroupItems;
|
||||
enum orientation fOrientation;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Rectangular area in the GUI, defined by a tab on each side.
|
||||
*/
|
||||
@@ -122,6 +153,7 @@ public:
|
||||
} // namespace BALM
|
||||
|
||||
using BALM::Area;
|
||||
using BALM::GroupItem;
|
||||
|
||||
#endif // AREA_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user