Fixed Separator class spacing behavior
This commit is contained in:
@@ -10,12 +10,31 @@ namespace JUI {
|
||||
/// Dashed, dotted, and solid lines of varying thickness are supported.
|
||||
class Separator : public Widget {
|
||||
public:
|
||||
Separator();
|
||||
|
||||
explicit Separator(Widget* parent);
|
||||
|
||||
|
||||
|
||||
|
||||
/// Constructs a Separator widget by specifying it's parent. Additional style parameters can also be specified.
|
||||
/// @param parent
|
||||
/// @param orientation
|
||||
/// @param spacing
|
||||
/// @param line_mode
|
||||
/// @param line_color
|
||||
/// @param line_thickness
|
||||
Separator(Widget* parent,
|
||||
const enum Orientation& orientation = Orientation::Horizontal,
|
||||
const UDim& spacing = 5_px,
|
||||
const enum LineFillMode& line_mode = LineFillMode::Solid,
|
||||
const Color4& line_color = Colors::Black,
|
||||
float line_thickness = 1.f
|
||||
);
|
||||
|
||||
enum Orientation Orientation() const;
|
||||
|
||||
/// Sets whether the separator is laid out as a horizontal or vertical line.
|
||||
/// Horizontal orientation draws a horizontal line, for separating elements in a vertical list.
|
||||
/// Vertical orientation draws a vertical line, for separating elements in a horizontal list.
|
||||
void Orient(const enum Orientation& orientation);
|
||||
|
||||
enum LineFillMode LineFillMode() const;
|
||||
@@ -26,18 +45,43 @@ namespace JUI {
|
||||
|
||||
void LineColor(const Color4& color);
|
||||
|
||||
float GetAbsoluteSpacing() const;
|
||||
|
||||
|
||||
void InnerDraw() override;
|
||||
|
||||
float Spacing() const;
|
||||
//float Spacing() const;
|
||||
|
||||
void Spacing(float spacing);
|
||||
//void Spacing(float spacing);
|
||||
|
||||
/// @return The size of the separator object.
|
||||
UDim Spacing() const { return spacing;}
|
||||
/// Sets the size of the separator object.
|
||||
void Spacing(const UDim& value) {
|
||||
spacing = value;
|
||||
UpdateSize();
|
||||
}
|
||||
|
||||
/// @returns The spacing between
|
||||
float LineSpacing() const { return line_spacing;}
|
||||
void LineSpacing(float value) {
|
||||
line_spacing = value;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// The default constructor zero-initializes all members.
|
||||
Separator();
|
||||
|
||||
/// Sets the widgets size based on the spacing and orientation.
|
||||
void UpdateSize();
|
||||
|
||||
enum LineFillMode line_mode = LineFillMode::Solid;
|
||||
enum Orientation orientation = Orientation::Horizontal;
|
||||
Color4 line_color = Colors::Black;
|
||||
float line_thickness = 1.f;
|
||||
float spacing = 2.f;
|
||||
float line_spacing = 2.f;
|
||||
|
||||
UDim spacing = 2_px;
|
||||
private:
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user