Mercurial > malikania
view libmlk-client/malikania/client/theme.hpp @ 214:e2574aa8301d
client: add basic input text, closes #910
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 01 Sep 2019 06:53:48 +0200 |
parents | 263122adef77 |
children |
line wrap: on
line source
/* * theme.hpp -- theming support for gui elements * * Copyright (c) 2013-2018 David Demelier <markand@malikania.fr> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef MALIKANIA_CLIENT_THEME_HPP #define MALIKANIA_CLIENT_THEME_HPP /** * \file theme.hpp * \brief Theming support for gui elements. */ #include <memory> #include <malikania/size.hpp> #include "color.hpp" #include "font.hpp" namespace mlk { struct rectangle; namespace client { class button; class input; class label; class painter; /** * \brief Reimplement this class to provide your own theme. */ class theme { private: static theme* global; font font_; color background_color_; color border_color_; color text_color_; public: /** * Get the default theme for whole game. * * \return the theme */ static auto get_default() noexcept -> theme&; /** * Set the default theme. * * \param theme the theme */ static void set_default(theme& theme) noexcept; /** * Default constructor. */ theme(); /** * Virtual destructor defaulted. */ virtual ~theme() noexcept = default; /** * Get the font. * * \return the font */ virtual auto get_font() const noexcept -> const font&; /** * Overloaded function. * * \return the font */ virtual auto get_font() noexcept -> font&; /** * Get the background color for basic widgets. * * \return the color */ virtual auto get_background_color() const noexcept -> const color&; /** * Get the border color for basic widgets. * * \return the color */ virtual auto get_border_color() const noexcept -> const color&; /** * Get the text color for basic widgets. * * \return the color */ virtual auto get_text_color() const noexcept -> const color&; /** * Draw a button. * * \param painter the painter * \param button the button */ virtual void draw_button(painter& painter, const button& button); /** * Draw a label. * * \param painter the painter * \param label the label */ virtual void draw_label(painter& painter, const label& label); /** * Draw an input text. * * \param painter the painter * \param input the input */ virtual void draw_input(painter& painter, const input& input); }; } // !client } // !mlk #endif // !MALIKANIA_CLIENT_THEME_HPP