summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-11-27 21:57:17 (GMT)
committerfluxgen <fluxgen>2003-11-27 21:57:17 (GMT)
commit098dd96c44d30038149fd5085009358ff123ac3b (patch)
tree515f0612338cecda4bd6a43db8a9012035f9bc33
parent527be4f10257d8b9b9ae5b3ab4b05f6b53956414 (diff)
downloadfluxbox_lack-098dd96c44d30038149fd5085009358ff123ac3b.zip
fluxbox_lack-098dd96c44d30038149fd5085009358ff123ac3b.tar.bz2
send to menu
-rw-r--r--src/SendToMenu.cc72
-rw-r--r--src/SendToMenu.hh43
2 files changed, 115 insertions, 0 deletions
diff --git a/src/SendToMenu.cc b/src/SendToMenu.cc
new file mode 100644
index 0000000..ef9019f
--- /dev/null
+++ b/src/SendToMenu.cc
@@ -0,0 +1,72 @@
1// SendToMenu.cc for Fluxbox
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3// and Simon Bowden (rathnor at users.sourceforge.net)
4//
5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation
8// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9// and/or sell copies of the Software, and to permit persons to whom the
10// Software is furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE.
22
23// $Id: SendToMenu.cc,v 1.1 2003/11/27 21:57:17 fluxgen Exp $
24
25#include "SendToMenu.hh"
26
27#include "Window.hh"
28#include "Screen.hh"
29#include "fluxbox.hh"
30#include "Workspace.hh"
31
32#include "FbTk/Command.hh"
33
34class SendToCmd: public FbTk::Command {
35public:
36 SendToCmd(FluxboxWindow &win, int workspace):
37 m_win(win),
38 m_workspace(workspace) { }
39 void execute() {
40 m_win.screen().sendToWorkspace(m_workspace, &m_win);
41 }
42private:
43 FluxboxWindow &m_win;
44 const int m_workspace;
45};
46
47SendToMenu::SendToMenu(FluxboxWindow &win):
48 FbMenu(*win.screen().menuTheme(), win.screen().screenNumber(),
49 win.screen().imageControl(),
50 *win.screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
51 m_win(win) {
52
53 win.screen().workspaceCountSig().attach(this);
54 win.screen().workspaceNamesSig().attach(this);
55
56 disableTitle();
57 update(0);
58}
59
60void SendToMenu::update(FbTk::Subject *subj) {
61 // rebuild menu
62
63 removeAll();
64
65 const BScreen::Workspaces &wlist = m_win.screen().getWorkspacesList();
66 for (size_t i = 0; i < wlist.size(); ++i) {
67 FbTk::RefCount<FbTk::Command> sendto_cmd(new SendToCmd(m_win, i));
68 insert(wlist[i]->name().c_str(), sendto_cmd);
69 }
70
71 FbMenu::update();
72}
diff --git a/src/SendToMenu.hh b/src/SendToMenu.hh
new file mode 100644
index 0000000..09fcdda
--- /dev/null
+++ b/src/SendToMenu.hh
@@ -0,0 +1,43 @@
1// SendToMenu.hh for Fluxbox
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3// and Simon Bowden (rathnor at users.sourceforge.net)
4//
5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation
8// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9// and/or sell copies of the Software, and to permit persons to whom the
10// Software is furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE.
22
23// $Id: SendToMenu.hh,v 1.1 2003/11/27 21:57:17 fluxgen Exp $
24
25#ifndef SENDTOMENU_HH
26#define SENDTOMENU_HH
27
28#include "FbMenu.hh"
29
30#include "FbTk/Observer.hh"
31
32class FluxboxWindow;
33
34class SendToMenu:public FbMenu, private FbTk::Observer {
35public:
36 SendToMenu(FluxboxWindow &win, const char *label);
37 virtual ~SendToMenu() { }
38private:
39 void update(FbTk::Subject *subj);
40 FluxboxWindow &m_win;
41};
42
43#endif // SENDTOMENU_HH