Commit 81bd54f2 authored by hybrid's avatar hybrid

Cleanup.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@971 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b6ca2502
...@@ -76,10 +76,6 @@ private: ...@@ -76,10 +76,6 @@ private:
struct SCurrentMaterial struct SCurrentMaterial
{ {
SCurrentMaterial() {};
~SCurrentMaterial() { };
void clear() { void clear() {
Material=video::SMaterial(); Material=video::SMaterial();
Name=""; Name="";
...@@ -111,7 +107,7 @@ private: ...@@ -111,7 +107,7 @@ private:
void clear() void clear()
{ {
if (faces) delete [] faces; delete [] faces;
faces = 0; faces = 0;
faceCount = 0; faceCount = 0;
} }
......
...@@ -26,7 +26,7 @@ namespace gui ...@@ -26,7 +26,7 @@ namespace gui
s32 id, core::rect<s32> rectangle, bool noclip=false); s32 id, core::rect<s32> rectangle, bool noclip=false);
//! destructor //! destructor
~CGUIButton(); virtual ~CGUIButton();
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
......
...@@ -80,6 +80,7 @@ u32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool has ...@@ -80,6 +80,7 @@ u32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool has
return Items.size() - 1; return Items.size() - 1;
} }
//! Adds a sub menu from an element that already exists. //! Adds a sub menu from an element that already exists.
void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu) void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
{ {
...@@ -289,7 +290,7 @@ void CGUIContextMenu::setVisible(bool visible) ...@@ -289,7 +290,7 @@ void CGUIContextMenu::setVisible(bool visible)
//! 0 if click went outside of the element, //! 0 if click went outside of the element,
//! 1 if a valid button was clicked, //! 1 if a valid button was clicked,
//! 2 if a nonclickable element was clicked //! 2 if a nonclickable element was clicked
u32 CGUIContextMenu::sendClick(core::position2d<s32> p) u32 CGUIContextMenu::sendClick(const core::position2d<s32>& p)
{ {
u32 t = 0; u32 t = 0;
...@@ -313,7 +314,7 @@ u32 CGUIContextMenu::sendClick(core::position2d<s32> p) ...@@ -313,7 +314,7 @@ u32 CGUIContextMenu::sendClick(core::position2d<s32> p)
// check click on myself // check click on myself
if (isPointInside(p) && if (isPointInside(p) &&
HighLighted >= 0 && HighLighted <(s32)Items.size()) (u32)HighLighted < Items.size())
{ {
if (!Items[HighLighted].Enabled || if (!Items[HighLighted].Enabled ||
Items[HighLighted].IsSeparator || Items[HighLighted].IsSeparator ||
...@@ -339,7 +340,7 @@ u32 CGUIContextMenu::sendClick(core::position2d<s32> p) ...@@ -339,7 +340,7 @@ u32 CGUIContextMenu::sendClick(core::position2d<s32> p)
//! returns true, if an element was highligted //! returns true, if an element was highligted
bool CGUIContextMenu::highlight(core::position2d<s32> p, bool canOpenSubMenu) bool CGUIContextMenu::highlight(const core::position2d<s32>& p, bool canOpenSubMenu)
{ {
// get number of open submenu // get number of open submenu
s32 openmenu = -1; s32 openmenu = -1;
...@@ -599,6 +600,7 @@ s32 CGUIContextMenu::getItemCommandId(u32 idx) const ...@@ -599,6 +600,7 @@ s32 CGUIContextMenu::getItemCommandId(u32 idx) const
return Items[idx].CommandId; return Items[idx].CommandId;
} }
//! Sets the command id of a menu item //! Sets the command id of a menu item
void CGUIContextMenu::setItemCommandId(u32 idx, s32 id) void CGUIContextMenu::setItemCommandId(u32 idx, s32 id)
{ {
...@@ -608,6 +610,7 @@ void CGUIContextMenu::setItemCommandId(u32 idx, s32 id) ...@@ -608,6 +610,7 @@ void CGUIContextMenu::setItemCommandId(u32 idx, s32 id)
Items[idx].CommandId = id; Items[idx].CommandId = id;
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
...@@ -697,6 +700,7 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR ...@@ -697,6 +700,7 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
recalculateSize(); recalculateSize();
} }
// because sometimes the element has no parent at click time // because sometimes the element has no parent at click time
void CGUIContextMenu::setEventParent(IGUIElement *parent) void CGUIContextMenu::setEventParent(IGUIElement *parent)
{ {
...@@ -704,9 +708,7 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent) ...@@ -704,9 +708,7 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent)
for (u32 i=0; i<Items.size(); ++i) for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu) if (Items[i].SubMenu)
{
Items[i].SubMenu->setEventParent(parent); Items[i].SubMenu->setEventParent(parent);
}
} }
......
...@@ -115,13 +115,13 @@ namespace gui ...@@ -115,13 +115,13 @@ namespace gui
virtual void recalculateSize(); virtual void recalculateSize();
//! returns true, if an element was highlighted //! returns true, if an element was highlighted
virtual bool highlight(core::position2d<s32> p, bool canOpenSubMenu); virtual bool highlight(const core::position2d<s32>& p, bool canOpenSubMenu);
//! sends a click Returns: //! sends a click Returns:
//! 0 if click went outside of the element, //! 0 if click went outside of the element,
//! 1 if a valid button was clicked, //! 1 if a valid button was clicked,
//! 2 if a nonclickable element was clicked //! 2 if a nonclickable element was clicked
virtual u32 sendClick(core::position2d<s32> p); virtual u32 sendClick(const core::position2d<s32>& p);
//! returns the item highlight-area //! returns the item highlight-area
virtual core::rect<s32> getHRect(const SItem& i, const core::rect<s32>& absolute) const; virtual core::rect<s32> getHRect(const SItem& i, const core::rect<s32>& absolute) const;
......
...@@ -23,7 +23,7 @@ namespace gui ...@@ -23,7 +23,7 @@ namespace gui
CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle); CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor //! destructor
~CGUIImage(); virtual ~CGUIImage();
//! sets an image //! sets an image
virtual void setImage(video::ITexture* image); virtual void setImage(video::ITexture* image);
......
...@@ -31,14 +31,6 @@ CGUIInOutFader::CGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent ...@@ -31,14 +31,6 @@ CGUIInOutFader::CGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent
} }
//! destructor
CGUIInOutFader::~CGUIInOutFader()
{
}
//! draws the element and its children //! draws the element and its children
void CGUIInOutFader::draw() void CGUIInOutFader::draw()
{ {
......
...@@ -23,9 +23,6 @@ namespace gui ...@@ -23,9 +23,6 @@ namespace gui
CGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent, CGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle); s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIInOutFader();
//! draws the element and its children //! draws the element and its children
virtual void draw(); virtual void draw();
......
...@@ -28,7 +28,7 @@ namespace gui ...@@ -28,7 +28,7 @@ namespace gui
bool drawBack=false, bool moveOverSelect=false); bool drawBack=false, bool moveOverSelect=false);
//! destructor //! destructor
~CGUIListBox(); virtual ~CGUIListBox();
//! returns amount of list items //! returns amount of list items
virtual u32 getItemCount() const; virtual u32 getItemCount() const;
......
...@@ -32,12 +32,6 @@ CGUIMenu::CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -32,12 +32,6 @@ CGUIMenu::CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent,
} }
//! destructor
CGUIMenu::~CGUIMenu()
{
}
//! draws the element and its children //! draws the element and its children
void CGUIMenu::draw() void CGUIMenu::draw()
{ {
...@@ -250,5 +244,5 @@ void CGUIMenu::updateAbsolutePosition() ...@@ -250,5 +244,5 @@ void CGUIMenu::updateAbsolutePosition()
} // end namespace } // end namespace
} // end namespace } // end namespace
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
...@@ -23,9 +23,6 @@ namespace gui ...@@ -23,9 +23,6 @@ namespace gui
//! constructor //! constructor
CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle); CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIMenu();
//! draws the element and its children //! draws the element and its children
virtual void draw(); virtual void draw();
......
...@@ -46,6 +46,27 @@ CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* capt ...@@ -46,6 +46,27 @@ CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* capt
refreshControls(); refreshControls();
} }
//! destructor
CGUIMessageBox::~CGUIMessageBox()
{
if (StaticText)
StaticText->drop();
if (OkButton)
OkButton->drop();
if (CancelButton)
CancelButton->drop();
if (YesButton)
YesButton->drop();
if (NoButton)
NoButton->drop();
}
void CGUIMessageBox::refreshControls() void CGUIMessageBox::refreshControls()
{ {
const IGUISkin* skin = Environment->getSkin(); const IGUISkin* skin = Environment->getSkin();
...@@ -230,26 +251,6 @@ void CGUIMessageBox::refreshControls() ...@@ -230,26 +251,6 @@ void CGUIMessageBox::refreshControls()
} }
//! destructor
CGUIMessageBox::~CGUIMessageBox()
{
if (StaticText)
StaticText->drop();
if (OkButton)
OkButton->drop();
if (CancelButton)
CancelButton->drop();
if (YesButton)
YesButton->drop();
if (NoButton)
NoButton->drop();
}
//! called if an event happened. //! called if an event happened.
bool CGUIMessageBox::OnEvent(const SEvent& event) bool CGUIMessageBox::OnEvent(const SEvent& event)
{ {
......
...@@ -26,7 +26,7 @@ namespace gui ...@@ -26,7 +26,7 @@ namespace gui
IGUIElement* parent, s32 id, core::rect<s32> rectangle); IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor //! destructor
~CGUIMessageBox(); virtual ~CGUIMessageBox();
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
......
...@@ -30,12 +30,6 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare ...@@ -30,12 +30,6 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare
} }
//! destructor
CGUIModalScreen::~CGUIModalScreen()
{
}
//! called if an event happened. //! called if an event happened.
bool CGUIModalScreen::OnEvent(const SEvent& event) bool CGUIModalScreen::OnEvent(const SEvent& event)
{ {
......
...@@ -22,9 +22,6 @@ namespace gui ...@@ -22,9 +22,6 @@ namespace gui
//! constructor //! constructor
CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* parent, s32 id); CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* parent, s32 id);
//! destructor
~CGUIModalScreen();
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
......
...@@ -26,7 +26,7 @@ namespace gui ...@@ -26,7 +26,7 @@ namespace gui
bool noclip=false); bool noclip=false);
//! destructor //! destructor
~CGUIScrollBar(); virtual ~CGUIScrollBar();
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
......
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