AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
APathChooserView.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 15.04.2021.
   14//
   15
   16
   17#pragma once
   18
   19
   20#include "AViewContainer.h"
   21#include "ATextField.h"
   22
   27class API_AUI_VIEWS APathChooserView: public AViewContainerBase {
   28private:
   29    _<ATextField> mPathField;
   30
   31public:
   32    explicit APathChooserView(const APath& defaultPath = "");
   33
   34    void setPath(const APath& path);
   35    APath getPath() const;
   36
   37    auto path() {
   38        return APropertyDef {
   39            this,
   40            &APathChooserView::getPath,
   41            &APathChooserView::setPath,
   42            changed,
   43        };
   44    }
   45
   46signals:
   47    emits<APath> changed;
   48};
   49
   50
   51
   52template<>
   54public:
   55    static auto setup(const _<APathChooserView>& v) {}
   56
   57    static auto property(const _<APathChooserView>& v) {
   58        return v->path();
   59    }
   60
   61    static auto getGetter() {
   62        return &APathChooserView::changed;
   63    }
   64    static auto getSetter() {
   65        return &APathChooserView::setPath;
   66    }
   67};
A text field with "..." button prompting path.
Definition APathChooserView.h:27
An add-on to AString with functions for working with the path.
Definition APath.h:128
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:572
Defines how View handles properties of FieldType type.
Definition ADataBinding.h:37
static void(View::*)(const FieldType &v) getSetter()
Returns setter for ADataBinding (deprecated)
Definition ADataBinding.h:63
static void setup(const _< View > &view)
Called then view linked with field.
Definition ADataBinding.h:43
static auto property(const _< View > &view)
Returns property definition for FieldType.
Definition ADataBinding.h:49
static ASignal< FieldType >View::* getGetter()
Returns getter for ADataBinding (deprecated)
Definition ADataBinding.h:55
Property implementation to use with custom getter/setter.
Definition AProperty.h:234