diff options
author | fluxgen <fluxgen> | 2001-12-11 20:47:02 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2001-12-11 20:47:02 (GMT) |
commit | 18830ac9add80cbd3bf7369307d7e35a519dca9b (patch) | |
tree | 4759a5434a34ba317fe77bbf8b0ed9bb57bb6018 /src/Workspacemenu.cc | |
parent | 1523b48bff07dead084af3064ad11c79a9b25df0 (diff) | |
download | fluxbox_pavel-18830ac9add80cbd3bf7369307d7e35a519dca9b.zip fluxbox_pavel-18830ac9add80cbd3bf7369307d7e35a519dca9b.tar.bz2 |
Initial revision
Diffstat (limited to 'src/Workspacemenu.cc')
-rw-r--r-- | src/Workspacemenu.cc | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/Workspacemenu.cc b/src/Workspacemenu.cc new file mode 100644 index 0000000..29033fa --- /dev/null +++ b/src/Workspacemenu.cc | |||
@@ -0,0 +1,84 @@ | |||
1 | // Workspacemenu.cc for Blackbox - an X11 Window manager | ||
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // stupid macros needed to access some functions in version 2 of the GNU C | ||
23 | // library | ||
24 | #ifndef _GNU_SOURCE | ||
25 | #define _GNU_SOURCE | ||
26 | #endif // _GNU_SOURCE | ||
27 | |||
28 | #ifdef HAVE_CONFIG_H | ||
29 | # include "../config.h" | ||
30 | #endif // HAVE_CONFIG_H | ||
31 | |||
32 | #include "i18n.hh" | ||
33 | #include "fluxbox.hh" | ||
34 | #include "Screen.hh" | ||
35 | #include "Toolbar.hh" | ||
36 | #include "Workspacemenu.hh" | ||
37 | #include "Workspace.hh" | ||
38 | |||
39 | |||
40 | Workspacemenu::Workspacemenu(BScreen *scrn) : Basemenu(scrn) { | ||
41 | screen = scrn; | ||
42 | |||
43 | setInternalMenu(); | ||
44 | I18n *i18n = I18n::instance(); | ||
45 | |||
46 | setLabel(i18n->getMessage( | ||
47 | #ifdef NLS | ||
48 | WorkspacemenuSet, WorkspacemenuWorkspacesTitle, | ||
49 | #else // !NLS | ||
50 | 0, 0, | ||
51 | #endif // NLS | ||
52 | "Workspaces")); | ||
53 | |||
54 | insert(i18n->getMessage( | ||
55 | #ifdef NLS | ||
56 | WorkspacemenuSet, WorkspacemenuNewWorkspace, | ||
57 | #else // !NLS | ||
58 | 0, 0, | ||
59 | #endif // NLS | ||
60 | "New Workspace")); | ||
61 | insert(i18n->getMessage( | ||
62 | #ifdef NLS | ||
63 | WorkspacemenuSet, WorkspacemenuRemoveLast, | ||
64 | #else // !NLS | ||
65 | 0, 0, | ||
66 | #endif // NLS | ||
67 | "Remove Last")); | ||
68 | } | ||
69 | |||
70 | |||
71 | void Workspacemenu::itemSelected(int button, int index) { | ||
72 | if (button == 1) { | ||
73 | if (index == 0) | ||
74 | screen->addWorkspace(); | ||
75 | else if (index == 1) | ||
76 | screen->removeLastWorkspace(); | ||
77 | else if ((screen->getCurrentWorkspace()->getWorkspaceID() != | ||
78 | (index - 2)) && ((index - 2) < screen->getCount())) | ||
79 | screen->changeWorkspaceID(index - 2); | ||
80 | |||
81 | if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) | ||
82 | hide(); | ||
83 | } | ||
84 | } | ||