Other edits.
This commit is contained in:
@@ -41,6 +41,12 @@ namespace JUI {
|
||||
using namespace J3ML::Math;
|
||||
using namespace J3ML::LinearAlgebra;
|
||||
|
||||
struct PaddedElementStyle {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct EventArgs {
|
||||
|
||||
};
|
||||
|
14
include/JUI/Style/ButtonStyler.hpp
Normal file
14
include/JUI/Style/ButtonStyler.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace JUI {
|
||||
struct ButtonStyle {
|
||||
RectStyle base_style;
|
||||
RectStyle hovered_style;
|
||||
RectStyle pressed_style;
|
||||
RectStyle disabled_style;
|
||||
};
|
||||
|
||||
class ButtonStyler {
|
||||
|
||||
};
|
||||
}
|
15
include/JUI/Style/CheckboxStyler.hpp
Normal file
15
include/JUI/Style/CheckboxStyler.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
namespace JUI {
|
||||
struct CheckboxStyle {
|
||||
RectStyle unchecked_style;
|
||||
RectStyle checked_color;
|
||||
RectStyle disabled_style;
|
||||
};
|
||||
|
||||
class CheckboxStyler {
|
||||
public:
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
}
|
@@ -5,6 +5,15 @@
|
||||
|
||||
namespace JUI {
|
||||
|
||||
struct RectStyle {
|
||||
float border_width = 1.f;
|
||||
Color4 border_color {192, 192, 192};
|
||||
Color4 bg_color {64, 64, 64};
|
||||
float corner_rounding = 0.f;
|
||||
enum BorderMode border_mode;
|
||||
enum CornerRoundingMode corner_mode;
|
||||
};
|
||||
|
||||
class RectStyler {
|
||||
public:
|
||||
#pragma region Getters
|
||||
@@ -21,11 +30,16 @@ namespace JUI {
|
||||
virtual void BorderWidth(float width) = 0;
|
||||
#pragma endregion
|
||||
|
||||
void Style(const RectStyle& value) {
|
||||
style = value;
|
||||
}
|
||||
protected:
|
||||
float border_width = 1.f;
|
||||
Color4 border_color {192, 192, 192};
|
||||
enum BorderMode border_mode;
|
||||
float corner_rounding = 0.f;
|
||||
|
||||
RectStyle style;
|
||||
private:
|
||||
};
|
||||
}
|
@@ -72,14 +72,18 @@ namespace JUI {
|
||||
/// @return True if this window widget is on-top of all other window-widgets with the same parent.
|
||||
bool OnTop() const;
|
||||
|
||||
|
||||
/// Brings this window widget to the top of the window-widget stack.
|
||||
void BringToTop();
|
||||
|
||||
/// Moves this window up in the window-widget stack.
|
||||
void MoveUp() const;
|
||||
void MoveUp() {
|
||||
zindex++;
|
||||
}
|
||||
/// Moves this window down in the window-widget stack.
|
||||
void MoveDown() const;
|
||||
void MoveDown() {
|
||||
zindex--;
|
||||
}
|
||||
|
||||
|
||||
void TitlebarHeight(int height);
|
||||
|
||||
|
97
main.cpp
97
main.cpp
@@ -35,6 +35,7 @@
|
||||
#include <JUI/Widgets/CommandLine.hpp>
|
||||
|
||||
#include "JUI/Widgets/ColorPicker.hpp"
|
||||
#include "JUI/Widgets/FileDialog.hpp"
|
||||
#include "JUI/Widgets/FpsGraph.hpp"
|
||||
#include "JUI/Widgets/LabeledSlider.hpp"
|
||||
#include "JUI/Widgets/Link.hpp"
|
||||
@@ -64,6 +65,10 @@ int count_descendants(JUI::Widget* w) {
|
||||
return w->GetDescendants().size();
|
||||
}
|
||||
|
||||
void CreateFileDialog() {
|
||||
auto* dialog = new JUI::FileDialogWindow(scene, "assets");
|
||||
}
|
||||
|
||||
/// Creates the window that provides a "Welcome" dialog to the user.
|
||||
/// Project metadata and copyright information is presented.
|
||||
JUI::Window* CreateInfoboxWindow(JUI::Widget* root) {
|
||||
@@ -158,6 +163,8 @@ JUI::UtilityBar* CreateUtilityBar(JUI::Widget* root) {
|
||||
|
||||
demos->AddButton("Command Line", [&]{ console->Toggle();});
|
||||
|
||||
demos->AddButton("File Dialog", [&] {CreateFileDialog();});
|
||||
|
||||
auto* test_sub = demos->AddSubmenu("Fruit"); {
|
||||
test_sub->AddButton("Apples");
|
||||
test_sub->AddButton("Bananas");
|
||||
@@ -192,7 +199,6 @@ JUI::UtilityBar* CreateUtilityBar(JUI::Widget* root) {
|
||||
docked = true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -332,42 +338,85 @@ JUI::Rect* CreateWidgetList(JUI::Widget* root) {
|
||||
auto* checkbox_section = new Collapsible(column_layout);
|
||||
{
|
||||
checkbox_section->Title("Checkbox Styles");
|
||||
checkbox_section->Size({100_percent, 50_px});
|
||||
checkbox_section->Size({100_percent, 60_px});
|
||||
|
||||
auto* checkbox_layout = new VerticalListLayout(checkbox_section->ContentBox());
|
||||
|
||||
auto* set_1 = new Rect(checkbox_layout);
|
||||
{
|
||||
set_1->Size({100_percent, 40_px});
|
||||
{auto* set_1 = new Rect(checkbox_layout);
|
||||
|
||||
set_1->Size({100_percent, 24_px});
|
||||
auto* set_1_layout = new HorizontalListLayout(set_1);
|
||||
auto* label = new TextRect(set_1_layout);
|
||||
label->Content("Standard");
|
||||
label->BorderWidth(0);
|
||||
label->AutoFitSizeToText(true);
|
||||
label->Size({50_px, 20_px});
|
||||
//label->Size({50_px, 20_px});
|
||||
|
||||
auto* separator_1 = new Separator(set_1_layout, Orientation::Vertical, 10_px);
|
||||
separator_1->Visible(false);
|
||||
|
||||
auto* check1 = new Checkbox(set_1_layout);
|
||||
check1->Size({20_px, 20_px});
|
||||
auto* separator_1 = new Separator(set_1_layout);
|
||||
separator_1->Orient(Orientation::Vertical);
|
||||
separator_1->Size({10_px, 100_percent});
|
||||
separator_1->Spacing(0);
|
||||
separator_1->Visible(false);
|
||||
|
||||
auto* separator_2 = new Separator(set_1_layout, Orientation::Vertical, 10_px);
|
||||
separator_2->Visible(false);
|
||||
|
||||
auto* check2 = new Checkbox(set_1_layout);
|
||||
check2->Size({20_px, 20_px});
|
||||
check2->CheckedColor(Colors::Blue);
|
||||
check2->CornerRounding(7);
|
||||
|
||||
auto* separator_2 = new Separator(set_1_layout);
|
||||
separator_2->Orient(Orientation::Vertical);
|
||||
separator_2->Spacing(0);
|
||||
separator_2->Visible(false);
|
||||
separator_2->Size({10_px, 100_percent});
|
||||
auto* separator_3 = new Separator(set_1_layout, Orientation::Vertical, 10_px);
|
||||
separator_3->Visible(false);
|
||||
|
||||
auto* check3 = new Checkbox(set_1_layout);
|
||||
check3->Size({20_px, 20_px});
|
||||
check3->CheckedColor(Colors::Oranges::Coral);
|
||||
check3->CornerRounding(7);
|
||||
|
||||
auto* separator_4 = new Separator(set_1_layout, Orientation::Vertical, 10_px);
|
||||
separator_4->Visible(false);
|
||||
|
||||
auto* check4 = new Checkbox(set_1_layout);
|
||||
check4->Size({20_px, 20_px});
|
||||
check4->DisabledBorderColor(Colors::Black);
|
||||
check4->Disable();
|
||||
|
||||
};
|
||||
{auto* set_2 = new Rect(checkbox_layout);
|
||||
|
||||
set_2->Size({100_percent, 24_px});
|
||||
auto* layout = new HorizontalListLayout(set_2);
|
||||
|
||||
auto* label = new TextRect(layout);
|
||||
label->Content("Customized:");
|
||||
label->BorderWidth(0);
|
||||
label->AutoFitSizeToText(true);
|
||||
|
||||
auto* separator_1 = new Separator(layout, Orientation::Vertical, 20_px);
|
||||
separator_1->Visible(false);
|
||||
|
||||
auto* check1 = new Checkbox(layout);
|
||||
check1->Size({20_px, 20_px});
|
||||
|
||||
auto* separator_2 = new Separator(layout, Orientation::Vertical, 10_px);
|
||||
separator_2->Visible(false);
|
||||
|
||||
auto* check2 = new Checkbox(layout);
|
||||
check2->Size({20_px, 20_px});
|
||||
check2->CheckedColor(Colors::Blue);
|
||||
check2->CornerRounding(7);
|
||||
|
||||
auto* separator_3 = new Separator(layout, Orientation::Vertical, 10_px);
|
||||
separator_3->Visible(false);
|
||||
|
||||
auto* check3 = new Checkbox(layout);
|
||||
check3->Size({20_px, 20_px});
|
||||
check3->CheckedColor(Colors::Oranges::Coral);
|
||||
check3->CornerRounding(10);
|
||||
check3->BorderMode(BorderMode::Inset);
|
||||
check3->BorderWidth(2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,22 +495,6 @@ JUI::Rect* CreateWidgetList(JUI::Widget* root) {
|
||||
radio_c_btn->Size({20_px, 20_px});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// What the FUCK?
|
||||
|
||||
/*auto* radio_c_label = new TextRect(radio_btn_set_layout);
|
||||
|
||||
radio_c_label->BorderWidth(0);
|
||||
radio_c_label->Size({20_px, 20_px});
|
||||
radio_c_label->AutoFitSizeToText(true);
|
||||
radio_c_label->SetContent("C ");
|
||||
radio_c_label->SetTextSize(12);*/
|
||||
|
||||
return widget_list;
|
||||
}
|
||||
|
||||
|
@@ -30,9 +30,9 @@ namespace JUI {
|
||||
Vector2 size = this->font.MeasureString(this->content, this->text_size);
|
||||
//size += pad_shrinks_size_by*2.f;
|
||||
|
||||
if (abs_size.x < size.x)
|
||||
//if (abs_size.x < size.x)
|
||||
this->size.X.Pixels = size.x;
|
||||
if (abs_size.y < size.y)
|
||||
//if (abs_size.y < size.y)
|
||||
this->size.Y.Pixels = size.y;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user