Skip to content

Commit

Permalink
Ui: fix signals to work with -fvisibility-inlines-hidden and on MinGW.
Browse files Browse the repository at this point in the history
Ugh, oh well.
  • Loading branch information
mosra committed Jun 26, 2019
1 parent 9bf269d commit 97da887
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/Magnum/Ui/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ Button& Button::setText(const Containers::ArrayView<const char> text) {
return *this;
}

auto Button::tapped() -> Signal {
/* See https://github.com/mosra/corrade/issues/72 for details */
return emit(&Button::tapped);
}

void Button::update() {
auto& plane = static_cast<Plane&>(this->plane());

Expand Down
4 changes: 1 addition & 3 deletions src/Magnum/Ui/Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ class MAGNUM_UI_EXPORT Button: public Widget, public Interconnect::Emitter {
}

/** @brief The button was tapped */
Signal tapped() {
return emit(&Button::tapped);
}
Signal tapped();

private:
void MAGNUM_UI_LOCAL update() override;
Expand Down
15 changes: 15 additions & 0 deletions src/Magnum/Ui/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ Input& Input::setValue(const Containers::ArrayView<const char> value) {
return *this;
}

auto Input::focused() -> Signal {
/* See https://github.com/mosra/corrade/issues/72 for details */
return emit(&Input::focused);
}

auto Input::blurred() -> Signal {
/* See https://github.com/mosra/corrade/issues/72 for details */
return emit(&Input::blurred);
}

auto Input::valueChanged(const std::string& value) -> Signal {
/* See https://github.com/mosra/corrade/issues/72 for details */
return emit(&Input::valueChanged, value);
}

void Input::update() {
auto& plane = static_cast<Plane&>(this->plane());

Expand Down
12 changes: 3 additions & 9 deletions src/Magnum/Ui/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ class MAGNUM_UI_EXPORT Input: public Widget, public Interconnect::Emitter {
* @see @ref UserInterface::inputWidgetFocused(),
* @ref Platform::Sdl2Application::startTextInput() "Platform::*Application::startTextInput()"
*/
Signal focused() {
return emit(&Input::focused);
}
Signal focused();

/**
* @brief The widget was blurred
Expand All @@ -131,18 +129,14 @@ class MAGNUM_UI_EXPORT Input: public Widget, public Interconnect::Emitter {
* @see @ref UserInterface::inputWidgetBlurred(),
* @ref Platform::Sdl2Application::stopTextInput() "Platform::*Application::stopTextInput()"
*/
Signal blurred() {
return emit(&Input::blurred);
}
Signal blurred();

/**
* @brief The input value changed
*
* Useful for attaching input validators.
*/
Signal valueChanged(const std::string& value) {
return emit(&Input::valueChanged, value);
}
Signal valueChanged(const std::string& value);

private:
void MAGNUM_UI_LOCAL update() override;
Expand Down
10 changes: 10 additions & 0 deletions src/Magnum/Ui/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,14 @@ void UserInterface::draw() {
BasicUserInterface::draw({_backgroundShader, _foregroundShader, _textShader});
}

auto UserInterface::inputWidgetFocused() -> Signal {
/* See https://github.com/mosra/corrade/issues/72 for details */
return emit(&UserInterface::inputWidgetFocused);
}

auto UserInterface::inputWidgetBlurred() -> Signal {
/* See https://github.com/mosra/corrade/issues/72 for details */
return emit(&UserInterface::inputWidgetBlurred);
}

}}
8 changes: 2 additions & 6 deletions src/Magnum/Ui/UserInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,7 @@ class MAGNUM_UI_EXPORT UserInterface: public BasicUserInterface<Implementation::
* @see @ref Input::focused(),
* @ref Platform::Sdl2Application::startTextInput() "Platform::*Application::startTextInput()"
*/
Signal inputWidgetFocused() {
return emit(&UserInterface::inputWidgetFocused);
}
Signal inputWidgetFocused();

/**
* @brief Input widget was blurred
Expand All @@ -310,9 +308,7 @@ class MAGNUM_UI_EXPORT UserInterface: public BasicUserInterface<Implementation::
* @see @ref Input::focused(),
* @ref Platform::Sdl2Application::stopTextInput() "Platform::*Application::stopTextInput()"
*/
Signal inputWidgetBlurred() {
return emit(&UserInterface::inputWidgetBlurred);
}
Signal inputWidgetBlurred();

private:
struct MAGNUM_UI_LOCAL FontState;
Expand Down

0 comments on commit 97da887

Please sign in to comment.