// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz // http://chaosforge.org/ // // This file is part of NV Libraries. // For conditions of distribution and use, see copyright notice in nv.hh /** * @file gui_element.hh * @author Kornel Kisielewicz * @brief GUI Element */ #ifndef NV_GUI_ELEMENT_HH #define NV_GUI_ELEMENT_HH #include #include #include #include namespace nv { namespace gui { class element { protected: /// List type typedef std::list list; explicit element( const rectangle& r ) : m_id( "" ) , m_parent( nullptr ) , m_children() , m_child_count(0) , m_class("") , m_relative( r ) , m_absolute( r ) , m_enabled( true ) , m_visible( true ) , m_dirty( true ) , m_render_data( nullptr ) {} protected: virtual ~element() { delete m_render_data; } protected: friend class environment; friend class renderer; friend class style; string m_id; ///< id type of the object element* m_parent; ///< pointer to parent list m_children; ///< children objects size_t m_child_count; ///< number of children string m_class; ///< Class name. string m_text; ///< Displayed label or text. rectangle m_relative; ///< Position relative to parent. rectangle m_absolute; ///< Position relative to window/screen. bool m_enabled; ///< Whether the element accepts events. bool m_visible; ///< Whether the element is drawn. bool m_dirty; ///< Whether the element needs updating. render_data* m_render_data; ///< -?- }; } // namespace gui } // namespace nv #endif // NV_GUI_ELEMENT_HH