libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UIList.hpp
Go to the documentation of this file.
1 #ifndef UILIST_HPP
2 #define UILIST_HPP
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio 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 Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "UIButton.hpp"
22 #include "UIBox.hpp"
23 
24 namespace AlgAudio{
25 
26 class UIList : public UIVBox{
27 public:
28  static std::shared_ptr<UIList> Create(std::weak_ptr<Window> parent_window);
29  void AddItem(std::string id, std::string text);
30  void Clear();
31  void SetColors(Color standard, Color highlight);
32  void SetHighlight(std::string id);
35 private:
36  UIList(std::weak_ptr<Window> parent_window);
37  std::map<std::string, std::shared_ptr<UIButton>> ids_to_buttons;
38  std::shared_ptr<UIButton> highlighted = nullptr;
39  Color standard_color = Theme::Get("bg-button-neutral");
40  Color highlight_color = Theme::Get("bg-button-positive");
41 };
42 
43 } // namespace AlgAudio
44 
45 #endif // UILIST_HPP
Definition: Color.hpp:28
void SetHighlight(std::string id)
Definition: UIBox.hpp:79
void SetColors(Color standard, Color highlight)
void AddItem(std::string id, std::string text)
Signal< std::string > on_clicked
Definition: UIList.hpp:34
Definition: Alertable.hpp:26
static std::shared_ptr< UIList > Create(std::weak_ptr< Window > parent_window)
Signal< std::string > on_pointed
Definition: UIList.hpp:33
Definition: UIList.hpp:26
static const Color & Get(const std::string &)