Rename BALM::GroupItem to BALM::ALMGroup, and move it to its own files.
Also make ALMGroup totally self-contained, i.e. BALMLayout no longer does the parsing, and is completely unaware of ALMGroup. A small touch of refactoring as well.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2012, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef ALMGROUP_H
|
||||
#define ALMGROUP_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <InterfaceDefs.h> // for enum orientation
|
||||
#include <Referenceable.h>
|
||||
|
||||
#include "Tab.h"
|
||||
|
||||
|
||||
class BLayoutItem;
|
||||
class BView;
|
||||
|
||||
|
||||
namespace BALM {
|
||||
|
||||
class BALMLayout;
|
||||
|
||||
|
||||
class ALMGroup {
|
||||
public:
|
||||
ALMGroup(BLayoutItem* item);
|
||||
ALMGroup(BView* view);
|
||||
|
||||
BLayoutItem* LayoutItem() const;
|
||||
BView* View() const;
|
||||
|
||||
const std::vector<ALMGroup>& Groups() const;
|
||||
enum orientation Orientation() const;
|
||||
|
||||
ALMGroup& operator|(const ALMGroup& right);
|
||||
ALMGroup& operator/(const ALMGroup& bottom);
|
||||
|
||||
void BuildLayout(BALMLayout* layout,
|
||||
XTab* left = NULL, YTab* top = NULL,
|
||||
XTab* right = NULL, YTab* bottom = NULL);
|
||||
|
||||
private:
|
||||
ALMGroup();
|
||||
|
||||
void _Init(BLayoutItem* item, BView* view,
|
||||
enum orientation orien = B_HORIZONTAL);
|
||||
ALMGroup& _AddItem(const ALMGroup& item,
|
||||
enum orientation orien);
|
||||
|
||||
void _Build(BALMLayout* layout,
|
||||
BReference<XTab> left, BReference<YTab> top,
|
||||
BReference<XTab> right,
|
||||
BReference<YTab> bottom) const;
|
||||
|
||||
|
||||
BLayoutItem* fLayoutItem;
|
||||
BView* fView;
|
||||
|
||||
std::vector<ALMGroup> fGroups;
|
||||
enum orientation fOrientation;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
using BALM::ALMGroup;
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@ namespace BALM {
|
||||
|
||||
|
||||
class Column;
|
||||
class GroupItem;
|
||||
class ALMGroup;
|
||||
class Row;
|
||||
class RowColumnManager;
|
||||
|
||||
@@ -86,10 +86,6 @@ 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,
|
||||
@@ -135,11 +131,6 @@ private:
|
||||
BSize _CalculateMaxSize();
|
||||
BSize _CalculatePreferredSize();
|
||||
|
||||
void _ParseGroupItem(GroupItem& item,
|
||||
BReference<XTab> left, BReference<YTab> top,
|
||||
BReference<XTab> right,
|
||||
BReference<YTab> bottom);
|
||||
|
||||
LinearProgramming::LinearSpec* fSolver;
|
||||
LinearProgramming::LinearSpec fOwnSolver;
|
||||
|
||||
|
||||
+1
-31
@@ -6,11 +6,9 @@
|
||||
#define AREA_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <InterfaceDefs.h> // for enum orientation
|
||||
#include <ObjectList.h>
|
||||
#include <Referenceable.h>
|
||||
#include <Rect.h>
|
||||
#include <Size.h>
|
||||
#include <String.h>
|
||||
|
||||
@@ -34,33 +32,6 @@ class XTab;
|
||||
class YTab;
|
||||
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
class RowColumnManager;
|
||||
@@ -179,7 +150,6 @@ public:
|
||||
} // namespace BALM
|
||||
|
||||
using BALM::Area;
|
||||
using BALM::GroupItem;
|
||||
|
||||
#endif // AREA_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user