diff options
Diffstat (limited to 'src/ui/button.cc')
-rw-r--r-- | src/ui/button.cc | 14 |
1 files changed, 9 insertions, 5 deletions
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; } +} |