2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2019-12-09 15:06:51 -05:00
|
|
|
|
2020-05-23 13:23:05 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-12-09 15:06:51 -05:00
|
|
|
#include "guiButton.h"
|
|
|
|
#include "IGUIButton.h"
|
2022-07-03 05:52:26 -07:00
|
|
|
#include "guiAnimatedImage.h"
|
2023-06-06 19:01:32 +02:00
|
|
|
#include "irr_ptr.h"
|
2019-12-09 15:06:51 -05:00
|
|
|
|
|
|
|
using namespace irr;
|
|
|
|
|
|
|
|
class GUIButtonImage : public GUIButton
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//! constructor
|
|
|
|
GUIButtonImage(gui::IGUIEnvironment *environment, gui::IGUIElement *parent,
|
2020-04-11 16:39:30 -04:00
|
|
|
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
|
|
|
|
bool noclip = false);
|
2019-12-09 15:06:51 -05:00
|
|
|
|
2023-06-06 19:01:32 +02:00
|
|
|
void setForegroundImage(irr_ptr<video::ITexture> image = nullptr,
|
2022-07-03 05:52:26 -07:00
|
|
|
const core::rect<s32> &middle = core::rect<s32>());
|
2019-12-09 15:06:51 -05:00
|
|
|
|
2020-04-11 16:39:30 -04:00
|
|
|
//! Set element properties from a StyleSpec
|
2022-07-03 05:52:26 -07:00
|
|
|
virtual void setFromStyle(const StyleSpec &style) override;
|
2019-12-09 15:06:51 -05:00
|
|
|
|
|
|
|
//! Do not drop returned handle
|
|
|
|
static GUIButtonImage *addButton(gui::IGUIEnvironment *environment,
|
2020-04-11 16:39:30 -04:00
|
|
|
const core::rect<s32> &rectangle, ISimpleTextureSource *tsrc,
|
|
|
|
IGUIElement *parent, s32 id, const wchar_t *text,
|
|
|
|
const wchar_t *tooltiptext = L"");
|
2019-12-09 15:06:51 -05:00
|
|
|
|
|
|
|
private:
|
2023-06-06 19:01:32 +02:00
|
|
|
irr_ptr<video::ITexture> m_foreground_image;
|
|
|
|
irr_ptr<GUIAnimatedImage> m_image;
|
2019-12-09 15:06:51 -05:00
|
|
|
};
|