fluxbox/src/CurrentWindowCmd.hh

225 lines
5.6 KiB
C++
Raw Normal View History

2003-06-30 14:35:11 +00:00
// CurrentWindowCmd.hh for Fluxbox - an X11 Window manager
2006-02-16 06:53:05 +00:00
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
2003-06-30 14:35:11 +00:00
// and Simon Bowden (rathnor at users.sourceforge.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
2004-11-19 11:37:27 +00:00
// $Id$
2003-06-30 14:35:11 +00:00
#ifndef CURRENTWINDOWCMD_HH
#define CURRENTWINDOWCMD_HH
#include "Command.hh"
#include "Window.hh"
2003-06-30 14:35:11 +00:00
/// 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 {
public:
2007-10-13 21:51:37 +00:00
explicit WindowHelperCmd(FluxboxWindow *win = 0): m_win(win) { }
2003-06-30 14:35:11 +00:00
void execute();
2007-10-13 21:51:37 +00:00
void execute(FluxboxWindow &fbwin);
2003-06-30 14:35:11 +00:00
protected:
FluxboxWindow &fbwindow();
2003-06-30 14:35:11 +00:00
virtual void real_execute() = 0;
2007-10-13 21:51:37 +00:00
private:
FluxboxWindow *m_win;
2003-06-30 14:35:11 +00:00
};
2007-10-13 21:51:37 +00:00
/// command that calls FluxboxWindow::<the function> on execute()
/// similar to FbTk::SimpleCommand<T>
class CurrentWindowCmd: public WindowHelperCmd {
public:
typedef void (FluxboxWindow::* Action)();
explicit CurrentWindowCmd(Action action): m_action(action) { }
2003-06-30 14:35:11 +00:00
void real_execute();
2007-10-13 21:51:37 +00:00
private:
Action m_action;
2003-06-30 14:35:11 +00:00
};
class SetHeadCmd : public WindowHelperCmd {
public:
explicit SetHeadCmd(int head) : m_head(head) { }
protected:
void real_execute();
private:
const int m_head;
};
2003-06-30 14:35:11 +00:00
class SendToWorkspaceCmd: public WindowHelperCmd {
public:
explicit SendToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { }
protected:
void real_execute();
private:
const int m_workspace_num;
};
class SendToNextWorkspaceCmd: public WindowHelperCmd {
public:
explicit SendToNextWorkspaceCmd(int delta):m_delta(delta) { }
protected:
void real_execute();
private:
const int m_delta;
};
class SendToPrevWorkspaceCmd: public WindowHelperCmd {
public:
explicit SendToPrevWorkspaceCmd(int delta):m_delta(delta) { }
protected:
void real_execute();
2003-06-30 14:35:11 +00:00
private:
const int m_delta;
2003-06-30 14:35:11 +00:00
};
class TakeToWorkspaceCmd : public WindowHelperCmd {
public:
explicit TakeToWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { }
protected:
void real_execute();
private:
const int m_workspace_num;
};
class TakeToNextWorkspaceCmd : public WindowHelperCmd {
public:
explicit TakeToNextWorkspaceCmd(int delta) : m_delta(delta) { }
protected:
void real_execute();
private:
const int m_delta;
};
class TakeToPrevWorkspaceCmd : public WindowHelperCmd {
public:
explicit TakeToPrevWorkspaceCmd(int delta) : m_delta(delta) { }
protected:
void real_execute();
private:
const int m_delta;
};
// goto tab
class GoToTabCmd: public WindowHelperCmd {
public:
explicit GoToTabCmd(int tab_num):m_tab_num(tab_num) { }
protected:
void real_execute();
private:
const int m_tab_num;
};
// begin moving with mouse
class StartMovingCmd: public WindowHelperCmd {
public:
StartMovingCmd() { }
protected:
void real_execute();
};
// begin resizing with mouse
class StartResizingCmd: public WindowHelperCmd {
public:
explicit StartResizingCmd(FluxboxWindow::ResizeModel mode):m_mode(mode) { }
protected:
void real_execute();
private:
const FluxboxWindow::ResizeModel m_mode;
};
2003-10-25 22:11:22 +00:00
// move cmd, relative position
class MoveCmd: public WindowHelperCmd {
2003-06-30 14:35:11 +00:00
public:
explicit MoveCmd(const int step_size_x, const int step_size_y);
2003-06-30 14:35:11 +00:00
protected:
void real_execute();
private:
const int m_step_size_x;
const int m_step_size_y;
2003-06-30 14:35:11 +00:00
};
2003-10-25 22:11:22 +00:00
// resize cmd, relative size
2003-09-06 15:43:27 +00:00
class ResizeCmd: public WindowHelperCmd{
public:
2003-09-06 15:43:27 +00:00
explicit ResizeCmd(int step_size_x, int step_size_y);
protected:
void real_execute();
2003-09-06 15:43:27 +00:00
2003-10-25 22:11:22 +00:00
private:
const int m_step_size_x;
const int m_step_size_y;
};
class MoveToCmd: public WindowHelperCmd {
public:
enum {
LEFT = 1 << 0,
RIGHT = 1 << 1,
UPPER = 1 << 2,
LOWER = 1 << 3,
IGNORE_X = 1 << 8,
IGNORE_Y = 1 << 9
};
explicit MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc);
2003-10-25 22:11:22 +00:00
protected:
void real_execute();
private:
const int m_step_size_x;
const int m_step_size_y;
const unsigned int m_refc;
2003-10-25 22:11:22 +00:00
};
// resize cmd
class ResizeToCmd: public WindowHelperCmd{
public:
explicit ResizeToCmd(int step_size_x, int step_size_y);
2003-10-25 22:11:22 +00:00
protected:
void real_execute();
2003-09-06 15:43:27 +00:00
private:
const int m_step_size_x;
const int m_step_size_y;
};
class FullscreenCmd: public WindowHelperCmd{
public:
explicit FullscreenCmd();
protected:
void real_execute();
};
2007-02-02 19:04:57 +00:00
class SetAlphaCmd: public WindowHelperCmd {
public:
SetAlphaCmd(int focus, bool rel, int unfocus, bool unrel);
protected:
void real_execute();
private:
int m_focus, m_unfocus;
int m_relative, m_un_relative;
};
2003-06-30 14:35:11 +00:00
#endif // CURRENTWINDOWCMD_HH