GG
ZList.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /* GG is a GUI for SDL and OpenGL.
3  Copyright (C) 2003-2008 T. Zachary Laine
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public License
7  as published by the Free Software Foundation; either version 2.1
8  of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free
17  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18  02111-1307 USA
19 
20  If you do not wish to comply with the terms of the LGPL please
21  contact the author as other terms are available for a fee.
22 
23  Zach Laine
24  whatwasthataddress@gmail.com */
25 
29 #ifndef _GG_ZList_h_
30 #define _GG_ZList_h_
31 
32 #include <GG/Base.h>
33 
34 #include <list>
35 #include <set>
36 
37 
38 namespace GG {
39  class Wnd;
40 
50 class GG_API ZList : public std::list<Wnd*>
51 {
52 public:
54 
56  Wnd* Pick(const Pt& pt, Wnd* modal, const std::set<Wnd*>* ignore = 0) const;
58 
60 
64  void Add(Wnd* wnd);
65 
66  bool Remove(Wnd* wnd);
67 
70  bool MoveUp(Wnd* wnd);
71 
74  bool MoveDown(Wnd* wnd);
76 
77 private:
78  Wnd* PickWithinWindow(const Pt& pt, Wnd* wnd, const std::set<Wnd*>* ignore) const;
79  bool NeedsRealignment() const;
80  void Realign();
81  iterator FirstNonOnTop();
82 
83  std::set<Wnd*> m_contents;
84 };
85 
86 } // namespace GG
87 
88 #endif