aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MultLayers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/MultLayers.cc')
-rw-r--r--src/FbTk/MultLayers.cc39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/FbTk/MultLayers.cc b/src/FbTk/MultLayers.cc
index 439201a..baa1446 100644
--- a/src/FbTk/MultLayers.cc
+++ b/src/FbTk/MultLayers.cc
@@ -28,14 +28,13 @@
28#include "App.hh" 28#include "App.hh"
29 29
30#include <iostream> 30#include <iostream>
31using namespace std;
32 31
33using namespace FbTk; 32using namespace FbTk;
34 33
35MultLayers::MultLayers(int numlayers) : 34MultLayers::MultLayers(int numlayers) :
36 m_lock(0) 35 m_lock(0)
37{ 36{
38 for (int i=0; i < numlayers; ++i) 37 for (int i=0; i < numlayers; ++i)
39 m_layers.push_back(new XLayer(*this, i)); 38 m_layers.push_back(new XLayer(*this, i));
40} 39}
41 40
@@ -48,7 +47,7 @@ MultLayers::~MultLayers() {
48 47
49 48
50XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) { 49XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) {
51 if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0) 50 if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0)
52 return 0; 51 return 0;
53 52
54 layernum--; // next one up 53 layernum--; // next one up
@@ -57,7 +56,7 @@ XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) {
57 layernum--; 56 layernum--;
58 return item; 57 return item;
59 58
60} 59}
61 60
62XLayerItem *MultLayers::getItemBelow(XLayerItem &item) { 61XLayerItem *MultLayers::getItemBelow(XLayerItem &item) {
63 XLayer &curr_layer = item.getLayer(); 62 XLayer &curr_layer = item.getLayer();
@@ -74,24 +73,24 @@ XLayerItem *MultLayers::getItemBelow(XLayerItem &item) {
74 } 73 }
75 74
76 return ret; 75 return ret;
77} 76}
78 77
79XLayerItem *MultLayers::getItemAbove(XLayerItem &item) { 78XLayerItem *MultLayers::getItemAbove(XLayerItem &item) {
80 XLayer &curr_layer = item.getLayer(); 79 XLayer &curr_layer = item.getLayer();
81 80
82 // assume that the LayerItem does exist in a layer. 81 // assume that the LayerItem does exist in a layer.
83 XLayerItem *ret = curr_layer.getItemAbove(item); 82 XLayerItem *ret = curr_layer.getItemAbove(item);
84 83
85 if (!ret) { 84 if (!ret) {
86 ret = getLowestItemAboveLayer(curr_layer.getLayerNum()); 85 ret = getLowestItemAboveLayer(curr_layer.getLayerNum());
87 } 86 }
88 87
89 return ret; 88 return ret;
90} 89}
91 90
92void MultLayers::addToTop(XLayerItem &item, int layernum) { 91void MultLayers::addToTop(XLayerItem &item, int layernum) {
93 if (layernum < 0) 92 if (layernum < 0)
94 layernum = 0; 93 layernum = 0;
95 else if (layernum >= static_cast<signed>(m_layers.size())) 94 else if (layernum >= static_cast<signed>(m_layers.size()))
96 layernum = m_layers.size()-1; 95 layernum = m_layers.size()-1;
97 96
@@ -106,7 +105,7 @@ void MultLayers::raise(XLayer &layer) {
106 if (layernum >= static_cast<signed>(m_layers.size() - 1)) 105 if (layernum >= static_cast<signed>(m_layers.size() - 1))
107 // already on top 106 // already on top
108 return; 107 return;
109 108
110 // not yet implemented 109 // not yet implemented
111} 110}
112 111
@@ -116,7 +115,7 @@ void MultLayers::lower(XLayer &layer) {
116 if (layernum == 0) 115 if (layernum == 0)
117 // already on bottom 116 // already on bottom
118 return; 117 return;
119 118
120 // not yet implemented 119 // not yet implemented
121} 120}
122 121
@@ -143,16 +142,16 @@ void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
143 return; 142 return;
144 143
145 // clamp layer number 144 // clamp layer number
146 if (layernum < 0) 145 if (layernum < 0)
147 layernum = 0; 146 layernum = 0;
148 else if (layernum >= static_cast<signed>(m_layers.size())) 147 else if (layernum >= static_cast<signed>(m_layers.size()))
149 layernum = m_layers.size()-1; 148 layernum = m_layers.size()-1;
150 // remove item from old layer and insert it into the 149 // remove item from old layer and insert it into the
151 item.setLayer(*m_layers[layernum]); 150 item.setLayer(*m_layers[layernum]);
152} 151}
153 152
154void MultLayers::restack() { 153void MultLayers::restack() {
155 if (!isUpdatable()) 154 if (!isUpdatable())
156 return; 155 return;
157 156
158 int layernum=0, winnum=0, size = this->size(); 157 int layernum=0, winnum=0, size = this->size();
@@ -162,13 +161,13 @@ void MultLayers::restack() {
162 161
163 XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin(); 162 XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin();
164 XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end(); 163 XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end();
165 164
166 // add all windows from each layeritem in each layer 165 // add all windows from each layeritem in each layer
167 for (; it != it_end; ++it) { 166 for (; it != it_end; ++it) {
168 XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin(); 167 XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
169 XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end(); 168 XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
170 for (; wit != wit_end; ++wit) { 169 for (; wit != wit_end; ++wit) {
171 if ((*wit)->window()) 170 if ((*wit)->window())
172 winlist[winnum++] = (*wit)->window(); 171 winlist[winnum++] = (*wit)->window();
173 } 172 }
174 } 173 }