~ubuntu-branches/ubuntu/trusty/fluxbox/trusty-proposed

« back to all changes in this revision

Viewing changes to src/WindowCmd.hh

  • Committer: Bazaar Package Importer
  • Author(s): Dmitry E. Oboukhov
  • Date: 2008-07-01 10:38:14 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080701103814-khx2b6il152x9p93
Tags: 1.0.0+deb1-8
* x-dev has been removed from build-depends (out-of-date package).
* Standards-Version bumped to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef WINDOWCMD_HH
2
 
#define WINDOWCMD_HH
3
 
 
4
 
#include "FbTk/Command.hh"
5
 
#include "Window.hh"
6
 
 
7
 
/// holds context for WindowCmd
8
 
class WindowCmd_base {
9
 
public:
10
 
    static void setWindow(FluxboxWindow *win) { s_win = win; }
11
 
    static FluxboxWindow *window() { return s_win; }
12
 
protected:
13
 
    static FluxboxWindow *s_win;
14
 
};
15
 
 
16
 
 
17
 
/// executes action for a dynamic context set in WindowCmd_base
18
 
template <typename ReturnType=void>
19
 
class WindowCmd: public WindowCmd_base, public FbTk::Command {
20
 
public:
21
 
    typedef ReturnType (FluxboxWindow::* Action)();
22
 
    WindowCmd(Action a):m_action(a) {}
23
 
    void execute() { 
24
 
        if (window() != 0)
25
 
            (*window().*m_action)();
26
 
    }
27
 
private:
28
 
    Action m_action;
29
 
};
30
 
 
31
 
 
32
 
#endif // WINDOWCMD_HH