diff options
Diffstat (limited to 'src/FbTk/XLayerItem.cc')
-rw-r--r-- | src/FbTk/XLayerItem.cc | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc index 872216b..f959c5e 100644 --- a/src/FbTk/XLayerItem.cc +++ b/src/FbTk/XLayerItem.cc | |||
@@ -20,32 +20,31 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: XLayerItem.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $ | 23 | // $Id: XLayerItem.cc,v 1.4 2003/02/03 13:43:46 fluxgen Exp $ |
24 | 24 | ||
25 | #include "XLayerItem.hh" | 25 | #include "XLayerItem.hh" |
26 | #include "XLayer.hh" | 26 | #include "XLayer.hh" |
27 | 27 | ||
28 | using namespace FbTk; | 28 | using namespace FbTk; |
29 | 29 | ||
30 | XLayerItem::XLayerItem(Window win) : | 30 | XLayerItem::XLayerItem(Window win, XLayer &layer) : |
31 | m_layer(0), m_layeriterator(0) { | 31 | m_layer(&layer), m_layeriterator(0) { |
32 | m_windows.push_front(win); | 32 | m_window = win; |
33 | } | 33 | } |
34 | 34 | ||
35 | /* | ||
36 | XLayerItem::XLayerItem(XLayer &layer): | ||
37 | m_layer(&layer) { | ||
38 | m_layeriterator = layer.insert(*this); | ||
39 | }*/ | ||
40 | 35 | ||
41 | XLayerItem::~XLayerItem() { | 36 | XLayerItem::~XLayerItem() { |
42 | if (m_layer) | 37 | m_layer->remove(*this); |
43 | m_layer->remove(*this); | ||
44 | } | 38 | } |
45 | 39 | ||
46 | void XLayerItem::setLayer(XLayer *layer) { | 40 | void XLayerItem::setLayer(XLayer &layer) { |
47 | // make sure we don't try to set the same layer | 41 | // make sure we don't try to set the same layer |
48 | m_layer = layer; | 42 | if (m_layer == &layer) |
43 | return; | ||
44 | |||
45 | m_layer->remove(*this); | ||
46 | m_layer = &layer; | ||
47 | m_layer->insert(*this); | ||
49 | } | 48 | } |
50 | 49 | ||
51 | void XLayerItem::raise() { | 50 | void XLayerItem::raise() { |
@@ -64,21 +63,3 @@ void XLayerItem::stepDown() { | |||
64 | m_layer->stepDown(*this); | 63 | m_layer->stepDown(*this); |
65 | } | 64 | } |
66 | 65 | ||
67 | void XLayerItem::addWindow(Window win) { | ||
68 | // I'd like to think we can trust ourselves that it won't be added twice... | ||
69 | // Otherwise we're always scanning through the list. | ||
70 | m_windows.push_back(win); | ||
71 | } | ||
72 | |||
73 | void XLayerItem::removeWindow(Window win) { | ||
74 | // I'd like to think we can trust ourselves that it won't be added twice... | ||
75 | // Otherwise we're always scanning through the list. | ||
76 | |||
77 | XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), win); | ||
78 | m_windows.erase(it); | ||
79 | } | ||
80 | |||
81 | void XLayerItem::bringToTop(Window win) { | ||
82 | removeWindow(win); | ||
83 | addWindow(win); | ||
84 | } | ||