diff options
author | fluxgen <fluxgen> | 2004-05-02 20:51:36 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-05-02 20:51:36 (GMT) |
commit | 11274940f84133791c71aeb716f52bf090765c89 (patch) | |
tree | 17f70f29f9745856357c1cf72227abf17afd5c77 /src/IconMenu.cc | |
parent | 6ab2a90d72b5350b5e6b410da611fe3ad2a771a9 (diff) | |
download | fluxbox-11274940f84133791c71aeb716f52bf090765c89.zip fluxbox-11274940f84133791c71aeb716f52bf090765c89.tar.bz2 |
menu instances that handles workspace and icon menu
Diffstat (limited to 'src/IconMenu.cc')
-rw-r--r-- | src/IconMenu.cc | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/IconMenu.cc b/src/IconMenu.cc new file mode 100644 index 0000000..16d7b27 --- /dev/null +++ b/src/IconMenu.cc | |||
@@ -0,0 +1,64 @@ | |||
1 | // IconMenu.cc for Fluxbox | ||
2 | // Copyright (c) 2004 Henrik Kinnunen (fluxgen at users.sourceforge.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 | // $Id: IconMenu.cc,v 1.1 2004/05/02 20:51:36 fluxgen Exp $ | ||
23 | |||
24 | #include "IconMenu.hh" | ||
25 | |||
26 | #include "Screen.hh" | ||
27 | #include "IconMenuItem.hh" | ||
28 | #include "fluxbox.hh" | ||
29 | #include "I18n.hh" | ||
30 | |||
31 | static void updateItems(FbTk::Menu &menu, BScreen &screen) { | ||
32 | menu.removeAll(); | ||
33 | BScreen::Icons::iterator it = screen.getIconList().begin(); | ||
34 | BScreen::Icons::iterator it_end = screen.getIconList().end(); | ||
35 | for (; it != it_end; ++it) { | ||
36 | FluxboxWindow::ClientList::iterator client_it = (*it)->clientList().begin(); | ||
37 | FluxboxWindow::ClientList::iterator client_it_end = (*it)->clientList().end(); | ||
38 | for (; client_it != client_it_end; ++client_it) | ||
39 | menu.insert(new IconMenuItem(**client_it)); | ||
40 | } | ||
41 | menu.update(); | ||
42 | } | ||
43 | |||
44 | IconMenu::IconMenu(BScreen &screen): | ||
45 | FbMenu(screen.menuTheme(), | ||
46 | screen.imageControl(), | ||
47 | *screen.layerManager(). | ||
48 | getLayer(Fluxbox::instance()->getMenuLayer())) { | ||
49 | |||
50 | setLabel(I18n::instance()->getMessage(FBNLS::IconSet, | ||
51 | FBNLS::IconIcons, "Icons")); | ||
52 | screen.iconListSig().attach(this); | ||
53 | updateItems(*this, screen); | ||
54 | } | ||
55 | |||
56 | void IconMenu::update(FbTk::Subject *subj) { | ||
57 | if (subj == 0) | ||
58 | FbTk::Menu::update(subj); | ||
59 | else if (typeid(*subj) == typeid(BScreen::ScreenSubject)) { | ||
60 | BScreen &screen = static_cast<BScreen::ScreenSubject *>(subj)->screen(); | ||
61 | updateItems(*this, screen); | ||
62 | } else | ||
63 | FbTk::Menu::update(subj); | ||
64 | } | ||