added custommenu command

This commit is contained in:
markt 2007-03-16 20:44:47 +00:00
parent d948abb81b
commit 74216903cc
4 changed files with 27 additions and 0 deletions

View file

@ -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

View file

@ -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") {

View file

@ -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)

View file

@ -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();