Merge pull request #146 from lucasr/style-getters
New style getters and cleanups in CSSNode
This commit is contained in:
@@ -221,6 +221,13 @@ public class CSSNode {
|
||||
return FloatUtil.floatsEqual(f1, f2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's direction, as defined in the style.
|
||||
*/
|
||||
public CSSDirection getStyleDirection() {
|
||||
return style.direction;
|
||||
}
|
||||
|
||||
public void setDirection(CSSDirection direction) {
|
||||
if (style.direction != direction) {
|
||||
style.direction = direction;
|
||||
@@ -228,6 +235,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's flex direction, as defined by style.
|
||||
*/
|
||||
public CSSFlexDirection getFlexDirection() {
|
||||
return style.flexDirection;
|
||||
}
|
||||
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
if (style.flexDirection != flexDirection) {
|
||||
style.flexDirection = flexDirection;
|
||||
@@ -235,6 +249,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's justify content, as defined by style.
|
||||
*/
|
||||
public CSSJustify getJustifyContent() {
|
||||
return style.justifyContent;
|
||||
}
|
||||
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
if (style.justifyContent != justifyContent) {
|
||||
style.justifyContent = justifyContent;
|
||||
@@ -242,6 +263,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's align items, as defined by style.
|
||||
*/
|
||||
public CSSAlign getAlignItems() {
|
||||
return style.alignItems;
|
||||
}
|
||||
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
if (style.alignItems != alignItems) {
|
||||
style.alignItems = alignItems;
|
||||
@@ -249,6 +277,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's align items, as defined by style.
|
||||
*/
|
||||
public CSSAlign getAlignSelf() {
|
||||
return style.alignSelf;
|
||||
}
|
||||
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
if (style.alignSelf != alignSelf) {
|
||||
style.alignSelf = alignSelf;
|
||||
@@ -256,6 +291,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's position type, as defined by style.
|
||||
*/
|
||||
public CSSPositionType getPositionType() {
|
||||
return style.positionType;
|
||||
}
|
||||
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
if (style.positionType != positionType) {
|
||||
style.positionType = positionType;
|
||||
@@ -270,6 +312,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's flex, as defined by style.
|
||||
*/
|
||||
public float getFlex() {
|
||||
return style.flex;
|
||||
}
|
||||
|
||||
public void setFlex(float flex) {
|
||||
if (!valuesEqual(style.flex, flex)) {
|
||||
style.flex = flex;
|
||||
@@ -277,24 +326,52 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's margin, as defined by style + default margin.
|
||||
*/
|
||||
public Spacing getMargin() {
|
||||
return style.margin;
|
||||
}
|
||||
|
||||
public void setMargin(int spacingType, float margin) {
|
||||
if (style.margin.set(spacingType, margin)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's padding, as defined by style + default padding.
|
||||
*/
|
||||
public Spacing getPadding() {
|
||||
return style.padding;
|
||||
}
|
||||
|
||||
public void setPadding(int spacingType, float padding) {
|
||||
if (style.padding.set(spacingType, padding)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's border, as defined by style.
|
||||
*/
|
||||
public Spacing getBorder() {
|
||||
return style.border;
|
||||
}
|
||||
|
||||
public void setBorder(int spacingType, float border) {
|
||||
if (style.border.set(spacingType, border)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's position top, as defined by style.
|
||||
*/
|
||||
public float getPositionTop() {
|
||||
return style.position[POSITION_TOP];
|
||||
}
|
||||
|
||||
public void setPositionTop(float positionTop) {
|
||||
if (!valuesEqual(style.position[POSITION_TOP], positionTop)) {
|
||||
style.position[POSITION_TOP] = positionTop;
|
||||
@@ -302,6 +379,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's position bottom, as defined by style.
|
||||
*/
|
||||
public float getPositionBottom() {
|
||||
return style.position[POSITION_BOTTOM];
|
||||
}
|
||||
|
||||
public void setPositionBottom(float positionBottom) {
|
||||
if (!valuesEqual(style.position[POSITION_BOTTOM], positionBottom)) {
|
||||
style.position[POSITION_BOTTOM] = positionBottom;
|
||||
@@ -309,6 +393,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's position left, as defined by style.
|
||||
*/
|
||||
public float getPositionLeft() {
|
||||
return style.position[POSITION_LEFT];
|
||||
}
|
||||
|
||||
public void setPositionLeft(float positionLeft) {
|
||||
if (!valuesEqual(style.position[POSITION_LEFT], positionLeft)) {
|
||||
style.position[POSITION_LEFT] = positionLeft;
|
||||
@@ -316,6 +407,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's position right, as defined by style.
|
||||
*/
|
||||
public float getPositionRight() {
|
||||
return style.position[POSITION_RIGHT];
|
||||
}
|
||||
|
||||
public void setPositionRight(float positionRight) {
|
||||
if (!valuesEqual(style.position[POSITION_RIGHT], positionRight)) {
|
||||
style.position[POSITION_RIGHT] = positionRight;
|
||||
@@ -323,6 +421,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's width, as defined in the style.
|
||||
*/
|
||||
public float getStyleWidth() {
|
||||
return style.dimensions[DIMENSION_WIDTH];
|
||||
}
|
||||
|
||||
public void setStyleWidth(float width) {
|
||||
if (!valuesEqual(style.dimensions[DIMENSION_WIDTH], width)) {
|
||||
style.dimensions[DIMENSION_WIDTH] = width;
|
||||
@@ -330,6 +435,13 @@ public class CSSNode {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's height, as defined in the style.
|
||||
*/
|
||||
public float getStyleHeight() {
|
||||
return style.dimensions[DIMENSION_HEIGHT];
|
||||
}
|
||||
|
||||
public void setStyleHeight(float height) {
|
||||
if (!valuesEqual(style.dimensions[DIMENSION_HEIGHT], height)) {
|
||||
style.dimensions[DIMENSION_HEIGHT] = height;
|
||||
@@ -357,34 +469,6 @@ public class CSSNode {
|
||||
return layout.direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's padding, as defined by style + default padding.
|
||||
*/
|
||||
public Spacing getStylePadding() {
|
||||
return style.padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's width, as defined in the style.
|
||||
*/
|
||||
public float getStyleWidth() {
|
||||
return style.dimensions[DIMENSION_WIDTH];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's height, as defined in the style.
|
||||
*/
|
||||
public float getStyleHeight() {
|
||||
return style.dimensions[DIMENSION_HEIGHT];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's direction, as defined in the style.
|
||||
*/
|
||||
public CSSDirection getStyleDirection() {
|
||||
return style.direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a default padding (left/top/right/bottom) for this node.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user