Skip to content

ass::Margin#

Controls view's margins.

Header:#include <AUI/ASS/Property/Margin.h>
CMake:aui_link(my_target PUBLIC aui::views)

Detailed Description#

See AUI Box Model.

Examples#

examples/7guis/cells/src/main.cpp

7GUIs Cells — Spreadsheet processor (Excel).

        ALayoutInflater::inflate(
            this,
            _new<ATextField>() AUI_OVERRIDE_STYLE {
                  MinSize { 0 },
                  Margin { 0 },
                  BorderRadius { 0 },
                } AUI_LET {
                    it && mState->currentExpression;
                    it->focus();
                    connect(it->focusLost, me::commitExpression);
examples/7guis/temperature_converter/src/main.cpp

7GUIs Temperature Converter — Fahrenheit to Celsius and vice versa.

                biConnect(it->value(), mCelsius);
                it->focus();
            },
            Label { "°C" },
            Label { "=" } AUI_OVERRIDE_STYLE { Margin { {}, 16_dp } },
            myPicker() AUI_LET { biConnect(it->value(), mFahrenheit); },
            Label { "°F" },
          } AUI_OVERRIDE_STYLE { LayoutSpacing { 4_dp } },
        });
examples/app/minesweeper/src/Style.cpp

Minesweeper Game — Minesweeper game implementation driven by ass.

          {
            class_of(".frame"),
            Border { 1_dp, 0x444444_rgb },
          },
          { class_of(".frame") > t<AButton>(), Margin { 4_dp } },
          { t<NewGameWindow>(), Padding { 4_dp } },
        });
    }
} s;
examples/app/notes/src/main.cpp

Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.

            },
    } AUI_OVERRIDE_STYLE {
        Padding { 4_dp, 8_dp },
        BorderRadius { 8_dp },
        Margin { 4_dp, 8_dp },
    };
}
/// [notePreview]

/// [noteEditor]
examples/ui/contacts/src/main.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

                            Label { AUI_REACT("{} contact(s)"_format(mContactCount)) } AUI_LET {
                                AObject::connect(AUI_REACT(ass::PropertyList{
                                    FontSize { 10_pt },
                                    ATextAlign::CENTER,
                                    Margin { 8_dp },
                                    mSearchQuery->empty() ? Visibility::VISIBLE : Visibility::GONE,
                                }), AUI_SLOT(it)::setCustomStyle);
                            },
                          } AUI_OVERRIDE_STYLE { Padding(0, 8_dp) })
                      .build() AUI_OVERRIDE_STYLE { Expanding(0, 1), MinSize(200_dp) },
examples/ui/views/src/ExampleWindow.cpp

Views Example — All-in-one views building example.

                  AUI_UI_THREAD {
                      auto view = Icon { drawable } AUI_OVERRIDE_STYLE {
                          FixedSize { 80_dp, 20_dp },
                          BackgroundImage { {}, {}, {}, Sizing::COVER },
                          Margin { 4_dp },
                          ACursor::POINTER,
                      };
                      connect(view->clicked, [] {
                          APlatform::openUrl("https://github.com/aui-framework/aui/stargazers");
                      });
examples/ui/contacts/src/view/ContactDetailsView.cpp

AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

                profilePhoto(mContact),
                Centered::Expanding {
                  presentation(mContact->displayName) AUI_OVERRIDE_STYLE { FontSize { 12_pt } },
                },
              } AUI_OVERRIDE_STYLE { Margin { 8_dp, {} }, LayoutSpacing { 4_dp } },
              row("Phone", mContact->phone),
              row("Address", mContact->address),
              row("Email", mContact->email),
              row("Homepage", mContact->homepage),
              Horizontal::Expanding {