diff options
author | Stijn Buys <ingar@osirion.org> | 2013-08-31 17:04:24 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-08-31 17:04:24 +0000 |
commit | 2ccf933af280efc249b47728b3b3fd6cf1beb90f (patch) | |
tree | d78d2ce5596e221b3c2246ccc58bb6d57b480fc6 /src/ui | |
parent | cba3a6db5371f3454321c74cdee3ee002d5d4762 (diff) |
Use a different cursor for clickable ui elements.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/button.cc | 6 | ||||
-rw-r--r-- | src/ui/iconbutton.cc | 8 | ||||
-rw-r--r-- | src/ui/listitem.cc | 9 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/ui/button.cc b/src/ui/button.cc index cba7732..e9a40b9 100644 --- a/src/ui/button.cc +++ b/src/ui/button.cc @@ -11,6 +11,7 @@ #include "core/application.h" #include "core/commandbuffer.h" #include "sys/sys.h" +#include "ui/ui.h" #include "ui/paint.h" #include "ui/button.h" @@ -84,7 +85,12 @@ void Button::draw() } else { Paint::set_color(palette()->foreground()); } + Paint::draw_label(global_location(), size(), font(), text(), alignment()); + + if (enabled() && has_mouse_focus()) { + root()->set_pointer("action", Palette::Highlight); + } } bool Button::on_keypress(const int key, const unsigned int modifier) diff --git a/src/ui/iconbutton.cc b/src/ui/iconbutton.cc index 22a7c14..066f5fa 100644 --- a/src/ui/iconbutton.cc +++ b/src/ui/iconbutton.cc @@ -11,6 +11,7 @@ #include "core/application.h" #include "core/commandbuffer.h" #include "sys/sys.h" +#include "ui/ui.h" #include "ui/paint.h" #include "ui/iconbutton.h" @@ -83,6 +84,11 @@ void IconButton::draw() } Paint::draw_bitmap(global_location(), size(), color, icon()); + + if (enabled() && has_mouse_focus()) { + root()->set_pointer("action", Palette::Highlight); + } + } void IconButton::draw_border() @@ -95,7 +101,7 @@ void IconButton::draw_border() t = 1 - t; color.a = 0.5f + t; Paint::set_color(color); - Paint::draw_border(global_location(), size()); + Paint::draw_border(global_location(), size()); } } diff --git a/src/ui/listitem.cc b/src/ui/listitem.cc index a5d033a..634cbaf 100644 --- a/src/ui/listitem.cc +++ b/src/ui/listitem.cc @@ -7,6 +7,7 @@ #include "audio/audio.h" #include "core/application.h" #include "ui/listitem.h" +#include "ui/ui.h" #include "ui/paint.h" namespace ui { @@ -25,7 +26,7 @@ ListItem::~ListItem() { void ListItem::draw_border() { - if (has_mouse_focus()) { + if (enabled() && has_mouse_focus()) { math::Color color(palette()->foreground()); float t = core::application()->time(); t = t - floorf(t); @@ -54,7 +55,13 @@ void ListItem::draw() } else { Paint::set_color(palette()->foreground()); } + Paint::draw_label(global_location(), size(), font(), text(), alignment()); + + if (enabled() && has_mouse_focus()) { + root()->set_pointer("action", Palette::Highlight); + } + } void ListItem::on_mouseover(const math::Vector2f &cursor) |