diff options
author | fluxgen <fluxgen> | 2003-02-03 13:43:46 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-02-03 13:43:46 (GMT) |
commit | 4870c5f0913dd212837c4970e14510520d7bcd84 (patch) | |
tree | 6eba000279c98b01654d07d9dd715240b345054b /src/FbTk | |
parent | b8cc8770e8b36fdc054575cc921cdcfab56c2eaf (diff) | |
download | fluxbox_paul-4870c5f0913dd212837c4970e14510520d7bcd84.zip fluxbox_paul-4870c5f0913dd212837c4970e14510520d7bcd84.tar.bz2 |
cleaning
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/XLayerItem.cc | 43 | ||||
-rw-r--r-- | src/FbTk/XLayerItem.hh | 36 |
2 files changed, 26 insertions, 53 deletions
diff --git a/src/FbTk/XLayerItem.cc b/src/FbTk/XLayerItem.cc index 872216b..f959c5e 100644 --- a/src/FbTk/XLayerItem.cc +++ b/src/FbTk/XLayerItem.cc | |||
@@ -20,32 +20,31 @@ | |||
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: XLayerItem.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $ | 23 | // $Id: XLayerItem.cc,v 1.4 2003/02/03 13:43:46 fluxgen Exp $ |
24 | 24 | ||
25 | #include "XLayerItem.hh" | 25 | #include "XLayerItem.hh" |
26 | #include "XLayer.hh" | 26 | #include "XLayer.hh" |
27 | 27 | ||
28 | using namespace FbTk; | 28 | using namespace FbTk; |
29 | 29 | ||
30 | XLayerItem::XLayerItem(Window win) : | 30 | XLayerItem::XLayerItem(Window win, XLayer &layer) : |
31 | m_layer(0), m_layeriterator(0) { | 31 | m_layer(&layer), m_layeriterator(0) { |
32 | m_windows.push_front(win); | 32 | m_window = win; |
33 | } | 33 | } |
34 | 34 | ||
35 | /* | ||
36 | XLayerItem::XLayerItem(XLayer &layer): | ||
37 | m_layer(&layer) { | ||
38 | m_layeriterator = layer.insert(*this); | ||
39 | }*/ | ||
40 | 35 | ||
41 | XLayerItem::~XLayerItem() { | 36 | XLayerItem::~XLayerItem() { |
42 | if (m_layer) | 37 | m_layer->remove(*this); |
43 | m_layer->remove(*this); | ||
44 | } | 38 | } |
45 | 39 | ||
46 | void XLayerItem::setLayer(XLayer *layer) { | 40 | void XLayerItem::setLayer(XLayer &layer) { |
47 | // make sure we don't try to set the same layer | 41 | // make sure we don't try to set the same layer |
48 | m_layer = layer; | 42 | if (m_layer == &layer) |
43 | return; | ||
44 | |||
45 | m_layer->remove(*this); | ||
46 | m_layer = &layer; | ||
47 | m_layer->insert(*this); | ||
49 | } | 48 | } |
50 | 49 | ||
51 | void XLayerItem::raise() { | 50 | void XLayerItem::raise() { |
@@ -64,21 +63,3 @@ void XLayerItem::stepDown() { | |||
64 | m_layer->stepDown(*this); | 63 | m_layer->stepDown(*this); |
65 | } | 64 | } |
66 | 65 | ||
67 | void XLayerItem::addWindow(Window win) { | ||
68 | // I'd like to think we can trust ourselves that it won't be added twice... | ||
69 | // Otherwise we're always scanning through the list. | ||
70 | m_windows.push_back(win); | ||
71 | } | ||
72 | |||
73 | void XLayerItem::removeWindow(Window win) { | ||
74 | // I'd like to think we can trust ourselves that it won't be added twice... | ||
75 | // Otherwise we're always scanning through the list. | ||
76 | |||
77 | XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), win); | ||
78 | m_windows.erase(it); | ||
79 | } | ||
80 | |||
81 | void XLayerItem::bringToTop(Window win) { | ||
82 | removeWindow(win); | ||
83 | addWindow(win); | ||
84 | } | ||
diff --git a/src/FbTk/XLayerItem.hh b/src/FbTk/XLayerItem.hh index 14d13e5..4706e2b 100644 --- a/src/FbTk/XLayerItem.hh +++ b/src/FbTk/XLayerItem.hh | |||
@@ -20,52 +20,44 @@ | |||
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: XLayerItem.hh,v 1.3 2003/02/02 16:32:41 rathnor Exp $ | 23 | // $Id: XLayerItem.hh,v 1.4 2003/02/03 13:42:47 fluxgen Exp $ |
24 | 24 | ||
25 | #ifndef FBTK_XLAYERITEM_HH | 25 | #ifndef FBTK_XLAYERITEM_HH |
26 | #define FBTK_XLAYERITEM_HH | 26 | #define FBTK_XLAYERITEM_HH |
27 | 27 | ||
28 | #include "LayerItem.hh" | 28 | #include "LayerItem.hh" |
29 | #include "XLayer.hh" | 29 | #include "XLayer.hh" |
30 | #include "NotCopyable.hh" | ||
31 | |||
30 | #include <X11/Xlib.h> | 32 | #include <X11/Xlib.h> |
31 | 33 | ||
32 | 34 | ||
33 | namespace FbTk { | 35 | namespace FbTk { |
34 | 36 | ||
35 | class XLayerItem : public LayerItem { | 37 | class XLayerItem : public LayerItem, private NotCopyable { |
36 | public: | 38 | public: |
37 | typedef std::list<Window> Windows; | 39 | typedef std::list<Window> Windows; |
38 | 40 | ||
39 | XLayerItem(Window win); | 41 | XLayerItem(Window win, XLayer &layer); |
40 | ~XLayerItem(); | 42 | ~XLayerItem(); |
41 | void setLayer(XLayer *layer); | 43 | |
42 | XLayer *getLayer() const { return m_layer; } | 44 | void setLayer(XLayer &layer); |
45 | |||
43 | void raise(); | 46 | void raise(); |
44 | void lower(); | 47 | void lower(); |
45 | void stepUp(); | 48 | void stepUp(); |
46 | void stepDown(); | 49 | void stepDown(); |
47 | XLayer::iterator getLayerIterator() const { return m_layeriterator; }; | 50 | //!! we don't need this? |
48 | void setLayerIterator(XLayer::iterator it) { m_layeriterator = it; }; | 51 | bool visible() const { return true; } |
49 | bool isEmpty() const { return m_windows.empty(); } | ||
50 | |||
51 | // not currently implemented | ||
52 | bool visible() { return true; } | ||
53 | |||
54 | // an XLayerItem holds several windows that are equivalent in a layer | ||
55 | // (i.e. if one is raised, then they should all be). | ||
56 | void addWindow(Window win); | ||
57 | void removeWindow(Window win); | ||
58 | |||
59 | // using this you can bring one window to the top (equivalent to add then remove) | ||
60 | void bringToTop(Window win); | ||
61 | 52 | ||
62 | Windows &getWindows() { return m_windows; } | 53 | const XLayer &getLayer() const { return *m_layer; } |
63 | size_t numWindows() const { return m_windows.size(); } | 54 | XLayer &getLayer() { return *m_layer; } |
55 | Window window() const { return m_window; } | ||
64 | 56 | ||
65 | private: | 57 | private: |
66 | XLayer *m_layer; | 58 | XLayer *m_layer; |
67 | XLayer::iterator m_layeriterator; | 59 | XLayer::iterator m_layeriterator; |
68 | Windows m_windows; | 60 | Window m_window; |
69 | }; | 61 | }; |
70 | 62 | ||
71 | }; | 63 | }; |