mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2025-04-07 05:56:53 +02:00
Layout for mod details panel, add gap property setters
This commit is contained in:
parent
4d904fbb50
commit
1e91bddeff
@ -424,4 +424,17 @@ namespace recompui {
|
||||
set_property(Rml::PropertyId::TextAlign, to_rml(text_align), Animation());
|
||||
}
|
||||
|
||||
void Style::set_gap(float size, Unit unit, Animation animation) {
|
||||
set_row_gap(size, unit, animation);
|
||||
set_column_gap(size, unit, animation);
|
||||
}
|
||||
|
||||
void Style::set_row_gap(float size, Unit unit, Animation animation) {
|
||||
set_property(Rml::PropertyId::RowGap, Rml::Property(size, to_rml(unit)), animation);
|
||||
}
|
||||
|
||||
void Style::set_column_gap(float size, Unit unit, Animation animation) {
|
||||
set_property(Rml::PropertyId::ColumnGap, Rml::Property(size, to_rml(unit)), animation);
|
||||
}
|
||||
|
||||
} // namespace recompui
|
@ -77,6 +77,9 @@ namespace recompui {
|
||||
void set_font_style(FontStyle style);
|
||||
void set_font_weight(uint32_t weight, Animation animation = Animation());
|
||||
void set_text_align(TextAlign text_align);
|
||||
void set_gap(float size, Unit unit = Unit::Dp, Animation animation = Animation());
|
||||
void set_row_gap(float size, Unit unit = Unit::Dp, Animation animation = Animation());
|
||||
void set_column_gap(float size, Unit unit = Unit::Dp, Animation animation = Animation());
|
||||
};
|
||||
|
||||
} // namespace recompui
|
@ -7,15 +7,19 @@ namespace recompui {
|
||||
ModDetailsPanel::ModDetailsPanel(Element *parent) : Element(parent) {
|
||||
set_flex(1.0f, 1.0f, 200.0f);
|
||||
set_height(100.0f, Unit::Percent);
|
||||
set_display(Display::Flex);
|
||||
set_flex_direction(FlexDirection::Column);
|
||||
set_border_bottom_right_radius(16.0f);
|
||||
set_background_color(Color{ 190, 184, 219, 25 });
|
||||
|
||||
header_container = new Container(FlexDirection::Row, JustifyContent::FlexStart, this);
|
||||
header_container->set_flex(0.0f, 0.0f);
|
||||
header_container->set_padding(16.0f);
|
||||
header_container->set_gap(16.0f);
|
||||
header_container->set_background_color(Color{ 0, 0, 0, 89 });
|
||||
{
|
||||
thumbnail_container = new Container(FlexDirection::Column, JustifyContent::SpaceEvenly, header_container);
|
||||
thumbnail_container->set_flex(0.0f, 0.0f);
|
||||
{
|
||||
thumbnail_image = new Image(thumbnail_container);
|
||||
thumbnail_image->set_width(100.0f);
|
||||
@ -24,10 +28,9 @@ ModDetailsPanel::ModDetailsPanel(Element *parent) : Element(parent) {
|
||||
}
|
||||
|
||||
header_details_container = new Container(FlexDirection::Column, JustifyContent::SpaceEvenly, header_container);
|
||||
header_details_container->set_width(100.0f, Unit::Percent);
|
||||
header_details_container->set_margin_left(32.0f);
|
||||
header_details_container->set_overflow(Overflow::Hidden);
|
||||
|
||||
header_details_container->set_flex(1.0f, 1.0f);
|
||||
header_details_container->set_flex_basis(100.0f, Unit::Percent);
|
||||
header_details_container->set_text_align(TextAlign::Left);
|
||||
{
|
||||
title_label = new Label(LabelStyle::Large, header_details_container);
|
||||
version_label = new Label(LabelStyle::Normal, header_details_container);
|
||||
@ -35,19 +38,26 @@ ModDetailsPanel::ModDetailsPanel(Element *parent) : Element(parent) {
|
||||
}
|
||||
|
||||
body_container = new recompui::Container(FlexDirection::Column, JustifyContent::FlexStart, this);
|
||||
body_container->set_padding_left(16.0f);
|
||||
body_container->set_flex(0.0f, 0.0f);
|
||||
body_container->set_text_align(TextAlign::Left);
|
||||
body_container->set_padding(16.0f);
|
||||
body_container->set_gap(16.0f);
|
||||
{
|
||||
description_label = new Label(LabelStyle::Normal, body_container);
|
||||
authors_label = new Label(LabelStyle::Normal, body_container);
|
||||
spacer_element = new Element(body_container);
|
||||
buttons_container = new Container(FlexDirection::Row, JustifyContent::SpaceAround, body_container);
|
||||
buttons_container->set_padding_left(16.0f);
|
||||
{
|
||||
enable_toggle = new Toggle(buttons_container);
|
||||
enable_toggle->add_checked_callback(std::bind(&ModDetailsPanel::enable_toggle_checked, this, std::placeholders::_1));
|
||||
configure_button = new Button("Configure", recompui::ButtonStyle::Secondary, buttons_container);
|
||||
erase_button = new Button("Erase", recompui::ButtonStyle::Secondary, buttons_container);
|
||||
}
|
||||
}
|
||||
|
||||
spacer_element = new Element(this);
|
||||
spacer_element->set_flex(1.0f, 0.0f);
|
||||
|
||||
buttons_container = new Container(FlexDirection::Row, JustifyContent::SpaceAround, this);
|
||||
buttons_container->set_flex(0.0f, 0.0f);
|
||||
buttons_container->set_padding(16.0f);
|
||||
{
|
||||
enable_toggle = new Toggle(buttons_container);
|
||||
enable_toggle->add_checked_callback(std::bind(&ModDetailsPanel::enable_toggle_checked, this, std::placeholders::_1));
|
||||
configure_button = new Button("Configure", recompui::ButtonStyle::Secondary, buttons_container);
|
||||
erase_button = new Button("Erase", recompui::ButtonStyle::Secondary, buttons_container);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user