From 74216903cc04b9b4492925fc4f90e9f5f378d8c1 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 16 Mar 2007 20:44:47 +0000 Subject: added custommenu command --- ChangeLog | 4 ++++ src/FbCommandFactory.cc | 3 +++ src/FbCommands.cc | 11 +++++++++++ src/FbCommands.hh | 9 +++++++++ 4 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index 720d148..61b94cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*07/03/16: + * Added key command to open a custom menu file (thanks Matteo Galiazzo) + - :CustomMenu /path/to/file + FbCommands.cc/hh FbCommandFactory.cc *07/03/11: * Fixed display bug with ParentRelative menu highlight (thanks Julien Trolet) FbTk/Menu.cc diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 2f05e5a..c02365a 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -65,6 +65,7 @@ FbCommandFactory::FbCommandFactory() { "close", "closeallwindows", "commanddialog", + "custommenu", "deiconify", "detachclient", "export", @@ -438,6 +439,8 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, return new HideMenuCmd(); else if (command == "rootmenu") return new ShowRootMenuCmd(); + else if (command == "custommenu") + return new ShowCustomMenuCmd(arguments.c_str()); else if (command == "workspacemenu") return new ShowWorkspaceMenuCmd(); else if (command == "setworkspacename") { diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 692e12f..bef6402 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -28,6 +28,7 @@ #include "Workspace.hh" #include "Window.hh" #include "Keys.hh" +#include "MenuCreator.hh" #include "FbTk/Theme.hh" #include "FbTk/Menu.hh" @@ -269,6 +270,16 @@ void HideMenuCmd::execute() { screen->workspaceMenu().hide(); } +ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {} + +void ShowCustomMenuCmd::execute() { + BScreen *screen = Fluxbox::instance()->mouseScreen(); + if (screen == 0) + return; + ::showMenu(*screen, *MenuCreator::createFromFile(custom_menu_file, + screen->screenNumber(), true)); +} + void ShowRootMenuCmd::execute() { BScreen *screen = Fluxbox::instance()->mouseScreen(); if (screen == 0) diff --git a/src/FbCommands.hh b/src/FbCommands.hh index 59200d2..3bc5074 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh @@ -118,6 +118,15 @@ public: void execute(); }; +class ShowCustomMenuCmd: public FbTk::Command { +public: + explicit ShowCustomMenuCmd(const std::string &arguments); + void execute(); +private: + std::string custom_menu_file; + +}; + class ShowRootMenuCmd: public FbTk::Command { public: void execute(); -- cgit v0.11.2