aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LayerItem.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-02-23 21:49:27 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-02-23 21:49:27 (GMT)
commit9616a676d869b8f67742da99d55e9327ea867166 (patch)
tree32d8daf4d851b4038e7098f88570891c0727bd7b /src/FbTk/LayerItem.cc
parent813e6c4402b7d13a9e7b1ce3e391bc4c8d894ea3 (diff)
downloadfluxbox-9616a676d869b8f67742da99d55e9327ea867166.zip
fluxbox-9616a676d869b8f67742da99d55e9327ea867166.tar.bz2
renamed FbTk::XLayer to FbTk::Layer and FbTk::XLayerItem to FbTk::LayerItem
Diffstat (limited to 'src/FbTk/LayerItem.cc')
-rw-r--r--src/FbTk/LayerItem.cc94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/FbTk/LayerItem.cc b/src/FbTk/LayerItem.cc
new file mode 100644
index 0000000..02be4f0
--- /dev/null
+++ b/src/FbTk/LayerItem.cc
@@ -0,0 +1,94 @@
1// LayerItem.cc for FbTk - fluxbox toolkit
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
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#include "LayerItem.hh"
24#include "Layer.hh"
25
26#include <algorithm>
27
28using namespace FbTk;
29
30LayerItem::LayerItem(FbWindow &win, Layer &layer) :
31 m_layer(&layer) {
32 m_windows.push_back(&win);
33 m_layer->insert(*this);
34}
35
36
37LayerItem::~LayerItem() {
38 m_layer->remove(*this);
39}
40
41void LayerItem::setLayer(Layer &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
51void LayerItem::raise() {
52 m_layer->raise(*this);
53}
54
55void LayerItem::lower() {
56 m_layer->lower(*this);
57}
58
59void LayerItem::tempRaise() {
60 m_layer->tempRaise(*this);
61}
62
63void LayerItem::raiseLayer() {
64 m_layer->raiseLayer(*this);
65}
66
67void LayerItem::lowerLayer() {
68 m_layer->lowerLayer(*this);
69}
70
71void LayerItem::moveToLayer(int layernum) {
72 m_layer->moveToLayer(*this, layernum);
73}
74
75void LayerItem::addWindow(FbWindow &win) {
76 // I'd like to think we can trust ourselves that it won't be added twice...
77 // Otherwise we're always scanning through the list.
78 m_windows.push_back(&win);
79 m_layer->alignItem(*this);
80}
81
82void LayerItem::removeWindow(FbWindow &win) {
83 // I'd like to think we can trust ourselves that it won't be added twice...
84 // Otherwise we're always scanning through the list.
85
86 LayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win);
87 if (it != m_windows.end())
88 m_windows.erase(it);
89}
90
91void LayerItem::bringToTop(FbWindow &win) {
92 removeWindow(win);
93 addWindow(win);
94}