AUI Framework
develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ADropdownList.h
1
/*
2
* AUI Framework - Declarative UI toolkit for modern C++20
3
* Copyright (C) 2020-2024 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 21.09.2020.
14
//
15
16
#pragma once
17
18
19
#include "AButton.h"
20
#include <AUI/Model/IListModel.h>
21
#include <AUI/Platform/AOverlappingSurface.h>
22
27
class
API_AUI_VIEWS ADropdownList:
public
AButton {
28
private
:
29
_<IListModel<AString>
> mModel;
30
int
mSelectionId = 0;
31
bool
mPopup =
false
;
32
_weak<AOverlappingSurface>
mComboWindow;
33
34
protected
:
35
virtual
void
updateText();
36
virtual
void
onComboBoxWindowCreated();
37
38
_<AViewContainer>
comboWindow() {
39
return
mComboWindow.lock();
40
}
41
42
public
:
43
explicit
ADropdownList(
const
_
<
IListModel<AString>
>& model);
44
ADropdownList();
45
~ADropdownList()
override
;
46
50
auto
selectionId
()
const
{
51
return
APropertyDef
{
52
this
,
53
&ADropdownList::getSelectionId,
54
&ADropdownList::setSelectionId,
55
selectionChanged,
56
};
57
}
58
59
void
setModel(
const
_
<
IListModel<AString>
>& model);
60
void
render
(
ARenderContext
context)
override
;
61
62
[[nodiscard]]
int
getSelectionId()
const
{
63
return
mSelectionId;
64
}
65
int
getSelectedId()
const
{
66
return
mSelectionId;
67
}
68
void
setSelectionId(
int
id
);
69
int
getContentMinimumWidth
()
override
;
70
71
void
onPointerReleased
(
const
APointerReleasedEvent& event)
override
;
72
73
void
destroyWindow();
74
75
[[nodiscard]]
76
const
_<IListModel<AString>>& getModel()
const
{
77
return
mModel;
78
}
79
80
signals:
81
emits<int>
selectionChanged;
82
};
83
84
AAbstractLabel::render
void render(ARenderContext context) override
Draws this AView. Noone should call this function except rendering routine.
Definition
AAbstractLabel.cpp:28
AAbstractLabel::getContentMinimumWidth
int getContentMinimumWidth() override
Definition
AAbstractLabel.cpp:34
ADropdownList::selectionId
auto selectionId() const
Selected id property.
Definition
ADropdownList.h:50
AView::onPointerReleased
virtual void onPointerReleased(const APointerReleasedEvent &event)
Called on pointer (mouse) released event.
Definition
AView.cpp:366
IListModel
Definition
IListModel.h:23
_
An std::weak_ptr with AUI extensions.
Definition
SharedPtrTypes.h:178
emits
ASignal< Args... > emits
A signal declaration.
Definition
ASignal.h:348
APropertyDef
Property implementation to use with custom getter/setter.
Definition
AProperty.h:308
ARenderContext
Render context passed to AView::render.
Definition
ARenderContext.h:43
_weak
An std::weak_ptr with AUI extensions.
Definition
SharedPtrTypes.h:51