diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2007-12-28 05:47:55 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2007-12-28 05:47:55 (GMT) |
commit | e8a2f155e8d5a082a8c04f291e65c137c20a05cb (patch) | |
tree | 4107154a6c73d518b604aab43371c994ae172624 /src/Container.hh | |
parent | 00ceefd8846bda6f4dc43a5a990086545ea28727 (diff) | |
download | fluxbox_lack-e8a2f155e8d5a082a8c04f291e65c137c20a05cb.zip fluxbox_lack-e8a2f155e8d5a082a8c04f291e65c137c20a05cb.tar.bz2 |
moved Container to FbTk
Diffstat (limited to 'src/Container.hh')
-rw-r--r-- | src/Container.hh | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/src/Container.hh b/src/Container.hh deleted file mode 100644 index 69da43d..0000000 --- a/src/Container.hh +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | // Container.hh | ||
2 | // Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) | ||
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$ | ||
24 | |||
25 | #ifndef CONTAINER_HH | ||
26 | #define CONTAINER_HH | ||
27 | |||
28 | #include "FbTk/FbWindow.hh" | ||
29 | #include "FbTk/EventHandler.hh" | ||
30 | #include "FbTk/NotCopyable.hh" | ||
31 | #include "FbTk/Text.hh" // for Orientation | ||
32 | |||
33 | namespace FbTk { | ||
34 | class Button; | ||
35 | } | ||
36 | |||
37 | #include <list> | ||
38 | #include <functional> | ||
39 | |||
40 | class Container:public FbTk::FbWindow, public FbTk::EventHandler, private FbTk::NotCopyable { | ||
41 | public: | ||
42 | // LEFT, RIGHT => fixed total width, fixed icon size | ||
43 | // RELATIVE => fixed total width, relative/variable icon size | ||
44 | enum Alignment { LEFT, RELATIVE, RIGHT }; | ||
45 | typedef FbTk::Button * Item; | ||
46 | typedef const FbTk::Button * ConstItem; | ||
47 | typedef std::list<Item> ItemList; | ||
48 | |||
49 | explicit Container(const FbTk::FbWindow &parent); | ||
50 | virtual ~Container(); | ||
51 | |||
52 | // manipulators | ||
53 | |||
54 | void resize(unsigned int width, unsigned int height); | ||
55 | void moveResize(int x, int y, | ||
56 | unsigned int width, unsigned int height); | ||
57 | |||
58 | #ifdef NOT_USED | ||
59 | void insertItems(ItemList &list, int position=-1); | ||
60 | #endif | ||
61 | void insertItem(Item item, int pos = -1); | ||
62 | bool removeItem(int item); // return true if something was removed | ||
63 | bool removeItem(Item item); // return true if something was removed | ||
64 | void removeAll(); | ||
65 | void moveItem(Item item, int movement); // wraps around | ||
66 | bool moveItemTo(Item item, int x, int y); | ||
67 | int find(ConstItem item); | ||
68 | void setMaxSizePerClient(unsigned int size); | ||
69 | void setMaxTotalSize(unsigned int size); | ||
70 | void setAlignment(Alignment a); | ||
71 | void setOrientation(FbTk::Orientation orient); | ||
72 | |||
73 | Item back() { return m_item_list.back(); } | ||
74 | |||
75 | /// force update | ||
76 | inline void update() { repositionItems(); } | ||
77 | /// so we can add items without having an graphic update for each item | ||
78 | inline void setUpdateLock(bool value) { m_update_lock = value; } | ||
79 | |||
80 | /// event handler | ||
81 | void exposeEvent(XExposeEvent &event); | ||
82 | // for use when embedded in something that may passthrough | ||
83 | bool tryExposeEvent(XExposeEvent &event); | ||
84 | bool tryButtonPressEvent(XButtonEvent &event); | ||
85 | bool tryButtonReleaseEvent(XButtonEvent &event); | ||
86 | |||
87 | void parentMoved(); | ||
88 | void invalidateBackground(); | ||
89 | |||
90 | /// accessors | ||
91 | inline Alignment alignment() const { return m_align; } | ||
92 | inline FbTk::Orientation orientation() const { return m_orientation; } | ||
93 | inline int size() const { return m_item_list.size(); } | ||
94 | inline bool empty() const { return m_item_list.empty(); } | ||
95 | unsigned int maxWidthPerClient() const; | ||
96 | inline bool updateLock() const { return m_update_lock; } | ||
97 | |||
98 | void for_each(std::mem_fun_t<void, FbTk::FbWindow> function); | ||
99 | void setAlpha(unsigned char alpha); // set alpha on all windows | ||
100 | |||
101 | ItemList::iterator begin() { return m_item_list.begin(); } | ||
102 | ItemList::iterator end() { return m_item_list.end(); } | ||
103 | |||
104 | void clear(); // clear all windows | ||
105 | |||
106 | private: | ||
107 | void repositionItems(); | ||
108 | |||
109 | FbTk::Orientation m_orientation; | ||
110 | |||
111 | Alignment m_align; | ||
112 | unsigned int m_max_size_per_client; | ||
113 | unsigned int m_max_total_size; | ||
114 | ItemList m_item_list; | ||
115 | bool m_update_lock; | ||
116 | }; | ||
117 | |||
118 | #endif // CONTAINER_HH | ||
119 | |||