src/slot.h

Go to the documentation of this file.
00001 // Copyright (c) 2003 - 2004 Anselm R. Garbe <anselmg at t-online.de>
00002 // See ../LICENSE.txt for license details.
00003 //
00004 // $Id: slot.h 7 2007-05-24 11:03:53Z eg1981 $
00005 
00006 #ifndef __SLOT_H
00007 #define __SLOT_H
00008 
00009 #include "ncwm.h"
00010 
00011 #ifdef SLOT_SUPPORT
00012 
00013 extern "C" {
00014 #include <X11/Xlib.h>
00015 }
00016 
00017 #include <list>
00018 #include <string>
00019 #include "container.h"
00020 #include "widget.h"
00021 
00022 class Client;
00023 class Label;
00024 class Monitor;
00025 class Theme;
00026 
00027 typedef list<Client *> LClient;
00028 
00032 class Tab {
00033 
00034 public:
00035 
00036     Tab(const string name);
00037     ~Tab();
00038 
00039     string name() const;
00040     LClient *clients();
00041     void addClient(Client *client);
00042     void removeClient(Client *client);
00043 
00044     void show();
00045     void hide();
00046     bool isVisible() const;
00047 
00048     Client *focused() const;
00049     void focus(Client *client);
00050 
00051 private:
00052 
00053     Client *focused_;
00054     bool isVisible_;
00055     string name_;
00056     LClient clients_;
00057 };
00058 
00059 typedef list<Tab *> LTab;
00060 
00065 class Slot : public Widget,
00066              public Container<Monitor, LTab, LTab::iterator, Tab>
00067 {
00068 
00069 public:
00070 
00071     Slot(Monitor *monitor, Rectangle *rect, Direction align);
00072 
00073     virtual ~Slot();
00074 
00075     Direction alignment() const;
00076 
00077     void show(string tabName);
00078     virtual void hide();
00079     bool hasClients();
00080     bool isGrabFocus() const;
00081     void setGrabFocus(bool grabFocus);
00082     void focusClient(Client *client);
00083 
00084     void attachClient(Client *client);
00085     void detachClient(Client *client);
00086     void manage();
00087 
00089     void illuminate();
00090 
00091     void handleButtonPress(XButtonEvent *event);
00092     void handleMotionNotify(XMotionEvent *event);
00093 
00094     string tabName();
00095 
00096 private:
00097 
00098     void initTabs();
00099     Tab *tabForName(string name);
00100 
00101     Direction align_;
00102     Label *label_;
00103     bool isSolid_;
00104     bool isGrabFocus_;
00105     Theme *theme_;
00106 };
00107 
00108 #endif // SLOT_SUPPORT
00109 #endif // __SLOT_H

Generated on Thu May 24 15:19:32 2007 for ncwm by  doxygen 1.5.1