Introduce SharedSolver class to improve BALMLayout's friend feature.
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
class BView;
|
||||
class BLayoutItem;
|
||||
|
||||
namespace BPrivate {
|
||||
class SharedSolver;
|
||||
};
|
||||
|
||||
|
||||
namespace BALM {
|
||||
|
||||
@@ -157,6 +161,7 @@ private:
|
||||
|
||||
template <class T>
|
||||
friend class TabAddTransaction;
|
||||
friend class BPrivate::SharedSolver;
|
||||
|
||||
friend class XTab;
|
||||
friend class YTab;
|
||||
@@ -165,6 +170,8 @@ private:
|
||||
float InsetForTab(XTab* tab) const;
|
||||
float InsetForTab(YTab* tab) const;
|
||||
|
||||
void UpdateConstraints(BLayoutContext* context);
|
||||
|
||||
void _RemoveSelfFromTab(XTab* tab);
|
||||
void _RemoveSelfFromTab(YTab* tab);
|
||||
bool _HasTabInLayout(XTab* tab);
|
||||
@@ -174,15 +181,7 @@ private:
|
||||
|
||||
BLayoutItem* _LayoutItemToAdd(BView* view);
|
||||
|
||||
void _UpdateAreaConstraints();
|
||||
|
||||
BSize _CalculateMinSize();
|
||||
BSize _CalculateMaxSize();
|
||||
BSize _CalculatePreferredSize();
|
||||
|
||||
bool _TrySolve();
|
||||
|
||||
LinearProgramming::LinearSpec* fSolver;
|
||||
BPrivate::SharedSolver* fSolver;
|
||||
|
||||
BReference<XTab> fLeft;
|
||||
BReference<XTab> fRight;
|
||||
|
||||
@@ -55,6 +55,9 @@ public:
|
||||
virtual BSize MinSize(Variable* width, Variable* height) = 0;
|
||||
virtual BSize MaxSize(Variable* width, Variable* height) = 0;
|
||||
|
||||
virtual ResultType FindMins(const VariableList* variables) = 0;
|
||||
virtual ResultType FindMaxs(const VariableList* variables) = 0;
|
||||
|
||||
protected:
|
||||
LinearSpec* fLinearSpec;
|
||||
};
|
||||
@@ -122,6 +125,9 @@ public:
|
||||
BSize MinSize(Variable* width, Variable* height);
|
||||
BSize MaxSize(Variable* width, Variable* height);
|
||||
|
||||
ResultType FindMins(const VariableList* variables);
|
||||
ResultType FindMaxs(const VariableList* variables);
|
||||
|
||||
ResultType Solve();
|
||||
bool Save(const char* fileName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user