silence warnings from gcc 4.0.2
[blackbox.git] / src / StackingList.hh
blob7735d4f4c4cea7f90046caded3c7e2e75c93847e
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // StackingList.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <shaleh@debian.org>
4 // Copyright (c) 1997 - 2000, 2002 - 2005
5 // Bradley T Hughes <bhughes at trolltech.com>
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the "Software"),
9 // to deal in the Software without restriction, including without limitation
10 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 // and/or sell copies of the Software, and to permit persons to whom the
12 // Software is furnished to do so, subject to the following conditions:
14 // The above copyright notice and this permission notice shall be included in
15 // all copies or substantial portions of the Software.
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 // DEALINGS IN THE SOFTWARE.
25 #ifndef __StackingList_hh
26 #define __StackingList_hh
28 #include <Util.hh>
30 #include <list>
31 #include <vector>
33 class BlackboxWindow;
34 class StackEntity;
36 typedef std::list<BlackboxWindow *> BlackboxWindowList;
37 typedef std::list<StackEntity *> StackEntityList;
38 typedef std::vector<Window> WindowStack;
40 class StackingList {
41 public:
42 enum Layer {
43 LayerNormal,
44 LayerFullScreen,
45 LayerAbove,
46 LayerBelow,
47 LayerDesktop
50 typedef StackEntityList::iterator iterator;
51 typedef StackEntityList::reverse_iterator reverse_iterator;
52 typedef StackEntityList::const_iterator const_iterator;
53 typedef StackEntityList::const_reverse_iterator const_reverse_iterator;
55 StackingList(void);
57 iterator insert(StackEntity *entity);
58 iterator append(StackEntity *entity);
59 iterator remove(StackEntity *entity);
61 iterator& layer(Layer which);
62 void changeLayer(StackEntity *entity, Layer new_layer);
64 iterator raise(StackEntity *entity);
65 iterator lower(StackEntity *entity);
67 bool empty(void) const { return (stack.size() == 5); }
68 StackEntityList::size_type size(void) const { return stack.size() - 5; }
69 StackEntity *front(void) const;
70 StackEntity *back(void) const;
71 iterator begin(void) { return stack.begin(); }
72 iterator end(void) { return stack.end(); }
73 reverse_iterator rbegin(void) { return stack.rbegin(); }
74 reverse_iterator rend(void) { return stack.rend(); }
75 const_iterator begin(void) const { return stack.begin(); }
76 const_iterator end(void) const { return stack.end(); }
77 const_reverse_iterator rbegin(void) const { return stack.rbegin(); }
78 const_reverse_iterator rend(void) const { return stack.rend(); }
80 void dump(void) const;
82 private:
83 StackEntityList stack;
84 iterator fullscreen, above, normal, below, desktop;
87 class StackEntity {
88 private:
89 StackingList::Layer _layer;
90 public:
91 inline StackEntity() : _layer(StackingList::LayerNormal) { }
92 inline virtual ~StackEntity() { }
93 inline void setLayer(StackingList::Layer new_layer)
94 { _layer = new_layer; }
95 inline StackingList::Layer layer(void) const
96 { return _layer; }
97 virtual Window windowID(void) const = 0;
100 #endif // __StackingList_hh