Implemented view change and trash in file selector, and moved more file IO to SDL file IO
This commit is contained in:
parent
b81b33660e
commit
9ea5a1eae9
15 changed files with 585 additions and 203 deletions
20
src/GUIStuff/Elements/MutableTextLabel.cpp
Normal file
20
src/GUIStuff/Elements/MutableTextLabel.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "MutableTextLabel.hpp"
|
||||
#include "../GUIManager.hpp"
|
||||
|
||||
namespace GUIStuff {
|
||||
|
||||
MutableTextLabel::MutableTextLabel(GUIManager& gui): Element(gui) {}
|
||||
|
||||
void MutableTextLabel::layout(const Clay_ElementId& id, const std::string& text, Clay_TextElementConfig* textConfig) {
|
||||
if(text != oldText) {
|
||||
oldText = text;
|
||||
gui.invalidate_draw_element(this);
|
||||
}
|
||||
CLAY(id, {
|
||||
.layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}}
|
||||
}) {
|
||||
CLAY_TEXT(gui.strArena.std_str_to_clay_str(text), textConfig);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
15
src/GUIStuff/Elements/MutableTextLabel.hpp
Normal file
15
src/GUIStuff/Elements/MutableTextLabel.hpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "Element.hpp"
|
||||
#include "Helpers/ConvertVec.hpp"
|
||||
|
||||
namespace GUIStuff {
|
||||
|
||||
class MutableTextLabel : public Element {
|
||||
public:
|
||||
MutableTextLabel(GUIManager& gui);
|
||||
void layout(const Clay_ElementId& id, const std::string& text, Clay_TextElementConfig* textConfig);
|
||||
private:
|
||||
std::string oldText;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -17,15 +17,6 @@ void PositionAdjustingPopupMenu::layout(const Clay_ElementId& id, Vector2f popup
|
|||
|
||||
layoutElement = gui.element<LayoutElement>("popup", [&] (LayoutElement*, const Clay_ElementId& lId) {
|
||||
CLAY(lId, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIT(100), .height = CLAY_SIZING_FIT(0)},
|
||||
.padding = CLAY_PADDING_ALL(gui.io.theme->padding1),
|
||||
.childGap = 1,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||
},
|
||||
.backgroundColor = convert_vec4<Clay_Color>(gui.io.theme->backColor1),
|
||||
.cornerRadius = CLAY_CORNER_RADIUS(gui.io.theme->windowCorners1),
|
||||
.floating = {
|
||||
.offset = {popupPos.x(), popupPos.y()},
|
||||
.zIndex = gui.get_z_index(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue