make FbTk::Command a template class, split parsing information out of ObjectRegistry
This commit is contained in:
parent
1f01d84c08
commit
9f2f65a698
49 changed files with 430 additions and 543 deletions
|
@ -30,7 +30,7 @@
|
|||
#include "FbTk/Resource.hh"
|
||||
|
||||
namespace {
|
||||
class ToggleFrameFocusCmd: public FbTk::Command {
|
||||
class ToggleFrameFocusCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
ToggleFrameFocusCmd(Focusable &client):
|
||||
m_client(client),
|
||||
|
@ -82,7 +82,7 @@ void AttentionNoticeHandler::addAttention(Focusable &client) {
|
|||
timeval timeout;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = **timeout_res * 1000;
|
||||
RefCount<Command> cmd(new ToggleFrameFocusCmd(client));
|
||||
RefCount<Command<void> > cmd(new ToggleFrameFocusCmd(client));
|
||||
timer->setCommand(cmd);
|
||||
timer->setTimeout(timeout);
|
||||
timer->fireOnce(false); // will repeat until window has focus
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "ToolTheme.hh"
|
||||
#include "Screen.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "CommandDialog.hh"
|
||||
#include "fluxbox.hh"
|
||||
|
||||
|
@ -116,7 +116,7 @@ private:
|
|||
ClockTool &m_tool;
|
||||
};
|
||||
|
||||
class EditClockFormatCmd: public FbTk::Command {
|
||||
class EditClockFormatCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
|
||||
CommandDialog *dialog = new CommandDialog(*screen, "Edit Clock Format",
|
||||
"SetResourceValue " + resourcename + " ");
|
||||
FbTk::RefCount<FbTk::Command> cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("reconfigure"));
|
||||
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse("reconfigure"));
|
||||
dialog->setPostCommand(cmd);
|
||||
dialog->setText(screen->resourceManager().resourceValue(resourcename));
|
||||
dialog->show();
|
||||
|
@ -160,7 +160,7 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
|||
// if nothing has changed, it wont update the graphics
|
||||
m_timer.setInterval(1);
|
||||
// m_timer.setTimeout(delay); // don't need to set timeout on interval timer
|
||||
FbTk::RefCount<FbTk::Command> update_graphic(new FbTk::SimpleCommand<ClockTool>(*this,
|
||||
FbTk::RefCount<FbTk::Command<void> > update_graphic(new FbTk::SimpleCommand<ClockTool>(*this,
|
||||
&ClockTool::updateTime));
|
||||
m_timer.setCommand(update_graphic);
|
||||
m_timer.start();
|
||||
|
@ -168,11 +168,11 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent,
|
|||
m_button.setGC(m_theme->textGC());
|
||||
|
||||
// setup menu
|
||||
FbTk::RefCount<FbTk::Command> saverc(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("saverc"));
|
||||
FbTk::RefCount<FbTk::Command<void> > saverc(FbTk::CommandParser<void>::instance().parse("saverc"));
|
||||
FbTk::MenuItem *item = new ClockMenuItem(*this);
|
||||
item->setCommand(saverc);
|
||||
menu.insert(item);
|
||||
FbTk::RefCount<FbTk::Command> editformat_cmd(new EditClockFormatCmd());
|
||||
FbTk::RefCount<FbTk::Command<void> > editformat_cmd(new EditClockFormatCmd());
|
||||
menu.insert(_FB_XTEXT(Toolbar, ClockEditFormat, "Edit Clock Format", "edit Clock Format") , editformat_cmd);
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Screen.hh"
|
||||
#include "FbWinFrameTheme.hh"
|
||||
#include "WinClient.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "FocusControl.hh"
|
||||
#include "fluxbox.hh"
|
||||
|
||||
|
@ -136,8 +136,8 @@ void CommandDialog::keyPressEvent(XKeyEvent &event) {
|
|||
|
||||
if (ks == XK_Return) {
|
||||
hide(); // hide and return focus to a FluxboxWindow
|
||||
// create command from line
|
||||
auto_ptr<FbTk::Command> cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse(m_precommand + m_textbox.text()));
|
||||
// create Command<void> from line
|
||||
auto_ptr<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(m_precommand + m_textbox.text()));
|
||||
if (cmd.get())
|
||||
cmd->execute();
|
||||
// post execute
|
||||
|
@ -167,8 +167,8 @@ void CommandDialog::tabComplete() {
|
|||
return;
|
||||
}
|
||||
|
||||
FbTk::ObjectRegistry<FbTk::Command>::CreatorMap::const_iterator it = FbTk::ObjectRegistry<FbTk::Command>::instance().creatorMap().begin();
|
||||
const FbTk::ObjectRegistry<FbTk::Command>::CreatorMap::const_iterator it_end = FbTk::ObjectRegistry<FbTk::Command>::instance().creatorMap().end();
|
||||
FbTk::ObjectRegistry<FbTk::CommandParser<void>::Creator *>::CreatorMap::const_iterator it = FbTk::ObjectRegistry<FbTk::CommandParser<void>::Creator *>::instance().creatorMap().begin();
|
||||
const FbTk::ObjectRegistry<FbTk::CommandParser<void>::Creator *>::CreatorMap::const_iterator it_end = FbTk::ObjectRegistry<FbTk::CommandParser<void>::Creator *>::instance().creatorMap().end();
|
||||
vector<string> matches;
|
||||
for (; it != it_end; ++it) {
|
||||
if ((*it).first.find(prefix) == 0) {
|
||||
|
|
|
@ -44,10 +44,10 @@ public:
|
|||
/// Sets the entry text.
|
||||
void setText(const std::string &text);
|
||||
/**
|
||||
* Sets the command to be execute after the command is done.
|
||||
* Sets the command to be executed after the command is done.
|
||||
* @param postcommand the command.
|
||||
*/
|
||||
void setPostCommand(FbTk::RefCount<FbTk::Command> &postcommand) {
|
||||
void setPostCommand(FbTk::RefCount<FbTk::Command<void> > &postcommand) {
|
||||
m_postcommand = postcommand;
|
||||
}
|
||||
void show();
|
||||
|
@ -71,11 +71,13 @@ private:
|
|||
FbTk::TextBox m_textbox; //< entry field
|
||||
FbTk::TextButton m_label; //< text in the titlebar
|
||||
FbTk::GContext m_gc;
|
||||
FbTk::RefCount<FbTk::Command> m_postcommand; ///< command to do after the first command was issued (like reconfigure)
|
||||
/// command to do after the first command was issued (like reconfigure)
|
||||
FbTk::RefCount<FbTk::Command<void> > m_postcommand;
|
||||
BScreen &m_screen;
|
||||
int m_move_x, m_move_y;
|
||||
Pixmap m_pixmap;
|
||||
const std::string m_precommand; ///< command to be used before the text (usefull for setting workspace name)
|
||||
/// command to be used before the text (usefull for setting workspace name)
|
||||
const std::string m_precommand;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "WinClient.hh"
|
||||
|
||||
#include "FocusControl.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "FbTk/stringstream.hh"
|
||||
#include "FbTk/StringUtil.hh"
|
||||
|
||||
|
@ -37,7 +37,7 @@ using FbTk::Command;
|
|||
|
||||
namespace {
|
||||
|
||||
FbTk::Command *createCurrentWindowCmd(const std::string &command,
|
||||
FbTk::Command<void> *createCurrentWindowCmd(const std::string &command,
|
||||
const std::string &args, bool trusted) {
|
||||
if (command == "minimizewindow" || command == "minimize" || command == "iconify")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::iconify);
|
||||
|
@ -86,35 +86,35 @@ FbTk::Command *createCurrentWindowCmd(const std::string &command,
|
|||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(minimizewindow, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(minimize, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(iconify, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(maximizewindow, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(maximize, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(maximizevertical, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(maximizehorizontal, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(raise, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(raiselayer, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(lower, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(lowerlayer, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(activate, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(focus, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(close, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(killwindow, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(kill, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(shade, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(shadewindow, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(shadeon, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(shadeoff, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(stick, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(stickwindow, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(toggledecor, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(nexttab, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(prevtab, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(movetableft, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(movetabright, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(detachclient, createCurrentWindowCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(windowmenu, createCurrentWindowCmd, Command);
|
||||
REGISTER_COMMAND_PARSER(minimizewindow, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(minimize, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(iconify, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(maximizewindow, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(maximize, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(activate, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(focus, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(shade, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(shadewindow, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(shadeon, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(shadeoff, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(stick, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(stickwindow, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(toggledecor, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(nexttab, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(prevtab, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(movetableft, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(movetabright, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(detachclient, createCurrentWindowCmd, void);
|
||||
REGISTER_COMMAND_PARSER(windowmenu, createCurrentWindowCmd, void);
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
|
@ -130,7 +130,7 @@ FluxboxWindow &WindowHelperCmd::fbwindow() {
|
|||
return *FocusControl::focusedFbWindow();
|
||||
}
|
||||
|
||||
bool WindowHelperBoolCmd::bool_execute() {
|
||||
bool WindowHelperBoolCmd::execute() {
|
||||
if (WindowCmd<void>::window() || FocusControl::focusedFbWindow())
|
||||
return real_execute();
|
||||
return false;
|
||||
|
@ -156,7 +156,7 @@ void CurrentWindowCmd::real_execute() {
|
|||
|
||||
namespace {
|
||||
|
||||
FbTk::Command *parseIntCmd(const string &command, const string &args,
|
||||
FbTk::Command<void> *parseIntCmd(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
int num = (command == "sethead" ? 0 : 1);
|
||||
FbTk_istringstream iss(args.c_str());
|
||||
|
@ -181,14 +181,14 @@ FbTk::Command *parseIntCmd(const string &command, const string &args,
|
|||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(sethead, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(tab, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(sendtonextworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(sendtoprevworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(taketonextworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(taketoprevworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(sendtoworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(taketoworkspace, parseIntCmd, Command);
|
||||
REGISTER_COMMAND_PARSER(sethead, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(tab, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(sendtonextworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(sendtoprevworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(taketonextworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(taketoprevworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(sendtoworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(taketoworkspace, parseIntCmd, void);
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
|
@ -251,7 +251,7 @@ void GoToTabCmd::real_execute() {
|
|||
(*it)->focus();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(startmoving, StartMovingCmd, Command);
|
||||
REGISTER_COMMAND(startmoving, StartMovingCmd, void);
|
||||
|
||||
void StartMovingCmd::real_execute() {
|
||||
const XEvent &last = Fluxbox::instance()->lastEvent();
|
||||
|
@ -261,7 +261,7 @@ void StartMovingCmd::real_execute() {
|
|||
}
|
||||
}
|
||||
|
||||
FbTk::Command *StartResizingCmd::parse(const string &cmd, const string &args,
|
||||
FbTk::Command<void> *StartResizingCmd::parse(const string &cmd, const string &args,
|
||||
bool trusted) {
|
||||
FluxboxWindow::ResizeModel mode = FluxboxWindow::DEFAULTRESIZE;
|
||||
std::vector<string> tokens;
|
||||
|
@ -294,7 +294,7 @@ FbTk::Command *StartResizingCmd::parse(const string &cmd, const string &args,
|
|||
return new StartResizingCmd(mode);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(startresizing, StartResizingCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(startresizing, StartResizingCmd::parse, void);
|
||||
|
||||
void StartResizingCmd::real_execute() {
|
||||
const XEvent &last = Fluxbox::instance()->lastEvent();
|
||||
|
@ -308,7 +308,7 @@ void StartResizingCmd::real_execute() {
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(starttabbing, StartTabbingCmd, Command);
|
||||
REGISTER_COMMAND(starttabbing, StartTabbingCmd, void);
|
||||
|
||||
void StartTabbingCmd::real_execute() {
|
||||
const XEvent &last = Fluxbox::instance()->lastEvent();
|
||||
|
@ -318,7 +318,7 @@ void StartTabbingCmd::real_execute() {
|
|||
}
|
||||
}
|
||||
|
||||
FbTk::Command *MoveCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<void> *MoveCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
FbTk_istringstream is(args.c_str());
|
||||
int dx = 0, dy = 0;
|
||||
|
@ -339,11 +339,11 @@ FbTk::Command *MoveCmd::parse(const string &command, const string &args,
|
|||
return new MoveCmd(dx, dy);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(move, MoveCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(moveright, MoveCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(moveleft, MoveCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(moveup, MoveCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(movedown, MoveCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(move, MoveCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(moveright, MoveCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(moveleft, MoveCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(moveup, MoveCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(movedown, MoveCmd::parse, void);
|
||||
|
||||
MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
|
||||
m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
|
||||
|
@ -354,7 +354,7 @@ void MoveCmd::real_execute() {
|
|||
fbwindow().y() + m_step_size_y);
|
||||
}
|
||||
|
||||
FbTk::Command *ResizeCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<void> *ResizeCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
FbTk_istringstream is(args.c_str());
|
||||
int dx = 0, dy = 0;
|
||||
|
@ -371,10 +371,10 @@ FbTk::Command *ResizeCmd::parse(const string &command, const string &args,
|
|||
return new ResizeCmd(dx, dy);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(resize, ResizeCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(resizeto, ResizeCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(resizehorizontal, ResizeCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(resizevertical, ResizeCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(resize, ResizeCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(resizeto, ResizeCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(resizehorizontal, ResizeCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(resizevertical, ResizeCmd::parse, void);
|
||||
|
||||
ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
|
||||
m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
|
||||
|
@ -390,7 +390,7 @@ void ResizeCmd::real_execute() {
|
|||
fbwindow().resize(w, h);
|
||||
}
|
||||
|
||||
FbTk::Command *MoveToCmd::parse(const string &cmd, const string &args,
|
||||
FbTk::Command<void> *MoveToCmd::parse(const string &cmd, const string &args,
|
||||
bool trusted) {
|
||||
typedef std::vector<string> StringTokens;
|
||||
StringTokens tokens;
|
||||
|
@ -435,7 +435,7 @@ FbTk::Command *MoveToCmd::parse(const string &cmd, const string &args,
|
|||
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(moveto, MoveToCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse, void);
|
||||
|
||||
MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc) :
|
||||
m_step_size_x(step_size_x), m_step_size_y(step_size_y), m_refc(refc) { }
|
||||
|
@ -472,14 +472,14 @@ void ResizeToCmd::real_execute() {
|
|||
fbwindow().resize(m_step_size_x, m_step_size_y);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(fullscreen, FullscreenCmd, Command);
|
||||
REGISTER_COMMAND(fullscreen, FullscreenCmd, void);
|
||||
|
||||
FullscreenCmd::FullscreenCmd() { }
|
||||
void FullscreenCmd::real_execute() {
|
||||
fbwindow().setFullscreen(!fbwindow().isFullscreen());
|
||||
}
|
||||
|
||||
FbTk::Command *SetAlphaCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
typedef std::vector<string> StringTokens;
|
||||
StringTokens tokens;
|
||||
|
@ -504,7 +504,7 @@ FbTk::Command *SetAlphaCmd::parse(const string &command, const string &args,
|
|||
return new SetAlphaCmd(focused, relative, unfocused, un_rel);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(setalpha, SetAlphaCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(setalpha, SetAlphaCmd::parse, void);
|
||||
|
||||
SetAlphaCmd::SetAlphaCmd(int focused, bool relative,
|
||||
int unfocused, bool un_relative) :
|
||||
|
@ -536,7 +536,7 @@ void SetAlphaCmd::real_execute() {
|
|||
fbwindow().setUnfocusedAlpha(m_unfocus);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WITH_ARGS_NSBASE(matches, MatchCmd, FbTk, BoolCommand);
|
||||
REGISTER_COMMAND_WITH_ARGS(matches, MatchCmd, bool);
|
||||
|
||||
bool MatchCmd::real_execute() {
|
||||
return m_pat.match(winclient());
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
/// helper class for window commands
|
||||
/// calls real_execute if there's a focused window or a window in button press/release window
|
||||
class WindowHelperCmd: public FbTk::Command {
|
||||
class WindowHelperCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit WindowHelperCmd() { }
|
||||
|
||||
|
@ -40,11 +40,11 @@ protected:
|
|||
virtual void real_execute() = 0;
|
||||
};
|
||||
|
||||
class WindowHelperBoolCmd: public FbTk::BoolCommand {
|
||||
class WindowHelperBoolCmd: public FbTk::Command<bool> {
|
||||
public:
|
||||
explicit WindowHelperBoolCmd() { }
|
||||
|
||||
bool bool_execute();
|
||||
bool execute();
|
||||
|
||||
protected:
|
||||
FluxboxWindow &fbwindow();
|
||||
|
@ -149,7 +149,7 @@ protected:
|
|||
class StartResizingCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit StartResizingCmd(FluxboxWindow::ResizeModel mode):m_mode(mode) { }
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
protected:
|
||||
void real_execute();
|
||||
|
@ -169,7 +169,7 @@ protected:
|
|||
class MoveCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit MoveCmd(const int step_size_x, const int step_size_y);
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
protected:
|
||||
void real_execute();
|
||||
|
@ -183,7 +183,7 @@ private:
|
|||
class ResizeCmd: public WindowHelperCmd{
|
||||
public:
|
||||
explicit ResizeCmd(int step_size_x, int step_size_y);
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
protected:
|
||||
void real_execute();
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
IGNORE_Y = 1 << 9
|
||||
};
|
||||
explicit MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc);
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
protected:
|
||||
void real_execute();
|
||||
|
@ -238,7 +238,7 @@ protected:
|
|||
class SetAlphaCmd: public WindowHelperCmd {
|
||||
public:
|
||||
SetAlphaCmd(int focus, bool rel, int unfocus, bool unrel);
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
protected:
|
||||
void real_execute();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "FbTk/Theme.hh"
|
||||
#include "FbTk/Menu.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "FbTk/StringUtil.hh"
|
||||
#include "FbTk/stringstream.hh"
|
||||
|
||||
|
@ -123,9 +123,9 @@ namespace FbCommands {
|
|||
|
||||
using FbTk::Command;
|
||||
|
||||
REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(exec, FbCommands::ExecuteCmd, Command);
|
||||
REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execute, FbCommands::ExecuteCmd, Command);
|
||||
REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execcommand, FbCommands::ExecuteCmd, Command);
|
||||
REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(exec, FbCommands::ExecuteCmd, void);
|
||||
REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execute, FbCommands::ExecuteCmd, void);
|
||||
REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execcommand, FbCommands::ExecuteCmd, void);
|
||||
|
||||
ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) {
|
||||
|
||||
|
@ -176,7 +176,7 @@ int ExecuteCmd::run() {
|
|||
return pid; // compiler happy -> we are happy ;)
|
||||
}
|
||||
|
||||
FbTk::Command *ExportCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<void> *ExportCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
string name = args;
|
||||
FbTk::StringUtil::removeFirstWhitespace(name);
|
||||
|
@ -193,9 +193,9 @@ FbTk::Command *ExportCmd::parse(const string &command, const string &args,
|
|||
return new ExportCmd(name, value);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(setenv, ExportCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(export, ExportCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(setresourcevalue, ExportCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(setenv, ExportCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(export, ExportCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(setresourcevalue, ExportCmd::parse, void);
|
||||
|
||||
ExportCmd::ExportCmd(const string& name, const string& value) :
|
||||
m_name(name), m_value(value) {
|
||||
|
@ -233,20 +233,20 @@ void ExportCmd::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(exit, FbCommands::ExitFluxboxCmd, Command);
|
||||
REGISTER_OBJECT(quit, FbCommands::ExitFluxboxCmd, Command);
|
||||
REGISTER_COMMAND(exit, FbCommands::ExitFluxboxCmd, void);
|
||||
REGISTER_COMMAND(quit, FbCommands::ExitFluxboxCmd, void);
|
||||
|
||||
void ExitFluxboxCmd::execute() {
|
||||
Fluxbox::instance()->shutdown();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(saverc, FbCommands::SaveResources, Command);
|
||||
REGISTER_COMMAND(saverc, FbCommands::SaveResources, void);
|
||||
|
||||
void SaveResources::execute() {
|
||||
Fluxbox::instance()->save_rc();
|
||||
}
|
||||
|
||||
REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd, Command);
|
||||
REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd, void);
|
||||
|
||||
RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){
|
||||
}
|
||||
|
@ -258,21 +258,21 @@ void RestartFluxboxCmd::execute() {
|
|||
Fluxbox::instance()->restart(m_cmd.c_str());
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(reconfigure, FbCommands::ReconfigureFluxboxCmd, Command);
|
||||
REGISTER_OBJECT(reconfig, FbCommands::ReconfigureFluxboxCmd, Command);
|
||||
REGISTER_COMMAND(reconfigure, FbCommands::ReconfigureFluxboxCmd, void);
|
||||
REGISTER_COMMAND(reconfig, FbCommands::ReconfigureFluxboxCmd, void);
|
||||
|
||||
void ReconfigureFluxboxCmd::execute() {
|
||||
Fluxbox::instance()->reconfigure();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(reloadstyle, FbCommands::ReloadStyleCmd, Command);
|
||||
REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd, void);
|
||||
|
||||
void ReloadStyleCmd::execute() {
|
||||
SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename());
|
||||
cmd.execute();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, Command);
|
||||
REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, void);
|
||||
|
||||
SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) {
|
||||
|
||||
|
@ -285,7 +285,7 @@ void SetStyleCmd::execute() {
|
|||
Fluxbox::instance()->getStyleOverlayFilename());
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WITH_ARGS(keymode, FbCommands::KeyModeCmd, Command);
|
||||
REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void);
|
||||
|
||||
KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") {
|
||||
string::size_type second_pos = m_keymode.find_first_of(" \t", 0);
|
||||
|
@ -302,13 +302,13 @@ void KeyModeCmd::execute() {
|
|||
Fluxbox::instance()->keys()->keyMode(m_keymode);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(hidemenus, FbCommands::HideMenuCmd, Command);
|
||||
REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd, void);
|
||||
|
||||
void HideMenuCmd::execute() {
|
||||
FbTk::Menu::hideShownMenu();
|
||||
}
|
||||
|
||||
FbTk::Command *ShowClientMenuCmd::parse(const string &command,
|
||||
FbTk::Command<void> *ShowClientMenuCmd::parse(const string &command,
|
||||
const string &args, bool trusted) {
|
||||
int opts;
|
||||
string pat;
|
||||
|
@ -316,7 +316,7 @@ FbTk::Command *ShowClientMenuCmd::parse(const string &command,
|
|||
return new ShowClientMenuCmd(opts, pat);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(clientmenu, ShowClientMenuCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(clientmenu, ShowClientMenuCmd::parse, void);
|
||||
|
||||
void ShowClientMenuCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -339,7 +339,7 @@ void ShowClientMenuCmd::execute() {
|
|||
::showMenu(*screen, **m_menu);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, Command);
|
||||
REGISTER_COMMAND_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, void);
|
||||
|
||||
ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {}
|
||||
|
||||
|
@ -354,7 +354,7 @@ void ShowCustomMenuCmd::execute() {
|
|||
::showMenu(*screen, **m_menu);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(rootmenu, FbCommands::ShowRootMenuCmd, Command);
|
||||
REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void);
|
||||
|
||||
void ShowRootMenuCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -364,7 +364,7 @@ void ShowRootMenuCmd::execute() {
|
|||
::showMenu(*screen, screen->rootMenu());
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(workspacemenu, FbCommands::ShowWorkspaceMenuCmd, Command);
|
||||
REGISTER_COMMAND(workspacemenu, FbCommands::ShowWorkspaceMenuCmd, void);
|
||||
|
||||
void ShowWorkspaceMenuCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -374,7 +374,7 @@ void ShowWorkspaceMenuCmd::execute() {
|
|||
::showMenu(*screen, screen->workspaceMenu());
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd, Command);
|
||||
REGISTER_COMMAND_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd, void);
|
||||
|
||||
SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid):
|
||||
m_name(name), m_workspace(spaceid) {
|
||||
|
@ -403,7 +403,7 @@ void SetWorkspaceNameCmd::execute() {
|
|||
Fluxbox::instance()->save_rc();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd, Command);
|
||||
REGISTER_COMMAND(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd, void);
|
||||
|
||||
void WorkspaceNameDialogCmd::execute() {
|
||||
|
||||
|
@ -416,7 +416,7 @@ void WorkspaceNameDialogCmd::execute() {
|
|||
win->show();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(commanddialog, FbCommands::CommandDialogCmd, Command);
|
||||
REGISTER_COMMAND(commanddialog, FbCommands::CommandDialogCmd, void);
|
||||
|
||||
void CommandDialogCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -443,7 +443,7 @@ void SetResourceValueCmd::execute() {
|
|||
Fluxbox::instance()->save_rc();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd, Command);
|
||||
REGISTER_COMMAND(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd, void);
|
||||
|
||||
void SetResourceValueDialogCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -454,7 +454,7 @@ void SetResourceValueDialogCmd::execute() {
|
|||
win->show();
|
||||
};
|
||||
|
||||
REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, Command);
|
||||
REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, void);
|
||||
|
||||
BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { }
|
||||
|
||||
|
@ -469,7 +469,7 @@ void BindKeyCmd::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
FbTk::Command *DeiconifyCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<void> *DeiconifyCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
FbTk_istringstream iss(args.c_str());
|
||||
string mode;
|
||||
|
@ -502,7 +502,7 @@ FbTk::Command *DeiconifyCmd::parse(const string &command, const string &args,
|
|||
return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(deiconify, DeiconifyCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(deiconify, DeiconifyCmd::parse, void);
|
||||
|
||||
DeiconifyCmd::DeiconifyCmd(Mode mode,
|
||||
Destination dest) : m_mode(mode), m_dest(dest) { }
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
namespace FbCommands {
|
||||
|
||||
/// executes a system command
|
||||
class ExecuteCmd: public FbTk::Command {
|
||||
class ExecuteCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
ExecuteCmd(const std::string &cmd, int screen_num = -1);
|
||||
void execute();
|
||||
|
@ -48,11 +48,11 @@ private:
|
|||
};
|
||||
|
||||
/// sets environment
|
||||
class ExportCmd : public FbTk::Command {
|
||||
class ExportCmd : public FbTk::Command<void> {
|
||||
public:
|
||||
ExportCmd(const std::string& name, const std::string& value);
|
||||
void execute();
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
private:
|
||||
std::string m_name;
|
||||
|
@ -60,19 +60,19 @@ private:
|
|||
};
|
||||
|
||||
/// exit fluxbox
|
||||
class ExitFluxboxCmd: public FbTk::Command {
|
||||
class ExitFluxboxCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
/// saves resources
|
||||
class SaveResources: public FbTk::Command {
|
||||
class SaveResources: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
/// restarts fluxbox
|
||||
class RestartFluxboxCmd: public FbTk::Command {
|
||||
class RestartFluxboxCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
RestartFluxboxCmd(const std::string &cmd);
|
||||
void execute();
|
||||
|
@ -81,17 +81,17 @@ private:
|
|||
};
|
||||
|
||||
/// reconfigures fluxbox
|
||||
class ReconfigureFluxboxCmd: public FbTk::Command {
|
||||
class ReconfigureFluxboxCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class ReloadStyleCmd: public FbTk::Command {
|
||||
class ReloadStyleCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class SetStyleCmd: public FbTk::Command {
|
||||
class SetStyleCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit SetStyleCmd(const std::string &filename);
|
||||
void execute();
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
std::string m_filename;
|
||||
};
|
||||
|
||||
class KeyModeCmd: public FbTk::Command {
|
||||
class KeyModeCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit KeyModeCmd(const std::string &arguments);
|
||||
void execute();
|
||||
|
@ -108,17 +108,17 @@ private:
|
|||
std::string m_end_args;
|
||||
};
|
||||
|
||||
class HideMenuCmd: public FbTk::Command {
|
||||
class HideMenuCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class ShowClientMenuCmd: public FbTk::Command {
|
||||
class ShowClientMenuCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
ShowClientMenuCmd(int option, std::string &pat):
|
||||
m_option(option|FocusableList::LIST_GROUPS), m_pat(pat.c_str()) { }
|
||||
void execute();
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
private:
|
||||
const int m_option;
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
FbTk::RefCount<ClientMenu> m_menu;
|
||||
};
|
||||
|
||||
class ShowCustomMenuCmd: public FbTk::Command {
|
||||
class ShowCustomMenuCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit ShowCustomMenuCmd(const std::string &arguments);
|
||||
void execute();
|
||||
|
@ -136,17 +136,17 @@ private:
|
|||
FbTk::RefCount<FbTk::Menu> m_menu;
|
||||
};
|
||||
|
||||
class ShowRootMenuCmd: public FbTk::Command {
|
||||
class ShowRootMenuCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class ShowWorkspaceMenuCmd: public FbTk::Command {
|
||||
class ShowWorkspaceMenuCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class SetWorkspaceNameCmd: public FbTk::Command {
|
||||
class SetWorkspaceNameCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
SetWorkspaceNameCmd(const std::string &name, int spaceid = -1);
|
||||
void execute();
|
||||
|
@ -155,18 +155,18 @@ private:
|
|||
int m_workspace;
|
||||
};
|
||||
|
||||
class WorkspaceNameDialogCmd: public FbTk::Command {
|
||||
class WorkspaceNameDialogCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class CommandDialogCmd: public FbTk::Command {
|
||||
class CommandDialogCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
|
||||
class SetResourceValueCmd: public FbTk::Command {
|
||||
class SetResourceValueCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
SetResourceValueCmd(const std::string &resourcename, const std::string &value);
|
||||
void execute();
|
||||
|
@ -175,12 +175,12 @@ private:
|
|||
const std::string m_value;
|
||||
};
|
||||
|
||||
class SetResourceValueDialogCmd: public FbTk::Command {
|
||||
class SetResourceValueDialogCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class BindKeyCmd: public FbTk::Command {
|
||||
class BindKeyCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
BindKeyCmd(const std::string &keybind);
|
||||
void execute();
|
||||
|
@ -189,7 +189,7 @@ private:
|
|||
};
|
||||
|
||||
/// deiconifies iconified windows
|
||||
class DeiconifyCmd: public FbTk::Command {
|
||||
class DeiconifyCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
enum Mode {
|
||||
LAST,
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
DeiconifyCmd(Mode mode= LASTWORKSPACE,
|
||||
Destination dest= CURRENT);
|
||||
void execute();
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
private:
|
||||
Mode m_mode;
|
||||
|
|
|
@ -32,7 +32,7 @@ class Accessor<class T>;
|
|||
class BoolMenuItem: public FbTk::MenuItem {
|
||||
public:
|
||||
BoolMenuItem(const FbTk::FbString &label, Accessor<bool> &item,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd), m_item(item) {
|
||||
FbTk::MenuItem::setSelected(m_item);
|
||||
setToggleItem(true);
|
||||
|
|
|
@ -62,7 +62,7 @@ Button::~Button() {
|
|||
}
|
||||
}
|
||||
|
||||
void Button::setOnClick(RefCount<Command> &cmd, int button) {
|
||||
void Button::setOnClick(RefCount<Command<void> > &cmd, int button) {
|
||||
// we only handle buttons 1 to 5
|
||||
if (button > 5 || button == 0)
|
||||
return;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
virtual ~Button();
|
||||
|
||||
/// sets action when the button is clicked with #button mouse btn
|
||||
void setOnClick(RefCount<Command> &com, int button = 1);
|
||||
void setOnClick(RefCount<Command<void> > &com, int button = 1);
|
||||
|
||||
/// sets the pixmap to be viewed when the button is pressed
|
||||
virtual void setPressedPixmap(Pixmap pm);
|
||||
|
@ -83,7 +83,7 @@ private:
|
|||
GC m_gc; ///< graphic context for button
|
||||
bool m_pressed; ///< if the button is pressed
|
||||
bool *mark_if_deleted; ///< if the button is deleted and this is set, make it true
|
||||
RefCount<Command> m_onclick[5]; ///< what to do when this button is clicked with button num
|
||||
RefCount<Command<void> > m_onclick[5]; ///< what to do when this button is clicked with button num
|
||||
};
|
||||
|
||||
} // namespace FbTk
|
||||
|
|
|
@ -25,18 +25,11 @@
|
|||
namespace FbTk {
|
||||
|
||||
/// Interface class for commands
|
||||
template <typename Ret=void>
|
||||
class Command {
|
||||
public:
|
||||
virtual ~Command() { }
|
||||
virtual void execute() = 0;
|
||||
};
|
||||
|
||||
/// Interface class for boolean commands
|
||||
class BoolCommand: public Command {
|
||||
public:
|
||||
virtual ~BoolCommand() { }
|
||||
virtual void execute() { bool_execute(); }
|
||||
virtual bool bool_execute() = 0;
|
||||
virtual Ret execute() = 0;
|
||||
};
|
||||
|
||||
} // end namespace FbTk
|
||||
|
|
|
@ -112,7 +112,7 @@ ImageControl::ImageControl(int screen_num, bool dither,
|
|||
|
||||
if (cache_timeout && s_timed_cache) {
|
||||
m_timer.setTimeout(cache_timeout);
|
||||
RefCount<Command> clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache));
|
||||
RefCount<Command<void> > clean_cache(new SimpleCommand<ImageControl>(*this, &ImageControl::cleanCache));
|
||||
m_timer.setCommand(clean_cache);
|
||||
m_timer.start();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "LogicCommands.hh"
|
||||
|
||||
#include "ObjectRegistry.hh"
|
||||
#include "CommandParser.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
#include <vector>
|
||||
|
@ -39,11 +39,11 @@ M *addCommands(M *macro, const string &args, bool trusted) {
|
|||
std::string blah;
|
||||
std::vector<std::string> cmds;
|
||||
StringUtil::stringTokensBetween(cmds, args, blah, '{', '}');
|
||||
RefCount<BoolCommand> cmd(0);
|
||||
RefCount<Command<bool> > cmd(0);
|
||||
|
||||
std::vector<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
|
||||
for (; it != it_end; ++it) {
|
||||
cmd = ObjectRegistry<BoolCommand>::instance().parse(*it, trusted);
|
||||
cmd = CommandParser<bool>::instance().parse(*it, trusted);
|
||||
if (*cmd)
|
||||
macro->add(cmd);
|
||||
}
|
||||
|
@ -54,14 +54,14 @@ M *addCommands(M *macro, const string &args, bool trusted) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
BoolCommand *parseLogicCommand(const string &command, const string &args,
|
||||
Command<bool> *parseLogicCommand(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
if (command == "not") {
|
||||
BoolCommand *boolcmd =
|
||||
ObjectRegistry<BoolCommand>::instance().parse(args, trusted);
|
||||
Command<bool> *boolcmd =
|
||||
CommandParser<bool>::instance().parse(args, trusted);
|
||||
if (!boolcmd)
|
||||
return 0;
|
||||
RefCount<BoolCommand> ref(boolcmd);
|
||||
RefCount<Command<bool> > ref(boolcmd);
|
||||
return new NotCommand(ref);
|
||||
} else if (command == "and")
|
||||
return addCommands<AndCommand>(new AndCommand(), args, trusted);
|
||||
|
@ -72,41 +72,41 @@ BoolCommand *parseLogicCommand(const string &command, const string &args,
|
|||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(not, parseLogicCommand, BoolCommand);
|
||||
REGISTER_OBJECT_PARSER(and, parseLogicCommand, BoolCommand);
|
||||
REGISTER_OBJECT_PARSER(or, parseLogicCommand, BoolCommand);
|
||||
REGISTER_OBJECT_PARSER(xor, parseLogicCommand, BoolCommand);
|
||||
REGISTER_COMMAND_PARSER(not, parseLogicCommand, bool);
|
||||
REGISTER_COMMAND_PARSER(and, parseLogicCommand, bool);
|
||||
REGISTER_COMMAND_PARSER(or, parseLogicCommand, bool);
|
||||
REGISTER_COMMAND_PARSER(xor, parseLogicCommand, bool);
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
Command *IfCommand::parse(const std::string &command, const std::string &args,
|
||||
Command<void> *IfCommand::parse(const std::string &command, const std::string &args,
|
||||
bool trusted) {
|
||||
std::string blah;
|
||||
std::vector<std::string> cmds;
|
||||
RefCount<BoolCommand> cond(0);
|
||||
RefCount<Command> t(0), f(0);
|
||||
RefCount<Command<bool> > cond(0);
|
||||
RefCount<Command<void> > t(0), f(0);
|
||||
|
||||
StringUtil::stringTokensBetween(cmds, args, blah, '{', '}');
|
||||
if (cmds.size() < 3)
|
||||
return 0;
|
||||
|
||||
cond = ObjectRegistry<BoolCommand>::instance().parse(cmds[0], trusted);
|
||||
cond = CommandParser<bool>::instance().parse(cmds[0], trusted);
|
||||
if (*cond == 0)
|
||||
return 0;
|
||||
|
||||
t = ObjectRegistry<Command>::instance().parse(cmds[1], trusted);
|
||||
t = CommandParser<void>::instance().parse(cmds[1], trusted);
|
||||
if (cmds.size() >= 3)
|
||||
f = ObjectRegistry<Command>::instance().parse(cmds[2], trusted);
|
||||
f = CommandParser<void>::instance().parse(cmds[2], trusted);
|
||||
if (*t == 0 && *f == 0)
|
||||
return 0;
|
||||
|
||||
return new IfCommand(cond, t, f);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(if, IfCommand::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(cond, IfCommand::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(if, IfCommand::parse, void);
|
||||
REGISTER_COMMAND_PARSER(cond, IfCommand::parse, void);
|
||||
|
||||
void OrCommand::add(RefCount<BoolCommand> &com) {
|
||||
void OrCommand::add(RefCount<Command<bool> > &com) {
|
||||
m_commandlist.push_back(com);
|
||||
}
|
||||
|
||||
|
@ -114,15 +114,15 @@ size_t OrCommand::size() const {
|
|||
return m_commandlist.size();
|
||||
}
|
||||
|
||||
bool OrCommand::bool_execute() {
|
||||
bool OrCommand::execute() {
|
||||
for (size_t i=0; i < m_commandlist.size(); ++i) {
|
||||
if (m_commandlist[i]->bool_execute())
|
||||
if (m_commandlist[i]->execute())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AndCommand::add(RefCount<BoolCommand> &com) {
|
||||
void AndCommand::add(RefCount<Command<bool> > &com) {
|
||||
m_commandlist.push_back(com);
|
||||
}
|
||||
|
||||
|
@ -130,15 +130,15 @@ size_t AndCommand::size() const {
|
|||
return m_commandlist.size();
|
||||
}
|
||||
|
||||
bool AndCommand::bool_execute() {
|
||||
bool AndCommand::execute() {
|
||||
for (size_t i=0; i < m_commandlist.size(); ++i) {
|
||||
if (!m_commandlist[i]->bool_execute())
|
||||
if (!m_commandlist[i]->execute())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void XorCommand::add(RefCount<BoolCommand> &com) {
|
||||
void XorCommand::add(RefCount<Command<bool> > &com) {
|
||||
m_commandlist.push_back(com);
|
||||
}
|
||||
|
||||
|
@ -146,10 +146,10 @@ size_t XorCommand::size() const {
|
|||
return m_commandlist.size();
|
||||
}
|
||||
|
||||
bool XorCommand::bool_execute() {
|
||||
bool XorCommand::execute() {
|
||||
bool ret = false;
|
||||
for (size_t i=0; i < m_commandlist.size(); ++i)
|
||||
ret ^= m_commandlist[i]->bool_execute();
|
||||
ret ^= m_commandlist[i]->execute();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,66 +30,66 @@
|
|||
|
||||
namespace FbTk {
|
||||
|
||||
/// executes a boolcommand and uses the result to decide what to do
|
||||
class IfCommand: public Command {
|
||||
/// executes a Command<bool> and uses the result to decide what to do
|
||||
class IfCommand: public Command<void> {
|
||||
public:
|
||||
IfCommand(RefCount<BoolCommand> &cond,
|
||||
RefCount<Command> &t, RefCount<Command> &f):
|
||||
IfCommand(RefCount<Command<bool> > &cond,
|
||||
RefCount<Command<void> > &t, RefCount<Command<void> > &f):
|
||||
m_cond(cond), m_t(t), m_f(f) { }
|
||||
void execute() {
|
||||
if (m_cond->bool_execute()) {
|
||||
if (m_cond->execute()) {
|
||||
if (*m_t) m_t->execute();
|
||||
} else
|
||||
if (*m_f) m_f->execute();
|
||||
}
|
||||
static Command *parse(const std::string &cmd, const std::string &args,
|
||||
static Command<void> *parse(const std::string &cmd, const std::string &args,
|
||||
bool trusted);
|
||||
private:
|
||||
RefCount<BoolCommand> m_cond;
|
||||
RefCount<Command> m_t, m_f;
|
||||
RefCount<Command<bool> > m_cond;
|
||||
RefCount<Command<void> > m_t, m_f;
|
||||
};
|
||||
|
||||
/// executes a list of boolcommands until one is true
|
||||
class OrCommand: public BoolCommand {
|
||||
/// executes a list of Command<bool>s until one is true
|
||||
class OrCommand: public Command<bool> {
|
||||
public:
|
||||
void add(RefCount<BoolCommand> &com);
|
||||
void add(RefCount<Command<bool> > &com);
|
||||
size_t size() const;
|
||||
bool bool_execute();
|
||||
bool execute();
|
||||
|
||||
private:
|
||||
std::vector<RefCount<BoolCommand> > m_commandlist;
|
||||
std::vector<RefCount<Command<bool> > > m_commandlist;
|
||||
};
|
||||
|
||||
/// executes a list of boolcommands until one is false
|
||||
class AndCommand: public BoolCommand {
|
||||
/// executes a list of Command<bool>s until one is false
|
||||
class AndCommand: public Command<bool> {
|
||||
public:
|
||||
void add(RefCount<BoolCommand> &com);
|
||||
void add(RefCount<Command<bool> > &com);
|
||||
size_t size() const;
|
||||
bool bool_execute();
|
||||
bool execute();
|
||||
|
||||
private:
|
||||
std::vector<RefCount<BoolCommand> > m_commandlist;
|
||||
std::vector<RefCount<Command<bool> > > m_commandlist;
|
||||
};
|
||||
|
||||
/// executes a list of boolcommands, returning the parity
|
||||
class XorCommand: public BoolCommand {
|
||||
/// executes a list of Command<bool>s, returning the parity
|
||||
class XorCommand: public Command<bool> {
|
||||
public:
|
||||
void add(RefCount<BoolCommand> &com);
|
||||
void add(RefCount<Command<bool> > &com);
|
||||
size_t size() const;
|
||||
bool bool_execute();
|
||||
bool execute();
|
||||
|
||||
private:
|
||||
std::vector<RefCount<BoolCommand> > m_commandlist;
|
||||
std::vector<RefCount<Command<bool> > > m_commandlist;
|
||||
};
|
||||
|
||||
/// executes a boolcommand and returns the negation
|
||||
class NotCommand: public BoolCommand {
|
||||
/// executes a Command<bool> and returns the negation
|
||||
class NotCommand: public Command<bool> {
|
||||
public:
|
||||
NotCommand(RefCount<BoolCommand> &com): m_command(com) { }
|
||||
bool bool_execute() { return !m_command->bool_execute(); }
|
||||
NotCommand(RefCount<Command<bool> > &com): m_command(com) { }
|
||||
bool execute() { return !m_command->execute(); }
|
||||
|
||||
private:
|
||||
RefCount<BoolCommand> m_command;
|
||||
RefCount<Command<bool> > m_command;
|
||||
};
|
||||
|
||||
} // end namespace FbTk
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "MacroCommand.hh"
|
||||
|
||||
#include "ObjectRegistry.hh"
|
||||
#include "CommandParser.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
#include <list>
|
||||
|
@ -36,11 +36,11 @@ M *addCommands(M *macro, const std::string &args, bool trusted) {
|
|||
std::string blah;
|
||||
std::list<std::string> cmds;
|
||||
StringUtil::stringTokensBetween(cmds, args, blah, '{', '}');
|
||||
RefCount<Command> cmd(0);
|
||||
RefCount<Command<void> > cmd(0);
|
||||
|
||||
std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
|
||||
for (; it != it_end; ++it) {
|
||||
cmd = ObjectRegistry<Command>::instance().parse(*it, trusted);
|
||||
cmd = CommandParser<void>::instance().parse(*it, trusted);
|
||||
if (*cmd)
|
||||
macro->add(cmd);
|
||||
}
|
||||
|
@ -52,21 +52,21 @@ M *addCommands(M *macro, const std::string &args, bool trusted) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
Command *parseMacroCmd(const std::string &command, const std::string &args,
|
||||
Command<void> *parseMacroCmd(const std::string &command, const std::string &args,
|
||||
bool trusted) {
|
||||
if (command == "macrocmd")
|
||||
return addCommands<MacroCommand>(new MacroCommand, args, trusted);
|
||||
return addCommands<MacroCommand >(new MacroCommand, args, trusted);
|
||||
else if (command == "togglecmd")
|
||||
return addCommands<ToggleCommand>(new ToggleCommand, args, trusted);
|
||||
return addCommands<ToggleCommand >(new ToggleCommand, args, trusted);
|
||||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(macrocmd, parseMacroCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(togglecmd, parseMacroCmd, Command);
|
||||
REGISTER_COMMAND_PARSER(macrocmd, parseMacroCmd, void);
|
||||
REGISTER_COMMAND_PARSER(togglecmd, parseMacroCmd, void);
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
void MacroCommand::add(RefCount<Command> &com) {
|
||||
void MacroCommand::add(RefCount<Command<void> > &com) {
|
||||
m_commandlist.push_back(com);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ ToggleCommand::ToggleCommand() {
|
|||
m_state = 0;
|
||||
}
|
||||
|
||||
void ToggleCommand::add(RefCount<Command> &com) {
|
||||
void ToggleCommand::add(RefCount<Command<void> > &com) {
|
||||
m_commandlist.push_back(com);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,26 +30,26 @@
|
|||
namespace FbTk {
|
||||
|
||||
/// executes a list of commands
|
||||
class MacroCommand:public Command {
|
||||
class MacroCommand:public Command<void> {
|
||||
public:
|
||||
void add(RefCount<Command> &com);
|
||||
void add(RefCount<Command<void> > &com);
|
||||
size_t size() const;
|
||||
virtual void execute();
|
||||
|
||||
private:
|
||||
std::vector<RefCount<Command> > m_commandlist;
|
||||
std::vector<RefCount<Command<void> > > m_commandlist;
|
||||
};
|
||||
|
||||
/// executes one command at a time
|
||||
class ToggleCommand:public Command {
|
||||
class ToggleCommand:public Command<void> {
|
||||
public:
|
||||
ToggleCommand();
|
||||
void add(RefCount<Command> &com);
|
||||
void add(RefCount<Command<void> > &com);
|
||||
size_t size() const;
|
||||
virtual void execute();
|
||||
|
||||
private:
|
||||
std::vector<RefCount<Command> > m_commandlist;
|
||||
std::vector<RefCount<Command<void> > > m_commandlist;
|
||||
size_t m_state;
|
||||
};
|
||||
|
||||
|
|
|
@ -95,12 +95,12 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl):
|
|||
m_need_update(true) {
|
||||
// setup timers
|
||||
|
||||
RefCount<Command> show_cmd(new SimpleCommand<Menu>(*this, &Menu::openSubmenu));
|
||||
RefCount<Command<void> > show_cmd(new SimpleCommand<Menu>(*this, &Menu::openSubmenu));
|
||||
m_submenu_timer.setCommand(show_cmd);
|
||||
m_submenu_timer.fireOnce(true);
|
||||
|
||||
|
||||
RefCount<Command> hide_cmd(new SimpleCommand<Menu>(*this, &Menu::closeMenu));
|
||||
RefCount<Command<void> > hide_cmd(new SimpleCommand<Menu>(*this, &Menu::closeMenu));
|
||||
m_hide_timer.setCommand(hide_cmd);
|
||||
m_hide_timer.fireOnce(true);
|
||||
|
||||
|
@ -198,7 +198,7 @@ Menu::~Menu() {
|
|||
s_focused = 0;
|
||||
}
|
||||
|
||||
int Menu::insert(const FbString &label, RefCount<Command> &cmd, int pos) {
|
||||
int Menu::insert(const FbString &label, RefCount<Command<void> > &cmd, int pos) {
|
||||
return insert(new MenuItem(label, cmd, this), pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
namespace FbTk {
|
||||
|
||||
class Command;
|
||||
class Command<class T>;
|
||||
class MenuItem;
|
||||
class ImageControl;
|
||||
class RefCount<class T>;
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
*/
|
||||
//@{
|
||||
/// add a menu item with a label and a command
|
||||
int insert(const FbString &label, RefCount<Command> &cmd, int pos=-1);
|
||||
int insert(const FbString &label, RefCount<Command<void> > &cmd, int pos=-1);
|
||||
/// add empty menu item
|
||||
int insert(const FbString &label, int pos=-1);
|
||||
/// add submenu
|
||||
|
|
|
@ -37,7 +37,7 @@ void MenuItem::click(int button, int time, unsigned int mods) {
|
|||
if (m_menu && m_close_on_click && (mods & ControlMask) == 0)
|
||||
m_menu->hide();
|
||||
// we need a local variable, since the command may destroy this object
|
||||
RefCount<Command> tmp(m_command);
|
||||
RefCount<Command<void> > tmp(m_command);
|
||||
tmp->execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
m_toggle_item(false)
|
||||
{ }
|
||||
/// create a menu item with a specific command to be executed on click
|
||||
MenuItem(const FbString &label, RefCount<Command> &cmd, Menu *menu = 0)
|
||||
MenuItem(const FbString &label, RefCount<Command<void> > &cmd, Menu *menu = 0)
|
||||
: m_label(label),
|
||||
m_menu(menu),
|
||||
m_submenu(0),
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
{ }
|
||||
virtual ~MenuItem() { }
|
||||
|
||||
void setCommand(RefCount<Command> &cmd) { m_command = cmd; }
|
||||
void setCommand(RefCount<Command<void> > &cmd) { m_command = cmd; }
|
||||
virtual void setSelected(bool selected) { m_selected = selected; }
|
||||
virtual void setEnabled(bool enabled) { m_enabled = enabled; }
|
||||
virtual void setLabel(const FbString &label) { m_label = label; }
|
||||
|
@ -140,8 +140,8 @@ public:
|
|||
virtual void click(int button, int time, unsigned int mods);
|
||||
/// must use this to show submenu to ensure consistency for object like window menu in ClientMenu (see Workspace.cc)
|
||||
virtual void showSubmenu();
|
||||
RefCount<Command> &command() { return m_command; }
|
||||
const RefCount<Command> &command() const { return m_command; }
|
||||
RefCount<Command<void> > &command() { return m_command; }
|
||||
const RefCount<Command<void> > &command() const { return m_command; }
|
||||
//@}
|
||||
|
||||
void setMenu(Menu &menu) { m_menu = &menu; }
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
FbString m_label; ///< label of this item
|
||||
Menu *m_menu; ///< the menu we live in
|
||||
Menu *m_submenu; ///< a submenu, 0 if we don't have one
|
||||
RefCount<Command> m_command; ///< command to be executed
|
||||
RefCount<Command<void> > m_command; ///< command to be executed
|
||||
bool m_enabled, m_selected;
|
||||
bool m_close_on_click, m_toggle_item;
|
||||
int m_index;
|
||||
|
|
|
@ -45,7 +45,7 @@ MultiButtonMenuItem::~MultiButtonMenuItem() {
|
|||
delete [] m_button_exe;
|
||||
}
|
||||
|
||||
void MultiButtonMenuItem::setCommand(int button, FbTk::RefCount<FbTk::Command> &cmd) {
|
||||
void MultiButtonMenuItem::setCommand(int button, FbTk::RefCount<FbTk::Command<void> > &cmd) {
|
||||
if (button <= 0 || button > static_cast<signed>(buttons()) || buttons() == 0)
|
||||
return;
|
||||
m_button_exe[button - 1] = cmd;
|
||||
|
@ -66,7 +66,7 @@ void MultiButtonMenuItem::init(int buttons) {
|
|||
m_buttons = buttons;
|
||||
|
||||
if (m_buttons != 0)
|
||||
m_button_exe = new FbTk::RefCount<FbTk::Command>[m_buttons];
|
||||
m_button_exe = new FbTk::RefCount<FbTk::Command<void> >[m_buttons];
|
||||
else
|
||||
m_button_exe = 0;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
MultiButtonMenuItem(int buttons, const FbString &label, Menu *submenu);
|
||||
virtual ~MultiButtonMenuItem();
|
||||
/// sets command to specified button
|
||||
void setCommand(int button, FbTk::RefCount<FbTk::Command> &cmd);
|
||||
void setCommand(int button, FbTk::RefCount<FbTk::Command<void> > &cmd);
|
||||
/// executes command for the button click
|
||||
virtual void click(int button, int time, unsigned int mods);
|
||||
/// @return number of buttons this instance handles
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
private:
|
||||
void init(int buttons);
|
||||
|
||||
FbTk::RefCount<FbTk::Command> *m_button_exe;
|
||||
FbTk::RefCount<FbTk::Command<void> > *m_button_exe;
|
||||
unsigned int m_buttons;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,124 +22,30 @@
|
|||
#ifndef OBJECTREGISTRY_HH
|
||||
#define OBJECTREGISTRY_HH
|
||||
|
||||
#include "StringUtil.hh"
|
||||
|
||||
#include <map>
|
||||
|
||||
using std::string;
|
||||
#include <string>
|
||||
|
||||
namespace FbTk {
|
||||
|
||||
#define REGISTER_OBJECT_PARSER(name, parser, type) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<type>::instance().registerObject(#name, parser); \
|
||||
}
|
||||
|
||||
#define REGISTER_OBJECT_PARSER_NSBASE(name, parser, space, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<space::base >::instance().registerObject(#name, parser); \
|
||||
}
|
||||
|
||||
/* Include some basic Object creators */
|
||||
template <typename Derived, typename Base>
|
||||
Base *ObjectCreator(const string &name, const string &args, bool trusted) {
|
||||
return new Derived();
|
||||
}
|
||||
|
||||
#define REGISTER_OBJECT(name, derived, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<base >::instance().registerObject(#name, FbTk::ObjectCreator<derived, base >); \
|
||||
}
|
||||
|
||||
#define REGISTER_OBJECT_NSBASE(name, derived, space, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<space::base >::instance().registerObject(#name, FbTk::ObjectCreator<derived, space::base >); \
|
||||
}
|
||||
|
||||
template <typename Derived, typename Base>
|
||||
Base *ObjectCreatorWithArgs(const string &name, const string &args,
|
||||
bool trusted) {
|
||||
return new Derived(args);
|
||||
}
|
||||
|
||||
#define REGISTER_OBJECT_WITH_ARGS(name, derived, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<base >::instance().registerObject(#name, FbTk::ObjectCreatorWithArgs<derived, base >); \
|
||||
}
|
||||
|
||||
#define REGISTER_OBJECT_WITH_ARGS_NSBASE(name, derived, space, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<space::base >::instance().registerObject(#name, FbTk::ObjectCreatorWithArgs<derived, space::base >); \
|
||||
}
|
||||
|
||||
template <typename Derived, typename Base>
|
||||
Base *UntrustedObjectCreator(const string &name, const string &args,
|
||||
bool trusted) {
|
||||
if (!trusted) return 0;
|
||||
return new Derived();
|
||||
}
|
||||
|
||||
#define REGISTER_UNTRUSTED_OBJECT(name, derived, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<base >::instance().registerObject(#name, FbTk::UntrustedObjectCreator<derived, base >); \
|
||||
}
|
||||
|
||||
#define REGISTER_UNTRUSTED_OBJECT_NSBASE(name, derived, space, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<space::base >::instance().registerObject(#name, FbTk::UntrustedObjectCreator<derived, space::base >); \
|
||||
}
|
||||
|
||||
template <typename Derived, typename Base>
|
||||
Base * UntrustedObjectCreatorWithArgs(const string &name, const string &args,
|
||||
bool trusted) {
|
||||
if (!trusted) return 0;
|
||||
return new Derived(args);
|
||||
}
|
||||
|
||||
#define REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(name, derived, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<base >::instance().registerObject(#name, FbTk::UntrustedObjectCreatorWithArgs<derived, base >); \
|
||||
}
|
||||
|
||||
#define REGISTER_UNTRUSTED_OBJECT_WITH_ARGS_NSBASE(name, derived, space, base) \
|
||||
namespace { \
|
||||
static const bool p_register_##type_##name = FbTk::ObjectRegistry<space::base >::instance().registerObject(#name, FbTk::UntrustedObjectCreatorWithArgs<derived, space::base >); \
|
||||
}
|
||||
|
||||
template <typename Base>
|
||||
template <typename Creator>
|
||||
class ObjectRegistry {
|
||||
public:
|
||||
typedef Base * CreateFunction(const string &name, const string &args, bool trusted);
|
||||
typedef std::map<string, CreateFunction *> CreatorMap;
|
||||
typedef std::map<std::string, Creator> CreatorMap;
|
||||
|
||||
static ObjectRegistry<Base > &instance() {
|
||||
static ObjectRegistry<Base > s_instance;
|
||||
static ObjectRegistry<Creator> &instance() {
|
||||
static ObjectRegistry<Creator> s_instance;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
Base *parse(const string &name, const string &args, bool trusted = true) const {
|
||||
string lc = StringUtil::toLower(name);
|
||||
typename CreatorMap::const_iterator it = m_creators.find(lc.c_str());
|
||||
Creator lookup(const std::string &name) {
|
||||
typename CreatorMap::const_iterator it = m_creators.find(name);
|
||||
if (it == m_creators.end())
|
||||
return 0;
|
||||
else
|
||||
return it->second(lc, args, trusted);
|
||||
return it->second;
|
||||
}
|
||||
|
||||
Base *parse(const string &line, bool trusted = true) const {
|
||||
// parse args and command
|
||||
string command, args;
|
||||
StringUtil::getFirstWord(line, command, args);
|
||||
StringUtil::removeFirstWhitespace(args);
|
||||
StringUtil::removeTrailingWhitespace(args);
|
||||
|
||||
// now we have parsed command and args
|
||||
return parse(command, args, trusted);
|
||||
}
|
||||
|
||||
bool registerObject(string name, CreateFunction createFunction) {
|
||||
name = StringUtil::toLower(name);
|
||||
m_creators[name] = createFunction;
|
||||
bool registerObject(const std::string &name, Creator creator) {
|
||||
m_creators[name] = creator;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
namespace FbTk {
|
||||
|
||||
/// a simple command
|
||||
/// a simple command
|
||||
template <typename Receiver, typename ReturnType=void>
|
||||
class SimpleCommand: public Command {
|
||||
class SimpleCommand: public Command<ReturnType> {
|
||||
public:
|
||||
typedef ReturnType (Receiver::* Action)();
|
||||
SimpleCommand(Receiver &r, Action a):
|
||||
|
@ -39,18 +39,6 @@ private:
|
|||
Action m_action;
|
||||
};
|
||||
|
||||
template <typename Receiver, typename ReturnType=bool>
|
||||
class SimpleBoolCommand: public BoolCommand {
|
||||
public:
|
||||
typedef ReturnType (Receiver::* Action)();
|
||||
SimpleBoolCommand(Receiver &r, Action a):
|
||||
m_receiver(r), m_action(a) { }
|
||||
bool bool_execute() { return (bool)(m_receiver.*m_action)(); }
|
||||
private:
|
||||
Receiver &m_receiver;
|
||||
Action m_action;
|
||||
};
|
||||
|
||||
} // end namespace FbTk
|
||||
|
||||
#endif // FBTK_SIMPLECOMMAND_HH
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "Timer.hh"
|
||||
|
||||
#include "ObjectRegistry.hh"
|
||||
#include "CommandParser.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
//use GNU extensions
|
||||
|
@ -53,7 +53,7 @@ Timer::Timer():m_timing(false), m_once(false), m_interval(0) {
|
|||
|
||||
}
|
||||
|
||||
Timer::Timer(RefCount<Command> &handler):
|
||||
Timer::Timer(RefCount<Command<void> > &handler):
|
||||
m_handler(handler),
|
||||
m_timing(false),
|
||||
m_once(false),
|
||||
|
@ -79,7 +79,7 @@ void Timer::setTimeout(const timeval &t) {
|
|||
m_timeout.tv_usec = t.tv_usec;
|
||||
}
|
||||
|
||||
void Timer::setCommand(RefCount<Command> &cmd) {
|
||||
void Timer::setCommand(RefCount<Command<void> > &cmd) {
|
||||
m_handler = cmd;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ void Timer::addTimer(Timer *timer) {
|
|||
|
||||
}
|
||||
|
||||
Command *DelayedCmd::parse(const std::string &command,
|
||||
Command<void> *DelayedCmd::parse(const std::string &command,
|
||||
const std::string &args, bool trusted) {
|
||||
|
||||
std::string cmd_str;
|
||||
|
@ -255,7 +255,7 @@ Command *DelayedCmd::parse(const std::string &command,
|
|||
if (err == 0)
|
||||
return 0;
|
||||
|
||||
RefCount<Command> cmd(ObjectRegistry<Command>::instance().parse(cmd_str, trusted));
|
||||
RefCount<Command<void> > cmd(CommandParser<void>::instance().parse(cmd_str, trusted));
|
||||
if (*cmd == 0)
|
||||
return 0;
|
||||
|
||||
|
@ -265,9 +265,9 @@ Command *DelayedCmd::parse(const std::string &command,
|
|||
return new DelayedCmd(cmd, delay);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(delay, DelayedCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void);
|
||||
|
||||
DelayedCmd::DelayedCmd(RefCount<Command> &cmd, unsigned int timeout) {
|
||||
DelayedCmd::DelayedCmd(RefCount<Command<void> > &cmd, unsigned int timeout) {
|
||||
timeval to; // defaults to 200ms
|
||||
to.tv_sec = timeout/1000000;
|
||||
to.tv_usec = timeout % 1000000;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace FbTk {
|
|||
class Timer {
|
||||
public:
|
||||
Timer();
|
||||
explicit Timer(RefCount<Command> &handler);
|
||||
explicit Timer(RefCount<Command<void> > &handler);
|
||||
virtual ~Timer();
|
||||
|
||||
void fireOnce(bool once) { m_once = once; }
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
void setTimeout(time_t val);
|
||||
/// set timeout
|
||||
void setTimeout(const timeval &val);
|
||||
void setCommand(RefCount<Command> &cmd);
|
||||
void setCommand(RefCount<Command<void> > &cmd);
|
||||
void setInterval(int val) { m_interval = val; }
|
||||
/// start timing
|
||||
void start();
|
||||
|
@ -96,7 +96,7 @@ private:
|
|||
typedef std::list<Timer *> TimerList;
|
||||
static TimerList m_timerlist; ///< list of all timers, sorted by next trigger time (start + timeout)
|
||||
|
||||
RefCount<Command> m_handler; ///< what to do on a timeout
|
||||
RefCount<Command<void> > m_handler; ///< what to do on a timeout
|
||||
|
||||
bool m_timing; ///< clock running?
|
||||
bool m_once; ///< do timeout only once?
|
||||
|
@ -108,11 +108,11 @@ private:
|
|||
};
|
||||
|
||||
/// executes a command after a specified timeout
|
||||
class DelayedCmd: public Command {
|
||||
class DelayedCmd: public Command<void> {
|
||||
public:
|
||||
DelayedCmd(RefCount<Command> &cmd, unsigned int timeout = 200000);
|
||||
DelayedCmd(RefCount<Command<void> > &cmd, unsigned int timeout = 200000);
|
||||
void execute();
|
||||
static Command *parse(const std::string &command,
|
||||
static Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
private:
|
||||
Timer m_timer;
|
||||
|
|
|
@ -44,7 +44,7 @@ template <class T> class FocusableTheme;
|
|||
|
||||
namespace FbTk {
|
||||
class ImageControl;
|
||||
class Command;
|
||||
template <class T> class Command;
|
||||
class Texture;
|
||||
class XLayer;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "FbTk/RefCount.hh"
|
||||
|
||||
namespace FbTk {
|
||||
class Command;
|
||||
template <class T> class Command;
|
||||
}
|
||||
|
||||
#include "FocusControl.hh"
|
||||
|
@ -37,7 +37,7 @@ class FocusModelMenuItem : public FbTk::MenuItem {
|
|||
public:
|
||||
FocusModelMenuItem(const FbTk::FbString &label, FocusControl &focus_control,
|
||||
FocusControl::FocusModel model,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd),
|
||||
m_focus_control(focus_control),
|
||||
m_focusmodel(model) {
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
TabFocusModelMenuItem(const FbTk::FbString &label,
|
||||
FocusControl &focus_control,
|
||||
FocusControl::TabFocusModel model,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd),
|
||||
m_focus_control(focus_control),
|
||||
m_tabfocusmodel(model) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "IconButton.hh"
|
||||
#include "Workspace.hh"
|
||||
#include "FbMenu.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "WinClient.hh"
|
||||
#include "FocusControl.hh"
|
||||
#include "FbCommands.hh"
|
||||
|
@ -103,7 +103,7 @@ class ToolbarModeMenuItem : public FbTk::MenuItem {
|
|||
public:
|
||||
ToolbarModeMenuItem(const FbTk::FbString &label, IconbarTool &handler,
|
||||
string mode,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd), m_handler(handler), m_mode(mode) {
|
||||
setCloseOnClick(false);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class ToolbarAlignMenuItem: public FbTk::MenuItem {
|
|||
public:
|
||||
ToolbarAlignMenuItem(const FbTk::FbString &label, IconbarTool &handler,
|
||||
FbTk::Container::Alignment mode,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd), m_handler(handler), m_mode(mode) {
|
||||
setCloseOnClick(false);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ void setupModeMenu(FbTk::Menu &menu, IconbarTool &handler) {
|
|||
|
||||
menu.setLabel(_FB_XTEXT(Toolbar, IconbarMode, "Iconbar Mode", "Menu title - chooses which set of icons are shown in the iconbar"));
|
||||
|
||||
RefCount<Command> saverc_cmd(new FbCommands::SaveResources());
|
||||
RefCount<Command<void> > saverc_cmd(new FbCommands::SaveResources());
|
||||
|
||||
|
||||
menu.insert(new ToolbarModeMenuItem(_FB_XTEXT(Toolbar, IconbarModeNone,
|
||||
|
@ -208,9 +208,9 @@ void setupModeMenu(FbTk::Menu &menu, IconbarTool &handler) {
|
|||
menu.updateMenu();
|
||||
}
|
||||
|
||||
typedef FbTk::RefCount<FbTk::Command> RefCmd;
|
||||
typedef FbTk::RefCount<FbTk::Command<void> > RefCmd;
|
||||
|
||||
class ShowMenu: public FbTk::Command {
|
||||
class ShowMenu: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit ShowMenu(FluxboxWindow &win):m_win(win) { }
|
||||
void execute() {
|
||||
|
@ -229,7 +229,7 @@ private:
|
|||
FluxboxWindow &m_win;
|
||||
};
|
||||
|
||||
class FocusCommand: public FbTk::Command {
|
||||
class FocusCommand: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit FocusCommand(Focusable &win): m_win(win) { }
|
||||
void execute() {
|
||||
|
@ -283,11 +283,11 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent,
|
|||
using namespace FbTk;
|
||||
// setup use pixmap item to reconfig iconbar and save resource on click
|
||||
MacroCommand *save_and_reconfig = new MacroCommand();
|
||||
RefCount<Command> reconfig(new SimpleCommand<IconbarTool>(*this, &IconbarTool::renderTheme));
|
||||
RefCount<Command> save(FbTk::ObjectRegistry<Command>::instance().parse("saverc"));
|
||||
RefCount<Command<void> > reconfig(new SimpleCommand<IconbarTool>(*this, &IconbarTool::renderTheme));
|
||||
RefCount<Command<void> > save(FbTk::CommandParser<void>::instance().parse("saverc"));
|
||||
save_and_reconfig->add(reconfig);
|
||||
save_and_reconfig->add(save);
|
||||
RefCount<Command> s_and_reconfig(save_and_reconfig);
|
||||
RefCount<Command<void> > s_and_reconfig(save_and_reconfig);
|
||||
m_menu.insert(new FbTk::BoolMenuItem(_FB_XTEXT(Toolbar, ShowIcons,
|
||||
"Show Pictures", "chooses if little icons are shown next to title in the iconbar"),
|
||||
m_rc_use_pixmap, s_and_reconfig));
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "FbTk/Command.hh"
|
||||
#include "FbTk/RefCount.hh"
|
||||
#include "FbTk/KeyUtil.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "FbTk/I18n.hh"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -135,7 +135,7 @@ public:
|
|||
unsigned int key; // key code or button number
|
||||
int context; // ON_TITLEBAR, etc.: bitwise-or of all desired contexts
|
||||
bool isdouble;
|
||||
FbTk::RefCount<FbTk::Command> m_command;
|
||||
FbTk::RefCount<FbTk::Command<void> > m_command;
|
||||
|
||||
keylist_t keylist;
|
||||
};
|
||||
|
@ -461,7 +461,7 @@ bool Keys::addBinding(const string &linebuffer) {
|
|||
const char *str = FbTk::StringUtil::strcasestr(linebuffer.c_str(),
|
||||
val[argc].c_str() + 1); // +1 to skip ':'
|
||||
if (str)
|
||||
current_key->m_command = FbTk::ObjectRegistry<FbTk::Command>::instance().parse(str);
|
||||
current_key->m_command = FbTk::CommandParser<void>::instance().parse(str);
|
||||
|
||||
if (!str || *current_key->m_command == 0 || mod) {
|
||||
delete first_new_key;
|
||||
|
|
|
@ -50,7 +50,7 @@ LayerMenu::LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
|
|||
{0, 0, _FB_XTEXT(Layer, Desktop, "Desktop", "Layer desktop"), Layer::DESKTOP},
|
||||
};
|
||||
|
||||
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbCommands::SaveResources());
|
||||
FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbCommands::SaveResources());
|
||||
|
||||
for (size_t i=0; i < 6; ++i) {
|
||||
// TODO: fetch nls string
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
class LayerMenuItem : public FbTk::MenuItem {
|
||||
public:
|
||||
LayerMenuItem(const FbTk::FbString &label, LayerObject *object,
|
||||
int layernum, FbTk::RefCount<FbTk::Command> &cmd):
|
||||
int layernum, FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd), m_object(object), m_layernum(layernum) {}
|
||||
|
||||
LayerMenuItem(const FbTk::FbString &label, LayerObject *object,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "defaults.hh"
|
||||
#include "Screen.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "fluxbox.hh"
|
||||
#include "Window.hh"
|
||||
#include "WindowCmd.hh"
|
||||
|
@ -209,7 +209,7 @@ static void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::Strin
|
|||
else
|
||||
menu.insert(str_label, submenu);
|
||||
} else if (str_key == "exit") { // exit
|
||||
FbTk::RefCount<FbTk::Command> exit_cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("exit"));
|
||||
FbTk::RefCount<FbTk::Command<void> > exit_cmd(FbTk::CommandParser<void>::instance().parse("exit"));
|
||||
if (str_label.empty())
|
||||
menu.insert(_FB_XTEXT(Menu, Exit, "Exit", "Exit Command"), exit_cmd);
|
||||
else
|
||||
|
@ -217,11 +217,11 @@ static void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::Strin
|
|||
} else if (str_key == "exec") {
|
||||
// execute and hide menu
|
||||
using namespace FbTk;
|
||||
RefCount<Command> exec_cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("exec " + str_cmd));
|
||||
RefCount<Command<void> > exec_cmd(FbTk::CommandParser<void>::instance().parse("exec " + str_cmd));
|
||||
menu.insert(str_label, exec_cmd);
|
||||
} else if (str_key == "macrocmd") {
|
||||
using namespace FbTk;
|
||||
RefCount<Command> macro_cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("macrocmd " + str_cmd));
|
||||
RefCount<Command<void> > macro_cmd(FbTk::CommandParser<void>::instance().parse("macrocmd " + str_cmd));
|
||||
menu.insert(str_label, macro_cmd);
|
||||
} else if (str_key == "style") { // style
|
||||
menu.insert(new StyleMenuItem(str_label, str_cmd));
|
||||
|
@ -313,10 +313,10 @@ static void translateMenuItem(FbTk::Parser &parse, ParseItem &pitem, FbTk::Strin
|
|||
} else if (str_key == "endencoding") {
|
||||
MenuCreator::endEncoding();
|
||||
}
|
||||
else { // ok, if we didn't find any special menu item we try with command FbTk::Parser
|
||||
// we need to attach command with arguments so command FbTk::Parser can parse it
|
||||
else { // ok, if we didn't find any special menu item we try with command parser
|
||||
// we need to attach command with arguments so command parser can parse it
|
||||
string line = str_key + " " + str_cmd;
|
||||
FbTk::RefCount<FbTk::Command> command(FbTk::ObjectRegistry<FbTk::Command>::instance().parse(line));
|
||||
FbTk::RefCount<FbTk::Command<void> > command(FbTk::CommandParser<void>::instance().parse(line));
|
||||
if (*command != 0) {
|
||||
// special NLS default labels
|
||||
if (str_label.empty()) {
|
||||
|
@ -507,7 +507,7 @@ FbTk::Menu *MenuCreator::createMenuType(const string &type, int screen_num) {
|
|||
bool MenuCreator::createWindowMenuItem(const string &type,
|
||||
const string &label,
|
||||
FbTk::Menu &menu) {
|
||||
typedef FbTk::RefCount<FbTk::Command> RefCmd;
|
||||
typedef FbTk::RefCount<FbTk::Command<void> > RefCmd;
|
||||
_FB_USES_NLS;
|
||||
|
||||
static MenuContext context;
|
||||
|
|
|
@ -238,7 +238,7 @@ bool handleStartupItem(const string &line, int offset) {
|
|||
|
||||
FbCommands::ExecuteCmd *tmp_exec_cmd = new FbCommands::ExecuteCmd(str, screen);
|
||||
#ifdef DEBUG
|
||||
cerr<<"Executing startup command '"<<str<<"' on screen "<<screen<<endl;
|
||||
cerr<<"Executing startup Command<void> '"<<str<<"' on screen "<<screen<<endl;
|
||||
#endif // DEBUG
|
||||
tmp_exec_cmd->execute();
|
||||
delete tmp_exec_cmd;
|
||||
|
|
|
@ -34,7 +34,7 @@ RootCmdMenuItem::RootCmdMenuItem(const FbTk::FbString &label,
|
|||
m_filename(filename) {
|
||||
|
||||
std::string prog = cmd.empty() ? realProgramName("fbsetbg") : cmd;
|
||||
FbTk::RefCount<FbTk::Command>
|
||||
FbTk::RefCount<FbTk::Command<void> >
|
||||
setwp_cmd(new FbCommands::ExecuteCmd(prog + " \"" + m_filename + "\""));
|
||||
setCommand(setwp_cmd);
|
||||
setToggleItem(true);
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "WinClient.hh"
|
||||
#include "FbWinFrame.hh"
|
||||
#include "Strut.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "AtomHandler.hh"
|
||||
#include "HeadArea.hh"
|
||||
#include "FbCommands.hh"
|
||||
|
@ -168,7 +168,7 @@ class TabPlacementMenuItem: public FbTk::MenuItem {
|
|||
public:
|
||||
TabPlacementMenuItem(FbTk::FbString & label, BScreen &screen,
|
||||
FbWinFrame::TabPlacement place,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd),
|
||||
m_screen(screen),
|
||||
m_place(place) {
|
||||
|
@ -773,7 +773,7 @@ void BScreen::propertyNotify(Atom atom) {
|
|||
&ret_bytes_after, (unsigned char **)&str);
|
||||
}
|
||||
|
||||
FbTk::RefCount<FbTk::Command> cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse(str, false));
|
||||
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(str, false));
|
||||
if (cmd.get())
|
||||
cmd->execute();
|
||||
XFree(str);
|
||||
|
@ -1479,9 +1479,9 @@ void BScreen::initMenu() {
|
|||
if (m_rootmenu.get() == 0) {
|
||||
_FB_USES_NLS;
|
||||
m_rootmenu.reset(createMenu(_FB_XTEXT(Menu, DefaultRootMenu, "Fluxbox default menu", "Title of fallback root menu")));
|
||||
FbTk::RefCount<FbTk::Command> restart_fb(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("restart"));
|
||||
FbTk::RefCount<FbTk::Command> exit_fb(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("exit"));
|
||||
FbTk::RefCount<FbTk::Command> execute_xterm(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("exec xterm"));
|
||||
FbTk::RefCount<FbTk::Command<void> > restart_fb(FbTk::CommandParser<void>::instance().parse("restart"));
|
||||
FbTk::RefCount<FbTk::Command<void> > exit_fb(FbTk::CommandParser<void>::instance().parse("exit"));
|
||||
FbTk::RefCount<FbTk::Command<void> > execute_xterm(FbTk::CommandParser<void>::instance().parse("exec xterm"));
|
||||
m_rootmenu->setInternalMenu();
|
||||
m_rootmenu->insert("xterm", execute_xterm);
|
||||
m_rootmenu->insert(_FB_XTEXT(Menu, Restart, "Restart", "Restart command"),
|
||||
|
@ -1523,20 +1523,20 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
|||
|
||||
FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand();
|
||||
FbTk::MacroCommand *s_a_reconftabs_macro = new FbTk::MacroCommand();
|
||||
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
|
||||
FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
|
||||
*Fluxbox::instance(),
|
||||
&Fluxbox::save_rc));
|
||||
FbTk::RefCount<FbTk::Command> reconf_cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse("reconfigure"));
|
||||
FbTk::RefCount<FbTk::Command<void> > reconf_cmd(FbTk::CommandParser<void>::instance().parse("reconfigure"));
|
||||
|
||||
FbTk::RefCount<FbTk::Command> reconftabs_cmd(new FbTk::SimpleCommand<BScreen>(
|
||||
FbTk::RefCount<FbTk::Command<void> > reconftabs_cmd(new FbTk::SimpleCommand<BScreen>(
|
||||
*this,
|
||||
&BScreen::reconfigureTabs));
|
||||
s_a_reconf_macro->add(saverc_cmd);
|
||||
s_a_reconf_macro->add(reconf_cmd);
|
||||
s_a_reconftabs_macro->add(saverc_cmd);
|
||||
s_a_reconftabs_macro->add(reconftabs_cmd);
|
||||
FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro);
|
||||
FbTk::RefCount<FbTk::Command> save_and_reconftabs(s_a_reconftabs_macro);
|
||||
FbTk::RefCount<FbTk::Command<void> > save_and_reconfigure(s_a_reconf_macro);
|
||||
FbTk::RefCount<FbTk::Command<void> > save_and_reconftabs(s_a_reconftabs_macro);
|
||||
// create focus menu
|
||||
// we don't set this to internal menu so will
|
||||
// be deleted toghether with the parent
|
||||
|
@ -1693,7 +1693,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
|||
|
||||
// in order to save system resources, don't save or reconfigure alpha
|
||||
// settings until after the user is done changing them
|
||||
FbTk::RefCount<FbTk::Command> delayed_save_and_reconf(
|
||||
FbTk::RefCount<FbTk::Command<void> > delayed_save_and_reconf(
|
||||
new FbTk::DelayedCmd(save_and_reconfigure));
|
||||
|
||||
FbTk::MenuItem *focused_alpha_item =
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "FbTk/MultiButtonMenuItem.hh"
|
||||
#include "FbTk/Command.hh"
|
||||
|
||||
class SendToCmd: public FbTk::Command {
|
||||
class SendToCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
SendToCmd(int workspace, bool follow):
|
||||
m_workspace(workspace),
|
||||
|
@ -78,8 +78,8 @@ void SendToMenu::update(FbTk::Subject *subj) {
|
|||
BScreen *screen = Fluxbox::instance()->findScreen(screenNumber());
|
||||
const BScreen::Workspaces &wlist = screen->getWorkspacesList();
|
||||
for (size_t i = 0; i < wlist.size(); ++i) {
|
||||
FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(i, false));
|
||||
FbTk::RefCount<FbTk::Command> sendto_follow_cmd(new SendToCmd(i, true));
|
||||
FbTk::RefCount<FbTk::Command<void> > sendto_cmd(new SendToCmd(i, false));
|
||||
FbTk::RefCount<FbTk::Command<void> > sendto_follow_cmd(new SendToCmd(i, true));
|
||||
|
||||
FbTk::MultiButtonMenuItem* item = new FbTk::MultiButtonMenuItem(3, wlist[i]->name());
|
||||
item->setCommand(1, sendto_cmd);
|
||||
|
|
30
src/Slit.cc
30
src/Slit.cc
|
@ -176,7 +176,7 @@ namespace {
|
|||
|
||||
class SlitClientMenuItem: public FbTk::MenuItem{
|
||||
public:
|
||||
explicit SlitClientMenuItem(Slit& slit, SlitClient &client, FbTk::RefCount<FbTk::Command> &cmd):
|
||||
explicit SlitClientMenuItem(Slit& slit, SlitClient &client, FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(client.matchName().c_str(), cmd), m_slit(slit), m_client(client) {
|
||||
setCommand(cmd);
|
||||
FbTk::MenuItem::setSelected(client.visible());
|
||||
|
@ -207,7 +207,7 @@ private:
|
|||
|
||||
class SlitDirMenuItem: public FbTk::MenuItem {
|
||||
public:
|
||||
SlitDirMenuItem(const FbTk::FbString &label, Slit &slit, FbTk::RefCount<FbTk::Command> &cmd)
|
||||
SlitDirMenuItem(const FbTk::FbString &label, Slit &slit, FbTk::RefCount<FbTk::Command<void> > &cmd)
|
||||
:FbTk::MenuItem(label,cmd),
|
||||
m_slit(slit),
|
||||
m_label(label) {
|
||||
|
@ -242,7 +242,7 @@ private:
|
|||
|
||||
class PlaceSlitMenuItem: public FbTk::MenuItem {
|
||||
public:
|
||||
PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command> &cmd):
|
||||
PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label, cmd), m_slit(slit), m_place(place) {
|
||||
setCloseOnClick(false);
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
|
|||
// setup timer
|
||||
m_timer.setTimeout(200); // default timeout
|
||||
m_timer.fireOnce(true);
|
||||
FbTk::RefCount<FbTk::Command> toggle_hidden(new FbTk::SimpleCommand<Slit>(*this, &Slit::toggleHidden));
|
||||
FbTk::RefCount<FbTk::Command<void> > toggle_hidden(new FbTk::SimpleCommand<Slit>(*this, &Slit::toggleHidden));
|
||||
m_timer.setCommand(toggle_hidden);
|
||||
|
||||
|
||||
|
@ -1178,14 +1178,14 @@ void Slit::updateClientmenu() {
|
|||
m_clientlist_menu.removeAll();
|
||||
m_clientlist_menu.setLabel(_FB_XTEXT(Slit, ClientsMenu, "Clients", "Slit client menu"));
|
||||
|
||||
FbTk::RefCount<FbTk::Command> cycle_up(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsUp));
|
||||
FbTk::RefCount<FbTk::Command> cycle_down(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsDown));
|
||||
FbTk::RefCount<FbTk::Command<void> > cycle_up(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsUp));
|
||||
FbTk::RefCount<FbTk::Command<void> > cycle_down(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsDown));
|
||||
m_clientlist_menu.insert(_FB_XTEXT(Slit, CycleUp, "Cycle Up", "Cycle clients upwards"), cycle_up);
|
||||
m_clientlist_menu.insert(_FB_XTEXT(Slit, CycleDown, "Cycle Down", "Cycle clients downwards"), cycle_down);
|
||||
|
||||
m_clientlist_menu.insert(new FbTk::MenuSeparator());
|
||||
|
||||
FbTk::RefCount<FbTk::Command> reconfig(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure));
|
||||
FbTk::RefCount<FbTk::Command<void> > reconfig(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure));
|
||||
SlitClients::iterator it = m_client_list.begin();
|
||||
for (; it != m_client_list.end(); ++it) {
|
||||
if ((*it) != 0 && (*it)->window() != 0)
|
||||
|
@ -1193,7 +1193,7 @@ void Slit::updateClientmenu() {
|
|||
}
|
||||
|
||||
m_clientlist_menu.insert(new FbTk::MenuSeparator());
|
||||
FbTk::RefCount<FbTk::Command> savecmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::saveClientList));
|
||||
FbTk::RefCount<FbTk::Command<void> > savecmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::saveClientList));
|
||||
m_clientlist_menu.insert(_FB_XTEXT(Slit,
|
||||
SaveSlitList,
|
||||
"Save SlitList", "Saves the current order in the slit"),
|
||||
|
@ -1224,9 +1224,9 @@ void Slit::setupMenu() {
|
|||
|
||||
FbTk::MacroCommand *s_a_reconf_macro = new FbTk::MacroCommand();
|
||||
FbTk::MacroCommand *s_a_reconf_slit_macro = new FbTk::MacroCommand();
|
||||
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbCommands::SaveResources());
|
||||
FbTk::RefCount<FbTk::Command> reconf_cmd(new FbCommands::ReconfigureFluxboxCmd());
|
||||
FbTk::RefCount<FbTk::Command> reconf_slit_cmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure));
|
||||
FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbCommands::SaveResources());
|
||||
FbTk::RefCount<FbTk::Command<void> > reconf_cmd(new FbCommands::ReconfigureFluxboxCmd());
|
||||
FbTk::RefCount<FbTk::Command<void> > reconf_slit_cmd(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure));
|
||||
|
||||
s_a_reconf_macro->add(saverc_cmd);
|
||||
s_a_reconf_macro->add(reconf_cmd);
|
||||
|
@ -1234,8 +1234,8 @@ void Slit::setupMenu() {
|
|||
s_a_reconf_slit_macro->add(saverc_cmd);
|
||||
s_a_reconf_slit_macro->add(reconf_slit_cmd);
|
||||
|
||||
FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro);
|
||||
FbTk::RefCount<FbTk::Command> save_and_reconfigure_slit(s_a_reconf_slit_macro);
|
||||
FbTk::RefCount<FbTk::Command<void> > save_and_reconfigure(s_a_reconf_macro);
|
||||
FbTk::RefCount<FbTk::Command<void> > save_and_reconfigure_slit(s_a_reconf_slit_macro);
|
||||
|
||||
|
||||
// it'll be freed by the slitmenu (since not marked internal)
|
||||
|
@ -1280,10 +1280,10 @@ void Slit::setupMenu() {
|
|||
0, 255, m_slitmenu);
|
||||
// setup command for alpha value
|
||||
MacroCommand *alpha_macrocmd = new MacroCommand();
|
||||
RefCount<Command> alpha_cmd(new SimpleCommand<Slit>(*this, &Slit::updateAlpha));
|
||||
RefCount<Command<void> > alpha_cmd(new SimpleCommand<Slit>(*this, &Slit::updateAlpha));
|
||||
alpha_macrocmd->add(saverc_cmd);
|
||||
alpha_macrocmd->add(alpha_cmd);
|
||||
RefCount<Command> set_alpha_cmd(alpha_macrocmd);
|
||||
RefCount<Command<void> > set_alpha_cmd(alpha_macrocmd);
|
||||
alpha_menuitem->setCommand(set_alpha_cmd);
|
||||
|
||||
m_slitmenu.insert(alpha_menuitem);
|
||||
|
|
|
@ -32,7 +32,7 @@ StyleMenuItem::StyleMenuItem(const FbTk::FbString &label, const std::string &fil
|
|||
m_filename(filename) {
|
||||
// perform shell style ~ home directory expansion
|
||||
// and insert style
|
||||
FbTk::RefCount<FbTk::Command>
|
||||
FbTk::RefCount<FbTk::Command<void> >
|
||||
setstyle_cmd(new FbCommands::
|
||||
SetStyleCmd(m_filename));
|
||||
setCommand(setstyle_cmd);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "WorkspaceNameTheme.hh"
|
||||
#include "ButtonTheme.hh"
|
||||
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "Screen.hh"
|
||||
#include "Toolbar.hh"
|
||||
#include "fluxbox.hh"
|
||||
|
@ -42,7 +42,7 @@
|
|||
#include <utility>
|
||||
|
||||
namespace {
|
||||
class ShowMenuAboveToolbar: public FbTk::Command {
|
||||
class ShowMenuAboveToolbar: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit ShowMenuAboveToolbar(Toolbar &tbar):m_tbar(tbar) { }
|
||||
void execute() {
|
||||
|
@ -92,7 +92,7 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
|
|||
WorkspaceNameTool *witem = new WorkspaceNameTool(parent,
|
||||
*m_workspace_theme, screen());
|
||||
using namespace FbTk;
|
||||
RefCount<Command> showmenu(new ShowMenuAboveToolbar(tbar));
|
||||
RefCount<Command<void> > showmenu(new ShowMenuAboveToolbar(tbar));
|
||||
witem->button().setOnClick(showmenu);
|
||||
item = witem;
|
||||
} else if (name == "iconbar") {
|
||||
|
@ -104,7 +104,7 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
|
|||
} else if (name == "nextworkspace" ||
|
||||
name == "prevworkspace") {
|
||||
|
||||
FbTk::RefCount<FbTk::Command> cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse(name));
|
||||
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
|
||||
if (*cmd == 0) // we need a command
|
||||
return 0;
|
||||
|
||||
|
@ -124,7 +124,7 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
|
|||
} else if (name == "nextwindow" ||
|
||||
name == "prevwindow") {
|
||||
|
||||
FbTk::RefCount<FbTk::Command> cmd(FbTk::ObjectRegistry<FbTk::Command>::instance().parse(name));
|
||||
FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(name));
|
||||
if (*cmd == 0) // we need a command
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#endif // XINERAMA
|
||||
|
||||
#include "Strut.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "Layer.hh"
|
||||
|
||||
#include "FbTk/I18n.hh"
|
||||
|
@ -159,7 +159,7 @@ getString() const {
|
|||
} // end namespace FbTk
|
||||
|
||||
namespace {
|
||||
class SetToolbarPlacementCmd: public FbTk::Command {
|
||||
class SetToolbarPlacementCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
SetToolbarPlacementCmd(Toolbar &tbar, Toolbar::Placement place):m_tbar(tbar), m_place(place) { }
|
||||
void execute() {
|
||||
|
@ -266,7 +266,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
|
|||
|
||||
// setup hide timer
|
||||
m_hide_timer.setTimeout(Fluxbox::instance()->getAutoRaiseDelay());
|
||||
FbTk::RefCount<FbTk::Command> toggle_hidden(new FbTk::SimpleCommand<Toolbar>(*this, &Toolbar::toggleHidden));
|
||||
FbTk::RefCount<FbTk::Command<void> > toggle_hidden(new FbTk::SimpleCommand<Toolbar>(*this, &Toolbar::toggleHidden));
|
||||
m_hide_timer.setCommand(toggle_hidden);
|
||||
m_hide_timer.fireOnce(true);
|
||||
|
||||
|
@ -813,14 +813,14 @@ void Toolbar::setupMenus(bool skip_new_placement) {
|
|||
_FB_USES_NLS;
|
||||
using namespace FbTk;
|
||||
|
||||
typedef RefCount<Command> RefCommand;
|
||||
typedef RefCount<Command<void> > RefCommand;
|
||||
typedef SimpleCommand<Toolbar> ToolbarCommand;
|
||||
|
||||
menu().setLabel(_FB_XTEXT(Toolbar, Toolbar,
|
||||
"Toolbar", "Title of Toolbar menu"));
|
||||
|
||||
RefCommand reconfig_toolbar(new ToolbarCommand(*this, &Toolbar::reconfigure));
|
||||
RefCommand save_resources(FbTk::ObjectRegistry<Command>::instance().parse("saverc"));
|
||||
RefCommand save_resources(FbTk::CommandParser<void>::instance().parse("saverc"));
|
||||
MacroCommand *toolbar_menuitem_macro = new MacroCommand();
|
||||
toolbar_menuitem_macro->add(reconfig_toolbar);
|
||||
toolbar_menuitem_macro->add(save_resources);
|
||||
|
@ -924,10 +924,10 @@ void Toolbar::setupMenus(bool skip_new_placement) {
|
|||
0, 255, menu());
|
||||
// setup command for alpha value
|
||||
MacroCommand *alpha_macrocmd = new MacroCommand();
|
||||
RefCount<Command> alpha_cmd(new SimpleCommand<Toolbar>(*this, &Toolbar::updateAlpha));
|
||||
RefCount<Command<void> > alpha_cmd(new SimpleCommand<Toolbar>(*this, &Toolbar::updateAlpha));
|
||||
alpha_macrocmd->add(save_resources);
|
||||
alpha_macrocmd->add(alpha_cmd);
|
||||
RefCount<Command> set_alpha_cmd(alpha_macrocmd);
|
||||
RefCount<Command<void> > set_alpha_cmd(alpha_macrocmd);
|
||||
alpha_menuitem->setCommand(set_alpha_cmd);
|
||||
|
||||
menu().insert(alpha_menuitem);
|
||||
|
|
|
@ -221,7 +221,7 @@ void tempRaiseFluxboxWindow(FluxboxWindow &win) {
|
|||
|
||||
}
|
||||
|
||||
class SetClientCmd:public FbTk::Command {
|
||||
class SetClientCmd:public FbTk::Command<void> {
|
||||
public:
|
||||
explicit SetClientCmd(WinClient &client):m_client(client) {
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ void FluxboxWindow::init() {
|
|||
m_client->x = wattrib.x; m_client->y = wattrib.y;
|
||||
|
||||
m_timer.setTimeout(fluxbox.getAutoRaiseDelay());
|
||||
FbTk::RefCount<FbTk::Command> raise_cmd(new FbTk::SimpleCommand<FluxboxWindow>(*this,
|
||||
FbTk::RefCount<FbTk::Command<void> > raise_cmd(new FbTk::SimpleCommand<FluxboxWindow>(*this,
|
||||
&FluxboxWindow::raise));
|
||||
m_timer.setCommand(raise_cmd);
|
||||
m_timer.fireOnce(true);
|
||||
|
@ -3971,7 +3971,7 @@ void FluxboxWindow::updateButtons() {
|
|||
frame().removeAllButtons();
|
||||
|
||||
using namespace FbTk;
|
||||
typedef RefCount<Command> CommandRef;
|
||||
typedef RefCount<Command<void> > CommandRef;
|
||||
typedef SimpleCommand<FluxboxWindow> WindowCmd;
|
||||
|
||||
CommandRef iconify_cmd(new WindowCmd(*this, &FluxboxWindow::iconify));
|
||||
|
@ -4142,7 +4142,7 @@ void FluxboxWindow::associateClient(WinClient &client) {
|
|||
frame().theme().unfocusedTheme()->iconbarTheme(), client);
|
||||
frame().createTab(*btn);
|
||||
|
||||
FbTk::RefCount<FbTk::Command> setcmd(new SetClientCmd(client));
|
||||
FbTk::RefCount<FbTk::Command<void> > setcmd(new SetClientCmd(client));
|
||||
btn->setOnClick(setcmd, 1);
|
||||
btn->setTextPadding(Fluxbox::instance()->getTabsPadding());
|
||||
btn->setPixmap(screen().getTabsUsePixmap());
|
||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
|||
|
||||
/// executes action for a dynamic context set in WindowCmd_base
|
||||
template <typename ReturnType=void>
|
||||
class WindowCmd: public WindowCmd_base, public FbTk::Command {
|
||||
class WindowCmd: public WindowCmd_base, public FbTk::Command<void> {
|
||||
public:
|
||||
typedef ReturnType (FluxboxWindow::* Action)();
|
||||
WindowCmd(Action a):m_action(a) {}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "WindowCmd.hh"
|
||||
|
||||
#include "FbTk/KeyUtil.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "FbTk/stringstream.hh"
|
||||
#include "FbTk/StringUtil.hh"
|
||||
|
||||
|
@ -45,16 +45,14 @@
|
|||
#include <vector>
|
||||
|
||||
using std::string;
|
||||
using FbTk::Command;
|
||||
using FbTk::BoolCommand;
|
||||
|
||||
REGISTER_OBJECT_PARSER(map, WindowListCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(foreach, WindowListCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(map, WindowListCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(foreach, WindowListCmd::parse, void);
|
||||
|
||||
FbTk::Command *WindowListCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<void> *WindowListCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
FbTk::Command *cmd = 0;
|
||||
FbTk::BoolCommand *filter = 0;
|
||||
FbTk::Command<void> *cmd = 0;
|
||||
FbTk::Command<bool> *filter = 0;
|
||||
std::vector<string> tokens;
|
||||
int opts;
|
||||
string pat;
|
||||
|
@ -63,19 +61,19 @@ FbTk::Command *WindowListCmd::parse(const string &command, const string &args,
|
|||
if (tokens.empty())
|
||||
return 0;
|
||||
|
||||
cmd = FbTk::ObjectRegistry<Command>::instance().parse(tokens[0], trusted);
|
||||
cmd = FbTk::CommandParser<void>::instance().parse(tokens[0], trusted);
|
||||
if (!cmd)
|
||||
return 0;
|
||||
|
||||
if (tokens.size() > 1) {
|
||||
FocusableList::parseArgs(tokens[1], opts, pat);
|
||||
|
||||
filter = FbTk::ObjectRegistry<BoolCommand>::instance().parse(pat,
|
||||
filter = FbTk::CommandParser<bool>::instance().parse(pat,
|
||||
trusted);
|
||||
}
|
||||
|
||||
return new WindowListCmd(FbTk::RefCount<Command>(cmd), opts,
|
||||
FbTk::RefCount<BoolCommand>(filter));
|
||||
return new WindowListCmd(FbTk::RefCount<FbTk::Command<void> >(cmd), opts,
|
||||
FbTk::RefCount<FbTk::Command<bool> >(filter));
|
||||
}
|
||||
|
||||
void WindowListCmd::execute() {
|
||||
|
@ -92,29 +90,29 @@ void WindowListCmd::execute() {
|
|||
WindowCmd<void>::setWindow((*it)->fbwindow());
|
||||
else if (typeid(**it) == typeid(WinClient))
|
||||
WindowCmd<void>::setClient(dynamic_cast<WinClient *>(*it));
|
||||
if (!*m_filter || m_filter->bool_execute())
|
||||
if (!*m_filter || m_filter->execute())
|
||||
m_cmd->execute();
|
||||
}
|
||||
WindowCmd<void>::setClient(old);
|
||||
}
|
||||
}
|
||||
|
||||
FbTk::BoolCommand *SomeCmd::parse(const string &command, const string &args,
|
||||
FbTk::Command<bool> *SomeCmd::parse(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
FbTk::BoolCommand *boolcmd =
|
||||
FbTk::ObjectRegistry<FbTk::BoolCommand>::instance().parse(args,
|
||||
FbTk::Command<bool> *boolcmd =
|
||||
FbTk::CommandParser<bool>::instance().parse(args,
|
||||
trusted);
|
||||
if (!boolcmd)
|
||||
return 0;
|
||||
if (command == "some")
|
||||
return new SomeCmd(FbTk::RefCount<FbTk::BoolCommand>(boolcmd));
|
||||
return new EveryCmd(FbTk::RefCount<FbTk::BoolCommand>(boolcmd));
|
||||
return new SomeCmd(FbTk::RefCount<FbTk::Command<bool> >(boolcmd));
|
||||
return new EveryCmd(FbTk::RefCount<FbTk::Command<bool> >(boolcmd));
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(some, SomeCmd::parse, BoolCommand);
|
||||
REGISTER_OBJECT_PARSER(every, SomeCmd::parse, BoolCommand);
|
||||
REGISTER_COMMAND_PARSER(some, SomeCmd::parse, bool);
|
||||
REGISTER_COMMAND_PARSER(every, SomeCmd::parse, bool);
|
||||
|
||||
bool SomeCmd::bool_execute() {
|
||||
bool SomeCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->keyScreen();
|
||||
if (screen != 0) {
|
||||
FocusControl::Focusables win_list(screen->focusControl().creationOrderList().clientList());
|
||||
|
@ -127,7 +125,7 @@ bool SomeCmd::bool_execute() {
|
|||
WinClient *client = dynamic_cast<WinClient *>(*it);
|
||||
if (!client) continue;
|
||||
WindowCmd<void>::setClient(client);
|
||||
if (m_cmd->bool_execute())
|
||||
if (m_cmd->execute())
|
||||
return true;
|
||||
}
|
||||
WindowCmd<void>::setClient(old);
|
||||
|
@ -135,7 +133,7 @@ bool SomeCmd::bool_execute() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool EveryCmd::bool_execute() {
|
||||
bool EveryCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->keyScreen();
|
||||
if (screen != 0) {
|
||||
FocusControl::Focusables win_list(screen->focusControl().creationOrderList().clientList());
|
||||
|
@ -148,7 +146,7 @@ bool EveryCmd::bool_execute() {
|
|||
WinClient *client = dynamic_cast<WinClient *>(*it);
|
||||
if (!client) continue;
|
||||
WindowCmd<void>::setClient(client);
|
||||
if (!m_cmd->bool_execute())
|
||||
if (!m_cmd->execute())
|
||||
return false;
|
||||
}
|
||||
WindowCmd<void>::setClient(old);
|
||||
|
@ -158,7 +156,7 @@ bool EveryCmd::bool_execute() {
|
|||
|
||||
namespace {
|
||||
|
||||
FbTk::Command *parseWindowList(const string &command,
|
||||
FbTk::Command<void> *parseWindowList(const string &command,
|
||||
const string &args, bool trusted) {
|
||||
int opts;
|
||||
string pat;
|
||||
|
@ -179,11 +177,11 @@ FbTk::Command *parseWindowList(const string &command,
|
|||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(attach, parseWindowList, Command);
|
||||
REGISTER_OBJECT_PARSER(nextwindow, parseWindowList, Command);
|
||||
REGISTER_OBJECT_PARSER(nextgroup, parseWindowList, Command);
|
||||
REGISTER_OBJECT_PARSER(prevwindow, parseWindowList, Command);
|
||||
REGISTER_OBJECT_PARSER(prevgroup, parseWindowList, Command);
|
||||
REGISTER_COMMAND_PARSER(attach, parseWindowList, void);
|
||||
REGISTER_COMMAND_PARSER(nextwindow, parseWindowList, void);
|
||||
REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void);
|
||||
REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void);
|
||||
REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void);
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
|
@ -219,7 +217,7 @@ void PrevWindowCmd::execute() {
|
|||
screen->cycleFocus(m_option, &m_pat, true);
|
||||
}
|
||||
|
||||
FbTk::Command *GoToWindowCmd::parse(const string &command,
|
||||
FbTk::Command<void> *GoToWindowCmd::parse(const string &command,
|
||||
const string &arguments, bool trusted) {
|
||||
int num, opts;
|
||||
string args, pat;
|
||||
|
@ -232,7 +230,7 @@ FbTk::Command *GoToWindowCmd::parse(const string &command,
|
|||
return new GoToWindowCmd(num, opts, pat);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(gotowindow, GoToWindowCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(gotowindow, GoToWindowCmd::parse, void);
|
||||
|
||||
void GoToWindowCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->keyScreen();
|
||||
|
@ -243,7 +241,7 @@ void GoToWindowCmd::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
FbTk::Command *DirFocusCmd::parse(const string &command,
|
||||
FbTk::Command<void> *DirFocusCmd::parse(const string &command,
|
||||
const string &args, bool trusted) {
|
||||
if (command == "focusup")
|
||||
return new DirFocusCmd(FocusControl::FOCUSUP);
|
||||
|
@ -256,10 +254,10 @@ FbTk::Command *DirFocusCmd::parse(const string &command,
|
|||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(focusup, DirFocusCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(focusdown, DirFocusCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(focusleft, DirFocusCmd::parse, Command);
|
||||
REGISTER_OBJECT_PARSER(focusright, DirFocusCmd::parse, Command);
|
||||
REGISTER_COMMAND_PARSER(focusup, DirFocusCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(focusdown, DirFocusCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(focusleft, DirFocusCmd::parse, void);
|
||||
REGISTER_COMMAND_PARSER(focusright, DirFocusCmd::parse, void);
|
||||
|
||||
void DirFocusCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->keyScreen();
|
||||
|
@ -271,7 +269,7 @@ void DirFocusCmd::execute() {
|
|||
screen->focusControl().dirFocus(*win, m_dir);
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(addworkspace, AddWorkspaceCmd, Command);
|
||||
REGISTER_COMMAND(addworkspace, AddWorkspaceCmd, void);
|
||||
|
||||
void AddWorkspaceCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -279,7 +277,7 @@ void AddWorkspaceCmd::execute() {
|
|||
screen->addWorkspace();
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(removelastworkspace, RemoveLastWorkspaceCmd, Command);
|
||||
REGISTER_COMMAND(removelastworkspace, RemoveLastWorkspaceCmd, void);
|
||||
|
||||
void RemoveLastWorkspaceCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -289,7 +287,7 @@ void RemoveLastWorkspaceCmd::execute() {
|
|||
|
||||
namespace {
|
||||
|
||||
FbTk::Command *parseIntCmd(const string &command, const string &args,
|
||||
FbTk::Command<void> *parseIntCmd(const string &command, const string &args,
|
||||
bool trusted) {
|
||||
int num = 1;
|
||||
FbTk_istringstream iss(args.c_str());
|
||||
|
@ -308,11 +306,11 @@ FbTk::Command *parseIntCmd(const string &command, const string &args,
|
|||
return 0;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_PARSER(nextworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(prevworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(rightworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(leftworkspace, parseIntCmd, Command);
|
||||
REGISTER_OBJECT_PARSER(workspace, parseIntCmd, Command);
|
||||
REGISTER_COMMAND_PARSER(nextworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(prevworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(rightworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(leftworkspace, parseIntCmd, void);
|
||||
REGISTER_COMMAND_PARSER(workspace, parseIntCmd, void);
|
||||
|
||||
}; // end anonymous namespace
|
||||
|
||||
|
@ -355,7 +353,7 @@ void JumpToWorkspaceCmd::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(arrangewindows, ArrangeWindowsCmd, Command);
|
||||
REGISTER_COMMAND(arrangewindows, ArrangeWindowsCmd, void);
|
||||
|
||||
/**
|
||||
try to arrange the windows on the current workspace in a 'clever' way.
|
||||
|
@ -481,7 +479,7 @@ void ArrangeWindowsCmd::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(showdesktop, ShowDesktopCmd, Command);
|
||||
REGISTER_COMMAND(showdesktop, ShowDesktopCmd, void);
|
||||
|
||||
void ShowDesktopCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
@ -497,7 +495,7 @@ void ShowDesktopCmd::execute() {
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_OBJECT(closeallwindows, CloseAllWindowsCmd, Command);
|
||||
REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd, void);
|
||||
|
||||
void CloseAllWindowsCmd::execute() {
|
||||
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||
|
|
|
@ -28,45 +28,45 @@
|
|||
#include "ClientPattern.hh"
|
||||
#include "FocusControl.hh"
|
||||
|
||||
class WindowListCmd: public FbTk::Command {
|
||||
class WindowListCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
WindowListCmd(FbTk::RefCount<FbTk::Command> cmd, int opts,
|
||||
FbTk::RefCount<FbTk::BoolCommand> filter):
|
||||
WindowListCmd(FbTk::RefCount<FbTk::Command<void> > cmd, int opts,
|
||||
FbTk::RefCount<FbTk::Command<bool> > filter):
|
||||
m_cmd(cmd), m_opts(opts), m_filter(filter) { }
|
||||
|
||||
void execute();
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
|
||||
private:
|
||||
FbTk::RefCount<FbTk::Command> m_cmd;
|
||||
FbTk::RefCount<FbTk::Command<void> > m_cmd;
|
||||
int m_opts;
|
||||
FbTk::RefCount<FbTk::BoolCommand> m_filter;
|
||||
FbTk::RefCount<FbTk::Command<bool> > m_filter;
|
||||
};
|
||||
|
||||
class SomeCmd: public FbTk::BoolCommand {
|
||||
class SomeCmd: public FbTk::Command<bool> {
|
||||
public:
|
||||
SomeCmd(FbTk::RefCount<FbTk::BoolCommand> cmd): m_cmd(cmd) { }
|
||||
SomeCmd(FbTk::RefCount<FbTk::Command<bool> > cmd): m_cmd(cmd) { }
|
||||
|
||||
bool bool_execute();
|
||||
static FbTk::BoolCommand *parse(const std::string &command,
|
||||
bool execute();
|
||||
static FbTk::Command<bool> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
|
||||
private:
|
||||
FbTk::RefCount<FbTk::BoolCommand> m_cmd;
|
||||
FbTk::RefCount<FbTk::Command<bool> > m_cmd;
|
||||
};
|
||||
|
||||
class EveryCmd: public FbTk::BoolCommand {
|
||||
class EveryCmd: public FbTk::Command<bool> {
|
||||
public:
|
||||
EveryCmd(FbTk::RefCount<FbTk::BoolCommand> cmd): m_cmd(cmd) { }
|
||||
EveryCmd(FbTk::RefCount<FbTk::Command<bool> > cmd): m_cmd(cmd) { }
|
||||
|
||||
bool bool_execute();
|
||||
bool execute();
|
||||
|
||||
private:
|
||||
FbTk::RefCount<FbTk::BoolCommand> m_cmd;
|
||||
FbTk::RefCount<FbTk::Command<bool> > m_cmd;
|
||||
};
|
||||
|
||||
class AttachCmd: public FbTk::Command {
|
||||
class AttachCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit AttachCmd(const std::string &pat): m_pat(pat.c_str()) { }
|
||||
void execute();
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
const ClientPattern m_pat;
|
||||
};
|
||||
|
||||
class NextWindowCmd: public FbTk::Command {
|
||||
class NextWindowCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit NextWindowCmd(int option, std::string &pat):
|
||||
m_option(option), m_pat(pat.c_str()) { }
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
const ClientPattern m_pat;
|
||||
};
|
||||
|
||||
class PrevWindowCmd: public FbTk::Command {
|
||||
class PrevWindowCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit PrevWindowCmd(int option, std::string &pat):
|
||||
m_option(option), m_pat(pat.c_str()) { }
|
||||
|
@ -94,12 +94,12 @@ private:
|
|||
const ClientPattern m_pat;
|
||||
};
|
||||
|
||||
class GoToWindowCmd: public FbTk::Command {
|
||||
class GoToWindowCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
GoToWindowCmd(int num, int option, std::string &pat):
|
||||
m_num(num), m_option(option), m_pat(pat.c_str()) { }
|
||||
void execute();
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
private:
|
||||
const int m_num;
|
||||
|
@ -107,27 +107,27 @@ private:
|
|||
const ClientPattern m_pat;
|
||||
};
|
||||
|
||||
class DirFocusCmd: public FbTk::Command {
|
||||
class DirFocusCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit DirFocusCmd(const FocusControl::FocusDir dir): m_dir(dir) { }
|
||||
void execute();
|
||||
static FbTk::Command *parse(const std::string &command,
|
||||
static FbTk::Command<void> *parse(const std::string &command,
|
||||
const std::string &args, bool trusted);
|
||||
private:
|
||||
const FocusControl::FocusDir m_dir;
|
||||
};
|
||||
|
||||
class AddWorkspaceCmd: public FbTk::Command {
|
||||
class AddWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class RemoveLastWorkspaceCmd: public FbTk::Command {
|
||||
class RemoveLastWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class NextWorkspaceCmd: public FbTk::Command {
|
||||
class NextWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit NextWorkspaceCmd(int option):m_option(option) { }
|
||||
void execute();
|
||||
|
@ -135,7 +135,7 @@ private:
|
|||
const int m_option;
|
||||
};
|
||||
|
||||
class PrevWorkspaceCmd: public FbTk::Command {
|
||||
class PrevWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit PrevWorkspaceCmd(int option):m_option(option) { }
|
||||
void execute();
|
||||
|
@ -143,7 +143,7 @@ private:
|
|||
const int m_option;
|
||||
};
|
||||
|
||||
class LeftWorkspaceCmd: public FbTk::Command {
|
||||
class LeftWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit LeftWorkspaceCmd(int num=1):m_param(num == 0 ? 1 : num) { }
|
||||
void execute();
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
const int m_param;
|
||||
};
|
||||
|
||||
class RightWorkspaceCmd: public FbTk::Command {
|
||||
class RightWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit RightWorkspaceCmd(int num=1):m_param(num == 0 ? 1 : num) { }
|
||||
void execute();
|
||||
|
@ -159,7 +159,7 @@ private:
|
|||
const int m_param;
|
||||
};
|
||||
|
||||
class JumpToWorkspaceCmd: public FbTk::Command {
|
||||
class JumpToWorkspaceCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
explicit JumpToWorkspaceCmd(int workspace_num);
|
||||
void execute();
|
||||
|
@ -168,17 +168,17 @@ private:
|
|||
};
|
||||
|
||||
/// arranges windows in current workspace to rows and columns
|
||||
class ArrangeWindowsCmd: public FbTk::Command {
|
||||
class ArrangeWindowsCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class ShowDesktopCmd: public FbTk::Command {
|
||||
class ShowDesktopCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
||||
class CloseAllWindowsCmd: public FbTk::Command {
|
||||
class CloseAllWindowsCmd: public FbTk::Command<void> {
|
||||
public:
|
||||
void execute();
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "Workspace.hh"
|
||||
#include "WorkspaceCmd.hh"
|
||||
#include "MenuCreator.hh"
|
||||
#include "FbTk/ObjectRegistry.hh"
|
||||
#include "FbTk/CommandParser.hh"
|
||||
#include "FbCommands.hh"
|
||||
#include "Layer.hh"
|
||||
|
||||
|
@ -92,7 +92,7 @@ void WorkspaceMenu::update(FbTk::Subject *subj) {
|
|||
FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5,
|
||||
wkspc->name().c_str(),
|
||||
&wkspc->menu());
|
||||
FbTk::RefCount<FbTk::Command> jump_cmd(new JumpToWorkspaceCmd(wkspc->workspaceID()));
|
||||
FbTk::RefCount<FbTk::Command<void> > jump_cmd(new JumpToWorkspaceCmd(wkspc->workspaceID()));
|
||||
mb_menu->setCommand(3, jump_cmd);
|
||||
insert(mb_menu, workspace + IDX_AFTER_ICONS);
|
||||
}
|
||||
|
@ -124,28 +124,28 @@ void WorkspaceMenu::init(BScreen &screen) {
|
|||
FbTk::MultiButtonMenuItem* mb_menu = new FbTk::MultiButtonMenuItem(5,
|
||||
wkspc->name().c_str(),
|
||||
&wkspc->menu());
|
||||
FbTk::RefCount<FbTk::Command> jump_cmd(new JumpToWorkspaceCmd(wkspc->workspaceID()));
|
||||
FbTk::RefCount<FbTk::Command<void> > jump_cmd(new JumpToWorkspaceCmd(wkspc->workspaceID()));
|
||||
mb_menu->setCommand(2, jump_cmd);
|
||||
insert(mb_menu, workspace + IDX_AFTER_ICONS);
|
||||
}
|
||||
setItemSelected(screen.currentWorkspace()->workspaceID() + IDX_AFTER_ICONS, true);
|
||||
|
||||
|
||||
RefCount<Command> saverc_cmd(new FbCommands::SaveResources());
|
||||
RefCount<Command<void> > saverc_cmd(new FbCommands::SaveResources());
|
||||
|
||||
MacroCommand *new_workspace_macro = new MacroCommand();
|
||||
RefCount<Command> addworkspace(new SimpleCommand<BScreen, int>(screen, &BScreen::addWorkspace));
|
||||
RefCount<Command<void> > addworkspace(new SimpleCommand<BScreen>(screen, (SimpleCommand<BScreen>::Action)&BScreen::addWorkspace));
|
||||
new_workspace_macro->add(addworkspace);
|
||||
new_workspace_macro->add(saverc_cmd);
|
||||
RefCount<Command> new_workspace_cmd(new_workspace_macro);
|
||||
RefCount<Command<void> > new_workspace_cmd(new_workspace_macro);
|
||||
|
||||
MacroCommand *remove_workspace_macro = new MacroCommand();
|
||||
RefCount<Command> rmworkspace(new SimpleCommand<BScreen, int>(screen, &BScreen::removeLastWorkspace));
|
||||
RefCount<Command<void> > rmworkspace(new SimpleCommand<BScreen>(screen, (SimpleCommand<BScreen>::Action)&BScreen::removeLastWorkspace));
|
||||
remove_workspace_macro->add(rmworkspace);
|
||||
remove_workspace_macro->add(saverc_cmd);
|
||||
RefCount<Command> remove_last_cmd(remove_workspace_macro);
|
||||
RefCount<Command<void> > remove_last_cmd(remove_workspace_macro);
|
||||
|
||||
RefCount<Command> start_edit(FbTk::ObjectRegistry<Command>::instance().parse("setworkspacenamedialog"));
|
||||
RefCount<Command<void> > start_edit(FbTk::CommandParser<void>::instance().parse("setworkspacenamedialog"));
|
||||
|
||||
insert(new FbTk::MenuSeparator());
|
||||
insert(_FB_XTEXT(Workspace, NewWorkspace, "New Workspace", "Add a new workspace"),
|
||||
|
|
|
@ -40,7 +40,7 @@ template <typename ItemType>
|
|||
class XineramaHeadMenuItem : public FbTk::MenuItem {
|
||||
public:
|
||||
XineramaHeadMenuItem(const FbTk::FbString &label, ItemType &object, int headnum,
|
||||
FbTk::RefCount<FbTk::Command> &cmd):
|
||||
FbTk::RefCount<FbTk::Command<void> > &cmd):
|
||||
FbTk::MenuItem(label,cmd), m_object(object), m_headnum(headnum) {}
|
||||
XineramaHeadMenuItem(const FbTk::FbString &label, ItemType &object, int headnum):
|
||||
FbTk::MenuItem(label), m_object(object), m_headnum(headnum) {}
|
||||
|
@ -79,7 +79,7 @@ XineramaHeadMenu<ItemType>::XineramaHeadMenu(
|
|||
m_object(item)
|
||||
{
|
||||
setLabel(title);
|
||||
FbTk::RefCount<FbTk::Command> saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
|
||||
FbTk::RefCount<FbTk::Command<void> > saverc_cmd(new FbTk::SimpleCommand<Fluxbox>(
|
||||
*Fluxbox::instance(),
|
||||
&Fluxbox::save_rc));
|
||||
char tname[128];
|
||||
|
|
|
@ -263,7 +263,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
|
|||
// Because when the command is executed we shouldn't do reconfig directly
|
||||
// because it could affect ongoing menu stuff so we need to reconfig in
|
||||
// the next event "round".
|
||||
FbTk::RefCount<FbTk::Command> reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure));
|
||||
FbTk::RefCount<FbTk::Command<void> > reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure));
|
||||
timeval to;
|
||||
to.tv_sec = 0;
|
||||
to.tv_usec = 1;
|
||||
|
@ -1034,7 +1034,7 @@ void Fluxbox::handleSignal(int signum) {
|
|||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
_FB_CONSOLETEXT(BaseDisplay, SignalCaught, "%s: signal %d caught\n", "signal catch debug message. Include %s for command and %d for signal number").c_str(),
|
||||
_FB_CONSOLETEXT(BaseDisplay, SignalCaught, "%s: signal %d caught\n", "signal catch debug message. Include %s for Command<void> and %d for signal number").c_str(),
|
||||
m_argv[0], signum);
|
||||
|
||||
if (! m_starting && ! re_enter) {
|
||||
|
|
Loading…
Reference in a new issue