Removed parameter of disabled function

0.8
Bruno Van de Velde 2017-01-25 01:27:21 +01:00
parent 4d665f62f8
commit 3559fa530c
7 changed files with 10 additions and 43 deletions

View File

@ -280,13 +280,11 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Disables the widget
///
/// @param blockMouseEvents Should mouse events be passed to the widget behind this one or blocked?
///
/// The widget will no longer receive events and it will thus no longer send callbacks.
/// All widgets are enabled by default.
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void disable(bool blockMouseEvents = true);
virtual void disable();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -549,20 +547,11 @@ namespace tgui
void rendererChangedCallback(const std::string& property);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Check if the widget blocks mouse events when disabled
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool isDisabledBlockingMouseEvents() const;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected:
std::string m_type;
// Block mouse events when the widget is disabled or let them pass to the widget behind it?
bool m_disabledBlockingMouseEvents = true;
// When a widget is disabled, it will no longer receive events
bool m_enabled = true;

View File

@ -117,13 +117,11 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Disables the widget
///
/// @param blockMouseEvents Should mouse events be passed to the widget behind this one or blocked?
///
/// The widget will no longer receive events and it will thus no longer send callbacks.
/// All widgets are enabled by default.
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void disable(bool blockMouseEvents = true) override;
virtual void disable() override;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -151,13 +151,11 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Disables the widget
///
/// @param blockMouseEvents Should mouse events be passed to the widget behind this one or blocked?
///
/// The widget will no longer receive events and it will thus no longer send callbacks.
/// All widgets are enabled by default.
///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
virtual void disable(bool blockMouseEvents = true) override;
virtual void disable() override;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -974,15 +974,9 @@ namespace tgui
if ((*it)->mouseOnWidget(mousePos - (*it)->getPosition()))
{
if ((*it)->isEnabled())
{
widget = *it;
break;
}
else // The widget is disabled
{
if ((*it)->isDisabledBlockingMouseEvents())
break;
}
break;
}
}
}

View File

@ -102,7 +102,6 @@ namespace tgui
SignalWidgetBase {other},
enable_shared_from_this<Widget>{other},
m_type (other.m_type), // Did not compile in VS2013 when using braces
m_disabledBlockingMouseEvents {other.m_disabledBlockingMouseEvents},
m_enabled {other.m_enabled},
m_visible {other.m_visible},
m_parent {nullptr},
@ -139,7 +138,6 @@ namespace tgui
SignalWidgetBase {std::move(other)},
enable_shared_from_this<Widget>{std::move(other)},
m_type (std::move(other.m_type)), // Did not compile in VS2013 when using braces
m_disabledBlockingMouseEvents {std::move(other.m_disabledBlockingMouseEvents)},
m_enabled {std::move(other.m_enabled)},
m_visible {std::move(other.m_visible)},
m_parent {nullptr},
@ -190,7 +188,6 @@ namespace tgui
m_callback.widget = this;
m_type = other.m_type;
m_disabledBlockingMouseEvents = other.m_disabledBlockingMouseEvents;
m_enabled = other.m_enabled;
m_visible = other.m_visible;
m_parent = nullptr;
@ -240,7 +237,6 @@ namespace tgui
m_callback.widget = this;
m_type = std::move(other.m_type);
m_disabledBlockingMouseEvents = std::move(other.m_disabledBlockingMouseEvents);
m_enabled = std::move(other.m_enabled);
m_visible = std::move(other.m_visible);
m_parent = nullptr;
@ -534,10 +530,9 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Widget::disable(bool blockMouseEvents)
void Widget::disable()
{
m_enabled = false;
m_disabledBlockingMouseEvents = blockMouseEvents;
// Change the mouse button state.
m_mouseHover = false;
@ -747,13 +742,6 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool Widget::isDisabledBlockingMouseEvents() const
{
return m_disabledBlockingMouseEvents;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Widget::drawRectangleShape(sf::RenderTarget& target,
const sf::RenderStates& states,
sf::Vector2f size,

View File

@ -109,9 +109,9 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Button::disable(bool blockMouseEvents)
void Button::disable()
{
Widget::disable(blockMouseEvents);
Widget::disable();
updateTextColorAndStyle();
}

View File

@ -130,9 +130,9 @@ namespace tgui
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void EditBox::disable(bool blockMouseEvents)
void EditBox::disable()
{
Widget::disable(blockMouseEvents);
Widget::disable();
if (getRenderer()->getTextColorDisabled().isSet())
{