From 02fcd22d8cde355aa898a8c6bb4773d9434b8e9a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 10 Oct 2008 16:41:38 +0000 Subject: adds KeyPress, DevInfo and Stats widgets --- src/ui/button.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/ui/button.cc') diff --git a/src/ui/button.cc b/src/ui/button.cc index d6384c9..1ac5fd8 100644 --- a/src/ui/button.cc +++ b/src/ui/button.cc @@ -17,6 +17,7 @@ Button::Button (Widget *parent, const char *text, const char *command) : Label(p { set_label("button"); set_command(command); + set_alignment(AlignCenter); } Button::~Button() @@ -51,6 +52,7 @@ void Button::draw_border() paint::color(palette()->foreground()); else paint::color(palette()->border()); + paint::border(global_location(), size()); } @@ -64,21 +66,23 @@ void Button::draw_text() else paint::color(palette()->foreground()); - paint::text_centered(global_location(), size(), text(), font()); + paint::text(global_location(), size(), font(), text(), alignment()); } -void Button::keypress(unsigned int key, unsigned int modifier) +bool Button::keypress(unsigned int key, unsigned int modifier) { - + return false; } -void Button::keyrelease(unsigned int key, unsigned int modifier) +bool Button::keyrelease(unsigned int key, unsigned int modifier) { if (key == 512 + SDL_BUTTON_LEFT) { core::cmd() << button_command << std::endl; audio::play("ui/button"); + return true; } -} + return false; } +} -- cgit v1.2.3