aboutsummaryrefslogtreecommitdiff
path: root/src/IconbarTool.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/IconbarTool.hh')
-rw-r--r--src/IconbarTool.hh124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh
new file mode 100644
index 0000000..bfcac34
--- /dev/null
+++ b/src/IconbarTool.hh
@@ -0,0 +1,124 @@
1// IconbarTool.hh
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
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: IconbarTool.hh,v 1.13 2003/12/23 01:55:07 rathnor Exp $
24
25#ifndef ICONBARTOOL_HH
26#define ICONBARTOOL_HH
27
28#include "ToolbarItem.hh"
29#include "Container.hh"
30#include "FbMenu.hh"
31
32#include "FbTk/Observer.hh"
33#include "FbTk/Resource.hh"
34#include "FbTk/Menu.hh"
35
36#include <X11/Xlib.h>
37
38#include <list>
39
40class IconbarTheme;
41class BScreen;
42class IconButton;
43class FluxboxWindow;
44
45class IconbarTool: public ToolbarItem, public FbTk::Observer {
46public:
47 typedef std::list<IconButton *> IconList;
48 /// iconbar mode
49 enum Mode {
50 NONE, ///< no icons
51 ICONS, ///< all icons from all workspaces
52 WORKSPACEICONS, ///< icons on current workspace
53 WORKSPACE, ///< all windows and all icons on current workspace
54 ALLWINDOWS ///< all windows and all icons from all workspaces
55 };
56
57 IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
58 BScreen &screen, FbTk::Menu &menu);
59 ~IconbarTool();
60
61 void move(int x, int y);
62 void resize(unsigned int width, unsigned int height);
63 void moveResize(int x, int y,
64 unsigned int width, unsigned int height);
65
66 void update(FbTk::Subject *subj);
67 void show();
68 void hide();
69 void setAlignment(Container::Alignment a);
70 void setMode(Mode mode);
71
72 unsigned int width() const;
73 unsigned int height() const;
74 unsigned int borderWidth() const;
75
76 Mode mode() const { return *m_rc_mode; }
77 Container::Alignment alignment() const { return m_icon_container.alignment(); }
78private:
79 /// @return button associated with window
80 IconButton *findButton(FluxboxWindow &win);
81
82 /// render single button that holds win
83 void renderWindow(FluxboxWindow &win);
84 /// render single button
85 void renderButton(IconButton &button);
86 /// render all buttons
87 void renderTheme();
88 /// destroy all icons
89 void deleteIcons();
90 /// remove a single window
91 void removeWindow(FluxboxWindow &win);
92 /// add a single window
93 void addWindow(FluxboxWindow &win);
94 /// add icons to the list
95 void updateIcons();
96 /// add normal windows to the list
97 void updateWorkspace();
98 /// add all windows to the list
99 void updateAllWindows();
100 /// add a list of windows
101 void addList(std::list<FluxboxWindow *> &winlist);
102 /// so we can update current window without flicker
103 void timedRender();
104
105 BScreen &m_screen;
106 Container m_icon_container;
107 const IconbarTheme &m_theme;
108 // cached pixmaps
109 Pixmap m_focused_pm, m_unfocused_pm;
110 // some are a fraction bigger due to rounding
111 Pixmap m_focused_err_pm, m_unfocused_err_pm;
112 Pixmap m_empty_pm; ///< pixmap for empty container
113
114
115 IconList m_icon_list;
116 FbTk::Resource<Mode> m_rc_mode;
117 FbTk::Resource<Container::Alignment> m_rc_alignment; ///< alignment of buttons
118 FbTk::Resource<int> m_rc_client_width; ///< size of client button in LEFT/RIGHT mode
119 FbTk::Resource<bool> m_rc_use_pixmap; ///< if iconbar should use win pixmap or not
120 FbTk::Timer m_focus_timer; ///< so we can update current window without flicker while changing attached clients
121 FbMenu m_menu;
122};
123
124#endif // ICONBARTOOL_HH