aboutsummaryrefslogtreecommitdiff
path: root/src/SystemTray.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/SystemTray.hh')
-rw-r--r--src/SystemTray.hh81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/SystemTray.hh b/src/SystemTray.hh
new file mode 100644
index 0000000..84d78fa
--- /dev/null
+++ b/src/SystemTray.hh
@@ -0,0 +1,81 @@
1// SystemTray.hh
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: SystemTray.hh,v 1.3 2003/10/31 10:37:09 rathnor Exp $
23
24#ifndef SYSTEMTRAY_HH
25#define SYSTEMTRAY_HH
26
27
28#include "FbTk/FbWindow.hh"
29#include "FbTk/EventHandler.hh"
30
31#include "ToolbarItem.hh"
32
33#include <X11/Xlib.h>
34
35#include <list>
36
37class AtomHandler;
38
39class SystemTray: public ToolbarItem, public FbTk::EventHandler {
40public:
41
42 explicit SystemTray(const FbTk::FbWindow &parent);
43 virtual ~SystemTray();
44
45 void move(int x, int y);
46 void resize(unsigned int width, unsigned int height);
47 void moveResize(int x, int y,
48 unsigned int width, unsigned int height);
49 void show();
50 void hide();
51
52 bool active() { return !m_clients.empty(); }
53
54 bool clientMessage(const XClientMessageEvent &event);
55 void exposeEvent(XExposeEvent &event);
56 void handleEvent(XEvent &event);
57
58 unsigned int width() const;
59 unsigned int height() const;
60 unsigned int borderWidth() const;
61
62 int numClients() const { return m_clients.size(); }
63 const FbTk::FbWindow &window() const { return m_window; }
64
65private:
66 typedef std::list<FbTk::FbWindow *> ClientList;
67 ClientList::iterator findClient(Window win);
68 void addClient(Window win);
69 void removeClient(Window win);
70 void renderTheme();
71 void rearrangeClients();
72 void removeAllClients();
73
74 FbTk::FbWindow m_window;
75
76 std::auto_ptr<AtomHandler> m_handler;
77
78 ClientList m_clients;
79};
80
81#endif // SYSTEMTRAY_HH