3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "guiButton.h"
21 #include "IGUIButton.h"
25 class GUIButtonImage : public GUIButton
29 GUIButtonImage(gui::IGUIEnvironment *environment, gui::IGUIElement *parent,
30 s32 id, core::rect<s32> rectangle, bool noclip = false);
32 virtual bool OnEvent(const SEvent& event) override;
34 void setForegroundImage(gui::EGUI_BUTTON_IMAGE_STATE state,
35 video::ITexture *image = nullptr,
36 const core::rect<s32> &sourceRect = core::rect<s32>(0, 0, 0, 0));
38 void setForegroundImage(video::ITexture *image = nullptr);
39 void setForegroundImage(video::ITexture *image, const core::rect<s32> &pos);
41 void setPressedForegroundImage(video::ITexture *image = nullptr);
42 void setPressedForegroundImage(video::ITexture *image, const core::rect<s32> &pos);
44 void setHoveredForegroundImage(video::ITexture *image = nullptr);
45 void setHoveredForegroundImage(video::ITexture *image, const core::rect<s32> &pos);
47 virtual void setFromStyle(const StyleSpec &style, ISimpleTextureSource *tsrc) override;
49 virtual void setScaleImage(bool scaleImage=true) override;
51 //! Do not drop returned handle
52 static GUIButtonImage *addButton(gui::IGUIEnvironment *environment,
53 const core::rect<s32> &rectangle, IGUIElement *parent, s32 id,
54 const wchar_t *text, const wchar_t *tooltiptext = L"");
57 ButtonImage m_foreground_images[gui::EGBIS_COUNT];
58 gui::IGUIImage *m_image;