summaryrefslogtreecommitdiff
path: root/src/FbTk/MultLayers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/MultLayers.cc')
-rw-r--r--src/FbTk/MultLayers.cc66
1 files changed, 50 insertions, 16 deletions
diff --git a/src/FbTk/MultLayers.cc b/src/FbTk/MultLayers.cc
index b552b5c..dab1ef8 100644
--- a/src/FbTk/MultLayers.cc
+++ b/src/FbTk/MultLayers.cc
@@ -20,7 +20,7 @@
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: MultLayers.cc,v 1.4 2003/02/03 13:46:13 fluxgen Exp $ 23// $Id: MultLayers.cc,v 1.5 2003/02/09 14:11:13 rathnor Exp $
24 24
25#include "MultLayers.hh" 25#include "MultLayers.hh"
26#include "XLayer.hh" 26#include "XLayer.hh"
@@ -97,13 +97,41 @@ void MultLayers::addToTop(XLayerItem &item, int layernum) {
97 restack(); 97 restack();
98} 98}
99 99
100
101// raise the whole layer
102void MultLayers::raise(XLayer &layer) {
103 int layernum = layer.getLayerNum();
104 if (layernum >= (m_layers.size() - 1))
105 // already on top
106 return;
107
108 // not yet implemented
109}
110
111// lower the whole layer
112void MultLayers::lower(XLayer &layer) {
113 int layernum = layer.getLayerNum();
114 if (layernum == 0)
115 // already on bottom
116 return;
117
118 // not yet implemented
119}
120
100/* raise the item one level */ 121/* raise the item one level */
101void MultLayers::raise(XLayerItem &item) { 122void MultLayers::raiseLayer(XLayerItem &item) {
102 // get the layer it is in 123 // get the layer it is in
103 XLayer &curr_layer = item.getLayer(); 124 XLayer &curr_layer = item.getLayer();
104 moveToLayer(item, curr_layer.getLayerNum()-1); 125 moveToLayer(item, curr_layer.getLayerNum()-1);
105} 126}
106 127
128/* raise the item one level */
129void MultLayers::lowerLayer(XLayerItem &item) {
130 // get the layer it is in
131 XLayer &curr_layer = item.getLayer();
132 moveToLayer(item, curr_layer.getLayerNum()+1);
133}
134
107void MultLayers::moveToLayer(XLayerItem &item, int layernum) { 135void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
108 // get the layer it is in 136 // get the layer it is in
109 XLayer &curr_layer = item.getLayer(); 137 XLayer &curr_layer = item.getLayer();
@@ -119,28 +147,34 @@ void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
119 layernum = m_layers.size()-1; 147 layernum = m_layers.size()-1;
120 // remove item from old layer and insert it into the 148 // remove item from old layer and insert it into the
121 item.setLayer(*m_layers[layernum]); 149 item.setLayer(*m_layers[layernum]);
122 curr_layer.remove(item);
123 m_layers[layernum]->insert(item);
124} 150}
125 151
126void MultLayers::restack() { 152void MultLayers::restack() {
127 size_t winlist_size=0;
128 for (size_t layer=0; layer < m_layers.size(); layer++) {
129 winlist_size += m_layers[layer]->countWindows();
130 }
131 153
132 Window *winlist = new Window[winlist_size]; 154 int layernum=0, winnum=0, size=0;
133 for (size_t layer=0, window=0; layer < m_layers.size(); layer++) { 155 for (; layernum < m_layers.size(); layernum++) {
156 size += m_layers[layernum]->countWindows();
157 }
134 158
135 XLayer::ItemList::iterator item_it = m_layers[layer]->getItemList().begin(); 159 Window *winlist = new Window[size];
136 XLayer::ItemList::iterator item_it_end = m_layers[layer]->getItemList().end(); 160 for (layernum=0; layernum < m_layers.size(); layernum++) {
137 for (; item_it != item_it_end; ++item_it, window++) 161
138 winlist[window] = (*item_it)->window(); 162 XLayer::ItemList::iterator it = m_layers[layernum]->getItemList().begin();
163 XLayer::ItemList::iterator it_end = m_layers[layernum]->getItemList().end();
164
165 // add all windows from each layeritem in each layer
166 for (; it != it_end; ++it) {
167 XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
168 XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
169 for (; wit != wit_end; ++wit, winnum++) {
170 winlist[winnum] = (*wit);
171 }
172 }
139 } 173 }
140 174
141 XRestackWindows(FbTk::App::instance()->display(), winlist, winlist_size); 175 XRestackWindows(FbTk::App::instance()->display(), winlist, size);
142 176
143 delete[] winlist; 177 delete [] winlist;
144} 178}
145 179
146int MultLayers::size() { 180int MultLayers::size() {