diff options
Diffstat (limited to 'src/script/lua_api/CMakeLists.txt')
0 files changed, 0 insertions, 0 deletions
![]() |
index : minetest.git | |
modified minetest for gpcfs purposes | gpcf |
aboutsummaryrefslogtreecommitdiff |
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "guiButton.h"
#include "client/guiscalingfilter.h"
#include "client/tile.h"
#include "IGUISkin.h"
#include "IGUIEnvironment.h"
#include "IVideoDriver.h"
#include "IGUIFont.h"
#include "irrlicht_changes/static_text.h"
#include "porting.h"
#include "StyleSpec.h"
#include "util/numeric.h"
using namespace irr;
using namespace gui;
// Multiply with a color to get the default corresponding hovered color
#define COLOR_HOVERED_MOD 1.25f
// Multiply with a color to get the default corresponding pressed color
#define COLOR_PRESSED_MOD 0.85f
//! constructor
GUIButton::GUIButton(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
bool noclip)
: IGUIButton(environment, parent, id, rectangle),
SpriteBank(0), OverrideFont(0),
OverrideColorEnabled(false), OverrideColor(video::SColor(101,255,255,255)),
ClickTime(0), HoverTime(0), FocusTime(0),
ClickShiftState(false), ClickControlState(false),
IsPushButton(false), Pressed(false),
UseAlphaChannel(false), DrawBorder(true), ScaleImage(false), TSrc(tsrc)
{
setNotClipped(noclip);
// This element can be tabbed.
setTabStop(true);
setTabOrder(-1);
// PATCH
for (size_t i = 0; i < 4; i++) {
Colors[i] = Environment->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
}
StaticText = gui::StaticText::add(Environment, Text.c_str(), core::rect<s32>(0,0,rectangle.getWidth(),rectangle.getHeight()), false, false, this, id);
StaticText->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
// END PATCH
}
//! destructor
GUIButton::~GUIButton()
{
if (OverrideFont)
OverrideFont->drop();
if (SpriteBank)
SpriteBank->drop();
}
//! Sets if the images should be scaled to fit the button
void GUIButton::setScaleImage(bool scaleImage)
{
ScaleImage = scaleImage;
}
//! Returns whether the button scale the used images
bool GUIButton::isScalingImage() const
{
return ScaleImage;
}
//! Sets if the button should use the skin to draw its border
void GUIButton::setDrawBorder(bool border)
{
DrawBorder = border;
}
void GUIButton::setSpriteBank(IGUISpriteBank* sprites)
{
if (sprites)
sprites->grab();
if (SpriteBank)
SpriteBank->drop();
SpriteBank = sprites;
}
void GUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop, bool scale)
{