aboutsummaryrefslogtreecommitdiff
path: root/src/SendToMenu.cc
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 /src/SendToMenu.cc
parent527be4f10257d8b9b9ae5b3ab4b05f6b53956414 (diff)
downloadfluxbox-098dd96c44d30038149fd5085009358ff123ac3b.zip
fluxbox-098dd96c44d30038149fd5085009358ff123ac3b.tar.bz2
send to menu
Diffstat (limited to 'src/SendToMenu.cc')
-rw-r--r--src/SendToMenu.cc72
1 files changed, 72 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}