renamed FbTk::XLayer to FbTk::Layer and FbTk::XLayerItem to FbTk::LayerItem

This commit is contained in:
Mathias Gumz 2011-02-23 22:49:27 +01:00
parent 813e6c4402
commit 9616a676d8
28 changed files with 239 additions and 389 deletions

View file

@ -33,7 +33,7 @@
#include "Window.hh" #include "Window.hh"
AlphaMenu::AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, AlphaMenu::AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): FbTk::ImageControl &imgctrl, FbTk::Layer &layer):
ToggleMenu(tm, imgctrl, layer) ToggleMenu(tm, imgctrl, layer)
{ {

View file

@ -35,7 +35,7 @@ namespace FbTk {
class AlphaMenu : public ToggleMenu { class AlphaMenu : public ToggleMenu {
public: public:
AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, AlphaMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer); FbTk::ImageControl &imgctrl, FbTk::Layer &layer);
// we override these to update the menu when the active window changes // we override these to update the menu when the active window changes
void move(int x, int y); void move(int x, int y);

View file

@ -34,8 +34,8 @@
#include "FbTk/App.hh" #include "FbTk/App.hh"
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/XLayer.hh" #include "FbTk/Layer.hh"
#include "FbTk/FbPixmap.hh" #include "FbTk/FbPixmap.hh"
#include <X11/Xproto.h> #include <X11/Xproto.h>
@ -1205,8 +1205,8 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
above_win == winclient) // this would be very wrong :) above_win == winclient) // this would be very wrong :)
return true; return true;
FbTk::XLayerItem &below_item = winclient->fbwindow()->layerItem(); FbTk::LayerItem &below_item = winclient->fbwindow()->layerItem();
FbTk::XLayerItem &above_item = above_win->fbwindow()->layerItem(); FbTk::LayerItem &above_item = above_win->fbwindow()->layerItem();
// this might break the transient_for layering // this might break the transient_for layering

View file

@ -29,7 +29,7 @@
FluxboxWindow *FbMenu::s_window = 0; FluxboxWindow *FbMenu::s_window = 0;
FbMenu::FbMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, FbMenu::FbMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): FbTk::ImageControl &imgctrl, FbTk::Layer &layer):
FbTk::Menu(tm, imgctrl), FbTk::Menu(tm, imgctrl),
m_layeritem(fbwindow(), layer) { m_layeritem(fbwindow(), layer) {

View file

@ -25,7 +25,7 @@
#include <memory> #include <memory>
#include "FbTk/Menu.hh" #include "FbTk/Menu.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/AutoReloadHelper.hh" #include "FbTk/AutoReloadHelper.hh"
class FluxboxWindow; class FluxboxWindow;
@ -38,7 +38,7 @@ class MenuTheme;
class FbMenu:public FbTk::Menu { class FbMenu:public FbTk::Menu {
public: public:
FbMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, FbTk::ImageControl &imgctrl, FbMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, FbTk::ImageControl &imgctrl,
FbTk::XLayer &layer); FbTk::Layer &layer);
virtual ~FbMenu() { } virtual ~FbMenu() { }
void raise() { m_layeritem.raise(); } void raise() { m_layeritem.raise(); }
void lower() { m_layeritem.lower(); } void lower() { m_layeritem.lower(); }
@ -53,7 +53,7 @@ public:
static FluxboxWindow *window() { return s_window; } static FluxboxWindow *window() { return s_window; }
private: private:
FbTk::XLayerItem m_layeritem; FbTk::LayerItem m_layeritem;
std::auto_ptr<FbTk::AutoReloadHelper> m_reloader; std::auto_ptr<FbTk::AutoReloadHelper> m_reloader;
static FluxboxWindow *s_window; static FluxboxWindow *s_window;
}; };

View file

@ -1,4 +1,4 @@
// XLayer.cc for FbTk - fluxbox toolkit // Layer.cc for FbTk - fluxbox toolkit
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) // Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
// and Simon Bowden (rathnor at users.sourceforge.net) // and Simon Bowden (rathnor at users.sourceforge.net)
// //
@ -20,8 +20,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#include "XLayer.hh" #include "Layer.hh"
#include "XLayerItem.hh" #include "LayerItem.hh"
#include "App.hh" #include "App.hh"
#include "FbWindow.hh" #include "FbWindow.hh"
#include "MultLayers.hh" #include "MultLayers.hh"
@ -39,18 +39,18 @@ using std::endl;
namespace { namespace {
int sum_windows(int nr, XLayerItem* item) { int sum_windows(int nr, LayerItem* item) {
return nr + item->numWindows(); return nr + item->numWindows();
} }
int count_windows(const FbTk::XLayer::ItemList& items) { int count_windows(const FbTk::Layer::ItemList& items) {
return std::accumulate(items.begin(), items.end(), 0, sum_windows); return std::accumulate(items.begin(), items.end(), 0, sum_windows);
} }
void extract_windows_to_stack(const XLayerItem::Windows& windows, std::vector<Window>& stack) { void extract_windows_to_stack(const LayerItem::Windows& windows, std::vector<Window>& stack) {
XLayerItem::Windows::const_iterator i = windows.begin(); LayerItem::Windows::const_iterator i = windows.begin();
XLayerItem::Windows::const_iterator end = windows.end(); LayerItem::Windows::const_iterator end = windows.end();
for (; i != end; ++i) { for (; i != end; ++i) {
Window w = (*i)->window(); Window w = (*i)->window();
if (w) if (w)
@ -58,14 +58,14 @@ void extract_windows_to_stack(const XLayerItem::Windows& windows, std::vector<Wi
} }
} }
void extract_windows_to_stack(const FbTk::XLayer::ItemList& items, XLayerItem* temp_raised, std::vector<Window>& stack) { void extract_windows_to_stack(const FbTk::Layer::ItemList& items, LayerItem* temp_raised, std::vector<Window>& stack) {
if (temp_raised) { // add windows that go on top if (temp_raised) { // add windows that go on top
extract_windows_to_stack(temp_raised->getWindows(), stack); extract_windows_to_stack(temp_raised->getWindows(), stack);
} }
FbTk::XLayer::ItemList::const_iterator it = items.begin(); FbTk::Layer::ItemList::const_iterator it = items.begin();
FbTk::XLayer::ItemList::const_iterator it_end = items.end(); FbTk::Layer::ItemList::const_iterator it_end = items.end();
for (; it != it_end; ++it) { // add all the windows from each other item for (; it != it_end; ++it) { // add all the windows from each other item
if (*it == temp_raised) { if (*it == temp_raised) {
continue; continue;
@ -74,7 +74,7 @@ void extract_windows_to_stack(const FbTk::XLayer::ItemList& items, XLayerItem* t
} }
} }
void restack(const FbTk::XLayer::ItemList& items, XLayerItem* temp_raised) { void restack(const FbTk::Layer::ItemList& items, LayerItem* temp_raised) {
std::vector<Window> stack; std::vector<Window> stack;
extract_windows_to_stack(items, temp_raised, stack); extract_windows_to_stack(items, temp_raised, stack);
@ -86,10 +86,10 @@ void restack(const FbTk::XLayer::ItemList& items, XLayerItem* temp_raised) {
} // end of anonymous namespace } // end of anonymous namespace
void XLayer::restack(const std::vector<XLayer*>& layers) { void Layer::restack(const std::vector<Layer*>& layers) {
std::vector<Window> stack; std::vector<Window> stack;
std::vector<XLayer*>::const_iterator l; std::vector<Layer*>::const_iterator l;
for (l = layers.begin(); l != layers.end(); ++l) { for (l = layers.begin(); l != layers.end(); ++l) {
extract_windows_to_stack((*l)->itemList(), 0, stack); extract_windows_to_stack((*l)->itemList(), 0, stack);
} }
@ -98,32 +98,32 @@ void XLayer::restack(const std::vector<XLayer*>& layers) {
XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size()); XRestackWindows(FbTk::App::instance()->display(), &stack[0], stack.size());
} }
XLayer::XLayer(MultLayers &manager, int layernum): Layer::Layer(MultLayers &manager, int layernum):
m_manager(manager), m_layernum(layernum), m_needs_restack(false) { m_manager(manager), m_layernum(layernum), m_needs_restack(false) {
} }
XLayer::~XLayer() { Layer::~Layer() {
} }
void XLayer::restack() { void Layer::restack() {
if (m_manager.isUpdatable()) { if (m_manager.isUpdatable()) {
::restack(itemList(), 0); ::restack(itemList(), 0);
m_needs_restack = false; m_needs_restack = false;
} }
} }
void XLayer::restackAndTempRaise(XLayerItem &item) { void Layer::restackAndTempRaise(LayerItem &item) {
::restack(itemList(), &item); ::restack(itemList(), &item);
} }
int XLayer::countWindows() { int Layer::countWindows() {
return ::count_windows(itemList()); return ::count_windows(itemList());
} }
// Stack all windows associated with 'item' below the 'above' item // Stack all windows associated with 'item' below the 'above' item
void XLayer::stackBelowItem(XLayerItem &item, XLayerItem *above) { void Layer::stackBelowItem(LayerItem &item, LayerItem *above) {
if (!m_manager.isUpdatable()) if (!m_manager.isUpdatable())
return; return;
@ -151,7 +151,7 @@ void XLayer::stackBelowItem(XLayerItem &item, XLayerItem *above) {
// We can't just use Restack here, because it won't do anything if they're // We can't just use Restack here, because it won't do anything if they're
// already in the same relative order excluding other windows // already in the same relative order excluding other windows
void XLayer::alignItem(XLayerItem &item) { void Layer::alignItem(LayerItem &item) {
if (itemList().front() == &item) { if (itemList().front() == &item) {
stackBelowItem(item, m_manager.getLowestItemAboveLayer(m_layernum)); stackBelowItem(item, m_manager.getLowestItemAboveLayer(m_layernum));
return; return;
@ -178,11 +178,11 @@ void XLayer::alignItem(XLayerItem &item) {
} }
XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) { Layer::iterator Layer::insert(LayerItem &item, unsigned int pos) {
#ifdef DEBUG #ifdef DEBUG
// at this point we don't support insertions into a layer other than at the top // at this point we don't support insertions into a layer other than at the top
if (pos != 0) if (pos != 0)
cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in XLayer"<<endl; cerr<<__FILE__<<"("<<__LINE__<<"): Insert using non-zero position not valid in Layer"<<endl;
#endif // DEBUG #endif // DEBUG
itemList().push_front(&item); itemList().push_front(&item);
@ -191,7 +191,7 @@ XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) {
return itemList().begin(); return itemList().begin();
} }
void XLayer::remove(XLayerItem &item) { void Layer::remove(LayerItem &item) {
iterator it = itemList().begin(); iterator it = itemList().begin();
iterator it_end = itemList().end(); iterator it_end = itemList().end();
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
@ -202,7 +202,7 @@ void XLayer::remove(XLayerItem &item) {
} }
} }
void XLayer::raise(XLayerItem &item) { void Layer::raise(LayerItem &item) {
// assume it is already in this layer // assume it is already in this layer
if (&item == itemList().front()) { if (&item == itemList().front()) {
@ -227,7 +227,7 @@ void XLayer::raise(XLayerItem &item) {
} }
void XLayer::tempRaise(XLayerItem &item) { void Layer::tempRaise(LayerItem &item) {
// assume it is already in this layer // assume it is already in this layer
if (!m_needs_restack && &item == itemList().front()) if (!m_needs_restack && &item == itemList().front())
@ -249,7 +249,7 @@ void XLayer::tempRaise(XLayerItem &item) {
m_needs_restack = true; m_needs_restack = true;
} }
void XLayer::lower(XLayerItem &item) { void Layer::lower(LayerItem &item) {
// assume already in this layer // assume already in this layer
// is it already the lowest? // is it already the lowest?
@ -288,20 +288,20 @@ void XLayer::lower(XLayerItem &item) {
stackBelowItem(item, *it); stackBelowItem(item, *it);
} }
void XLayer::raiseLayer(XLayerItem &item) { void Layer::raiseLayer(LayerItem &item) {
m_manager.raiseLayer(item); m_manager.raiseLayer(item);
} }
void XLayer::lowerLayer(XLayerItem &item) { void Layer::lowerLayer(LayerItem &item) {
m_manager.lowerLayer(item); m_manager.lowerLayer(item);
} }
void XLayer::moveToLayer(XLayerItem &item, int layernum) { void Layer::moveToLayer(LayerItem &item, int layernum) {
m_manager.moveToLayer(item, layernum); m_manager.moveToLayer(item, layernum);
} }
XLayerItem *XLayer::getLowestItem() { LayerItem *Layer::getLowestItem() {
if (itemList().empty()) if (itemList().empty())
return 0; return 0;
else else

View file

@ -1,7 +1,7 @@
// Layer.hh for FbTk - fluxbox toolkit // Layer.hh for FbTk - fluxbox toolkit
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) // Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
// and Simon Bowden (rathnor at users.sourceforge.net) // and Simon Bowden (rathnor at users.sourceforge.net)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
@ -20,92 +20,66 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#ifndef FBTK_LAYERTEMPLATE_HH #ifndef FBTK_XLAYER_HH
#define FBTK_LAYERTEMPLATE_HH #define FBTK_XLAYER_HH
#include <vector> #include <vector>
#include <algorithm> #include <list>
namespace FbTk { namespace FbTk {
template <typename ItemType, typename Container = std::vector<ItemType *> > class MultLayers;
class LayerBase { class LayerItem;
class Layer {
public: public:
typedef Container ListType;
typedef typename Container::iterator iterator; Layer(MultLayers &manager, int layernum);
typedef typename Container::reverse_iterator reverse_iterator; ~Layer();
virtual ~LayerBase() { }
/// insert in top by default typedef std::list<LayerItem *> ItemList;
virtual iterator insert(ItemType &item, unsigned int pos=0); typedef std::list<LayerItem *>::iterator iterator;
/// remove item from list
virtual void remove(ItemType &item); //typedef std::list<LayerItem *>::reverse_iterator reverse_iterator;
/// move item to top
virtual void raise(ItemType &item); void setLayerNum(int layernum) { m_layernum = layernum; };
/// move item to bottom int getLayerNum() { return m_layernum; };
virtual void lower(ItemType &item); // Put all items on the same layer (called when layer item added to)
/// @return number of elements in layer void alignItem(LayerItem &item);
size_t size() const { return m_list.size(); } int countWindows();
/// @return layer list void stackBelowItem(LayerItem &item, LayerItem *above);
const ListType &itemList() const { return m_list; } LayerItem *getLowestItem();
/// @return layer list const ItemList &itemList() const { return m_items; }
ListType &itemList() { return m_list; } ItemList &itemList() { return m_items; }
protected:
virtual void restack(); // we redefine these as Layer has special optimisations, and X restacking needs
iterator insert(LayerItem &item, unsigned int pos=0);
void remove(LayerItem &item);
// bring to top of layer
void raise(LayerItem &item);
void lower(LayerItem &item);
// raise it, but don't make it permanent (i.e. restack will revert)
void tempRaise(LayerItem &item);
// send to next layer up
void raiseLayer(LayerItem &item);
void lowerLayer(LayerItem &item);
void moveToLayer(LayerItem &item, int layernum);
static void restack(const std::vector<Layer*>& layers);
private: private:
ListType m_list; void restack();
void restackAndTempRaise(LayerItem &item);
MultLayers &m_manager;
int m_layernum;
bool m_needs_restack;
ItemList m_items;
}; };
template <typename ItemType, typename Container> } // namespace FbTk
typename Container::iterator LayerBase<ItemType, Container>::insert(ItemType &item, unsigned int position) {
// make sure we don't alreay have it in the list
if (std::find(itemList().begin(), itemList().end(), &item) != itemList().end())
return m_list.end();
if (position > size()) #endif // FBTK_XLAYER_HH
position = size();
iterator it = m_list.begin();
for (unsigned int i=0; i<position; ++it, ++i)
continue;
m_list.insert(it, &item);
restack();
return it++;
}
template <typename ItemType, typename Container>
void LayerBase<ItemType, Container>::remove(ItemType &item) {
iterator it = std::find(itemList().begin(), itemList().end(), &item);
if (it != itemList().end())
m_list.erase(it);
}
template <typename ItemType, typename Container>
void LayerBase<ItemType, Container>::raise(ItemType &item) {
if (&item == itemList().front()) // already at the bottom
return;
remove(item);
insert(item, 0);
restack();
}
template <typename ItemType, typename Container>
void LayerBase<ItemType, Container>::lower(ItemType &item) {
if (&item == itemList().back()) // already at the bottom
return;
remove(item);
insert(item, size());
restack();
}
template <typename ItemType, typename Container>
void LayerBase<ItemType, Container>::restack() {
}
} // end namespace FbTk
#endif // FBTK_LAYERTEMPLATE_HH

View file

@ -1,4 +1,4 @@
// XLayerItem.cc for FbTk - fluxbox toolkit // LayerItem.cc for FbTk - fluxbox toolkit
// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) // Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
// and Simon Bowden (rathnor at users.sourceforge.net) // and Simon Bowden (rathnor at users.sourceforge.net)
// //
@ -20,25 +20,25 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#include "XLayerItem.hh" #include "LayerItem.hh"
#include "XLayer.hh" #include "Layer.hh"
#include <algorithm> #include <algorithm>
using namespace FbTk; using namespace FbTk;
XLayerItem::XLayerItem(FbWindow &win, XLayer &layer) : LayerItem::LayerItem(FbWindow &win, Layer &layer) :
m_layer(&layer) { m_layer(&layer) {
m_windows.push_back(&win); m_windows.push_back(&win);
m_layer->insert(*this); m_layer->insert(*this);
} }
XLayerItem::~XLayerItem() { LayerItem::~LayerItem() {
m_layer->remove(*this); m_layer->remove(*this);
} }
void XLayerItem::setLayer(XLayer &layer) { void LayerItem::setLayer(Layer &layer) {
// make sure we don't try to set the same layer // make sure we don't try to set the same layer
if (m_layer == &layer) if (m_layer == &layer)
return; return;
@ -48,47 +48,47 @@ void XLayerItem::setLayer(XLayer &layer) {
m_layer->insert(*this); m_layer->insert(*this);
} }
void XLayerItem::raise() { void LayerItem::raise() {
m_layer->raise(*this); m_layer->raise(*this);
} }
void XLayerItem::lower() { void LayerItem::lower() {
m_layer->lower(*this); m_layer->lower(*this);
} }
void XLayerItem::tempRaise() { void LayerItem::tempRaise() {
m_layer->tempRaise(*this); m_layer->tempRaise(*this);
} }
void XLayerItem::raiseLayer() { void LayerItem::raiseLayer() {
m_layer->raiseLayer(*this); m_layer->raiseLayer(*this);
} }
void XLayerItem::lowerLayer() { void LayerItem::lowerLayer() {
m_layer->lowerLayer(*this); m_layer->lowerLayer(*this);
} }
void XLayerItem::moveToLayer(int layernum) { void LayerItem::moveToLayer(int layernum) {
m_layer->moveToLayer(*this, layernum); m_layer->moveToLayer(*this, layernum);
} }
void XLayerItem::addWindow(FbWindow &win) { void LayerItem::addWindow(FbWindow &win) {
// I'd like to think we can trust ourselves that it won't be added twice... // I'd like to think we can trust ourselves that it won't be added twice...
// Otherwise we're always scanning through the list. // Otherwise we're always scanning through the list.
m_windows.push_back(&win); m_windows.push_back(&win);
m_layer->alignItem(*this); m_layer->alignItem(*this);
} }
void XLayerItem::removeWindow(FbWindow &win) { void LayerItem::removeWindow(FbWindow &win) {
// I'd like to think we can trust ourselves that it won't be added twice... // I'd like to think we can trust ourselves that it won't be added twice...
// Otherwise we're always scanning through the list. // Otherwise we're always scanning through the list.
XLayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win); LayerItem::Windows::iterator it = std::find(m_windows.begin(), m_windows.end(), &win);
if (it != m_windows.end()) if (it != m_windows.end())
m_windows.erase(it); m_windows.erase(it);
} }
void XLayerItem::bringToTop(FbWindow &win) { void LayerItem::bringToTop(FbWindow &win) {
removeWindow(win); removeWindow(win);
addWindow(win); addWindow(win);
} }

View file

@ -1,7 +1,7 @@
// LayerItem.hh for fluxbox // LayerItem.hh for FbTk - fluxbox toolkit
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) // Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
// and Simon Bowden (rathnor at users.sourceforge.net) // and Simon Bowden (rathnor at users.sourceforge.net)
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
@ -20,20 +20,60 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#ifndef FBTK_LAYERITEM_HH #ifndef FBTK_XLAYERITEM_HH
#define FBTK_LAYERITEM_HH #define FBTK_XLAYERITEM_HH
#include "Layer.hh"
#include "NotCopyable.hh"
#include <vector>
namespace FbTk { namespace FbTk {
/// pure interface class, an item in layer class FbWindow;
class LayerItem {
public:
virtual ~LayerItem() { }
virtual void raise() = 0; class LayerItem : private NotCopyable {
virtual void lower() = 0; public:
typedef std::vector<FbWindow *> Windows;
LayerItem(FbWindow &win, Layer &layer);
~LayerItem();
void setLayer(Layer &layer);
void raise();
void lower();
void tempRaise(); // this raise gets reverted by a restack()
// send to next layer up
void raiseLayer();
void lowerLayer();
void moveToLayer(int layernum);
// this is needed for step and cycle functions
// (you need to know the next one visible, otherwise nothing may appear to happen)
// not yet implemented
bool visible() const { return true; }
const Layer &getLayer() const { return *m_layer; }
Layer &getLayer() { return *m_layer; }
int getLayerNum() { return m_layer->getLayerNum(); }
// an LayerItem holds several windows that are equivalent in a layer
// (i.e. if one is raised, then they should all be).
void addWindow(FbWindow &win);
void removeWindow(FbWindow &win);
// using this you can bring one window to the top of this item (equivalent to add then remove)
void bringToTop(FbWindow &win);
Windows &getWindows() { return m_windows; }
size_t numWindows() const { return m_windows.size(); }
private:
Layer *m_layer;
Windows m_windows;
}; };
} // end namespace FbTk }
#endif // FBTK_LAYERITEM_HH #endif // FBTK_XLAYERITEM_HH

View file

@ -40,8 +40,8 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
Button.hh Button.cc \ Button.hh Button.cc \
TextButton.hh TextButton.cc \ TextButton.hh TextButton.cc \
Container.hh Container.cc \ Container.hh Container.cc \
Layer.hh LayerItem.hh MultLayers.cc MultLayers.hh \ MultLayers.cc MultLayers.hh \
XLayer.cc XLayer.hh XLayerItem.cc XLayerItem.hh \ Layer.cc Layer.hh LayerItem.cc LayerItem.hh \
Resource.hh Resource.cc \ Resource.hh Resource.cc \
StringUtil.hh StringUtil.cc Parser.hh Parser.cc \ StringUtil.hh StringUtil.cc Parser.hh Parser.cc \
RegExp.hh RegExp.cc \ RegExp.hh RegExp.cc \

View file

@ -21,8 +21,8 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#include "MultLayers.hh" #include "MultLayers.hh"
#include "XLayer.hh" #include "Layer.hh"
#include "XLayerItem.hh" #include "LayerItem.hh"
#include "App.hh" #include "App.hh"
#include "FbWindow.hh" #include "FbWindow.hh"
@ -34,7 +34,7 @@ MultLayers::MultLayers(int numlayers) :
m_lock(0) m_lock(0)
{ {
for (int i=0; i < numlayers; ++i) for (int i=0; i < numlayers; ++i)
m_layers.push_back(new XLayer(*this, i)); m_layers.push_back(new Layer(*this, i));
} }
MultLayers::~MultLayers() { MultLayers::~MultLayers() {
@ -45,19 +45,19 @@ MultLayers::~MultLayers() {
} }
XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) { LayerItem *MultLayers::getLowestItemAboveLayer(int layernum) {
if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0) if (layernum >= static_cast<signed>(m_layers.size()) || layernum <= 0)
return 0; return 0;
layernum--; // next one up layernum--; // next one up
XLayerItem *item = 0; LayerItem *item = 0;
while (layernum >= 0 && (item = m_layers[layernum]->getLowestItem()) == 0) while (layernum >= 0 && (item = m_layers[layernum]->getLowestItem()) == 0)
layernum--; layernum--;
return item; return item;
} }
void MultLayers::addToTop(XLayerItem &item, int layernum) { void MultLayers::addToTop(LayerItem &item, int layernum) {
layernum = FbTk::Util::clamp(layernum, 0, static_cast<signed>(m_layers.size()) - 1); layernum = FbTk::Util::clamp(layernum, 0, static_cast<signed>(m_layers.size()) - 1);
m_layers[layernum]->insert(item); m_layers[layernum]->insert(item);
restack(); restack();
@ -65,7 +65,7 @@ void MultLayers::addToTop(XLayerItem &item, int layernum) {
// raise the whole layer // raise the whole layer
void MultLayers::raise(XLayer &layer) { void MultLayers::raise(Layer &layer) {
int layernum = layer.getLayerNum(); int layernum = layer.getLayerNum();
if (layernum >= static_cast<signed>(m_layers.size() - 1)) if (layernum >= static_cast<signed>(m_layers.size() - 1))
// already on top // already on top
@ -75,7 +75,7 @@ void MultLayers::raise(XLayer &layer) {
} }
// lower the whole layer // lower the whole layer
void MultLayers::lower(XLayer &layer) { void MultLayers::lower(Layer &layer) {
int layernum = layer.getLayerNum(); int layernum = layer.getLayerNum();
if (layernum == 0) if (layernum == 0)
// already on bottom // already on bottom
@ -85,22 +85,22 @@ void MultLayers::lower(XLayer &layer) {
} }
/* raise the item one level */ /* raise the item one level */
void MultLayers::raiseLayer(XLayerItem &item) { void MultLayers::raiseLayer(LayerItem &item) {
// get the layer it is in // get the layer it is in
XLayer &curr_layer = item.getLayer(); Layer &curr_layer = item.getLayer();
moveToLayer(item, curr_layer.getLayerNum()-1); moveToLayer(item, curr_layer.getLayerNum()-1);
} }
/* raise the item one level */ /* raise the item one level */
void MultLayers::lowerLayer(XLayerItem &item) { void MultLayers::lowerLayer(LayerItem &item) {
// get the layer it is in // get the layer it is in
XLayer &curr_layer = item.getLayer(); Layer &curr_layer = item.getLayer();
moveToLayer(item, curr_layer.getLayerNum()+1); moveToLayer(item, curr_layer.getLayerNum()+1);
} }
void MultLayers::moveToLayer(XLayerItem &item, int layernum) { void MultLayers::moveToLayer(LayerItem &item, int layernum) {
// get the layer it is in // get the layer it is in
XLayer &curr_layer = item.getLayer(); Layer &curr_layer = item.getLayer();
// do nothing if the item already is in the requested layer // do nothing if the item already is in the requested layer
if (curr_layer.getLayerNum() == layernum) if (curr_layer.getLayerNum() == layernum)
@ -114,7 +114,7 @@ void MultLayers::restack() {
if (!isUpdatable()) if (!isUpdatable())
return; return;
XLayer::restack(m_layers); Layer::restack(m_layers);
} }
int MultLayers::size() { int MultLayers::size() {
@ -125,13 +125,13 @@ int MultLayers::size() {
return num; return num;
} }
XLayer *MultLayers::getLayer(size_t num) { Layer *MultLayers::getLayer(size_t num) {
if (num >= m_layers.size()) if (num >= m_layers.size())
return 0; return 0;
return m_layers[num]; return m_layers[num];
} }
const XLayer *MultLayers::getLayer(size_t num) const { const Layer *MultLayers::getLayer(size_t num) const {
if (num >= m_layers.size()) if (num >= m_layers.size())
return 0; return 0;
return m_layers[num]; return m_layers[num];

View file

@ -27,34 +27,34 @@
namespace FbTk { namespace FbTk {
class XLayerItem; class LayerItem;
class XLayer; class Layer;
class MultLayers { class MultLayers {
public: public:
explicit MultLayers(int numlayers); explicit MultLayers(int numlayers);
~MultLayers(); ~MultLayers();
XLayerItem *getLowestItemAboveLayer(int layernum); LayerItem *getLowestItemAboveLayer(int layernum);
/// if there are none below, it will return null /// if there are none below, it will return null
XLayerItem *getItemBelow(XLayerItem &item); LayerItem *getItemBelow(LayerItem &item);
XLayerItem *getItemAbove(XLayerItem &item); LayerItem *getItemAbove(LayerItem &item);
void addToTop(XLayerItem &item, int layernum); void addToTop(LayerItem &item, int layernum);
void remove(XLayerItem &item); void remove(LayerItem &item);
// raise/lower the whole layer // raise/lower the whole layer
void raise(XLayer &layer); void raise(Layer &layer);
void lower(XLayer &layer); void lower(Layer &layer);
// raise/lower the item a whole layer, not just to top of current layer // raise/lower the item a whole layer, not just to top of current layer
void raiseLayer(XLayerItem &item); void raiseLayer(LayerItem &item);
void lowerLayer(XLayerItem &item); void lowerLayer(LayerItem &item);
void moveToLayer(XLayerItem &item, int layernum); void moveToLayer(LayerItem &item, int layernum);
int size(); int size();
XLayer *getLayer(size_t num); Layer *getLayer(size_t num);
const XLayer *getLayer(size_t num) const; const Layer *getLayer(size_t num) const;
bool isUpdatable() const { return m_lock == 0; } bool isUpdatable() const { return m_lock == 0; }
void lock() { ++m_lock; } void lock() { ++m_lock; }
@ -63,7 +63,7 @@ public:
private: private:
void restack(); void restack();
std::vector<XLayer *> m_layers; std::vector<Layer *> m_layers;
int m_lock; int m_lock;
}; };

View file

@ -1,85 +0,0 @@
// XLayer.hh for FbTk - fluxbox toolkit
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
// and Simon Bowden (rathnor at users.sourceforge.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef FBTK_XLAYER_HH
#define FBTK_XLAYER_HH
#include <vector>
#include <list>
namespace FbTk {
class MultLayers;
class XLayerItem;
class XLayer {
public:
XLayer(MultLayers &manager, int layernum);
~XLayer();
typedef std::list<XLayerItem *> ItemList;
typedef std::list<XLayerItem *>::iterator iterator;
//typedef std::list<XLayerItem *>::reverse_iterator reverse_iterator;
void setLayerNum(int layernum) { m_layernum = layernum; };
int getLayerNum() { return m_layernum; };
// Put all items on the same layer (called when layer item added to)
void alignItem(XLayerItem &item);
int countWindows();
void stackBelowItem(XLayerItem &item, XLayerItem *above);
XLayerItem *getLowestItem();
const ItemList &itemList() const { return m_items; }
ItemList &itemList() { return m_items; }
// we redefine these as XLayer has special optimisations, and X restacking needs
iterator insert(XLayerItem &item, unsigned int pos=0);
void remove(XLayerItem &item);
// bring to top of layer
void raise(XLayerItem &item);
void lower(XLayerItem &item);
// raise it, but don't make it permanent (i.e. restack will revert)
void tempRaise(XLayerItem &item);
// send to next layer up
void raiseLayer(XLayerItem &item);
void lowerLayer(XLayerItem &item);
void moveToLayer(XLayerItem &item, int layernum);
static void restack(const std::vector<XLayer*>& layers);
private:
void restack();
void restackAndTempRaise(XLayerItem &item);
MultLayers &m_manager;
int m_layernum;
bool m_needs_restack;
ItemList m_items;
};
} // namespace FbTk
#endif // FBTK_XLAYER_HH

View file

@ -1,79 +0,0 @@
// XLayerItem.hh for FbTk - fluxbox toolkit
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
// and Simon Bowden (rathnor at users.sourceforge.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef FBTK_XLAYERITEM_HH
#define FBTK_XLAYERITEM_HH
#include "XLayer.hh"
#include "NotCopyable.hh"
#include <vector>
namespace FbTk {
class FbWindow;
class XLayerItem : private NotCopyable {
public:
typedef std::vector<FbWindow *> Windows;
XLayerItem(FbWindow &win, XLayer &layer);
~XLayerItem();
void setLayer(XLayer &layer);
void raise();
void lower();
void tempRaise(); // this raise gets reverted by a restack()
// send to next layer up
void raiseLayer();
void lowerLayer();
void moveToLayer(int layernum);
// this is needed for step and cycle functions
// (you need to know the next one visible, otherwise nothing may appear to happen)
// not yet implemented
bool visible() const { return true; }
const XLayer &getLayer() const { return *m_layer; }
XLayer &getLayer() { return *m_layer; }
int getLayerNum() { return m_layer->getLayerNum(); }
// an XLayerItem holds several windows that are equivalent in a layer
// (i.e. if one is raised, then they should all be).
void addWindow(FbWindow &win);
void removeWindow(FbWindow &win);
// using this you can bring one window to the top of this item (equivalent to add then remove)
void bringToTop(FbWindow &win);
Windows &getWindows() { return m_windows; }
size_t numWindows() const { return m_windows.size(); }
private:
XLayer *m_layer;
Windows m_windows;
};
}
#endif // FBTK_XLAYERITEM_HH

View file

@ -27,7 +27,7 @@
#include "FbTk/RefCount.hh" #include "FbTk/RefCount.hh"
#include "FbTk/Subject.hh" #include "FbTk/Subject.hh"
#include "FbTk/Color.hh" #include "FbTk/Color.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/TextButton.hh" #include "FbTk/TextButton.hh"
#include "FbTk/DefaultValue.hh" #include "FbTk/DefaultValue.hh"
#include "FbTk/Container.hh" #include "FbTk/Container.hh"
@ -50,7 +50,7 @@ namespace FbTk {
class ImageControl; class ImageControl;
template <class T> class Command; template <class T> class Command;
class Texture; class Texture;
class XLayer; class Layer;
} }
/// holds a window frame with a client window /// holds a window frame with a client window
@ -231,8 +231,8 @@ public:
unsigned int buttonHeight() const; unsigned int buttonHeight() const;
bool externalTabMode() const { return m_tabmode == EXTERNAL && m_use_tabs; } bool externalTabMode() const { return m_tabmode == EXTERNAL && m_use_tabs; }
const FbTk::XLayerItem &layerItem() const { return m_layeritem; } const FbTk::LayerItem &layerItem() const { return m_layeritem; }
FbTk::XLayerItem &layerItem() { return m_layeritem; } FbTk::LayerItem &layerItem() { return m_layeritem; }
const FbTk::Subject &frameExtentSig() const { return m_frame_extent_sig; } const FbTk::Subject &frameExtentSig() const { return m_frame_extent_sig; }
FbTk::Subject &frameExtentSig() { return m_frame_extent_sig; } FbTk::Subject &frameExtentSig() { return m_frame_extent_sig; }
@ -310,7 +310,7 @@ private:
//@{ //@{
FbTk::FbWindow m_window; ///< base window that holds each decorations (ie titlebar, handles) FbTk::FbWindow m_window; ///< base window that holds each decorations (ie titlebar, handles)
// want this deleted before the windows in it // want this deleted before the windows in it
FbTk::XLayerItem m_layeritem; FbTk::LayerItem m_layeritem;
FbTk::FbWindow m_titlebar; ///< titlebar window FbTk::FbWindow m_titlebar; ///< titlebar window
FbTk::Container m_tab_container; ///< Holds tabs FbTk::Container m_tab_container; ///< Holds tabs

View file

@ -30,7 +30,7 @@
LayerMenu::LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, LayerMenu::LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
FbTk::ImageControl &imgctrl, FbTk::ImageControl &imgctrl,
FbTk::XLayer &layer, LayerObject *object, bool save_rc): FbTk::Layer &layer, LayerObject *object, bool save_rc):
ToggleMenu(tm, imgctrl, layer) { ToggleMenu(tm, imgctrl, layer) {
_FB_USES_NLS; _FB_USES_NLS;

View file

@ -64,7 +64,7 @@ class LayerMenu : public ToggleMenu {
public: public:
LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, LayerMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
FbTk::ImageControl &imgctrl, FbTk::ImageControl &imgctrl,
FbTk::XLayer &layer, LayerObject *item, bool save_rc); FbTk::Layer &layer, LayerObject *item, bool save_rc);
void show(); void show();
}; };

View file

@ -62,7 +62,7 @@
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
#include "FbTk/SimpleCommand.hh" #include "FbTk/SimpleCommand.hh"
#include "FbTk/MultLayers.hh" #include "FbTk/MultLayers.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/MacroCommand.hh" #include "FbTk/MacroCommand.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/StringUtil.hh"
#include "FbTk/ImageControl.hh" #include "FbTk/ImageControl.hh"
@ -1794,7 +1794,7 @@ void BScreen::hideGeometry() {
m_geom_window->hide(); m_geom_window->hide();
} }
void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { void BScreen::setLayer(FbTk::LayerItem &item, int layernum) {
m_layermanager.moveToLayer(item, layernum); m_layermanager.moveToLayer(item, layernum);
} }

View file

@ -72,7 +72,7 @@ class OSDWindow;
namespace FbTk { namespace FbTk {
class Menu; class Menu;
class ImageControl; class ImageControl;
class XLayerItem; class LayerItem;
class FbWindow; class FbWindow;
class Subject; class Subject;
} }
@ -386,7 +386,7 @@ public:
TooltipWindow& tooltipWindow() { return *m_tooltip_window; } TooltipWindow& tooltipWindow() { return *m_tooltip_window; }
void setLayer(FbTk::XLayerItem &item, int layernum); void setLayer(FbTk::LayerItem &item, int layernum);
// remove? no, items are never removed from their layer until they die // remove? no, items are never removed from their layer until they die
/// updates root window size and resizes/reconfigures screen clients /// updates root window size and resizes/reconfigures screen clients

View file

@ -46,7 +46,7 @@
#include "FbCommands.hh" #include "FbCommands.hh"
#include "Layer.hh" #include "Layer.hh"
#include "LayerMenu.hh" #include "LayerMenu.hh"
#include "FbTk/XLayer.hh" #include "FbTk/Layer.hh"
#include "RootTheme.hh" #include "RootTheme.hh"
#include "FbMenu.hh" #include "FbMenu.hh"
@ -218,7 +218,7 @@ private:
unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask | unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask |
EnterWindowMask | LeaveWindowMask | ExposureMask; EnterWindowMask | LeaveWindowMask | ExposureMask;
Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename)
: m_hidden(false), m_visible(false), : m_hidden(false), m_visible(false),
m_screen(scr), m_screen(scr),
m_clientlist_menu(scr.menuTheme(), m_clientlist_menu(scr.menuTheme(),
@ -292,7 +292,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
frame.window.setAlpha(*m_rc_alpha); frame.window.setAlpha(*m_rc_alpha);
} }
m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); m_layeritem.reset(new FbTk::LayerItem(frame.window, layer));
m_layermenu.reset(new LayerMenu(scr.menuTheme(), m_layermenu.reset(new LayerMenu(scr.menuTheme(),
scr.imageControl(), scr.imageControl(),

View file

@ -37,7 +37,7 @@
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
#include "FbTk/Timer.hh" #include "FbTk/Timer.hh"
#include "FbTk/Resource.hh" #include "FbTk/Resource.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/Signal.hh" #include "FbTk/Signal.hh"
#include <X11/Xutil.h> #include <X11/Xutil.h>
@ -69,7 +69,7 @@ public:
RIGHTBOTTOM, RIGHTCENTER, RIGHTTOP RIGHTBOTTOM, RIGHTCENTER, RIGHTTOP
}; };
Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0); Slit(BScreen &screen, FbTk::Layer &layer, const char *filename = 0);
virtual ~Slit(); virtual ~Slit();
void show() { frame.window.show(); m_visible = true; } void show() { frame.window.show(); m_visible = true; }
@ -178,7 +178,7 @@ private:
// for KDE // for KDE
Atom m_kwm1_dockwindow, m_kwm2_dockwindow; Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
std::auto_ptr<FbTk::XLayerItem> m_layeritem; std::auto_ptr<FbTk::LayerItem> m_layeritem;
std::auto_ptr<SlitTheme> m_slit_theme; std::auto_ptr<SlitTheme> m_slit_theme;
static unsigned int s_eventmask; static unsigned int s_eventmask;
Strut *m_strut; Strut *m_strut;

View file

@ -31,7 +31,7 @@
class ToggleMenu: public FbMenu { class ToggleMenu: public FbMenu {
public: public:
ToggleMenu(class FbTk::ThemeProxy<FbTk::MenuTheme> &tm, ToggleMenu(class FbTk::ThemeProxy<FbTk::MenuTheme> &tm,
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer): FbTk::ImageControl &imgctrl, FbTk::Layer &layer):
FbMenu(tm, imgctrl, layer) { } FbMenu(tm, imgctrl, layer) { }
virtual ~ToggleMenu() {} virtual ~ToggleMenu() {}

View file

@ -181,7 +181,7 @@ Toolbar::Frame::~Frame() {
evm.remove(window); evm.remove(window);
} }
Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width):
m_hidden(false), m_hidden(false),
frame(*this, scrn.screenNumber()), frame(*this, scrn.screenNumber()),
m_window_pm(0), m_window_pm(0),

View file

@ -37,8 +37,8 @@
#include "FbTk/Timer.hh" #include "FbTk/Timer.hh"
#include "FbTk/Resource.hh" #include "FbTk/Resource.hh"
#include "FbTk/XLayer.hh" #include "FbTk/Layer.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/EventHandler.hh" #include "FbTk/EventHandler.hh"
#include "FbTk/FbWindow.hh" #include "FbTk/FbWindow.hh"
#include "FbTk/Signal.hh" #include "FbTk/Signal.hh"
@ -74,7 +74,7 @@ public:
}; };
/// Create a toolbar on the screen with specific width /// Create a toolbar on the screen with specific width
Toolbar(BScreen &screen, FbTk::XLayer &layer, size_t width = 200); Toolbar(BScreen &screen, FbTk::Layer &layer, size_t width = 200);
virtual ~Toolbar(); virtual ~Toolbar();
@ -102,7 +102,7 @@ public:
void reconfigure(); void reconfigure();
void setPlacement(Placement where); void setPlacement(Placement where);
int layerNumber() const { return const_cast<FbTk::XLayerItem &>(m_layeritem).getLayerNum(); } int layerNumber() const { return const_cast<FbTk::LayerItem &>(m_layeritem).getLayerNum(); }
const FbTk::Menu &menu() const { return m_toolbarmenu; } const FbTk::Menu &menu() const { return m_toolbarmenu; }
FbTk::Menu &menu() { return m_toolbarmenu; } FbTk::Menu &menu() { return m_toolbarmenu; }
@ -164,7 +164,7 @@ private:
FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar
FbTk::XLayerItem m_layeritem; ///< layer item, must be declared before layermenu FbTk::LayerItem m_layeritem; ///< layer item, must be declared before layermenu
LayerMenu m_layermenu; LayerMenu m_layermenu;
FbMenu m_placementmenu, m_toolbarmenu; FbMenu m_placementmenu, m_toolbarmenu;
#ifdef XINERAMA #ifdef XINERAMA

View file

@ -30,7 +30,7 @@
#include "FbTk/Subject.hh" #include "FbTk/Subject.hh"
#include "FbTk/Observer.hh" #include "FbTk/Observer.hh"
#include "FbTk/EventHandler.hh" #include "FbTk/EventHandler.hh"
#include "FbTk/XLayerItem.hh" #include "FbTk/LayerItem.hh"
#include "FbTk/Signal.hh" #include "FbTk/Signal.hh"
#include "FbWinFrame.hh" #include "FbWinFrame.hh"
@ -55,7 +55,7 @@ namespace FbTk {
class TextButton; class TextButton;
class MenuTheme; class MenuTheme;
class ImageControl; class ImageControl;
class XLayer; class Layer;
} }
/// Creates the window frame and handles any window event for it /// Creates the window frame and handles any window event for it
@ -403,8 +403,8 @@ public:
bool isTyping() const; bool isTyping() const;
const FbTk::XLayerItem &layerItem() const { return m_frame.layerItem(); } const FbTk::LayerItem &layerItem() const { return m_frame.layerItem(); }
FbTk::XLayerItem &layerItem() { return m_frame.layerItem(); } FbTk::LayerItem &layerItem() { return m_frame.layerItem(); }
Window clientWindow() const; Window clientWindow() const;

View file

@ -63,7 +63,7 @@ template <typename ItemType>
class XineramaHeadMenu : public ToggleMenu { class XineramaHeadMenu : public ToggleMenu {
public: public:
XineramaHeadMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen, XineramaHeadMenu(FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen,
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, FbTk::ImageControl &imgctrl, FbTk::Layer &layer,
ItemType &item, const FbTk::FbString & title = ""); ItemType &item, const FbTk::FbString & title = "");
void reloadHeads(); void reloadHeads();
@ -76,7 +76,7 @@ private:
template <typename ItemType> template <typename ItemType>
XineramaHeadMenu<ItemType>::XineramaHeadMenu( XineramaHeadMenu<ItemType>::XineramaHeadMenu(
FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen, FbTk::ThemeProxy<FbTk::MenuTheme> &tm, BScreen &screen,
FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, ItemType &item, FbTk::ImageControl &imgctrl, FbTk::Layer &layer, ItemType &item,
const FbTk::FbString & title): const FbTk::FbString & title):
ToggleMenu(tm, imgctrl, layer), ToggleMenu(tm, imgctrl, layer),
m_object(item), m_screen(screen) m_object(item), m_screen(screen)

View file

@ -465,7 +465,7 @@ Fluxbox::Fluxbox(int argc, char **argv,
Fluxbox::~Fluxbox() { Fluxbox::~Fluxbox() {
// this needs to be destroyed before screens; otherwise, menus stored in // this needs to be destroyed before screens; otherwise, menus stored in
// key commands cause a segfault when the XLayerItem is destroyed // key commands cause a segfault when the LayerItem is destroyed
m_key.reset(0); m_key.reset(0);
leaveAll(); // leave all connections leaveAll(); // leave all connections

View file

@ -7,8 +7,8 @@
#include "Color.hh" #include "Color.hh"
#include "EventManager.hh" #include "EventManager.hh"
#include <iostream> #include <iostream>
#include "XLayer.hh" #include "Layer.hh"
#include "XLayerItem.hh" #include "LayerItem.hh"
#include "MultLayers.hh" #include "MultLayers.hh"
using namespace FbTk; using namespace FbTk;
@ -87,26 +87,26 @@ int main() {
Display *disp = app.display(); Display *disp = app.display();
XEvent event; XEvent event;
MultLayers *ml = new MultLayers(3); MultLayers *ml = new MultLayers(3);
XLayerItem *item_red = new XLayerItem(win_red.window()); LayerItem *item_red = new XLayerItem(win_red.window());
item_red->addWindow(win_redB.window()); item_red->addWindow(win_redB.window());
XLayerItem *item_green = new XLayerItem(win_green.window()); LayerItem *item_green = new LayerItem(win_green.window());
XLayerItem *item_blue = new XLayerItem(win_blue.window()); LayerItem *item_blue = new LayerItem(win_blue.window());
ml->addToTop(*item_blue, 0); ml->addToTop(*item_blue, 0);
ml->addToTop(*item_green, 0); ml->addToTop(*item_green, 0);
ml->addToTop(*item_red, 0); ml->addToTop(*item_red, 0);
XLayerItem *item_red2 = new XLayerItem(win_red2.window()); LayerItem *item_red2 = new LayerItem(win_red2.window());
XLayerItem *item_green2 = new XLayerItem(win_green2.window()); LayerItem *item_green2 = new LayerItem(win_green2.window());
XLayerItem *item_blue2 = new XLayerItem(win_blue2.window()); LayerItem *item_blue2 = new LayerItem(win_blue2.window());
ml->addToTop(*item_blue2, 1); ml->addToTop(*item_blue2, 1);
ml->addToTop(*item_green2, 1); ml->addToTop(*item_green2, 1);
ml->addToTop(*item_red2, 1); ml->addToTop(*item_red2, 1);
XLayerItem *item_red3 = new XLayerItem(win_red3.window()); LayerItem *item_red3 = new LayerItem(win_red3.window());
XLayerItem *item_green3 = new XLayerItem(win_green3.window()); LayerItem *item_green3 = new LayerItem(win_green3.window());
XLayerItem *item_blue3 = new XLayerItem(win_blue3.window()); LayerItem *item_blue3 = new LayerItem(win_blue3.window());
ml->addToTop(*item_blue3, 2); ml->addToTop(*item_blue3, 2);
ml->addToTop(*item_green3, 2); ml->addToTop(*item_green3, 2);