aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MultLayers.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/MultLayers.hh')
-rw-r--r--src/FbTk/MultLayers.hh74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/FbTk/MultLayers.hh b/src/FbTk/MultLayers.hh
new file mode 100644
index 0000000..29c80a8
--- /dev/null
+++ b/src/FbTk/MultLayers.hh
@@ -0,0 +1,74 @@
1// MultLayers.hh 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: MultLayers.hh,v 1.6 2003/07/20 18:05:40 rathnor Exp $
24
25#ifndef FBTK_MULTLAYERS_HH
26#define FBTK_MULTLAYERS_HH
27
28#include <vector>
29
30namespace FbTk {
31
32class XLayerItem;
33class XLayer;
34
35class MultLayers {
36public:
37 MultLayers(int numlayers);
38 ~MultLayers();
39 XLayerItem *getLowestItemAboveLayer(int layernum);
40
41 /// if there are none below, it will return null
42 XLayerItem *getItemBelow(XLayerItem &item);
43 XLayerItem *getItemAbove(XLayerItem &item);
44 void addToTop(XLayerItem &item, int layernum);
45 void remove(XLayerItem &item);
46
47 // raise/lower the whole layer
48 void raise(XLayer &layer);
49 void lower(XLayer &layer);
50
51 // raise/lower the item a whole layer, not just to top of current layer
52 void raiseLayer(XLayerItem &item);
53 void lowerLayer(XLayerItem &item);
54
55 void moveToLayer(XLayerItem &item, int layernum);
56 int size();
57 void restack();
58
59 XLayer *getLayer(size_t num);
60 const XLayer *getLayer(size_t num) const;
61
62 inline bool isUpdatable() const { return m_lock == 0; }
63 inline void lock() { ++m_lock; }
64 inline void unlock() { if (--m_lock == 0) restack(); }
65
66private:
67 std::vector<XLayer *> m_layers;
68
69 int m_lock;
70
71};
72
73};
74#endif // FBTK_MULTLAYERS_HH