Skip to content

ass::Opacity#

Controls the opacity of AView.

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

Examples#

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

7GUIs Cells — Spreadsheet processor (Excel).

};

static _<AView> labelTitle(AString s) {
    return _new<ALabel>(std::move(s)) AUI_OVERRIDE_STYLE {
        Opacity { 0.5f },
        ATextAlign::CENTER,
    };
}

class CellView : public AViewContainer {
examples/app/notes/src/main.cpp

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

        Label {
          .text = AUI_REACT(stringOneLinePreview(note->content)),
        } AUI_OVERRIDE_STYLE {
              ATextOverflow::ELLIPSIS,
              Opacity { 0.7f },
            },
    } AUI_OVERRIDE_STYLE {
        Padding { 4_dp, 8_dp },
        BorderRadius { 8_dp },
        Margin { 4_dp, 8_dp },
examples/ui/contacts/src/main.cpp

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

            auto firstLetter = groupLetter(firstContact->displayName);
            ALogger::info("Test") << "Computing view for group " << AString(1, firstLetter);
            return Vertical {
                Label { firstLetter } AUI_OVERRIDE_STYLE {
                                        Opacity(0.5f),
                                        Padding { 12_dp, 0, 4_dp },
                                        Margin { 0 },
                                        FontSize { 8_pt },
                                      },
                common_views::divider(),
examples/ui/contacts/src/view/ContactDetailsView.cpp

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

_<AView> profilePhoto(const _<Contact>& contact) {
    return Centered {
        Label {
          AUI_REACT(contact->displayName->empty() ? "?" : AString(1, contact->displayName->first()).uppercase())
        } AUI_OVERRIDE_STYLE { Opacity(0.5f), FontSize { 32_dp } },
    } AUI_OVERRIDE_STYLE {
        FixedSize { 64_dp },
        BorderRadius { 32_dp },
        BackgroundGradient { AColor::GRAY.lighter(0.5f), AColor::GRAY, 163_deg },
    };