diff options
Diffstat (limited to 'src/Icon.cc')
-rw-r--r-- | src/Icon.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/Icon.cc b/src/Icon.cc new file mode 100644 index 0000000..6578bc8 --- /dev/null +++ b/src/Icon.cc | |||
@@ -0,0 +1,67 @@ | |||
1 | // Icon.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 "Icon.hh" | ||
34 | #include "Screen.hh" | ||
35 | #include "Window.hh" | ||
36 | |||
37 | |||
38 | Iconmenu::Iconmenu(BScreen *scrn) : Basemenu(scrn) { | ||
39 | setInternalMenu(); | ||
40 | |||
41 | screen = scrn; | ||
42 | setLabel(I18n::instance()->getMessage( | ||
43 | #ifdef NLS | ||
44 | IconSet, IconIcons, | ||
45 | #else // !NLS | ||
46 | 0, 0, | ||
47 | #endif // NLS | ||
48 | "Icons")); | ||
49 | update(); | ||
50 | } | ||
51 | |||
52 | |||
53 | void Iconmenu::itemSelected(int button, int index) { | ||
54 | if (button == 1) { | ||
55 | if (index >= 0 && index < screen->getIconCount()) { | ||
56 | FluxboxWindow *win = screen->getIcon(index); | ||
57 | |||
58 | if (win) { | ||
59 | win->deiconify(); | ||
60 | win->setInputFocus(); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) | ||
65 | hide(); | ||
66 | } | ||
67 | } | ||