mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 15:50:49 +01:00
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#ifndef LAYOUT_REFERENCE_H
|
|
#define LAYOUT_REFERENCE_H
|
|
|
|
#include "tree_reference.h"
|
|
#include "layout_node.h"
|
|
|
|
class LayoutCursor;
|
|
|
|
template <typename T>
|
|
class LayoutReference : public TreeReference<T> {
|
|
friend class LayoutCursor;
|
|
public:
|
|
using TreeReference<T>::TreeReference;
|
|
|
|
/* Allow every LayoutReference<T> to be transformed into a
|
|
* LayoutReference<LayoutNode>, i.e. Layout */
|
|
operator LayoutReference<LayoutNode>() const {
|
|
return LayoutReference<LayoutNode>(this->node());
|
|
}
|
|
|
|
LayoutCursor cursor() const;
|
|
|
|
virtual void addChild(LayoutReference<LayoutNode> l) {
|
|
TreeReference<T>::addChild(l);
|
|
}
|
|
|
|
LayoutReference<LayoutNode> childAtIndex(int i) {
|
|
TreeReference<T> treeRefChild = TreeReference<T>::treeChildAtIndex(i);
|
|
return LayoutReference<LayoutNode>(treeRefChild.node());
|
|
}
|
|
|
|
void replaceChildAtIndex(int oldChildIndex, LayoutReference<LayoutNode> newChild) {
|
|
TreeReference<T>::replaceChildAtIndex(oldChildIndex, newChild);
|
|
}
|
|
|
|
int layoutOrigin() {
|
|
return this->node()->layoutOrigin();
|
|
}
|
|
|
|
int absoluteOrigin() {
|
|
return this->node()->absoluteOrigin();
|
|
}
|
|
};
|
|
|
|
typedef LayoutReference<LayoutNode> LayoutRef;
|
|
|
|
#endif
|