Commit 3d51b275 authored by bitplane's avatar bitplane

Checking for IsEnabled is now consistent across all GUI elements (bug 2003234 by CuteAlien)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1412 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f7173847
......@@ -46,6 +46,7 @@ Changes in version 1.5 (... 2008)
Nodes are now solid or transparent. ( but still more states are needed )
- GUI:
- Checking IsEnabled is now consistent across all GUI elements
- Disabling the BMP loader now compiles without the built-in font
- Added setTextAlignment to IGUIComboBox
- Fixed a bug in CGUISpriteBank which caused a crash when a non-looping animated sprite reached the end of its animation.
......
......@@ -93,7 +93,7 @@ void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor col
bool CGUIButton::OnEvent(const SEvent& event)
{
if (!IsEnabled)
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
switch(event.EventType)
{
......
......@@ -119,7 +119,7 @@ bool CGUICheckBox::OnEvent(const SEvent& event)
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -339,7 +339,8 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d<s32> & dim,
//! called if an event happened.
bool CGUIColorSelectDialog::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
......@@ -423,8 +424,9 @@ bool CGUIColorSelectDialog::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -161,6 +161,8 @@ void CGUIComboBox::setSelected(s32 idx)
//! called if an event happened.
bool CGUIComboBox::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
......@@ -304,8 +306,9 @@ bool CGUIComboBox::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -218,8 +218,8 @@ void CGUIContextMenu::removeAllItems()
//! called if an event happened.
bool CGUIContextMenu::OnEvent(const SEvent& event)
{
if (!IsEnabled)
return Parent ? Parent->OnEvent(event) : false;
if (IsEnabled)
{
switch(event.EventType)
{
......@@ -271,8 +271,9 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -187,6 +187,9 @@ void CGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ver
//! called if an event happened.
bool CGUIEditBox::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
......@@ -211,8 +214,9 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -136,6 +136,8 @@ const wchar_t* CGUIFileOpenDialog::getFileName() const
//! called if an event happened.
bool CGUIFileOpenDialog::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
......@@ -235,8 +237,9 @@ bool CGUIFileOpenDialog::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -195,6 +195,8 @@ void CGUIListBox::setSelected(s32 id)
//! called if an event happened.
bool CGUIListBox::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_KEY_INPUT_EVENT:
......@@ -405,8 +407,9 @@ bool CGUIListBox::OnEvent(const SEvent& event)
case EET_USER_EVENT:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -99,8 +99,8 @@ void CGUIMenu::draw()
//! called if an event happened.
bool CGUIMenu::OnEvent(const SEvent& event)
{
if (!IsEnabled)
return Parent ? Parent->OnEvent(event) : false;
if (IsEnabled)
{
switch(event.EventType)
{
......@@ -163,8 +163,9 @@ bool CGUIMenu::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -83,7 +83,7 @@ const video::SMaterial& CGUIMeshViewer::getMaterial() const
//! called if an event happened.
bool CGUIMeshViewer::OnEvent(const SEvent& event)
{
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -254,6 +254,8 @@ void CGUIMessageBox::refreshControls()
//! called if an event happened.
bool CGUIMessageBox::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
SEvent outevent;
outevent.EventType = EET_GUI_EVENT;
outevent.GUIEvent.Caller = this;
......@@ -390,6 +392,7 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
default:
break;
}
}
return CGUIWindow::OnEvent(event);
}
......
......@@ -59,6 +59,9 @@ CGUIScrollBar::~CGUIScrollBar()
//! called if an event happened.
bool CGUIScrollBar::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_KEY_INPUT_EVENT:
......@@ -211,6 +214,7 @@ bool CGUIScrollBar::OnEvent(const SEvent& event)
default:
break;
}
}
return IGUIElement::OnEvent(event);
}
......
......@@ -161,6 +161,8 @@ void CGUISpinBox::setDecimalPlaces(s32 places)
bool CGUISpinBox::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
bool changeEvent = false;
switch(event.EventType)
{
......@@ -207,6 +209,7 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
Parent->OnEvent(e);
return true;
}
}
return IGUIElement::OnEvent(event);
}
......
......@@ -323,8 +323,8 @@ IGUITab* CGUITabControl::getTab(s32 idx) const
//! called if an event happened.
bool CGUITabControl::OnEvent(const SEvent& event)
{
if (!IsEnabled)
return Parent ? Parent->OnEvent(event) : false;
if (IsEnabled)
{
switch(event.EventType)
{
......@@ -365,8 +365,9 @@ bool CGUITabControl::OnEvent(const SEvent& event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
void CGUITabControl::scrollLeft()
......
......@@ -502,6 +502,8 @@ void CGUITable::refreshControls()
//! called if an event happened.
bool CGUITable::OnEvent(const SEvent &event)
{
if (IsEnabled)
{
switch(event.EventType)
{
......@@ -623,8 +625,9 @@ bool CGUITable::OnEvent(const SEvent &event)
default:
break;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -67,14 +67,17 @@ CGUIToolBar::CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32
//! called if an event happened.
bool CGUIToolBar::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
if (event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
if (AbsoluteClippingRect.isPointInside(core::position2di(event.MouseInput.X, event.MouseInput.Y)))
return true;
}
}
return Parent ? Parent->OnEvent(event) : false;
return IGUIElement::OnEvent(event);
}
......
......@@ -109,6 +109,9 @@ CGUIWindow::~CGUIWindow()
//! called if an event happened.
bool CGUIWindow::OnEvent(const SEvent& event)
{
if (IsEnabled)
{
switch(event.EventType)
{
case EET_GUI_EVENT:
......@@ -189,6 +192,7 @@ bool CGUIWindow::OnEvent(const SEvent& event)
default:
break;
}
}
return IGUIElement::OnEvent(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