1 /* ImageIcon.hpp 2 * Copyright (C) 2019 Sven Jähnichen 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef ICON_HPP_ 19 #define ICON_HPP_ 20 21 #include "Widget.hpp" 22 23 namespace BWidgets 24 { 25 /** 26 * Class BWidgets::Icon 27 * 28 * Widget displaying an icon. 29 */ 30 class Icon : public Widget 31 { 32 public: 33 Icon (); 34 Icon (const double x, const double y, const double width, const double height, const std::string& name); 35 36 /** 37 * Creates a new (orphan) image icon widget and copies the widget 38 * properties from a source image icon widget. This method doesn't 39 * copy any parent or child widgets. 40 * @param that Source drawing surface widget 41 */ 42 Icon (const Icon& that); 43 44 ~Icon (); 45 46 /** 47 * Assignment. Copies the widget properties from a source widget and keeps 48 * its name and its position within the widget tree. Emits a 49 * BEvents::ExposeEvent if the widget is visible. 50 * @param that Source widget 51 */ 52 Icon& operator= (const Icon& that); 53 54 /** 55 * Pattern cloning. Creates a new instance of the widget and copies all 56 * its properties. 57 */ 58 virtual Widget* clone () const override; 59 60 cairo_surface_t* getIconSurface (BColors::State state) const; 61 62 protected: 63 virtual void draw (const BUtilities::RectArea& area) override; 64 65 std::vector<cairo_surface_t*> iconSurface; 66 }; 67 68 } 69 70 #endif /* ICON_HPP_ */ 71