From ba366729fe3d98f964d249a2963d8ce2e632636b Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Wed, 19 Jul 2023 01:00:49 +0200 Subject: [PATCH] Add margin to Transform --- src/Widget.cpp | 4 ++++ src/Widget.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Widget.cpp b/src/Widget.cpp index f69e1ac..dd18b32 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -173,6 +173,10 @@ void Widget::ApplyPropertiesToWidget() gtk_widget_set_valign(m_Widget, Utils::ToGtkAlign(m_VerticalTransform.alignment)); gtk_widget_set_hexpand(m_Widget, m_HorizontalTransform.expand); gtk_widget_set_vexpand(m_Widget, m_VerticalTransform.expand); + gtk_widget_set_margin_start(m_Widget, m_HorizontalTransform.marginBefore); + gtk_widget_set_margin_end(m_Widget, m_HorizontalTransform.marginAfter); + gtk_widget_set_margin_top(m_Widget, m_VerticalTransform.marginBefore); + gtk_widget_set_margin_bottom(m_Widget, m_VerticalTransform.marginAfter); if (m_OnCreate) m_OnCreate(*this); diff --git a/src/Widget.h b/src/Widget.h index bfb2e95..30b9a51 100644 --- a/src/Widget.h +++ b/src/Widget.h @@ -18,6 +18,10 @@ struct Transform int size = -1; bool expand = true; Alignment alignment = Alignment::Fill; + // Left/Top + int marginBefore = 0; + // Right/Bottom + int marginAfter = 0; }; enum class Orientation