Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-07 17:14:27 +0000
committerStijn Buys <ingar@osirion.org>2008-10-07 17:14:27 +0000
commitf54bd48a884e4e3c95818f042a4b2418a6e070a4 (patch)
tree73e82729a2f97b58e94ffd6944ac1ad47bf8314e /src/ui/button.cc
parentf8d1ee921c83b7b148883b3ee16e4ec9c776d6db (diff)
working button click
Diffstat (limited to 'src/ui/button.cc')
-rw-r--r--src/ui/button.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/ui/button.cc b/src/ui/button.cc
index 73a349e..0910995 100644
--- a/src/ui/button.cc
+++ b/src/ui/button.cc
@@ -4,9 +4,11 @@
the terms of the GNU General Public License version 2
*/
-#include "ui/button.h"
#include "auxiliary/functions.h"
+#include "render/primitives.h"
#include "sys/sys.h"
+#include "ui/button.h"
+#include "core/commandbuffer.h"
namespace ui {
@@ -44,6 +46,33 @@ void Button::draw()
Label::draw();
}
+void Button::draw_text()
+{
+ if (!text().size())
+ return;
+
+ if (palette()) {
+ if (has_focus())
+ render::gl::color(palette()->highlight());
+ else
+ render::gl::color(palette()->foreground());
+ }
+
+ render::primitives::text_centered(global_location(), size(), text());
+}
+
+void Button::event_keypress(unsigned int key, unsigned int modifier)
+{
+
+}
+
+void Button::event_keyrelease(unsigned int key, unsigned int modifier)
+{
+ if (key == 512 + SDL_BUTTON_LEFT) {
+ core::cmd() << button_command << std::endl;
+ }
+}
+
}