| 1 | // Aseprite UI Library |
| 2 | // Copyright (C) 2001-2013, 2015 David Capello |
| 3 | // |
| 4 | // This file is released under the terms of the MIT license. |
| 5 | // Read LICENSE.txt for more information. |
| 6 | |
| 7 | #ifndef UI_COMPONENT_H_INCLUDED |
| 8 | #define UI_COMPONENT_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "base/disable_copying.h" |
| 12 | #include "ui/property.h" |
| 13 | |
| 14 | #include <map> |
| 15 | #include <string> |
| 16 | |
| 17 | namespace ui { |
| 18 | |
| 19 | // A component is a visual object, such as widgets or menus. |
| 20 | // |
| 21 | // Components are non-copyable. |
| 22 | class Component |
| 23 | { |
| 24 | public: |
| 25 | typedef std::map<std::string, PropertyPtr> Properties; |
| 26 | |
| 27 | Component(); |
| 28 | virtual ~Component(); |
| 29 | |
| 30 | PropertyPtr getProperty(const std::string& name) const; |
| 31 | void setProperty(PropertyPtr property); |
| 32 | |
| 33 | bool hasProperty(const std::string& name) const; |
| 34 | void removeProperty(const std::string& name); |
| 35 | |
| 36 | const Properties& getProperties() const; |
| 37 | |
| 38 | private: |
| 39 | Properties m_properties; |
| 40 | |
| 41 | DISABLE_COPYING(Component); |
| 42 | }; |
| 43 | |
| 44 | } // namespace ui |
| 45 | |
| 46 | #endif |
| 47 | |