1
0

Reformat the code, using:

find -type f |  # list all regular files
  grep -E '\.(h|cpp|mm)$' |  # filter for source files
  grep -v '/mt_' |  # filter out generated files
  grep -v '/vendor/' | # and vendored GL
  grep -v '/test/image_loader_test.cpp' |  # and this file (has giant literals arrays)
  xargs -n 1 -P $(nproc) clang-format -i  # reformat everything

Co-authored-by: numzero <numzer0@yandex.ru>
This commit is contained in:
Desour
2024-03-20 19:35:52 +01:00
committed by sfan5
parent 9814510b1b
commit f5c6d3e945
292 changed files with 37376 additions and 42421 deletions

View File

@@ -15,41 +15,39 @@ namespace irr
namespace gui
{
CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
: SpriteBank(0), Driver(driver), Type(type)
CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver *driver) :
SpriteBank(0), Driver(driver), Type(type)
{
#ifdef _DEBUG
#ifdef _DEBUG
setDebugName("CGUISkin");
#endif
if ((Type == EGST_WINDOWS_CLASSIC) || (Type == EGST_WINDOWS_METALLIC))
{
Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50);
Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130);
Colors[EGDC_3D_FACE] = video::SColor(101,210,210,210);
Colors[EGDC_3D_HIGH_LIGHT] = video::SColor(101,255,255,255);
Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210);
Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115);
Colors[EGDC_ACTIVE_CAPTION] = video::SColor(255,255,255,255);
Colors[EGDC_APP_WORKSPACE] = video::SColor(101,100,100,100);
Colors[EGDC_BUTTON_TEXT] = video::SColor(240,10,10,10);
Colors[EGDC_GRAY_TEXT] = video::SColor(240,130,130,130);
Colors[EGDC_HIGH_LIGHT] = video::SColor(101,8,36,107);
Colors[EGDC_HIGH_LIGHT_TEXT] = video::SColor(240,255,255,255);
Colors[EGDC_INACTIVE_BORDER] = video::SColor(101,165,165,165);
Colors[EGDC_INACTIVE_CAPTION] = video::SColor(255,30,30,30);
Colors[EGDC_TOOLTIP] = video::SColor(200,0,0,0);
Colors[EGDC_TOOLTIP_BACKGROUND] = video::SColor(200,255,255,225);
Colors[EGDC_SCROLLBAR] = video::SColor(101,230,230,230);
Colors[EGDC_WINDOW] = video::SColor(101,255,255,255);
Colors[EGDC_WINDOW_SYMBOL] = video::SColor(200,10,10,10);
Colors[EGDC_ICON] = video::SColor(200,255,255,255);
Colors[EGDC_ICON_HIGH_LIGHT] = video::SColor(200,8,36,107);
Colors[EGDC_GRAY_WINDOW_SYMBOL] = video::SColor(240,100,100,100);
Colors[EGDC_EDITABLE] = video::SColor(255,255,255,255);
Colors[EGDC_GRAY_EDITABLE] = video::SColor(255,120,120,120);
Colors[EGDC_FOCUSED_EDITABLE] = video::SColor(255,240,240,255);
#endif
if ((Type == EGST_WINDOWS_CLASSIC) || (Type == EGST_WINDOWS_METALLIC)) {
Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101, 50, 50, 50);
Colors[EGDC_3D_SHADOW] = video::SColor(101, 130, 130, 130);
Colors[EGDC_3D_FACE] = video::SColor(101, 210, 210, 210);
Colors[EGDC_3D_HIGH_LIGHT] = video::SColor(101, 255, 255, 255);
Colors[EGDC_3D_LIGHT] = video::SColor(101, 210, 210, 210);
Colors[EGDC_ACTIVE_BORDER] = video::SColor(101, 16, 14, 115);
Colors[EGDC_ACTIVE_CAPTION] = video::SColor(255, 255, 255, 255);
Colors[EGDC_APP_WORKSPACE] = video::SColor(101, 100, 100, 100);
Colors[EGDC_BUTTON_TEXT] = video::SColor(240, 10, 10, 10);
Colors[EGDC_GRAY_TEXT] = video::SColor(240, 130, 130, 130);
Colors[EGDC_HIGH_LIGHT] = video::SColor(101, 8, 36, 107);
Colors[EGDC_HIGH_LIGHT_TEXT] = video::SColor(240, 255, 255, 255);
Colors[EGDC_INACTIVE_BORDER] = video::SColor(101, 165, 165, 165);
Colors[EGDC_INACTIVE_CAPTION] = video::SColor(255, 30, 30, 30);
Colors[EGDC_TOOLTIP] = video::SColor(200, 0, 0, 0);
Colors[EGDC_TOOLTIP_BACKGROUND] = video::SColor(200, 255, 255, 225);
Colors[EGDC_SCROLLBAR] = video::SColor(101, 230, 230, 230);
Colors[EGDC_WINDOW] = video::SColor(101, 255, 255, 255);
Colors[EGDC_WINDOW_SYMBOL] = video::SColor(200, 10, 10, 10);
Colors[EGDC_ICON] = video::SColor(200, 255, 255, 255);
Colors[EGDC_ICON_HIGH_LIGHT] = video::SColor(200, 8, 36, 107);
Colors[EGDC_GRAY_WINDOW_SYMBOL] = video::SColor(240, 100, 100, 100);
Colors[EGDC_EDITABLE] = video::SColor(255, 255, 255, 255);
Colors[EGDC_GRAY_EDITABLE] = video::SColor(255, 120, 120, 120);
Colors[EGDC_FOCUSED_EDITABLE] = video::SColor(255, 240, 240, 255);
Sizes[EGDS_SCROLLBAR_SIZE] = 14;
Sizes[EGDS_MENU_HEIGHT] = 30;
@@ -65,36 +63,34 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
Sizes[EGDS_TITLEBARTEXT_DISTANCE_X] = 2;
Sizes[EGDS_TITLEBARTEXT_DISTANCE_Y] = 0;
}
else
{
//0x80a6a8af
Colors[EGDC_3D_DARK_SHADOW] = 0x60767982;
//Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background
Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background
Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight
Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc;
Colors[EGDC_3D_LIGHT] = 0x802e313a;
Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title
Colors[EGDC_ACTIVE_CAPTION] = 0xffd0d0d0;
Colors[EGDC_APP_WORKSPACE] = 0xc0646464; // unused
Colors[EGDC_BUTTON_TEXT] = 0xd0161616;
Colors[EGDC_GRAY_TEXT] = 0x3c141414;
Colors[EGDC_HIGH_LIGHT] = 0x6c606060;
Colors[EGDC_HIGH_LIGHT_TEXT] = 0xd0e0e0e0;
Colors[EGDC_INACTIVE_BORDER] = 0xf0a5a5a5;
Colors[EGDC_INACTIVE_CAPTION] = 0xffd2d2d2;
Colors[EGDC_TOOLTIP] = 0xf00f2033;
Colors[EGDC_TOOLTIP_BACKGROUND] = 0xc0cbd2d9;
Colors[EGDC_SCROLLBAR] = 0xf0e0e0e0;
Colors[EGDC_WINDOW] = 0xf0f0f0f0;
Colors[EGDC_WINDOW_SYMBOL] = 0xd0161616;
Colors[EGDC_ICON] = 0xd0161616;
Colors[EGDC_ICON_HIGH_LIGHT] = 0xd0606060;
Colors[EGDC_GRAY_WINDOW_SYMBOL] = 0x3c101010;
Colors[EGDC_EDITABLE] = 0xf0ffffff;
Colors[EGDC_GRAY_EDITABLE] = 0xf0cccccc;
Colors[EGDC_FOCUSED_EDITABLE] = 0xf0fffff0;
} else {
// 0x80a6a8af
Colors[EGDC_3D_DARK_SHADOW] = 0x60767982;
// Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background
Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background
Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight
Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc;
Colors[EGDC_3D_LIGHT] = 0x802e313a;
Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title
Colors[EGDC_ACTIVE_CAPTION] = 0xffd0d0d0;
Colors[EGDC_APP_WORKSPACE] = 0xc0646464; // unused
Colors[EGDC_BUTTON_TEXT] = 0xd0161616;
Colors[EGDC_GRAY_TEXT] = 0x3c141414;
Colors[EGDC_HIGH_LIGHT] = 0x6c606060;
Colors[EGDC_HIGH_LIGHT_TEXT] = 0xd0e0e0e0;
Colors[EGDC_INACTIVE_BORDER] = 0xf0a5a5a5;
Colors[EGDC_INACTIVE_CAPTION] = 0xffd2d2d2;
Colors[EGDC_TOOLTIP] = 0xf00f2033;
Colors[EGDC_TOOLTIP_BACKGROUND] = 0xc0cbd2d9;
Colors[EGDC_SCROLLBAR] = 0xf0e0e0e0;
Colors[EGDC_WINDOW] = 0xf0f0f0f0;
Colors[EGDC_WINDOW_SYMBOL] = 0xd0161616;
Colors[EGDC_ICON] = 0xd0161616;
Colors[EGDC_ICON_HIGH_LIGHT] = 0xd0606060;
Colors[EGDC_GRAY_WINDOW_SYMBOL] = 0x3c101010;
Colors[EGDC_EDITABLE] = 0xf0ffffff;
Colors[EGDC_GRAY_EDITABLE] = 0xf0cccccc;
Colors[EGDC_FOCUSED_EDITABLE] = 0xf0fffff0;
Sizes[EGDS_SCROLLBAR_SIZE] = 14;
Sizes[EGDS_MENU_HEIGHT] = 48;
@@ -159,18 +155,16 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
Icons[EGDI_FILE] = 245;
Icons[EGDI_DIRECTORY] = 246;
for (u32 i=0; i<EGDF_COUNT; ++i)
for (u32 i = 0; i < EGDF_COUNT; ++i)
Fonts[i] = 0;
UseGradient = (Type == EGST_WINDOWS_METALLIC) || (Type == EGST_BURNING_SKIN) ;
UseGradient = (Type == EGST_WINDOWS_METALLIC) || (Type == EGST_BURNING_SKIN);
}
//! destructor
CGUISkin::~CGUISkin()
{
for (u32 i=0; i<EGDF_COUNT; ++i)
{
for (u32 i = 0; i < EGDF_COUNT; ++i) {
if (Fonts[i])
Fonts[i]->drop();
}
@@ -179,7 +173,6 @@ CGUISkin::~CGUISkin()
SpriteBank->drop();
}
//! returns default color
video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color) const
{
@@ -189,7 +182,6 @@ video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color) const
return video::SColor();
}
//! sets a default color
void CGUISkin::setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor)
{
@@ -197,7 +189,6 @@ void CGUISkin::setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor)
Colors[which] = newColor;
}
//! returns size for the given size type
s32 CGUISkin::getSize(EGUI_DEFAULT_SIZE size) const
{
@@ -207,7 +198,6 @@ s32 CGUISkin::getSize(EGUI_DEFAULT_SIZE size) const
return 0;
}
//! sets a default size
void CGUISkin::setSize(EGUI_DEFAULT_SIZE which, s32 size)
{
@@ -215,9 +205,8 @@ void CGUISkin::setSize(EGUI_DEFAULT_SIZE which, s32 size)
Sizes[which] = size;
}
//! returns the default font
IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which) const
IGUIFont *CGUISkin::getFont(EGUI_DEFAULT_FONT which) const
{
if (((u32)which < EGDF_COUNT) && Fonts[which])
return Fonts[which];
@@ -225,15 +214,13 @@ IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which) const
return Fonts[EGDF_DEFAULT];
}
//! sets a default font
void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
void CGUISkin::setFont(IGUIFont *font, EGUI_DEFAULT_FONT which)
{
if ((u32)which >= EGDF_COUNT)
return;
if (font)
{
if (font) {
font->grab();
if (Fonts[which])
Fonts[which]->drop();
@@ -242,16 +229,14 @@ void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
}
}
//! gets the sprite bank stored
IGUISpriteBank* CGUISkin::getSpriteBank() const
IGUISpriteBank *CGUISkin::getSpriteBank() const
{
return SpriteBank;
}
//! set a new sprite bank or remove one by passing 0
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
void CGUISkin::setSpriteBank(IGUISpriteBank *bank)
{
if (bank)
bank->grab();
@@ -262,7 +247,6 @@ void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
SpriteBank = bank;
}
//! Returns a default icon
u32 CGUISkin::getIcon(EGUI_DEFAULT_ICON icon) const
{
@@ -272,7 +256,6 @@ u32 CGUISkin::getIcon(EGUI_DEFAULT_ICON icon) const
return 0;
}
//! Sets a default icon
void CGUISkin::setIcon(EGUI_DEFAULT_ICON icon, u32 index)
{
@@ -280,10 +263,9 @@ void CGUISkin::setIcon(EGUI_DEFAULT_ICON icon, u32 index)
Icons[icon] = index;
}
//! Returns a default text. For example for Message box button captions:
//! "OK", "Cancel", "Yes", "No" and so on.
const wchar_t* CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text) const
const wchar_t *CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text) const
{
if ((u32)text < EGDT_COUNT)
return Texts[text].c_str();
@@ -291,16 +273,14 @@ const wchar_t* CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text) const
return Texts[0].c_str();
}
//! Sets a default text. For example for Message box button captions:
//! "OK", "Cancel", "Yes", "No" and so on.
void CGUISkin::setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText)
void CGUISkin::setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t *newText)
{
if ((u32)which < EGDT_COUNT)
Texts[which] = newText;
}
//! draws a standard 3d button pane
/** 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
@@ -310,24 +290,22 @@ EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\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
implementations to find out how to draw the part exactly. */
void CGUISkin::draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& r,
const core::rect<s32>* clip)
void CGUISkin::draw3DButtonPaneStandard(IGUIElement *element,
const core::rect<s32> &r,
const core::rect<s32> *clip)
{
if (!Driver)
return;
core::rect<s32> rect = r;
if ( Type == EGST_BURNING_SKIN )
{
if (Type == EGST_BURNING_SKIN) {
rect.UpperLeftCorner.X -= 1;
rect.UpperLeftCorner.Y -= 1;
rect.LowerRightCorner.X += 1;
rect.LowerRightCorner.Y += 1;
draw3DSunkenPane(element,
getColor( EGDC_WINDOW ).getInterpolated( 0xFFFFFFFF, 0.9f )
,false, true, rect, clip);
getColor(EGDC_WINDOW).getInterpolated(0xFFFFFFFF, 0.9f), false, true, rect, clip);
return;
}
@@ -344,19 +322,15 @@ void CGUISkin::draw3DButtonPaneStandard(IGUIElement* element,
rect.LowerRightCorner.X -= 1;
rect.LowerRightCorner.Y -= 1;
if (!UseGradient)
{
if (!UseGradient) {
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), rect, clip);
}
else
{
} else {
const video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = c1.getInterpolated(getColor(EGDC_3D_DARK_SHADOW), 0.4f);
Driver->draw2DRectangle(rect, c1, c1, c2, c2, clip);
}
}
//! draws a pressed 3d button pane
/** 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
@@ -366,9 +340,9 @@ EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
\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
implementations to find out how to draw the part exactly. */
void CGUISkin::draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& r,
const core::rect<s32>* clip)
void CGUISkin::draw3DButtonPanePressed(IGUIElement *element,
const core::rect<s32> &r,
const core::rect<s32> *clip)
{
if (!Driver)
return;
@@ -387,19 +361,15 @@ void CGUISkin::draw3DButtonPanePressed(IGUIElement* element,
rect.UpperLeftCorner.X += 1;
rect.UpperLeftCorner.Y += 1;
if (!UseGradient)
{
if (!UseGradient) {
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), rect, clip);
}
else
{
} else {
const video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = c1.getInterpolated(getColor(EGDC_3D_DARK_SHADOW), 0.4f);
Driver->draw2DRectangle(rect, c1, c1, c2, c2, clip);
}
}
//! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes.
\param element: Pointer to the element which wishes to draw this. This parameter
@@ -410,10 +380,10 @@ implementations to find out how to draw the part exactly.
deep into the ground.
\param rect: Defining area where to draw.
\param clip: Clip area. */
void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
bool flat, bool fillBackGround,
const core::rect<s32>& r,
const core::rect<s32>* clip)
void CGUISkin::draw3DSunkenPane(IGUIElement *element, video::SColor bgcolor,
bool flat, bool fillBackGround,
const core::rect<s32> &r,
const core::rect<s32> *clip)
{
if (!Driver)
return;
@@ -423,34 +393,31 @@ void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
if (fillBackGround)
Driver->draw2DRectangle(bgcolor, rect, clip);
if (flat)
{
if (flat) {
// draw flat sunken pane
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // top
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // top
++rect.UpperLeftCorner.Y;
rect.LowerRightCorner.Y = r.LowerRightCorner.Y;
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // left
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // left
rect = r;
++rect.UpperLeftCorner.Y;
rect.UpperLeftCorner.X = rect.LowerRightCorner.X - 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // right
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // right
rect = r;
++rect.UpperLeftCorner.X;
rect.UpperLeftCorner.Y = r.LowerRightCorner.Y - 1;
--rect.LowerRightCorner.X;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // bottom
}
else
{
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // bottom
} else {
// draw deep sunken pane
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // top
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // top
++rect.UpperLeftCorner.X;
++rect.UpperLeftCorner.Y;
--rect.LowerRightCorner.X;
@@ -458,10 +425,10 @@ void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), rect, clip);
rect.UpperLeftCorner.X = r.UpperLeftCorner.X;
rect.UpperLeftCorner.Y = r.UpperLeftCorner.Y+1;
rect.UpperLeftCorner.Y = r.UpperLeftCorner.Y + 1;
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + 1;
rect.LowerRightCorner.Y = r.LowerRightCorner.Y;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // left
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip); // left
++rect.UpperLeftCorner.X;
++rect.UpperLeftCorner.Y;
++rect.LowerRightCorner.X;
@@ -471,7 +438,7 @@ void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
rect = r;
rect.UpperLeftCorner.X = rect.LowerRightCorner.X - 1;
++rect.UpperLeftCorner.Y;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // right
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // right
--rect.UpperLeftCorner.X;
++rect.UpperLeftCorner.Y;
--rect.LowerRightCorner.X;
@@ -482,7 +449,7 @@ void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
++rect.UpperLeftCorner.X;
rect.UpperLeftCorner.Y = r.LowerRightCorner.Y - 1;
--rect.LowerRightCorner.X;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // bottom
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip); // bottom
++rect.UpperLeftCorner.X;
--rect.UpperLeftCorner.Y;
--rect.LowerRightCorner.X;
@@ -491,19 +458,16 @@ void CGUISkin::draw3DSunkenPane(IGUIElement* element, video::SColor bgcolor,
}
}
//! draws a window background
// return where to draw title bar text.
core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& r,
const core::rect<s32>* clip,
core::rect<s32>* checkClientArea)
core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement *element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32> &r,
const core::rect<s32> *clip,
core::rect<s32> *checkClientArea)
{
if (!Driver)
{
if ( checkClientArea )
{
if (!Driver) {
if (checkClientArea) {
*checkClientArea = r;
}
return r;
@@ -513,16 +477,14 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
// top border
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + 1;
if ( !checkClientArea )
{
if (!checkClientArea) {
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip);
}
// left border
rect.LowerRightCorner.Y = r.LowerRightCorner.Y;
rect.LowerRightCorner.X = rect.UpperLeftCorner.X + 1;
if ( !checkClientArea )
{
if (!checkClientArea) {
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip);
}
@@ -531,8 +493,7 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
rect.LowerRightCorner.X = r.LowerRightCorner.X;
rect.UpperLeftCorner.Y = r.UpperLeftCorner.Y;
rect.LowerRightCorner.Y = r.LowerRightCorner.Y;
if ( !checkClientArea )
{
if (!checkClientArea) {
Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), rect, clip);
}
@@ -541,8 +502,7 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
rect.LowerRightCorner.X -= 1;
rect.UpperLeftCorner.Y += 1;
rect.LowerRightCorner.Y -= 1;
if ( !checkClientArea )
{
if (!checkClientArea) {
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip);
}
@@ -551,8 +511,7 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
rect.UpperLeftCorner.Y = r.LowerRightCorner.Y - 1;
rect.LowerRightCorner.Y = r.LowerRightCorner.Y;
rect.LowerRightCorner.X = r.LowerRightCorner.X;
if ( !checkClientArea )
{
if (!checkClientArea) {
Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), rect, clip);
}
@@ -561,37 +520,29 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
rect.LowerRightCorner.X -= 1;
rect.UpperLeftCorner.Y -= 1;
rect.LowerRightCorner.Y -= 1;
if ( !checkClientArea )
{
if (!checkClientArea) {
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip);
}
// client area for background
rect = r;
rect.UpperLeftCorner.X +=1;
rect.UpperLeftCorner.Y +=1;
rect.UpperLeftCorner.X += 1;
rect.UpperLeftCorner.Y += 1;
rect.LowerRightCorner.X -= 2;
rect.LowerRightCorner.Y -= 2;
if (checkClientArea)
{
if (checkClientArea) {
*checkClientArea = rect;
}
if ( !checkClientArea )
{
if (!UseGradient)
{
if (!checkClientArea) {
if (!UseGradient) {
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), rect, clip);
}
else if ( Type == EGST_BURNING_SKIN )
{
const video::SColor c1 = getColor(EGDC_WINDOW).getInterpolated ( 0xFFFFFFFF, 0.9f );
const video::SColor c2 = getColor(EGDC_WINDOW).getInterpolated ( 0xFFFFFFFF, 0.8f );
} else if (Type == EGST_BURNING_SKIN) {
const video::SColor c1 = getColor(EGDC_WINDOW).getInterpolated(0xFFFFFFFF, 0.9f);
const video::SColor c2 = getColor(EGDC_WINDOW).getInterpolated(0xFFFFFFFF, 0.8f);
Driver->draw2DRectangle(rect, c1, c1, c2, c2, clip);
}
else
{
} else {
const video::SColor c2 = getColor(EGDC_3D_SHADOW);
const video::SColor c1 = getColor(EGDC_3D_FACE);
Driver->draw2DRectangle(rect, c1, c1, c1, c2, clip);
@@ -605,26 +556,19 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
rect.LowerRightCorner.X -= 2;
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + getSize(EGDS_WINDOW_BUTTON_WIDTH) + 2;
if (drawTitleBar )
{
if (checkClientArea)
{
if (drawTitleBar) {
if (checkClientArea) {
(*checkClientArea).UpperLeftCorner.Y = rect.LowerRightCorner.Y;
}
else
{
} else {
// draw title bar
//if (!UseGradient)
// if (!UseGradient)
// Driver->draw2DRectangle(titleBarColor, rect, clip);
//else
if ( Type == EGST_BURNING_SKIN )
{
const video::SColor c = titleBarColor.getInterpolated( video::SColor(titleBarColor.getAlpha(),255,255,255), 0.8f);
// else
if (Type == EGST_BURNING_SKIN) {
const video::SColor c = titleBarColor.getInterpolated(video::SColor(titleBarColor.getAlpha(), 255, 255, 255), 0.8f);
Driver->draw2DRectangle(rect, titleBarColor, titleBarColor, c, c, clip);
}
else
{
const video::SColor c = titleBarColor.getInterpolated(video::SColor(titleBarColor.getAlpha(),0,0,0), 0.2f);
} else {
const video::SColor c = titleBarColor.getInterpolated(video::SColor(titleBarColor.getAlpha(), 0, 0, 0), 0.2f);
Driver->draw2DRectangle(rect, titleBarColor, c, titleBarColor, c, clip);
}
}
@@ -633,7 +577,6 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
return rect;
}
//! draws a standard 3d menu pane
/** Used for drawing for menus and context menus.
It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
@@ -643,16 +586,15 @@ 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.
\param rect: Defining area where to draw.
\param clip: Clip area. */
void CGUISkin::draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& r, const core::rect<s32>* clip)
void CGUISkin::draw3DMenuPane(IGUIElement *element,
const core::rect<s32> &r, const core::rect<s32> *clip)
{
if (!Driver)
return;
core::rect<s32> rect = r;
if ( Type == EGST_BURNING_SKIN )
{
if (Type == EGST_BURNING_SKIN) {
rect.UpperLeftCorner.Y -= 3;
draw3DButtonPaneStandard(element, rect, clip);
return;
@@ -698,22 +640,20 @@ void CGUISkin::draw3DMenuPane(IGUIElement* element,
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), rect, clip);
rect = r;
rect.UpperLeftCorner.X +=1;
rect.UpperLeftCorner.Y +=1;
rect.UpperLeftCorner.X += 1;
rect.UpperLeftCorner.Y += 1;
rect.LowerRightCorner.X -= 2;
rect.LowerRightCorner.Y -= 2;
if (!UseGradient)
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), rect, clip);
else
{
else {
const video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = getColor(EGDC_3D_SHADOW);
Driver->draw2DRectangle(rect, c1, c1, c2, c2, clip);
}
}
//! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus.
\param element: Pointer to the element which wishes to draw this. This parameter
@@ -721,9 +661,9 @@ 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.
\param rect: Defining area where to draw.
\param clip: Clip area. */
void CGUISkin::draw3DToolBar(IGUIElement* element,
const core::rect<s32>& r,
const core::rect<s32>* clip)
void CGUISkin::draw3DToolBar(IGUIElement *element,
const core::rect<s32> &r,
const core::rect<s32> *clip)
{
if (!Driver)
return;
@@ -739,28 +679,21 @@ void CGUISkin::draw3DToolBar(IGUIElement* element,
rect = r;
rect.LowerRightCorner.Y -= 1;
if (!UseGradient)
{
if (!UseGradient) {
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), rect, clip);
}
else
if ( Type == EGST_BURNING_SKIN )
{
} else if (Type == EGST_BURNING_SKIN) {
const video::SColor c1 = 0xF0000000 | getColor(EGDC_3D_FACE).color;
const video::SColor c2 = 0xF0000000 | getColor(EGDC_3D_SHADOW).color;
rect.LowerRightCorner.Y += 1;
Driver->draw2DRectangle(rect, c1, c2, c1, c2, clip);
}
else
{
} else {
const video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = getColor(EGDC_3D_SHADOW);
Driver->draw2DRectangle(rect, c1, c1, c2, c2, clip);
}
}
//! draws a tab button
/** Used for drawing for tab buttons on top of tabs.
\param element: Pointer to the element which wishes to draw this. This parameter
@@ -769,16 +702,15 @@ implementations to find out how to draw the part exactly.
\param active: Specifies if the tab is currently active.
\param rect: Defining area where to draw.
\param clip: Clip area. */
void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
const core::rect<s32>& frameRect, const core::rect<s32>* clip, EGUI_ALIGNMENT alignment)
void CGUISkin::draw3DTabButton(IGUIElement *element, bool active,
const core::rect<s32> &frameRect, const core::rect<s32> *clip, EGUI_ALIGNMENT alignment)
{
if (!Driver)
return;
core::rect<s32> tr = frameRect;
if ( alignment == EGUIA_UPPERLEFT )
{
if (alignment == EGUIA_UPPERLEFT) {
tr.LowerRightCorner.X -= 2;
tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1;
tr.UpperLeftCorner.X += 1;
@@ -806,9 +738,7 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
tr.UpperLeftCorner.X += 1;
tr.UpperLeftCorner.Y += 1;
Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip);
}
else
{
} else {
tr.LowerRightCorner.X -= 2;
tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1;
tr.UpperLeftCorner.X += 1;
@@ -831,7 +761,7 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
// draw right middle gray shadow
tr.LowerRightCorner.X += 1;
tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1;
//tr.LowerRightCorner.Y -= 1;
// tr.LowerRightCorner.Y -= 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip);
tr.LowerRightCorner.X += 1;
@@ -841,7 +771,6 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active,
}
}
//! draws a tab control body
/** \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
@@ -850,22 +779,20 @@ implementations to find out how to draw the part exactly.
\param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw.
\param clip: Clip area. */
void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
const core::rect<s32>& rect, const core::rect<s32>* clip, s32 tabHeight, EGUI_ALIGNMENT alignment)
void CGUISkin::draw3DTabBody(IGUIElement *element, bool border, bool background,
const core::rect<s32> &rect, const core::rect<s32> *clip, s32 tabHeight, EGUI_ALIGNMENT alignment)
{
if (!Driver)
return;
core::rect<s32> tr = rect;
if ( tabHeight == -1 )
if (tabHeight == -1)
tabHeight = getSize(gui::EGDS_BUTTON_HEIGHT);
// draw border.
if (border)
{
if ( alignment == EGUIA_UPPERLEFT )
{
if (border) {
if (alignment == EGUIA_UPPERLEFT) {
// draw left hightlight
tr.UpperLeftCorner.Y += tabHeight + 2;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
@@ -880,9 +807,7 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
tr = rect;
tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1;
Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip);
}
else
{
} else {
// draw left hightlight
tr.LowerRightCorner.Y -= tabHeight + 2;
tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1;
@@ -900,30 +825,25 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
}
}
if (background)
{
if ( alignment == EGUIA_UPPERLEFT )
{
if (background) {
if (alignment == EGUIA_UPPERLEFT) {
tr = rect;
tr.UpperLeftCorner.Y += tabHeight + 2;
tr.LowerRightCorner.X -= 1;
tr.UpperLeftCorner.X += 1;
tr.LowerRightCorner.Y -= 1;
}
else
{
} else {
tr = rect;
tr.UpperLeftCorner.X += 1;
tr.UpperLeftCorner.Y -= 1;
tr.LowerRightCorner.X -= 1;
tr.LowerRightCorner.Y -= tabHeight + 2;
//tr.UpperLeftCorner.X += 1;
// tr.UpperLeftCorner.X += 1;
}
if (!UseGradient)
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip);
else
{
else {
video::SColor c1 = getColor(EGDC_3D_FACE);
video::SColor c2 = getColor(EGDC_3D_SHADOW);
Driver->draw2DRectangle(tr, c1, c1, c2, c2, clip);
@@ -931,7 +851,6 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
}
}
//! draws an icon, usually from the skin's sprite bank
/** \param parent: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example
@@ -942,30 +861,28 @@ by more complex implementations to find out how to draw the part exactly.
\param currenttime: The present time, used to calculate the frame number
\param loop: Whether the animation should loop or not
\param clip: Clip area. */
void CGUISkin::drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position,
u32 starttime, u32 currenttime,
bool loop, const core::rect<s32>* clip)
void CGUISkin::drawIcon(IGUIElement *element, EGUI_DEFAULT_ICON icon,
const core::position2di position,
u32 starttime, u32 currenttime,
bool loop, const core::rect<s32> *clip)
{
if (!SpriteBank)
return;
bool gray = element && !element->isEnabled();
SpriteBank->draw2DSprite(Icons[icon], position, clip,
Colors[gray? EGDC_GRAY_WINDOW_SYMBOL : EGDC_WINDOW_SYMBOL], starttime, currenttime, loop, true);
Colors[gray ? EGDC_GRAY_WINDOW_SYMBOL : EGDC_WINDOW_SYMBOL], starttime, currenttime, loop, true);
}
EGUI_SKIN_TYPE CGUISkin::getType() const
{
return Type;
}
//! draws a 2d rectangle.
void CGUISkin::draw2DRectangle(IGUIElement* element,
const video::SColor &color, const core::rect<s32>& pos,
const core::rect<s32>* clip)
void CGUISkin::draw2DRectangle(IGUIElement *element,
const video::SColor &color, const core::rect<s32> &pos,
const core::rect<s32> *clip)
{
Driver->draw2DRectangle(color, pos, clip);
}