From d26252aa8ebba40aecaa15b0e14e9926c2247eb1 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Fri, 19 Dec 2003 18:26:48 +0000 Subject: edit clock format menu item --- src/ClockTool.cc | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 10b9ad5..889c65e 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc @@ -20,13 +20,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ClockTool.cc,v 1.8 2003/12/07 16:39:43 fluxgen Exp $ +// $Id: ClockTool.cc,v 1.9 2003/12/19 18:26:48 fluxgen Exp $ #include "ClockTool.hh" #include "ToolTheme.hh" #include "Screen.hh" #include "CommandParser.hh" +#include "CommandDialog.hh" +#include "fluxbox.hh" #include "FbTk/SimpleCommand.hh" #include "FbTk/ImageControl.hh" @@ -38,6 +40,9 @@ #endif // HAVE_CONFIG_H #include +#include +#include +using namespace std; class ClockMenuItem: public FbTk::MenuItem { public: @@ -104,6 +109,23 @@ private: ClockTool &m_tool; }; +class EditClockFormatCmd: public FbTk::Command { +public: + void execute() { + BScreen *screen = Fluxbox::instance()->mouseScreen(); + if (screen == 0) + return; + std::string resourcename = screen->name() + ".strftimeFormat"; + + CommandDialog *dialog = new CommandDialog(*screen, "Edit Clock Format", + "SetResourceValue " + resourcename + " "); + FbTk::RefCount cmd(CommandParser::instance().parseLine("reconfigure")); + dialog->setPostCommand(cmd); + dialog->setText(screen->resourceManager().resourceValue(resourcename)); + dialog->show(); + } +}; + ClockTool::ClockTool(const FbTk::FbWindow &parent, ToolTheme &theme, BScreen &screen, FbTk::Menu &menu): ToolbarItem(ToolbarItem::FIXED), @@ -127,10 +149,16 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent, m_timer.start(); m_button.setGC(m_theme.textGC()); + + // setup menu FbTk::RefCount saverc(CommandParser::instance().parseLine("saverc")); FbTk::MenuItem *item = new ClockMenuItem(*this); item->setCommand(saverc); menu.insert(item); + FbTk::RefCount editformat_cmd(new EditClockFormatCmd()); + menu.insert("Edit Clock Format", editformat_cmd); + + update(0); } -- cgit v0.11.2