Sync push
This commit is contained in:
parent
c98dd97670
commit
da0d6e0c19
6 changed files with 30 additions and 13 deletions
|
|
@ -21,11 +21,15 @@ window.backgroundColor = Color(rgba(120, 120, 120, 255))
|
||||||
|
|
||||||
(panel) {
|
(panel) {
|
||||||
backgroundColor = Color(#AAAAAAFF)
|
backgroundColor = Color(#AAAAAAFF)
|
||||||
borderColor = Color(#00FF00FF)
|
borderColor = Color(#000000FF)
|
||||||
borderRadius = 8
|
borderRadius = 8
|
||||||
borderWidth = 4
|
borderWidth = 4
|
||||||
showBorder = true
|
showBorder = true
|
||||||
padding = Rect(15, 15, 15, 15)
|
padding = Rect(15, 15, 15, 15)
|
||||||
|
showTitle = true
|
||||||
|
titleColor = Color(#000000FF)
|
||||||
|
titlebarType = "full"
|
||||||
|
titleHeight = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
(@testLabel label) {
|
(@testLabel label) {
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@
|
||||||
***implement file theme loading
|
***implement file theme loading
|
||||||
***Implemenmt MouseDragged callback
|
***Implemenmt MouseDragged callback
|
||||||
***Add scissoring to only draw inside the bounds of containers
|
***Add scissoring to only draw inside the bounds of containers
|
||||||
|
***Implement Drag And Drop
|
||||||
|
***Implement a way to determine on what widget (in the hierarchy chain) and event must stop
|
||||||
Add theme caching
|
Add theme caching
|
||||||
Implement mouse scroll callback
|
Implement mouse scroll callback
|
||||||
Implement a way to determine on what widget (in the hierarchy chain) and event must stop
|
|
||||||
Implement margin for widgets
|
Implement margin for widgets
|
||||||
|
Implement const in stylesheet
|
||||||
|
Implement color constants in stylesheet
|
||||||
|
|
||||||
|
|
||||||
Implement following widgets:
|
Implement following widgets:
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ namespace ogfx
|
||||||
m_borderWidth = getThemeValue<int32_t>(theme, "panel.borderWidth", 2);
|
m_borderWidth = getThemeValue<int32_t>(theme, "panel.borderWidth", 2);
|
||||||
m_showBorder = getThemeValue<bool>(theme, "panel.showBorder", true);
|
m_showBorder = getThemeValue<bool>(theme, "panel.showBorder", true);
|
||||||
m_borderColor = getThemeValue<ostd::Color>(theme, "panel.borderColor", ostd::Colors::Black);
|
m_borderColor = getThemeValue<ostd::Color>(theme, "panel.borderColor", ostd::Colors::Black);
|
||||||
|
m_titleColor = getThemeValue<ostd::Color>(theme, "panel.titleColor", ostd::Colors::Black);
|
||||||
|
m_showTitle = getThemeValue<bool>(theme, "panel.showTitle", false);
|
||||||
|
m_titleHeight = getThemeValue<float>(theme, "panel.titleHeight", 30);
|
||||||
|
m_titleType = getThemeValue<ostd::String>(theme, "panel.titleHeight", "text");
|
||||||
setPadding(getThemeValue<ostd::Rectangle>(theme, "panel.padding", { 15, 15, 15, 15 }));
|
setPadding(getThemeValue<ostd::Rectangle>(theme, "panel.padding", { 15, 15, 15, 15 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +58,6 @@ namespace ogfx
|
||||||
gfx.outlinedRoundRect({ getGlobalPosition(), getSize() }, getBackgroundColor(), m_borderColor, m_borderRadius, m_borderWidth);
|
gfx.outlinedRoundRect({ getGlobalPosition(), getSize() }, getBackgroundColor(), m_borderColor, m_borderRadius, m_borderWidth);
|
||||||
else
|
else
|
||||||
gfx.fillRoundRect({ getGlobalPosition(), getSize() }, getBackgroundColor(), m_borderRadius);
|
gfx.fillRoundRect({ getGlobalPosition(), getSize() }, getBackgroundColor(), m_borderRadius);
|
||||||
gfx.drawRect(getGlobalContentBounds(), ostd::Colors::Aquamarine, 6);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ namespace ogfx
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ostd::Color m_backgroundColor { 150, 150, 150 };
|
ostd::Color m_backgroundColor { 150, 150, 150 };
|
||||||
|
ostd::Color m_titleColor { 0, 0, 0 };
|
||||||
|
bool m_showTitle { false };
|
||||||
|
ostd::String m_titleType = "full";
|
||||||
|
float m_titleHeight { 30 };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@ namespace ogfx
|
||||||
public:
|
public:
|
||||||
Widget(const ostd::Rectangle& bounds, WindowCore& window);
|
Widget(const ostd::Rectangle& bounds, WindowCore& window);
|
||||||
bool addChild(Widget& child);
|
bool addChild(Widget& child);
|
||||||
ostd::Vec2 getGlobalPosition(void) const;
|
virtual ostd::Vec2 getGlobalPosition(void) const;
|
||||||
ostd::Vec2 getGlobalContentPosition(void) const;
|
virtual ostd::Vec2 getGlobalContentPosition(void) const;
|
||||||
ostd::Rectangle getGlobalBounds(void) const;
|
virtual ostd::Rectangle getGlobalBounds(void) const;
|
||||||
ostd::Rectangle getContentBounds(void) const;
|
virtual ostd::Rectangle getContentBounds(void) const;
|
||||||
ostd::Rectangle getGlobalContentBounds(void) const;
|
virtual ostd::Rectangle getGlobalContentBounds(void) const;
|
||||||
using ostd::Rectangle::contains;
|
using ostd::Rectangle::contains;
|
||||||
bool contains(ostd::Vec2 p, bool includeBounds = false) const override;
|
bool contains(ostd::Vec2 p, bool includeBounds = false) const override;
|
||||||
void enable(bool enable = true);
|
void enable(bool enable = true);
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,16 @@ class Window : public ogfx::gui::Window
|
||||||
pos = { event.mouse->position_x, event.mouse->position_y };
|
pos = { event.mouse->position_x, event.mouse->position_y };
|
||||||
});
|
});
|
||||||
m_panel1.setMouseDraggedCallback([&](const ogfx::gui::Event& event) -> void {
|
m_panel1.setMouseDraggedCallback([&](const ogfx::gui::Event& event) -> void {
|
||||||
|
if (m_panel1.getPressedMouseButton() == ogfx::MouseEventData::eButton::None)
|
||||||
|
return;
|
||||||
ostd::Vec2 pos2 { event.mouse->position_x, event.mouse->position_y };
|
ostd::Vec2 pos2 { event.mouse->position_x, event.mouse->position_y };
|
||||||
m_panel1.addPos(pos2 - pos);
|
m_panel1.addPos(pos2 - pos);
|
||||||
pos = pos2;
|
pos = pos2;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
m_panel2.setSize(300, 140);
|
m_panel2.setSize(600, 400);
|
||||||
m_panel2.setPosition(130, 200);
|
m_panel2.setPosition(170, 200);
|
||||||
m_panel2.setMousePressedCallback([&](const ogfx::gui::Event& event) -> void {
|
m_panel2.setMousePressedCallback([&](const ogfx::gui::Event& event) -> void {
|
||||||
ogfx::gui::Widget::setDragAndDropData(m_label3);
|
ogfx::gui::Widget::setDragAndDropData(m_label3);
|
||||||
setCursor(eCursor::Move);
|
setCursor(eCursor::Move);
|
||||||
|
|
@ -58,7 +60,7 @@ class Window : public ogfx::gui::Window
|
||||||
std::cout << "PRESS!\n";
|
std::cout << "PRESS!\n";
|
||||||
});
|
});
|
||||||
addWidget(m_label1);
|
addWidget(m_label1);
|
||||||
addWidget(m_panel1);
|
m_panel2.addChild(m_panel1);
|
||||||
addWidget(m_panel2);
|
addWidget(m_panel2);
|
||||||
|
|
||||||
m_label2.setPosition(0, 0);
|
m_label2.setPosition(0, 0);
|
||||||
|
|
@ -66,7 +68,7 @@ class Window : public ogfx::gui::Window
|
||||||
m_label2.connectSignal(ostd::BuiltinSignals::FileDragAndDropped);
|
m_label2.connectSignal(ostd::BuiltinSignals::FileDragAndDropped);
|
||||||
m_label2.addThemeID("testLabel");
|
m_label2.addThemeID("testLabel");
|
||||||
m_label2.addThemeID("testLabel2");
|
m_label2.addThemeID("testLabel2");
|
||||||
m_label2.setSignalCallback([&](ostd::Signal& signal){
|
m_label2.setSignalCallback([&](ostd::Signal& signal) -> void {
|
||||||
if (signal.ID == ostd::BuiltinSignals::FileDragAndDropped)
|
if (signal.ID == ostd::BuiltinSignals::FileDragAndDropped)
|
||||||
{
|
{
|
||||||
auto& data = (ogfx::DropEventData&)signal.userData;
|
auto& data = (ogfx::DropEventData&)signal.userData;
|
||||||
|
|
@ -95,6 +97,8 @@ class Window : public ogfx::gui::Window
|
||||||
m_panel1.addChild(m_label3);
|
m_panel1.addChild(m_label3);
|
||||||
|
|
||||||
setTheme(m_theme);
|
setTheme(m_theme);
|
||||||
|
|
||||||
|
std::cout << m_theme.get<ostd::String>("panel.titlebarType", "", {}, {}) << " \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void onSignal(ostd::Signal& signal) override
|
inline void onSignal(ostd::Signal& signal) override
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue