From a14d80f83aebe75241bf63b4f3ffca3a5d952577 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 6 Oct 2008 18:22:32 +0000 Subject: libui updates, support menu .ini files --- src/ui/button.cc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/ui/button.cc') diff --git a/src/ui/button.cc b/src/ui/button.cc index 09e8695..73a349e 100644 --- a/src/ui/button.cc +++ b/src/ui/button.cc @@ -5,18 +5,38 @@ */ #include "ui/button.h" +#include "auxiliary/functions.h" +#include "sys/sys.h" namespace ui { -Button::Button (Widget *parent, char const *text, char const *command) : Label(parent, text) +Button::Button (Widget *parent, const char *text, const char *command) : Label(parent, text) { set_label("button"); + set_command(command); +} + +Button::~Button() +{ +} + +void Button::print(size_t indent) +{ + std::string marker(""); + con_print << aux::pad_left(marker, indent*2) << label() << " \"" << text() << "\" \"" << command() << "\"" << std::endl; +} + +void Button::set_command(const char *command) +{ if (command) button_command.assign(command); + else + button_command.clear(); } -Button::~Button() +void Button::set_command(std::string const &command) { + button_command.assign(command); } void Button::draw() -- cgit v1.2.3