ManaPlus
popuplist.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef GUI_WIDGETS_POPUPLIST_H
23 #define GUI_WIDGETS_POPUPLIST_H
24 
26 
27 #include "gui/widgets/popup.h"
28 
30 
31 #include "localconsts.h"
32 
33 class DropDown;
34 class ListBox;
35 class ListModel;
36 class ScrollArea;
37 
38 class PopupList final : public Popup,
39  public FocusListener
40 {
41  public:
42  PopupList(DropDown *const widget,
43  ListModel *const listModel,
44  const bool extended,
45  const Modal modal);
46 
47  ~PopupList() override final;
48 
50 
51  void postInit() override final;
52 
53  void show(int x, int y);
54 
55  void widgetResized(const Event &event) override final;
56 
57  void setSelected(const int selected);
58 
59  int getSelected() const;
60 
61  void setListModel(ListModel *const model);
62 
64  { return mListModel; }
65 
66  void adjustSize();
67 
68  void focusGained(const Event& event A_UNUSED) override final;
69 
70  void focusLost(const Event& event A_UNUSED) override final;
71 
72  void mousePressed(MouseEvent& event) override final;
73 
74  void mouseReleased(MouseEvent& event) override final;
75 
76  private:
83 };
84 
85 #endif // GUI_WIDGETS_POPUPLIST_H
Definition: event.h:79
void widgetResized(const Event &event)
Definition: popuplist.cpp:101
PopupList(DropDown *const widget, ListModel *const listModel, const bool extended, const Modal modal)
Definition: popuplist.cpp:35
ListBox * mListBox
Definition: popuplist.h:78
ScrollArea * mScrollArea
Definition: popuplist.h:79
void setSelected(const int selected)
Definition: popuplist.cpp:107
int getSelected() const
Definition: popuplist.cpp:115
void setListModel(ListModel *const model)
Definition: popuplist.cpp:123
void adjustSize()
Definition: popuplist.cpp:130
void focusLost(const Event &event)
Definition: popuplist.cpp:185
int mPressedIndex
Definition: popuplist.h:81
void focusGained(const Event &event)
Definition: popuplist.cpp:166
void postInit()
Definition: popuplist.cpp:60
void mouseReleased(MouseEvent &event)
Definition: popuplist.cpp:147
ListModel * mListModel
Definition: popuplist.h:77
Modal mModal
Definition: popuplist.h:82
DropDown * mDropDown
Definition: popuplist.h:80
void mousePressed(MouseEvent &event)
Definition: popuplist.cpp:140
void show(int x, int y)
Definition: popuplist.cpp:82
ListModel * getListModel() const
Definition: popuplist.h:63
Definition: popup.h:52
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
#define A_UNUSED
Definition: localconsts.h:160
bool Modal
Definition: modal.h:30