Skip to content

Commit de63082

Browse files
committed
Call base methods of virtual members in MLEM.Ui constructors
Closes #43
1 parent eda1a89 commit de63082

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

MLEM.Ui/Elements/Button.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public Button(Anchor anchor, Vector2 size, string text = null, string tooltipTex
115115
if (text != null) {
116116
this.Text = new Paragraph(Anchor.Center, 1, text, true);
117117
this.Text.Padding = this.Text.Padding.OrStyle(new Padding(1), 1);
118-
this.AddChild(this.Text);
118+
base.AddChild(this.Text);
119119
}
120120
if (tooltipText != null)
121121
this.Tooltip = this.AddTooltip(tooltipText);
@@ -132,7 +132,7 @@ public Button(Anchor anchor, Vector2 size, Paragraph.TextCallback textCallback =
132132
if (textCallback != null) {
133133
this.Text = new Paragraph(Anchor.Center, 1, textCallback, true);
134134
this.Text.Padding = this.Text.Padding.OrStyle(new Padding(1), 1);
135-
this.AddChild(this.Text);
135+
base.AddChild(this.Text);
136136
}
137137
if (tooltipTextCallback != null)
138138
this.Tooltip = this.AddTooltip(tooltipTextCallback);

MLEM.Ui/Elements/Checkbox.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public Checkbox(Anchor anchor, Vector2 size, string label, bool defaultChecked =
115115

116116
if (label != null) {
117117
this.Label = new Paragraph(Anchor.CenterLeft, 0, label);
118-
this.AddChild(this.Label);
118+
base.AddChild(this.Label);
119119
}
120120
}
121121

@@ -145,7 +145,7 @@ public override void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteB
145145
var uncheckedColor = this.UncheckColor.OrDefault(Color.Transparent);
146146
if (this.Checked)
147147
batch.Draw(this.Checkmark, boxDisplayArea, this.CheckColor.OrDefault(Color.White) * alpha);
148-
else if(uncheckedColor.A != 0) {
148+
else if (uncheckedColor.A != 0) {
149149
batch.Draw(this.Checkmark, boxDisplayArea, uncheckedColor * alpha);
150150
}
151151
base.Draw(time, batch, alpha, context);

MLEM.Ui/Elements/Group.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public Group(Anchor anchor, Vector2 size, bool setHeightBasedOnChildren = true)
2626
/// <param name="setWidthBasedOnChildren">Whether the group's width should be based on its children's width, see <see cref="Element.SetWidthBasedOnChildren"/>.</param>
2727
/// <param name="setHeightBasedOnChildren">Whether the group's height should be based on its children's height, see <see cref="Element.SetHeightBasedOnChildren"/>.</param>
2828
public Group(Anchor anchor, Vector2 size, bool setWidthBasedOnChildren, bool setHeightBasedOnChildren) : base(anchor, size) {
29-
this.SetWidthBasedOnChildren = setWidthBasedOnChildren;
30-
this.SetHeightBasedOnChildren = setHeightBasedOnChildren;
31-
this.CanBeSelected = false;
29+
base.SetWidthBasedOnChildren = setWidthBasedOnChildren;
30+
base.SetHeightBasedOnChildren = setHeightBasedOnChildren;
31+
base.CanBeSelected = false;
3232
}
3333

3434
}

MLEM.Ui/Elements/Image.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,16 @@ public bool SetHeightBasedOnAspect {
122122
public Image(Anchor anchor, Vector2 size, TextureRegion texture, bool scaleToImage = false) : base(anchor, size) {
123123
this.Texture = texture;
124124
this.ScaleToImage = scaleToImage;
125-
this.CanBeSelected = false;
126-
this.CanBeMoused = false;
125+
base.CanBeSelected = false;
126+
base.CanBeMoused = false;
127127
}
128128

129129
/// <inheritdoc cref="Image(Anchor,Vector2,TextureRegion,bool)"/>
130130
public Image(Anchor anchor, Vector2 size, TextureCallback getTextureCallback, bool scaleToImage = false) : base(anchor, size) {
131131
this.GetTextureCallback = getTextureCallback;
132132
this.ScaleToImage = scaleToImage;
133-
this.CanBeSelected = false;
134-
this.CanBeMoused = false;
133+
base.CanBeSelected = false;
134+
base.CanBeMoused = false;
135135
}
136136

137137
/// <inheritdoc />

MLEM.Ui/Elements/Panel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ public StyleProp<float> ScrollBarOffset {
7979
/// <param name="autoHideScrollbar">Whether the scroll bar should be hidden automatically if the panel does not contain enough children to allow for scrolling. This only has an effect if <paramref name="scrollOverflow"/> is <see langword="true"/>.</param>
8080
public Panel(Anchor anchor, Vector2 size, Vector2 positionOffset, bool setHeightBasedOnChildren = false, bool scrollOverflow = false, bool autoHideScrollbar = true) : base(anchor, size) {
8181
this.PositionOffset = positionOffset;
82-
this.SetHeightBasedOnChildren = setHeightBasedOnChildren;
83-
this.TreatSizeAsMaximum = setHeightBasedOnChildren && scrollOverflow;
82+
base.SetHeightBasedOnChildren = setHeightBasedOnChildren;
83+
base.TreatSizeAsMaximum = setHeightBasedOnChildren && scrollOverflow;
8484
this.scrollOverflow = scrollOverflow;
85-
this.CanBeSelected = false;
85+
base.CanBeSelected = false;
8686

8787
if (scrollOverflow) {
8888
this.scrollBarMaxHistory = new float[3];
@@ -104,7 +104,7 @@ public Panel(Anchor anchor, Vector2 size, Vector2 positionOffset, bool setHeight
104104
return;
105105
this.ScrollToElement(e);
106106
};
107-
this.AddChild(this.ScrollBar);
107+
base.AddChild(this.ScrollBar);
108108
}
109109
}
110110

MLEM.Ui/Elements/Paragraph.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ public Paragraph(Anchor anchor, float width, TextCallback textCallback, bool aut
223223
public Paragraph(Anchor anchor, float width, string text, bool autoAdjustWidth = false) : base(anchor, new Vector2(width, 0)) {
224224
this.Text = text;
225225
this.AutoAdjustWidth = autoAdjustWidth;
226-
this.CanBeSelected = false;
227-
this.CanBeMoused = false;
226+
base.CanBeSelected = false;
227+
base.CanBeMoused = false;
228228
}
229229

230230
/// <inheritdoc />

MLEM.Ui/Elements/ProgressBar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public ProgressBar(Anchor anchor, Vector2 size, Direction2 direction, float maxV
6969
this.Direction = direction;
7070
this.MaxValue = maxValue;
7171
this.currentValue = currentValue;
72-
this.CanBeSelected = false;
72+
base.CanBeSelected = false;
7373
}
7474

7575
/// <inheritdoc />

MLEM.Ui/Elements/ScrollBar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public ScrollBar(Anchor anchor, Vector2 size, int scrollerSize, float maxValue,
143143
this.maxValue = maxValue;
144144
this.Horizontal = horizontal;
145145
this.ScrollerSize = new Vector2(horizontal ? scrollerSize : size.X, !horizontal ? scrollerSize : size.Y);
146-
this.CanBeSelected = false;
146+
base.CanBeSelected = false;
147147
}
148148

149149
/// <inheritdoc />

MLEM.Ui/Elements/Slider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Slider : ScrollBar {
1717
/// <param name="maxValue">The slider's maximum value</param>
1818
public Slider(Anchor anchor, Vector2 size, int scrollerSize, float maxValue) :
1919
base(anchor, size, scrollerSize, maxValue, true) {
20-
this.CanBeSelected = true;
20+
base.CanBeSelected = true;
2121
this.GetGamepadNextElement = (dir, next) => {
2222
if (dir == Direction2.Left || dir == Direction2.Right)
2323
return null;

MLEM.Ui/Elements/VerticalSpace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class VerticalSpace : Element {
1212
/// </summary>
1313
/// <param name="height">The height of the vertical space</param>
1414
public VerticalSpace(float height) : base(Anchor.AutoCenter, new Vector2(1, height)) {
15-
this.CanBeSelected = false;
15+
base.CanBeSelected = false;
1616
}
1717

1818
}

0 commit comments

Comments
 (0)