diff options
Diffstat (limited to 'src/FbTk/XLayerItem.cc')
-rw-r--r-- | src/FbTk/XLayerItem.cc | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc new file mode 100644 index 0000000..fdc7fb6 --- /dev/null +++ b/src/FbTk/XLayerItem.cc | |||
@@ -0,0 +1,100 @@ | |||
1 | // XLayerItem.cc for FbTk - fluxbox toolkit | ||
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: XLayerItem.cc,v 1.7 2003/04/15 23:09:25 rathnor Exp $ | ||
24 | |||
25 | #include "XLayerItem.hh" | ||
26 | #include "XLayer.hh" | ||
27 | |||
28 | using namespace FbTk; | ||
29 | |||
30 | XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : | ||
31 | m_layer(&layer), m_layeriterator(0) { | ||
32 | m_windows.push_front(&win); | ||
33 | m_layer->insert(*this); | ||
34 | } | ||
35 | |||
36 | |||
37 | XLayerItem::~XLayerItem() { | ||
38 | m_layer->remove(*this); | ||
39 | } | ||
40 | |||
41 | void XLayerItem::setLayer(XLayer &layer) { | ||
42 | // make sure we don't try to set the same layer | ||
43 | if (m_layer == &layer) | ||
44 | return; | ||
45 | |||
46 | m_layer->remove(*this); | ||
47 | m_layer = &layer; | ||
48 | m_layer->insert(*this); | ||
49 | } | ||
50 | |||
51 | void XLayerItem::raise() { | ||
52 | m_layer->raise(*this); | ||
53 | } | ||
54 | |||
55 | void XLayerItem::lower() { | ||
56 | m_layer->lower(*this); | ||
57 | } | ||
58 | |||
59 | void XLayerItem::tempRaise() { | ||
60 | m_layer->tempRaise(*this); | ||
61 | } | ||
62 | |||
63 | void XLayerItem::stepUp() { | ||
64 | m_layer->stepUp(*this); | ||
65 | } | ||
66 | |||
67 | void XLayerItem::stepDown() { | ||
68 | m_layer->stepDown(*this); | ||
69 | } | ||
70 | |||
71 | void XLayerItem::raiseLayer() { | ||
72 | m_layer->raiseLayer(*this); | ||
73 | } | ||
74 | |||
75 | void XLayerItem::lowerLayer() { | ||
76 | m_layer->lowerLayer(*this); | ||
77 | } | ||
78 | |||
79 | void XLayerItem::moveToLayer(int layernum) { | ||
80 | m_layer->moveToLayer(*this, layernum); | ||
81 | } | ||
82 | |||
83 | void XLayerItem::addWindow(FbWindow &win) { | ||
84 | // I'd like to think we can trust ourselves that it won't be added twice... | ||
85 | // Otherwise we're always scanning through the list. | ||
86 | m_windows.push_back(&win); | ||
87 | } | ||
88 | |||
89 | void XLayerItem::removeWindow(FbWindow &win) { | ||
90 | // I'd like to think we can trust ourselves that it won't be added twice... | ||
91 | // Otherwise we're always scanning through the list. | ||
92 | |||
93 | XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win); | ||
94 | m_windows.erase(it); | ||
95 | } | ||
96 | |||
97 | void XLayerItem::bringToTop(FbWindow &win) { | ||
98 | removeWindow(win); | ||
99 | addWindow(win); | ||
100 | } | ||