Turn dos files into unix files

This commit is contained in:
cx384 2024-03-22 00:46:19 +01:00 committed by Lars Müller
parent e79587c934
commit 3a35db6e67
5 changed files with 2512 additions and 2512 deletions

View File

@ -1,66 +1,66 @@
#include <windows.h> #include <windows.h>
#include <winuser.h> #include <winuser.h>
#include <commctrl.h> #include <commctrl.h>
#include <richedit.h> #include <richedit.h>
#ifndef USE_CMAKE_CONFIG_H #ifndef USE_CMAKE_CONFIG_H
#define USE_CMAKE_CONFIG_H #define USE_CMAKE_CONFIG_H
#endif #endif
#include "config.h" #include "config.h"
#undef USE_CMAKE_CONFIG_H #undef USE_CMAKE_CONFIG_H
#if RUN_IN_PLACE #if RUN_IN_PLACE
#define BUILDMODE "RUN_IN_PLACE=1" #define BUILDMODE "RUN_IN_PLACE=1"
#else #else
#define BUILDMODE "RUN_IN_PLACE=0" #define BUILDMODE "RUN_IN_PLACE=0"
#endif #endif
#ifdef __MINGW32__ #ifdef __MINGW32__
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "minetest.exe.manifest" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "minetest.exe.manifest"
#endif #endif
LANGUAGE 0, SUBLANG_NEUTRAL LANGUAGE 0, SUBLANG_NEUTRAL
130 ICON "minetest-icon.ico" 130 ICON "minetest-icon.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Version // Version
// //
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0 FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0 PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifndef NDEBUG #ifndef NDEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
#else #else
FILEFLAGS 0x0L FILEFLAGS 0x0L
#endif #endif
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP FILETYPE VFT_APP
FILESUBTYPE 0x0L FILESUBTYPE 0x0L
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "Comments", "" VALUE "Comments", ""
VALUE "CompanyName", PROJECT_NAME_C " community" VALUE "CompanyName", PROJECT_NAME_C " community"
VALUE "FileDescription", PROJECT_NAME_C " engine" VALUE "FileDescription", PROJECT_NAME_C " engine"
VALUE "FileVersion", VERSION_STRING VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", PROJECT_NAME VALUE "InternalName", PROJECT_NAME
VALUE "LegalCopyright", "(c) 2011-2015 celeron55" VALUE "LegalCopyright", "(c) 2011-2015 celeron55"
VALUE "LegalTrademarks", """Minetest"" is the property of the Minetest community, don't use it without permission!" VALUE "LegalTrademarks", """Minetest"" is the property of the Minetest community, don't use it without permission!"
VALUE "OriginalFilename", "minetest.exe" VALUE "OriginalFilename", "minetest.exe"
VALUE "PrivateBuild", VERSION_EXTRA VALUE "PrivateBuild", VERSION_EXTRA
VALUE "ProductName", PROJECT_NAME_C VALUE "ProductName", PROJECT_NAME_C
VALUE "ProductVersion", PRODUCT_VERSION_STRING VALUE "ProductVersion", PRODUCT_VERSION_STRING
VALUE "SpecialBuild", BUILDMODE VALUE "SpecialBuild", BUILDMODE
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
BEGIN BEGIN
VALUE "Translation", 0x409, 1200 VALUE "Translation", 0x409, 1200
END END
END END

File diff suppressed because it is too large Load Diff

View File

@ -1,280 +1,280 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt // Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once #pragma once
#include <IGUIStaticText.h> #include <IGUIStaticText.h>
#include "irrlicht_changes/static_text.h" #include "irrlicht_changes/static_text.h"
#include "IGUIButton.h" #include "IGUIButton.h"
#include "IGUISpriteBank.h" #include "IGUISpriteBank.h"
#include "ITexture.h" #include "ITexture.h"
#include "SColor.h" #include "SColor.h"
#include "guiSkin.h" #include "guiSkin.h"
#include "StyleSpec.h" #include "StyleSpec.h"
using namespace irr; using namespace irr;
class ISimpleTextureSource; class ISimpleTextureSource;
class GUIButton : public gui::IGUIButton class GUIButton : public gui::IGUIButton
{ {
public: public:
//! constructor //! constructor
GUIButton(gui::IGUIEnvironment* environment, gui::IGUIElement* parent, GUIButton(gui::IGUIEnvironment* environment, gui::IGUIElement* parent,
s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc, s32 id, core::rect<s32> rectangle, ISimpleTextureSource *tsrc,
bool noclip=false); bool noclip=false);
//! destructor //! destructor
virtual ~GUIButton(); virtual ~GUIButton();
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event) override; virtual bool OnEvent(const SEvent& event) override;
//! draws the element and its children //! draws the element and its children
virtual void draw() override; virtual void draw() override;
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin. //! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
virtual void setOverrideFont(gui::IGUIFont* font=0) override; virtual void setOverrideFont(gui::IGUIFont* font=0) override;
//! Gets the override font (if any) //! Gets the override font (if any)
virtual gui::IGUIFont* getOverrideFont() const override; virtual gui::IGUIFont* getOverrideFont() const override;
//! Get the font which is used right now for drawing //! Get the font which is used right now for drawing
virtual gui::IGUIFont* getActiveFont() const override; virtual gui::IGUIFont* getActiveFont() const override;
//! Sets another color for the button text. //! Sets another color for the button text.
virtual void setOverrideColor(video::SColor color) override; virtual void setOverrideColor(video::SColor color) override;
//! Gets the override color //! Gets the override color
virtual video::SColor getOverrideColor() const override; virtual video::SColor getOverrideColor() const override;
//! Gets the currently used text color //! Gets the currently used text color
virtual video::SColor getActiveColor() const override; virtual video::SColor getActiveColor() const override;
//! Sets if the button text should use the override color or the color in the gui skin. //! Sets if the button text should use the override color or the color in the gui skin.
virtual void enableOverrideColor(bool enable) override; virtual void enableOverrideColor(bool enable) override;
//! Checks if an override color is enabled //! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void) const override; virtual bool isOverrideColorEnabled(void) const override;
// PATCH // PATCH
//! Sets an image which should be displayed on the button when it is in the given state. //! Sets an image which should be displayed on the button when it is in the given state.
virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state, virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,
video::ITexture* image=nullptr, video::ITexture* image=nullptr,
const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) override; const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) override;
//! Sets an image which should be displayed on the button when it is in normal state. //! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image=nullptr) override; virtual void setImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in normal state. //! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) override; virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets an image which should be displayed on the button when it is in pressed state. //! Sets an image which should be displayed on the button when it is in pressed state.
virtual void setPressedImage(video::ITexture* image=nullptr) override; virtual void setPressedImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in pressed state. //! Sets an image which should be displayed on the button when it is in pressed state.
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override; virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets the text displayed by the button //! Sets the text displayed by the button
virtual void setText(const wchar_t* text) override; virtual void setText(const wchar_t* text) override;
// END PATCH // END PATCH
//! Sets the sprite bank used by the button //! Sets the sprite bank used by the button
virtual void setSpriteBank(gui::IGUISpriteBank* bank=0) override; virtual void setSpriteBank(gui::IGUISpriteBank* bank=0) override;
//! Sets the animated sprite for a specific button state //! Sets the animated sprite for a specific button state
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite /** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
\param state: State of the button to set the sprite for \param state: State of the button to set the sprite for
\param index: The sprite number from the current sprite bank \param index: The sprite number from the current sprite bank
\param color: The color of the sprite \param color: The color of the sprite
*/ */
virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255), video::SColor color=video::SColor(255,255,255,255),
bool loop=false, bool scale=false) override; bool loop=false, bool scale=false) override;
//! Get the sprite-index for the given state or -1 when no sprite is set //! Get the sprite-index for the given state or -1 when no sprite is set
virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const override; virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const override;
//! Get the sprite color for the given state. Color is only used when a sprite is set. //! Get the sprite color for the given state. Color is only used when a sprite is set.
virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const override; virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state does loop //! Returns if the sprite in the given state does loop
virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const override; virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state is scaled //! Returns if the sprite in the given state is scaled
virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const override; virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const override;
//! Sets if the button should behave like a push button. Which means it //! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button, //! can be in two states: Normal or Pressed. With a click on the button,
//! the user can change the state of the button. //! the user can change the state of the button.
virtual void setIsPushButton(bool isPushButton=true) override; virtual void setIsPushButton(bool isPushButton=true) override;
//! Checks whether the button is a push button //! Checks whether the button is a push button
virtual bool isPushButton() const override; virtual bool isPushButton() const override;
//! Sets the pressed state of the button if this is a pushbutton //! Sets the pressed state of the button if this is a pushbutton
virtual void setPressed(bool pressed=true) override; virtual void setPressed(bool pressed=true) override;
//! Returns if the button is currently pressed //! Returns if the button is currently pressed
virtual bool isPressed() const override; virtual bool isPressed() const override;
// PATCH // PATCH
//! Returns if this element (or one of its direct children) is hovered //! Returns if this element (or one of its direct children) is hovered
bool isHovered() const; bool isHovered() const;
//! Returns if this element (or one of its direct children) is focused //! Returns if this element (or one of its direct children) is focused
bool isFocused() const; bool isFocused() const;
// END PATCH // END PATCH
//! Sets if the button should use the skin to draw its border //! Sets if the button should use the skin to draw its border
virtual void setDrawBorder(bool border=true) override; virtual void setDrawBorder(bool border=true) override;
//! Checks if the button face and border are being drawn //! Checks if the button face and border are being drawn
virtual bool isDrawingBorder() const override; virtual bool isDrawingBorder() const override;
//! Sets if the alpha channel should be used for drawing images on the button (default is false) //! Sets if the alpha channel should be used for drawing images on the button (default is false)
virtual void setUseAlphaChannel(bool useAlphaChannel=true) override; virtual void setUseAlphaChannel(bool useAlphaChannel=true) override;
//! Checks if the alpha channel should be used for drawing images on the button //! Checks if the alpha channel should be used for drawing images on the button
virtual bool isAlphaChannelUsed() const override; virtual bool isAlphaChannelUsed() const override;
//! Sets if the button should scale the button images to fit //! Sets if the button should scale the button images to fit
virtual void setScaleImage(bool scaleImage=true) override; virtual void setScaleImage(bool scaleImage=true) override;
//! Checks whether the button scales the used images //! Checks whether the button scales the used images
virtual bool isScalingImage() const override; virtual bool isScalingImage() const override;
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event //! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickShiftState() const override virtual bool getClickShiftState() const override
{ {
return ClickShiftState; return ClickShiftState;
} }
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event //! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickControlState() const override virtual bool getClickControlState() const override
{ {
return ClickControlState; return ClickControlState;
} }
void setColor(video::SColor color); void setColor(video::SColor color);
// PATCH // PATCH
//! Set element properties from a StyleSpec corresponding to the button state //! Set element properties from a StyleSpec corresponding to the button state
void setFromState(); void setFromState();
//! Set element properties from a StyleSpec //! Set element properties from a StyleSpec
virtual void setFromStyle(const StyleSpec& style); virtual void setFromStyle(const StyleSpec& style);
//! Set the styles used for each state //! Set the styles used for each state
void setStyles(const std::array<StyleSpec, StyleSpec::NUM_STATES>& styles); void setStyles(const std::array<StyleSpec, StyleSpec::NUM_STATES>& styles);
// END PATCH // END PATCH
//! Do not drop returned handle //! Do not drop returned handle
static GUIButton* addButton(gui::IGUIEnvironment *environment, static GUIButton* addButton(gui::IGUIEnvironment *environment,
const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc, const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc,
IGUIElement* parent, s32 id, const wchar_t* text, IGUIElement* parent, s32 id, const wchar_t* text,
const wchar_t *tooltiptext=L""); const wchar_t *tooltiptext=L"");
protected: protected:
void drawSprite(gui::EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center); void drawSprite(gui::EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center);
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const; gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const;
ISimpleTextureSource *getTextureSource() { return TSrc; } ISimpleTextureSource *getTextureSource() { return TSrc; }
struct ButtonImage struct ButtonImage
{ {
ButtonImage() = default; ButtonImage() = default;
ButtonImage(const ButtonImage& other) ButtonImage(const ButtonImage& other)
{ {
*this = other; *this = other;
} }
~ButtonImage() ~ButtonImage()
{ {
if ( Texture ) if ( Texture )
Texture->drop(); Texture->drop();
} }
ButtonImage& operator=(const ButtonImage& other) ButtonImage& operator=(const ButtonImage& other)
{ {
if ( this == &other ) if ( this == &other )
return *this; return *this;
if (other.Texture) if (other.Texture)
other.Texture->grab(); other.Texture->grab();
if ( Texture ) if ( Texture )
Texture->drop(); Texture->drop();
Texture = other.Texture; Texture = other.Texture;
SourceRect = other.SourceRect; SourceRect = other.SourceRect;
return *this; return *this;
} }
bool operator==(const ButtonImage& other) const bool operator==(const ButtonImage& other) const
{ {
return Texture == other.Texture && SourceRect == other.SourceRect; return Texture == other.Texture && SourceRect == other.SourceRect;
} }
video::ITexture* Texture = nullptr; video::ITexture* Texture = nullptr;
core::rect<s32> SourceRect = core::rect<s32>(0,0,0,0); core::rect<s32> SourceRect = core::rect<s32>(0,0,0,0);
}; };
gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed, const ButtonImage* images) const; gui::EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed, const ButtonImage* images) const;
private: private:
struct ButtonSprite struct ButtonSprite
{ {
bool operator==(const ButtonSprite &other) const bool operator==(const ButtonSprite &other) const
{ {
return Index == other.Index && Color == other.Color && Loop == other.Loop && Scale == other.Scale; return Index == other.Index && Color == other.Color && Loop == other.Loop && Scale == other.Scale;
} }
s32 Index = -1; s32 Index = -1;
video::SColor Color; video::SColor Color;
bool Loop = false; bool Loop = false;
bool Scale = false; bool Scale = false;
}; };
ButtonSprite ButtonSprites[gui::EGBS_COUNT]; ButtonSprite ButtonSprites[gui::EGBS_COUNT];
gui::IGUISpriteBank* SpriteBank = nullptr; gui::IGUISpriteBank* SpriteBank = nullptr;
ButtonImage ButtonImages[gui::EGBIS_COUNT]; ButtonImage ButtonImages[gui::EGBIS_COUNT];
std::array<StyleSpec, StyleSpec::NUM_STATES> Styles; std::array<StyleSpec, StyleSpec::NUM_STATES> Styles;
gui::IGUIFont* OverrideFont = nullptr; gui::IGUIFont* OverrideFont = nullptr;
bool OverrideColorEnabled = false; bool OverrideColorEnabled = false;
video::SColor OverrideColor = video::SColor(101,255,255,255); video::SColor OverrideColor = video::SColor(101,255,255,255);
u32 ClickTime = 0; u32 ClickTime = 0;
u32 HoverTime = 0; u32 HoverTime = 0;
u32 FocusTime = 0; u32 FocusTime = 0;
bool ClickShiftState = false; bool ClickShiftState = false;
bool ClickControlState = false; bool ClickControlState = false;
bool IsPushButton = false; bool IsPushButton = false;
bool Pressed = false; bool Pressed = false;
bool UseAlphaChannel = false; bool UseAlphaChannel = false;
bool DrawBorder = true; bool DrawBorder = true;
bool ScaleImage = false; bool ScaleImage = false;
video::SColor Colors[4]; video::SColor Colors[4];
// PATCH // PATCH
bool WasHovered = false; bool WasHovered = false;
bool WasFocused = false; bool WasFocused = false;
ISimpleTextureSource *TSrc; ISimpleTextureSource *TSrc;
gui::IGUIStaticText *StaticText; gui::IGUIStaticText *StaticText;
core::rect<s32> BgMiddle; core::rect<s32> BgMiddle;
core::rect<s32> Padding; core::rect<s32> Padding;
core::vector2d<s32> ContentOffset; core::vector2d<s32> ContentOffset;
video::SColor BgColor = video::SColor(0xFF,0xFF,0xFF,0xFF); video::SColor BgColor = video::SColor(0xFF,0xFF,0xFF,0xFF);
// END PATCH // END PATCH
}; };

File diff suppressed because it is too large Load Diff

View File

@ -1,360 +1,360 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt // Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __GUI_SKIN_H_INCLUDED__ #ifndef __GUI_SKIN_H_INCLUDED__
#define __GUI_SKIN_H_INCLUDED__ #define __GUI_SKIN_H_INCLUDED__
#include "IGUISkin.h" #include "IGUISkin.h"
#include "irrString.h" #include "irrString.h"
#include <string> #include <string>
#include "ITexture.h" #include "ITexture.h"
namespace irr namespace irr
{ {
namespace video namespace video
{ {
class IVideoDriver; class IVideoDriver;
} }
namespace gui namespace gui
{ {
class GUISkin : public IGUISkin class GUISkin : public IGUISkin
{ {
public: public:
GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver); GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver);
//! destructor //! destructor
virtual ~GUISkin(); virtual ~GUISkin();
//! returns default color //! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const; virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const;
//! sets a default color //! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor); virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor);
//! returns size for the given size type //! returns size for the given size type
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const; virtual s32 getSize(EGUI_DEFAULT_SIZE size) const;
//! sets a default size //! sets a default size
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size); virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size);
//! returns the default font //! returns the default font
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const; virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const;
//! sets a default font //! sets a default font
virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT); virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
//! sets the sprite bank used for drawing icons //! sets the sprite bank used for drawing icons
virtual void setSpriteBank(IGUISpriteBank* bank); virtual void setSpriteBank(IGUISpriteBank* bank);
//! gets the sprite bank used for drawing icons //! gets the sprite bank used for drawing icons
virtual IGUISpriteBank* getSpriteBank() const; virtual IGUISpriteBank* getSpriteBank() const;
//! Returns a default icon //! Returns a default icon
/** Returns the sprite index within the sprite bank */ /** Returns the sprite index within the sprite bank */
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const; virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
//! Sets a default icon //! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows, /** Sets the sprite index used for drawing icons like arrows,
close buttons and ticks in checkboxes close buttons and ticks in checkboxes
\param icon: Enum specifying which icon to change \param icon: Enum specifying which icon to change
\param index: The sprite index used to draw this icon */ \param index: The sprite index used to draw this icon */
virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index); virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index);
//! Returns a default text. //! Returns a default text.
/** For example for Message box button captions: /** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */ "OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const; virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
//! Sets a default text. //! Sets a default text.
/** For example for Message box button captions: /** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */ "OK", "Cancel", "Yes", "No" and so on. */
virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText); virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText);
//! draws a standard 3d button pane //! draws a standard 3d button pane
/** Used for drawing for example buttons in normal state. /** Used for drawing for example buttons in normal state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */ implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPaneStandard(IGUIElement* element, virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) const core::rect<s32>* clip=0)
{ {
drawColored3DButtonPaneStandard(element, rect,clip); drawColored3DButtonPaneStandard(element, rect,clip);
} }
virtual void drawColored3DButtonPaneStandard(IGUIElement* element, virtual void drawColored3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0, const core::rect<s32>* clip=0,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a pressed 3d button pane //! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state. /** Used for drawing for example buttons in pressed state.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. */ implementations to find out how to draw the part exactly. */
virtual void draw3DButtonPanePressed(IGUIElement* element, virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) const core::rect<s32>* clip=0)
{ {
drawColored3DButtonPanePressed(element, rect, clip); drawColored3DButtonPanePressed(element, rect, clip);
} }
virtual void drawColored3DButtonPanePressed(IGUIElement* element, virtual void drawColored3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0, const core::rect<s32>* clip=0,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a sunken 3d pane //! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes. /** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param bgcolor: Background color. \param bgcolor: Background color.
\param flat: Specifies if the sunken pane should be flat or displayed as sunken \param flat: Specifies if the sunken pane should be flat or displayed as sunken
deep into the ground. deep into the ground.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element, virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, video::SColor bgcolor, bool flat,
bool fillBackGround, bool fillBackGround,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) const core::rect<s32>* clip=0)
{ {
drawColored3DSunkenPane(element, bgcolor, flat, fillBackGround, rect, clip); drawColored3DSunkenPane(element, bgcolor, flat, fillBackGround, rect, clip);
} }
virtual void drawColored3DSunkenPane(IGUIElement* element, virtual void drawColored3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, video::SColor bgcolor, bool flat,
bool fillBackGround, bool fillBackGround,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0, const core::rect<s32>* clip=0,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a window background //! draws a window background
/** Used for drawing the background of dialogs and windows. /** Used for drawing the background of dialogs and windows.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param titleBarColor: Title color. \param titleBarColor: Title color.
\param drawTitleBar: True to enable title drawing. \param drawTitleBar: True to enable title drawing.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. \param clip: Clip area.
\param checkClientArea: When set to non-null the function will not draw anything, \param checkClientArea: When set to non-null the function will not draw anything,
but will instead return the clientArea which can be used for drawing by the calling window. but will instead return the clientArea which can be used for drawing by the calling window.
That is the area without borders and without titlebar. That is the area without borders and without titlebar.
\return Returns rect where it would be good to draw title bar text. This will \return Returns rect where it would be good to draw title bar text. This will
work even when checkClientArea is set to a non-null value.*/ work even when checkClientArea is set to a non-null value.*/
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element, virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor, bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip, const core::rect<s32>* clip,
core::rect<s32>* checkClientArea) core::rect<s32>* checkClientArea)
{ {
return drawColored3DWindowBackground(element, drawTitleBar, titleBarColor, return drawColored3DWindowBackground(element, drawTitleBar, titleBarColor,
rect, clip, checkClientArea); rect, clip, checkClientArea);
} }
virtual core::rect<s32> drawColored3DWindowBackground(IGUIElement* element, virtual core::rect<s32> drawColored3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor, bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip, const core::rect<s32>* clip,
core::rect<s32>* checkClientArea, core::rect<s32>* checkClientArea,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a standard 3d menu pane //! draws a standard 3d menu pane
/** Used for drawing for menus and context menus. /** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element, virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) const core::rect<s32>* clip=0)
{ {
drawColored3DMenuPane(element, rect, clip); drawColored3DMenuPane(element, rect, clip);
} }
virtual void drawColored3DMenuPane(IGUIElement* element, virtual void drawColored3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0, const core::rect<s32>* clip=0,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a standard 3d tool bar //! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus. /** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element, virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0) const core::rect<s32>* clip=0)
{ {
drawColored3DToolBar(element, rect, clip); drawColored3DToolBar(element, rect, clip);
} }
virtual void drawColored3DToolBar(IGUIElement* element, virtual void drawColored3DToolBar(IGUIElement* element,
const core::rect<s32>& rect, const core::rect<s32>& rect,
const core::rect<s32>* clip=0, const core::rect<s32>* clip=0,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a tab button //! draws a tab button
/** Used for drawing for tab buttons on top of tabs. /** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active. \param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DTabButton(IGUIElement* element, bool active, virtual void draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
{ {
drawColored3DTabButton(element, active, rect, clip, alignment); drawColored3DTabButton(element, active, rect, clip, alignment);
} }
virtual void drawColored3DTabButton(IGUIElement* element, bool active, virtual void drawColored3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT, const core::rect<s32>& rect, const core::rect<s32>* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a tab control body //! draws a tab control body
/** \param element: Pointer to the element which wishes to draw this. This parameter /** \param element: Pointer to the element which wishes to draw this. This parameter
is usually not used by ISkin, but can be used for example by more complex is usually not used by ISkin, but can be used for example by more complex
implementations to find out how to draw the part exactly. implementations to find out how to draw the part exactly.
\param border: Specifies if the border should be drawn. \param border: Specifies if the border should be drawn.
\param background: Specifies if the background should be drawn. \param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw. \param rect: Defining area where to draw.
\param clip: Clip area. */ \param clip: Clip area. */
virtual void draw3DTabBody(IGUIElement* element, bool border, bool background, virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
{ {
drawColored3DTabBody(element, border, background, rect, clip, tabHeight, alignment); drawColored3DTabBody(element, border, background, rect, clip, tabHeight, alignment);
} }
virtual void drawColored3DTabBody(IGUIElement* element, bool border, bool background, virtual void drawColored3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT, const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws an icon, usually from the skin's sprite bank //! draws an icon, usually from the skin's sprite bank
/** \param element: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn. \param icon: Specifies the icon to be drawn.
\param position: The position to draw the icon \param position: The position to draw the icon
\param starttime: The time at the start of the animation \param starttime: The time at the start of the animation
\param currenttime: The present time, used to calculate the frame number \param currenttime: The present time, used to calculate the frame number
\param loop: Whether the animation should loop or not \param loop: Whether the animation should loop or not
\param clip: Clip area. */ \param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, const core::position2di position,
u32 starttime=0, u32 currenttime=0, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0) bool loop=false, const core::rect<s32>* clip=0)
{ {
drawColoredIcon(element, icon, position, starttime, currenttime, loop, clip); drawColoredIcon(element, icon, position, starttime, currenttime, loop, clip);
} }
virtual void drawColoredIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, virtual void drawColoredIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, const core::position2di position,
u32 starttime=0, u32 currenttime=0, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0, bool loop=false, const core::rect<s32>* clip=0,
const video::SColor* colors=0); const video::SColor* colors=0);
//! draws a 2d rectangle. //! draws a 2d rectangle.
/** \param element: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param color: Color of the rectangle to draw. The alpha component specifies how \param color: Color of the rectangle to draw. The alpha component specifies how
transparent the rectangle will be. transparent the rectangle will be.
\param pos: Position of the rectangle. \param pos: Position of the rectangle.
\param clip: Pointer to rectangle against which the rectangle will be clipped. \param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */ If the pointer is null, no clipping will be performed. */
virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color, virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
const core::rect<s32>& pos, const core::rect<s32>* clip = 0); const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
//! get the type of this skin //! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const; virtual EGUI_SKIN_TYPE getType() const;
//! gets the colors //! gets the colors
virtual void getColors(video::SColor* colors); // ::PATCH: virtual void getColors(video::SColor* colors); // ::PATCH:
private: private:
video::SColor Colors[EGDC_COUNT]; video::SColor Colors[EGDC_COUNT];
s32 Sizes[EGDS_COUNT]; s32 Sizes[EGDS_COUNT];
u32 Icons[EGDI_COUNT]; u32 Icons[EGDI_COUNT];
IGUIFont* Fonts[EGDF_COUNT]; IGUIFont* Fonts[EGDF_COUNT];
IGUISpriteBank* SpriteBank; IGUISpriteBank* SpriteBank;
core::stringw Texts[EGDT_COUNT]; core::stringw Texts[EGDT_COUNT];
video::IVideoDriver* Driver; video::IVideoDriver* Driver;
bool UseGradient; bool UseGradient;
EGUI_SKIN_TYPE Type; EGUI_SKIN_TYPE Type;
}; };
#define set3DSkinColors(skin, button_color) \ #define set3DSkinColors(skin, button_color) \
{ \ { \
skin->setColor(EGDC_3D_FACE, button_color); \ skin->setColor(EGDC_3D_FACE, button_color); \
skin->setColor(EGDC_3D_DARK_SHADOW, button_color, 0.25f); \ skin->setColor(EGDC_3D_DARK_SHADOW, button_color, 0.25f); \
skin->setColor(EGDC_3D_SHADOW, button_color, 0.5f); \ skin->setColor(EGDC_3D_SHADOW, button_color, 0.5f); \
skin->setColor(EGDC_3D_LIGHT, button_color); \ skin->setColor(EGDC_3D_LIGHT, button_color); \
skin->setColor(EGDC_3D_HIGH_LIGHT, button_color, 1.5f); \ skin->setColor(EGDC_3D_HIGH_LIGHT, button_color, 1.5f); \
} }
#define getElementSkinColor(color) \ #define getElementSkinColor(color) \
{ \ { \
if (!Colors) \ if (!Colors) \
{ \ { \
IGUISkin* skin = Environment->getSkin(); \ IGUISkin* skin = Environment->getSkin(); \
if (skin) \ if (skin) \
return skin->getColor(color); \ return skin->getColor(color); \
} \ } \
return Colors[color]; \ return Colors[color]; \
} }
#define setElementSkinColor(which, newColor, shading) \ #define setElementSkinColor(which, newColor, shading) \
{ \ { \
if (!Colors) \ if (!Colors) \
{ \ { \
Colors = new video::SColor[EGDC_COUNT]; \ Colors = new video::SColor[EGDC_COUNT]; \
GUISkin* skin = (GUISkin *)Environment->getSkin(); \ GUISkin* skin = (GUISkin *)Environment->getSkin(); \
if (skin) \ if (skin) \
skin->getColors(Colors); \ skin->getColors(Colors); \
} \ } \
Colors[which] = newColor; \ Colors[which] = newColor; \
setShading(Colors[which],shading); \ setShading(Colors[which],shading); \
} }
} // end namespace gui } // end namespace gui
//! Sets the shading //! Sets the shading
inline void setShading(video::SColor &color,f32 s) // :PATCH: inline void setShading(video::SColor &color,f32 s) // :PATCH:
{ {
if (s < 1.0f) if (s < 1.0f)
{ {
color.setRed(color.getRed() * s); color.setRed(color.getRed() * s);
color.setGreen(color.getGreen() * s); color.setGreen(color.getGreen() * s);
color.setBlue(color.getBlue() * s); color.setBlue(color.getBlue() * s);
} }
else if (s > 1.0f) else if (s > 1.0f)
{ {
s -= 1.0f; s -= 1.0f;
color.setRed(color.getRed() + (255 - color.getRed()) * s); color.setRed(color.getRed() + (255 - color.getRed()) * s);
color.setGreen(color.getGreen() + (255 - color.getGreen()) * s); color.setGreen(color.getGreen() + (255 - color.getGreen()) * s);
color.setBlue(color.getBlue() + (255 - color.getBlue()) * s); color.setBlue(color.getBlue() + (255 - color.getBlue()) * s);
} }
} }
} // end namespace irr } // end namespace irr
#endif #endif