AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AMenu.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 Alex2772 and Contributors
    4 *
    5 * SPDX-License-Identifier: MPL-2.0
    6 *
    7 * This Source Code Form is subject to the terms of the Mozilla Public
    8 * License, v. 2.0. If a copy of the MPL was not distributed with this
    9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   10 */
   11
   12//
   13// Created by alex2 on 5/13/2021.
   14//
   15
   16
   17#pragma once
   18
   19
   20#include <AUI/Common/AString.h>
   21#include <AUI/Common/AVector.h>
   22#include "AShortcut.h"
   23
   24class IMenuProvider;
   25struct AMenuItem;
   26
   27using AMenuModel = AVector<AMenuItem>;
   28
   29class API_AUI_VIEWS AMenu {
   30private:
   31    static _<IMenuProvider>& provider();
   32public:
   33    static void show(const AMenuModel& model);
   34    static void close();
   35    static bool isOpen();
   36
   37    enum Type {
   38        SINGLE,
   39        SUBLIST,
   40        SEPARATOR
   41    };
   42};
   43
   44
   46    AMenu::Type type = AMenu::SINGLE;
   47    AString name;
   48    AShortcut shortcut;
   49    std::function<void()> onAction;
   50    AVector<AMenuItem> subItems;
   51    bool enabled = true;
   52};
   53
Definition AMenu.h:29
Definition AShortcut.h:23
Represents a Unicode character string.
Definition AString.h:38
A std::vector with AUI extensions.
Definition AVector.h:39
Definition IMenuProvider.h:17
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
Definition AMenu.h:45