Commit 8a0d790a authored by hybrid's avatar hybrid

Some constification.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@948 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f583f7dc
......@@ -111,9 +111,9 @@ public:
virtual IGUISkin* getSkin() = 0;
//! Sets a new GUI Skin
/** You can used this to change the appearance of the whole GUI Environment. You
can set one ot the built-in skins or implement your own class derived from
IGUISkin and set this useing this method.
/** You can use this to change the appearance of the whole GUI Environment. You
can set one of the built-in skins or implement your own class derived from
IGUISkin and enable it using this method.
To set for example the built-in Windows classic skin, use the following code:
\code
gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
......@@ -126,7 +126,7 @@ public:
//! Creates a new GUI Skin based on a template.
/** Use setSkin() to set the created skin.
\return Returns a pointer to the created skin.
If you no longer need the image, you should call IGUISkin::drop().
If you no longer need it, you should call IGUISkin::drop().
See IReferenceCounted::drop() for more information. */
virtual IGUISkin* createSkin(EGUI_SKIN_TYPE type) = 0;
......
......@@ -326,21 +326,21 @@ namespace gui
public:
//! destructor
~IGUISkin() {};
virtual ~IGUISkin() {};
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) = 0;
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
//! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor) = 0;
//! returns default color
virtual s32 getSize(EGUI_DEFAULT_SIZE size) = 0;
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const = 0;
//! Returns a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) = 0;
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const = 0;
//! Sets a default text.
/** For example for Message box button captions:
......@@ -351,20 +351,20 @@ namespace gui
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size) = 0;
//! returns the default font
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) = 0;
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const = 0;
//! sets a default font
virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT) = 0;
//! returns the sprite bank
virtual IGUISpriteBank* getSpriteBank() = 0;
virtual IGUISpriteBank* getSpriteBank() const = 0;
//! sets the sprite bank
virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
//! Returns a default icon
/** Returns the sprite index within the sprite bank */
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) = 0;
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const = 0;
//! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows,
......
......@@ -48,24 +48,24 @@ CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* capt
void CGUIMessageBox::refreshControls()
{
IGUISkin* skin = Environment->getSkin();
const IGUISkin* skin = Environment->getSkin();
IGUIElement* focusMe = 0;
s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT);
s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH);
s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2;
s32 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT);
const s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH);
const s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2;
const s32 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
// add static multiline text
core::dimension2d<s32> dim(AbsoluteClippingRect.getWidth() - buttonWidth,
AbsoluteClippingRect.getHeight() - (buttonHeight * 3));
core::position2d<s32> pos((AbsoluteClippingRect.getWidth() - dim.Width) / 2,
const core::position2d<s32> pos((AbsoluteClippingRect.getWidth() - dim.Width) / 2,
buttonHeight / 2 + titleHeight);
if (!StaticText)
{
StaticText = Environment->addStaticText(MessageText.c_str(),
StaticText = Environment->addStaticText(MessageText.c_str(),
core::rect<s32>(pos, dim), false, false, this);
StaticText->setWordWrap(true);
StaticText->setSubElement(true);
......@@ -73,13 +73,13 @@ void CGUIMessageBox::refreshControls()
}
else
{
StaticText->setRelativePosition( core::rect<s32>(pos, dim));
StaticText->setRelativePosition(core::rect<s32>(pos, dim));
StaticText->setText(MessageText.c_str());
}
// adjust static text height
s32 textHeight = StaticText->getTextHeight();
const s32 textHeight = StaticText->getTextHeight();
core::rect<s32> tmp = StaticText->getRelativePosition();
tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + textHeight;
StaticText->setRelativePosition(tmp);
......@@ -88,7 +88,7 @@ void CGUIMessageBox::refreshControls()
// adjust message box height
tmp = getRelativePosition();
s32 msgBoxHeight = textHeight + (s32)(2.5f * buttonHeight) + titleHeight;
s32 msgBoxHeight = textHeight + core::floor32(2.5f * buttonHeight) + titleHeight;
// adjust message box position
......@@ -99,15 +99,19 @@ void CGUIMessageBox::refreshControls()
// add buttons
s32 countButtons = 0;
if (Flags & EMBF_OK) ++countButtons;
if (Flags & EMBF_CANCEL) ++countButtons;
if (Flags & EMBF_YES) ++countButtons;
if (Flags & EMBF_NO) ++countButtons;
if (Flags & EMBF_OK)
++countButtons;
if (Flags & EMBF_CANCEL)
++countButtons;
if (Flags & EMBF_YES)
++countButtons;
if (Flags & EMBF_NO)
++countButtons;
core::rect<s32> btnRect;
btnRect.UpperLeftCorner.Y = pos.Y + dim.Height + buttonHeight / 2;
btnRect.LowerRightCorner.Y = btnRect.UpperLeftCorner.Y + buttonHeight;
btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() -
btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() -
((buttonWidth + buttonDistance)*countButtons)) / 2;
btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth;
......@@ -134,7 +138,7 @@ void CGUIMessageBox::refreshControls()
{
OkButton->drop();
OkButton->remove();
OkButton =0;
OkButton = 0;
}
// add cancel button
......@@ -150,7 +154,6 @@ void CGUIMessageBox::refreshControls()
CancelButton->setRelativePosition(btnRect);
CancelButton->setText(skin->getDefaultText(EGDT_MSG_BOX_CANCEL));
CancelButton->grab();
btnRect.LowerRightCorner.X += buttonWidth + buttonDistance;
btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance;
......@@ -296,21 +299,23 @@ bool CGUIMessageBox::OnEvent(SEvent event)
else
if (CancelButton)
{
CancelButton->setPressed(true);
CancelButton->setPressed(true);
Pressed = true;
}
}
else
if (CloseButton && CloseButton->isVisible())
{
CloseButton->setPressed(true);
CloseButton->setPressed(true);
Pressed = true;
}
break;
default: // no other key is handled here
break;
}
}
else
if (Pressed)
{
if (OkButton && event.KeyInput.Key == KEY_RETURN)
{
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_OK;
......@@ -355,7 +360,7 @@ bool CGUIMessageBox::OnEvent(SEvent event)
return true;
}
else
if (event.GUIEvent.Caller == CancelButton ||
if (event.GUIEvent.Caller == CancelButton ||
event.GUIEvent.Caller == CloseButton)
{
outevent.GUIEvent.EventType = EGET_MESSAGEBOX_CANCEL;
......@@ -391,12 +396,12 @@ void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeRea
{
CGUIWindow::serializeAttributes(out,options);
out->addBool ("OkayButton", (Flags & EMBF_OK) != 0 );
out->addBool ("CancelButton", (Flags & EMBF_CANCEL)!= 0 );
out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );
out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );
out->addBool ("OkayButton", (Flags & EMBF_OK) != 0 );
out->addBool ("CancelButton", (Flags & EMBF_CANCEL) != 0 );
out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );
out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );
out->addString ("MessageText", MessageText.c_str() );
out->addString ("MessageText", MessageText.c_str());
}
//! Reads attributes of the element
......@@ -414,7 +419,6 @@ void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
CGUIWindow::deserializeAttributes(in,options);
refreshControls();
}
......@@ -423,3 +427,4 @@ void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
#endif // _IRR_COMPILE_WITH_GUI_
......@@ -60,7 +60,6 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
Sizes[EGDS_TEXT_DISTANCE_X] = 2;
Sizes[EGDS_TEXT_DISTANCE_Y] = 0;
}
else
{
......@@ -159,24 +158,30 @@ CGUISkin::~CGUISkin()
//! returns default color
video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color)
video::SColor CGUISkin::getColor(EGUI_DEFAULT_COLOR color) const
{
return Colors[color];
if ((u32)color < EGDC_COUNT)
return Colors[color];
else
return video::SColor();
}
//! sets a default color
void CGUISkin::setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor)
{
if (which>=0 && which<= EGDC_COUNT)
if ((u32)which < EGDC_COUNT)
Colors[which] = newColor;
}
//! returns default color
s32 CGUISkin::getSize(EGUI_DEFAULT_SIZE size)
s32 CGUISkin::getSize(EGUI_DEFAULT_SIZE size) const
{
return Sizes[size];
if ((u32)size < EGDS_COUNT)
return Sizes[size];
else
return 0;
}
......@@ -184,16 +189,16 @@ s32 CGUISkin::getSize(EGUI_DEFAULT_SIZE size)
//! sets a default size
void CGUISkin::setSize(EGUI_DEFAULT_SIZE which, s32 size)
{
if (which >= 0 && which <= EGDS_COUNT)
if ((u32)which < EGDS_COUNT)
Sizes[which] = size;
}
//! returns the default font
IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which)
IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which) const
{
if (Fonts[which])
if (((u32)which < EGDS_COUNT) && Fonts[which])
return Fonts[which];
else
return Fonts[EGDF_DEFAULT];
......@@ -202,6 +207,9 @@ IGUIFont* CGUISkin::getFont(EGUI_DEFAULT_FONT which)
//! sets a default font
void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
{
if ((u32)which >= EGDS_COUNT)
return;
if (Fonts[which])
Fonts[which]->drop();
......@@ -211,11 +219,15 @@ void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
Fonts[which]->grab();
}
IGUISpriteBank* CGUISkin::getSpriteBank()
//! gets the sprite bank stored
IGUISpriteBank* CGUISkin::getSpriteBank() const
{
return SpriteBank;
}
//! set a new sprite bank or remove one by passing 0
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
{
if (SpriteBank)
......@@ -227,23 +239,31 @@ void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
SpriteBank = bank;
}
//! Returns a default icon
u32 CGUISkin::getIcon(EGUI_DEFAULT_ICON icon)
u32 CGUISkin::getIcon(EGUI_DEFAULT_ICON icon) const
{
return Icons[icon];
if ((u32)icon < EGDI_COUNT)
return Icons[icon];
else
return 0;
}
//! Sets a default icon
void CGUISkin::setIcon(EGUI_DEFAULT_ICON icon, u32 index)
{
Icons[icon] = index;
if ((u32)icon < EGDI_COUNT)
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 wchar_t* CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text) const
{
return Texts[text].c_str();
if ((u32)text < EGDT_COUNT)
return Texts[text].c_str();
else
return Texts[0].c_str();
}
......@@ -251,7 +271,8 @@ const wchar_t* CGUISkin::getDefaultText(EGUI_DEFAULT_TEXT text)
//! "OK", "Cancel", "Yes", "No" and so on.
void CGUISkin::setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText)
{
Texts[which] = newText;
if ((u32)which < EGDT_COUNT)
Texts[which] = newText;
}
//! draws a standard 3d button pane
......@@ -264,8 +285,8 @@ EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
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)
const core::rect<s32>& r,
const core::rect<s32>* clip)
{
if (!Driver)
return;
......@@ -279,8 +300,8 @@ void CGUISkin::draw3DButtonPaneStandard(IGUIElement* element,
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;
}
......@@ -303,8 +324,8 @@ void CGUISkin::draw3DButtonPaneStandard(IGUIElement* element,
}
else
{
video::SColor c1 = getColor(EGDC_3D_FACE);
video::SColor c2 = c1.getInterpolated(getColor(EGDC_3D_DARK_SHADOW), 0.4f);
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);
}
}
......@@ -320,8 +341,8 @@ EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
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)
const core::rect<s32>& r,
const core::rect<s32>* clip)
{
if (!Driver)
return;
......@@ -346,8 +367,8 @@ void CGUISkin::draw3DButtonPanePressed(IGUIElement* element,
}
else
{
video::SColor c1 = getColor(EGDC_3D_FACE);
video::SColor c2 = c1.getInterpolated(getColor(EGDC_3D_DARK_SHADOW), 0.4f);
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);
}
}
......@@ -363,17 +384,16 @@ 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;
core::rect<s32> rect = r;
if (flat)
{
// draw flat sunken pane
......@@ -432,16 +452,15 @@ implementations to find out how to draw the part exactly.
\param clip: Clip area.
\return Returns rect 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>* cl)
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& r,
const core::rect<s32>* cl)
{
if (!Driver)
return r;
core::rect<s32> rect = r;
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, cl);
......@@ -486,15 +505,15 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
else
if ( Type == EGST_BURNING_SKIN )
{
video::SColor c1 = getColor(EGDC_WINDOW).getInterpolated ( 0xFFFFFFFF, 0.9f );
video::SColor c2 = getColor(EGDC_WINDOW).getInterpolated ( 0xFFFFFFFF, 0.8f );
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, cl);
}
else
{
video::SColor c2 = getColor(EGDC_3D_SHADOW);
video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = getColor(EGDC_3D_SHADOW);
const video::SColor c1 = getColor(EGDC_3D_FACE);
Driver->draw2DRectangle(rect, c1, c1, c1, c2, cl);
}
......@@ -512,12 +531,12 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
//else
if ( Type == EGST_BURNING_SKIN )
{
video::SColor c = titleBarColor.getInterpolated( 0xffffffff, 0.8f);
const video::SColor c = titleBarColor.getInterpolated( 0xffffffff, 0.8f);
Driver->draw2DRectangle(rect, titleBarColor, titleBarColor, c, c, cl);
}
else
{
video::SColor c = titleBarColor.getInterpolated(video::SColor(255,0,0,0), 0.2f);
const video::SColor c = titleBarColor.getInterpolated(video::SColor(255,0,0,0), 0.2f);
Driver->draw2DRectangle(rect, titleBarColor, c, titleBarColor, c, cl);
}
}
......@@ -538,17 +557,18 @@ implementations to find out how to draw the part exactly.
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 )
{
core::rect<s32> rect = r;
rect.UpperLeftCorner.Y -= 3;
draw3DButtonPaneStandard(element, rect, clip);
return;
}
if (!Driver)
return;
// in this skin, this is exactly what non pressed buttons look like,
// so we could simply call
// draw3DButtonPaneStandard(element, rect, clip);
......@@ -557,7 +577,6 @@ void CGUISkin::draw3DMenuPane(IGUIElement* element,
// We draw it a little bit better, with some more draw2DRectangle calls,
// but there aren't that much menus visible anyway.
core::rect<s32> rect = r;
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + 1;
Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), rect, clip);
......@@ -599,8 +618,8 @@ void CGUISkin::draw3DMenuPane(IGUIElement* element,
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), rect, clip);
else
{
video::SColor c1 = getColor(EGDC_3D_FACE);
video::SColor c2 = getColor(EGDC_3D_SHADOW);
const video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = getColor(EGDC_3D_SHADOW);
Driver->draw2DRectangle(rect, c1, c1, c2, c2, clip);
}
}
......@@ -614,8 +633,8 @@ 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)
const core::rect<s32>& r,
const core::rect<s32>* clip)
{
if (!Driver)
return;
......@@ -638,21 +657,21 @@ void CGUISkin::draw3DToolBar(IGUIElement* element,
else
if ( Type == EGST_BURNING_SKIN )
{
video::SColor c1 = 0xF0000000 | getColor(EGDC_3D_FACE).color;
video::SColor c2 = 0xF0000000 | getColor(EGDC_3D_SHADOW).color;
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
{
video::SColor c1 = getColor(EGDC_3D_FACE);
video::SColor c2 = getColor(EGDC_3D_SHADOW);
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 whiches to draw this. This parameter
......@@ -662,7 +681,8 @@ implementations to find out how to draw the part exactly.
\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)
const core::rect<s32>& frameRect,
const core::rect<s32>* clip)
{
if (!Driver)
return;
......@@ -746,13 +766,14 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background,
Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip);
else
{
video::SColor c1 = getColor(EGDC_3D_FACE);
video::SColor c2 = getColor(EGDC_3D_SHADOW);
const video::SColor c1 = getColor(EGDC_3D_FACE);
const video::SColor c2 = getColor(EGDC_3D_SHADOW);
Driver->draw2DRectangle(tr, c1, c1, c2, c2, clip);
}
}
}
//! 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
......@@ -764,7 +785,8 @@ by more complex implementations to find out how to draw the part exactly.
\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,
const core::position2di position,
u32 starttime, u32 currenttime,
bool loop, const core::rect<s32>* clip)
{
if (!SpriteBank)
......@@ -772,14 +794,15 @@ void CGUISkin::drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
SpriteBank->draw2DSprite(Icons[icon], position, clip,
video::SColor(255,0,0,0), 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,
......@@ -788,6 +811,7 @@ void CGUISkin::draw2DRectangle(IGUIElement* element,
Driver->draw2DRectangle(color, pos, clip);
}
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
......@@ -807,6 +831,7 @@ void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrite
out->addInt(GUISkinIconNames[i], Icons[i]);
}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
......@@ -824,7 +849,6 @@ void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrit
for (i=0; i<EGDI_COUNT; ++i)
Icons[i] = in->getAttributeAsInt(GUISkinIconNames[i]);
}
......@@ -832,3 +856,4 @@ void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrit
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
......@@ -27,22 +27,22 @@ namespace gui
CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver);
//! destructor
~CGUISkin();
virtual ~CGUISkin();
//! returns default color
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color);
virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const;
//! sets a default color
virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor);
//! returns default color
virtual s32 getSize(EGUI_DEFAULT_SIZE size);
virtual s32 getSize(EGUI_DEFAULT_SIZE size) const;
//! sets a default size
virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size);
//! returns the default font
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const;
//! sets a default font
virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
......@@ -51,11 +51,11 @@ namespace gui
virtual void setSpriteBank(IGUISpriteBank* bank);
//! gets the sprite bank used for drawing icons
virtual IGUISpriteBank* getSpriteBank();
virtual IGUISpriteBank* getSpriteBank() const;
//! Returns a default icon
/** Returns the sprite index within the sprite bank */
virtual u32 getIcon(EGUI_DEFAULT_ICON icon);
virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const;
//! Sets a default icon
/** Sets the sprite index used for drawing icons like arrows,
......@@ -67,7 +67,7 @@ namespace gui
//! Returns a default text.
/** For example for Message box button captions:
"OK", "Cancel", "Yes", "No" and so on. */
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text);
virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const;
//! Sets a default text.
/** For example for Message box button captions:
......@@ -84,8 +84,8 @@ namespace gui
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. */
virtual void draw3DButtonPaneStandard(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
//! draws a pressed 3d button pane
/** Used for drawing for example buttons in pressed state.
......@@ -97,8 +97,8 @@ namespace gui
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. */
virtual void draw3DButtonPanePressed(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
//! draws a sunken 3d pane
/** Used for drawing the background of edit, combo or check boxes.
......@@ -111,9 +111,10 @@ namespace gui
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DSunkenPane(IGUIElement* element,
video::SColor bgcolor, bool flat, bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
video::SColor bgcolor, bool flat,
bool fillBackGround,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
//! draws a window background
/** Used for drawing the background of dialogs and windows.
......@@ -126,9 +127,9 @@ namespace gui
\param clip: Clip area.
\return Returns rect where to draw title bar text. */
virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
bool drawTitleBar, video::SColor titleBarColor,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
//! draws a standard 3d menu pane
/** Used for drawing for menus and context menus.
......@@ -140,8 +141,8 @@ namespace gui
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DMenuPane(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
//! draws a standard 3d tool bar
/** Used for drawing for toolbars and menus.
......@@ -151,8 +152,8 @@ namespace gui
\param rect: Defining area where to draw.
\param clip: Clip area. */
virtual void draw3DToolBar(IGUIElement* element,
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
const core::rect<s32>& rect,
const core::rect<s32>* clip=0);
//! draws a tab button
/** Used for drawing for tab buttons on top of tabs.
......@@ -174,7 +175,8 @@ namespace gui
\param background: Specifies if the background should be drawn.
\param rect: Defining area where to draw.
\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);
......@@ -189,8 +191,9 @@ namespace gui
\param loop: Whether the animation should loop or not
\param clip: Clip area. */
virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
const core::position2di position, u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0);
const core::position2di position,
u32 starttime=0, u32 currenttime=0,
bool loop=false, const core::rect<s32>* clip=0);
//! draws a 2d rectangle.
......@@ -203,7 +206,7 @@ namespace gui
\param clip: Pointer to rectangle against which the rectangle will be clipped.
If the pointer is null, no clipping will be performed. */
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment