changed behaviour of IGUIElement::OnEvent so it doesn't always absorb events, and added getAbsoluteClippingRect.

fixed tooltip text on file open dialog's close button.
added some managed marshalling bugfix things where I missed them earlier.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@751 dfc29bdd-3216-0410-991c-e03cc46cb475
master
bitplane 2007-07-02 02:15:18 +00:00
parent 4b370145d9
commit 9b3c67fe37
11 changed files with 66 additions and 39 deletions

View File

@ -5,20 +5,6 @@ Changes in version 1.4 (... 2007)
- Fixed a bug in CBillboardTextSceneNode::setText where the old text was not cleared.
- IGUIElement now calls getter and setter functions when serializing,
in case people override them.
- Added setDrawBorder and setTextAlignment to IGUIStaticText.
- IGUIEditBox new methods:
setWordWrap/isWordWrapEnabled, to split words on to the next line.
setMultiLine and isMultiLineEnabled, inserts a newline instead of sending
EGET_EDITBOX_ENTER events.
setTextAlignment, to align the text to left, right, top, bottom and centers
setAutoScroll, to enable and disable automatic scrolling with the cursor
- Added IGUISpinBox, by Michael Zeilfelder (CuteAlien).
- Changed irrArray::linear_search to use the == operator rather than <
This may be slower in some cases, but it no longer returns false positives
when searching arrays of classes that override the < operator but
@ -42,6 +28,26 @@ Changes in version 1.4 (... 2007)
- Fixed a typo to do with 2nd light vectors in opengl parallax and normal map
renderers.
GUI:
- IGUIElement changes:
OnEvent no longer absorbs events by default.
Serialize/deserialize now call getter and setter functions, in case people
override these and don't use the internal protected variables.
added getAbsoluteClippingRect, returns the visible area of an element.
- Added IGUISpinBox, by Michael Zeilfelder (CuteAlien).
- IGUIEditBox new methods:
setWordWrap/isWordWrapEnabled, to split words on to the next line.
setMultiLine and isMultiLineEnabled, inserts a newline instead of sending
EGET_EDITBOX_ENTER events.
setTextAlignment, to align the text to left, right, top, bottom and centers
setAutoScroll, to enable and disable automatic scrolling with the cursor
- IGUIStaticText new methods setDrawBorder and setTextAlignment.
Changes in version 1.3.1 (20 Jun 2007)
- Fixed a bug with negative exponents in fast_atof, posted by RVL

View File

@ -147,6 +147,12 @@ public:
return AbsoluteRect;
}
//! Returns the visible area of the element.
core::rect<s32> getAbsoluteClippingRect() const
{
return AbsoluteClippingRect;
}
//! Sets whether the element will ignore its parent's clipping rectangle
void setNotClipped(bool noClip)
{
@ -516,10 +522,7 @@ public:
//! Called if an event happened.
virtual bool OnEvent(SEvent event)
{
if (Parent)
Parent->OnEvent(event);
return true;
return Parent ? Parent->OnEvent(event) : false;
}

View File

@ -114,6 +114,7 @@ void CGUIEditBox::updateAbsolutePosition()
//! Checks if word wrap is enabled
bool CGUIEditBox::isWordWrapEnabled()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return WordWrap;
}
@ -126,6 +127,7 @@ void CGUIEditBox::setMultiLine(bool enable)
//! Checks if multi line editing is enabled
bool CGUIEditBox::isMultiLineEnabled()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return MultiLine;
}
@ -779,6 +781,7 @@ void CGUIEditBox::setAutoScroll(bool enable)
//! \return true if automatic scrolling is enabled, false if not
bool CGUIEditBox::isAutoScrollEnabled()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return AutoScroll;
}
@ -871,7 +874,8 @@ bool CGUIEditBox::processMouse(const SEvent& event)
Environment->removeFocus(this);
return false;
}
else
{
// move cursor
CursorPos = getCursorPos(event.MouseInput.X, event.MouseInput.Y);
@ -884,6 +888,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
return true;
}
}
}
return false;
}

View File

@ -299,7 +299,7 @@ void CGUIEnvironment::clear()
//! called by ui if an event happened.
bool CGUIEnvironment::OnEvent(SEvent event)
{
if (UserReceiver && event.GUIEvent.Caller != this)
if (UserReceiver && (event.EventType != EET_GUI_EVENT || event.GUIEvent.Caller != this))
return UserReceiver->OnEvent(event);
return false;

View File

@ -50,7 +50,7 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title, IGUIEnvironment* en
s32 posx = RelativeRect.getWidth() - buttonw - 4;
CloseButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
L"", skin ? skin->getDefaultText(EGDT_MSG_BOX_OK) : L"Close");
L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close");
CloseButton->setSubElement(true);
if (sprites)
{

View File

@ -44,7 +44,7 @@ bool CGUIModalScreen::OnEvent(SEvent event)
}
}
return IGUIElement::OnEvent(event);
return true;
}

View File

@ -93,9 +93,8 @@ bool CGUIScrollBar::OnEvent(SEvent event)
break;
case EMIE_LMOUSE_PRESSED_DOWN:
{
IGUIElement *el = Environment->getRootGUIElement()->getElementFromPoint(
core::position2di(event.MouseInput.X, event.MouseInput.Y));
if (el == this )
if (AbsoluteClippingRect.isPointInside(core::position2di(event.MouseInput.X, event.MouseInput.Y)))
{
Dragging = true;
Environment->setFocus(this);
@ -103,11 +102,7 @@ bool CGUIScrollBar::OnEvent(SEvent event)
}
else
{
if (Environment->getFocus() == this)
{
Environment->setFocus(el);
return el->OnEvent(event);
}
Environment->removeFocus(this);
}
break;
}

View File

@ -208,6 +208,7 @@ void CGUIStaticText::enableOverrideColor(bool enable)
bool CGUIStaticText::isOverrideColorEnabled()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return OverrideColorEnabled;
}
@ -222,6 +223,7 @@ void CGUIStaticText::setWordWrap(bool enable)
bool CGUIStaticText::isWordWrapEnabled()
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return WordWrap;
}

View File

@ -68,7 +68,18 @@ CGUIToolBar::~CGUIToolBar()
{
}
//! called if an event happened.
bool CGUIToolBar::OnEvent(SEvent event)
{
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;
}
//! draws the element and its children
void CGUIToolBar::draw()

View File

@ -23,6 +23,9 @@ namespace gui
//! destructor
~CGUIToolBar();
//! called if an event happened.
virtual bool OnEvent(SEvent event);
//! draws the element and its children
virtual void draw();

View File

@ -107,9 +107,11 @@ bool CGUIWindow::OnEvent(SEvent event)
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST)
{
if (event.GUIEvent.Caller == (IGUIElement*)this)
{
Dragging = false;
return true;
}
}
else
if (event.GUIEvent.EventType == EGET_BUTTON_CLICKED)
{