AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AButton Class Reference

Button with text, which can be pushed to make some action. More...

#include <AUI/View/AButton.h>

Detailed Description

Button is a fundamental view which can be pushed to make some action.

The button view being pressed.

Button is styled with background, box shadow, and a border that highlights on hover. When pushed, the shadow disappears, making an illusion of pressing.

Button can be made default. In such case, it is colored to user's accent color, making it stand out. Also, when the user presses Enter, the button is pushed automatically.

Button usually contains text only, but in practice any view can be put in it.

/*
* AUI Framework - Declarative UI toolkit for modern C++20
* Copyright (C) 2020-2025 Alex2772 and Contributors
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <AUI/Platform/Entry.h>
#include <AUI/Platform/AWindow.h>
#include <AUI/Util/UIBuildingHelpers.h>
#include <AUI/View/AButton.h>
using namespace ass;
using namespace declarative;
    auto window = _new<AWindow>("Button", 600_dp, 300_dp);
    window->setContents(Centered {
      Button { "Click me" },
    });
    window->show();
    return 0;
}
#define AUI_ENTRY
Application entry point.
Definition Entry.h:90
Declarative form of AButton.
Definition AButton.h:87

See declarative::Button for a declarative form and examples.

Member Function Documentation

> All members, including inherited

◆ consumesClick()

bool AButton::consumesClick ( const glm::ivec2 & pos)
overridevirtual
Parameters
posmouse position
Returns
true if AView processes this click

Used in AViewContainer::getViewAt method subset, thus affecting click event handling.

Reimplemented from AView.