git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@971 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2007-09-17 23:32:02 +00:00
parent b6ca25020b
commit 81bd54f2fd
15 changed files with 38 additions and 68 deletions

View File

@ -76,10 +76,6 @@ private:
struct SCurrentMaterial
{
SCurrentMaterial() {};
~SCurrentMaterial() { };
void clear() {
Material=video::SMaterial();
Name="";
@ -111,7 +107,7 @@ private:
void clear()
{
if (faces) delete [] faces;
delete [] faces;
faces = 0;
faceCount = 0;
}

View File

@ -26,7 +26,7 @@ namespace gui
s32 id, core::rect<s32> rectangle, bool noclip=false);
//! destructor
~CGUIButton();
virtual ~CGUIButton();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);

View File

@ -80,6 +80,7 @@ u32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool has
return Items.size() - 1;
}
//! Adds a sub menu from an element that already exists.
void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
{
@ -289,7 +290,7 @@ void CGUIContextMenu::setVisible(bool visible)
//! 0 if click went outside of the element,
//! 1 if a valid button 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;
@ -313,7 +314,7 @@ u32 CGUIContextMenu::sendClick(core::position2d<s32> p)
// check click on myself
if (isPointInside(p) &&
HighLighted >= 0 && HighLighted <(s32)Items.size())
(u32)HighLighted < Items.size())
{
if (!Items[HighLighted].Enabled ||
Items[HighLighted].IsSeparator ||
@ -339,7 +340,7 @@ u32 CGUIContextMenu::sendClick(core::position2d<s32> p)
//! 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
s32 openmenu = -1;
@ -599,6 +600,7 @@ s32 CGUIContextMenu::getItemCommandId(u32 idx) const
return Items[idx].CommandId;
}
//! Sets the command id of a menu item
void CGUIContextMenu::setItemCommandId(u32 idx, s32 id)
{
@ -608,6 +610,7 @@ void CGUIContextMenu::setItemCommandId(u32 idx, s32 id)
Items[idx].CommandId = id;
}
//! Writes attributes of the element.
void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
@ -697,6 +700,7 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
recalculateSize();
}
// because sometimes the element has no parent at click time
void CGUIContextMenu::setEventParent(IGUIElement *parent)
{
@ -704,9 +708,7 @@ void CGUIContextMenu::setEventParent(IGUIElement *parent)
for (u32 i=0; i<Items.size(); ++i)
if (Items[i].SubMenu)
{
Items[i].SubMenu->setEventParent(parent);
}
}

View File

@ -115,13 +115,13 @@ namespace gui
virtual void recalculateSize();
//! 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:
//! 0 if click went outside of the element,
//! 1 if a valid button 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
virtual core::rect<s32> getHRect(const SItem& i, const core::rect<s32>& absolute) const;

View File

@ -23,7 +23,7 @@ namespace gui
CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIImage();
virtual ~CGUIImage();
//! sets an image
virtual void setImage(video::ITexture* image);

View File

@ -31,14 +31,6 @@ CGUIInOutFader::CGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent
}
//! destructor
CGUIInOutFader::~CGUIInOutFader()
{
}
//! draws the element and its children
void CGUIInOutFader::draw()
{

View File

@ -23,9 +23,6 @@ namespace gui
CGUIInOutFader(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIInOutFader();
//! draws the element and its children
virtual void draw();

View File

@ -28,7 +28,7 @@ namespace gui
bool drawBack=false, bool moveOverSelect=false);
//! destructor
~CGUIListBox();
virtual ~CGUIListBox();
//! returns amount of list items
virtual u32 getItemCount() const;

View File

@ -32,12 +32,6 @@ CGUIMenu::CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent,
}
//! destructor
CGUIMenu::~CGUIMenu()
{
}
//! draws the element and its children
void CGUIMenu::draw()
{
@ -146,7 +140,7 @@ bool CGUIMenu::OnEvent(const SEvent& event)
}
case EMIE_MOUSE_MOVED:
if (Environment->hasFocus(this))
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), hasOpenSubMenu());
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), hasOpenSubMenu());
return true;
default:
break;
@ -250,5 +244,5 @@ void CGUIMenu::updateAbsolutePosition()
} // end namespace
} // end namespace
#endif // _IRR_COMPILE_WITH_GUI_

View File

@ -23,9 +23,6 @@ namespace gui
//! constructor
CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIMenu();
//! draws the element and its children
virtual void draw();

View File

@ -46,6 +46,27 @@ CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* capt
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()
{
const IGUISkin* skin = Environment->getSkin();
@ -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.
bool CGUIMessageBox::OnEvent(const SEvent& event)
{

View File

@ -26,7 +26,7 @@ namespace gui
IGUIElement* parent, s32 id, core::rect<s32> rectangle);
//! destructor
~CGUIMessageBox();
virtual ~CGUIMessageBox();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);

View File

@ -30,12 +30,6 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare
}
//! destructor
CGUIModalScreen::~CGUIModalScreen()
{
}
//! called if an event happened.
bool CGUIModalScreen::OnEvent(const SEvent& event)
{

View File

@ -22,9 +22,6 @@ namespace gui
//! constructor
CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* parent, s32 id);
//! destructor
~CGUIModalScreen();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);

View File

@ -26,7 +26,7 @@ namespace gui
bool noclip=false);
//! destructor
~CGUIScrollBar();
virtual ~CGUIScrollBar();
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);