aboutsummaryrefslogtreecommitdiff
path: root/src/IconbarTool.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/IconbarTool.hh')
-rw-r--r--src/IconbarTool.hh38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh
index 323c714..e1bebe3 100644
--- a/src/IconbarTool.hh
+++ b/src/IconbarTool.hh
@@ -28,6 +28,7 @@
28#include "ToolbarItem.hh" 28#include "ToolbarItem.hh"
29#include "Container.hh" 29#include "Container.hh"
30#include "FbMenu.hh" 30#include "FbMenu.hh"
31#include "FocusableList.hh"
31 32
32#include "FbTk/CachedPixmap.hh" 33#include "FbTk/CachedPixmap.hh"
33#include "FbTk/Observer.hh" 34#include "FbTk/Observer.hh"
@@ -36,7 +37,7 @@
36 37
37#include <X11/Xlib.h> 38#include <X11/Xlib.h>
38 39
39#include <list> 40#include <map>
40 41
41class IconbarTheme; 42class IconbarTheme;
42class BScreen; 43class BScreen;
@@ -45,17 +46,7 @@ class Focusable;
45 46
46class IconbarTool: public ToolbarItem, public FbTk::Observer { 47class IconbarTool: public ToolbarItem, public FbTk::Observer {
47public: 48public:
48 typedef std::list<IconButton *> IconList; 49 typedef std::map<Focusable *, IconButton *> IconMap;
49 /// iconbar mode
50 enum Mode {
51 NONE, ///< no icons
52 ICONS, ///< all icons from all workspaces
53 NOICONS, ///< all noniconified windows from all workspaces
54 WORKSPACEICONS, ///< icons on current workspace
55 WORKSPACENOICONS, ///< non iconified workspaces on current workspaces
56 WORKSPACE, ///< all windows and all icons on current workspace
57 ALLWINDOWS ///< all windows and all icons from all workspaces
58 };
59 50
60 IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, 51 IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
61 BScreen &screen, FbTk::Menu &menu); 52 BScreen &screen, FbTk::Menu &menu);
@@ -70,14 +61,14 @@ public:
70 void show(); 61 void show();
71 void hide(); 62 void hide();
72 void setAlignment(Container::Alignment a); 63 void setAlignment(Container::Alignment a);
73 void setMode(Mode mode); 64 void setMode(std::string mode);
74 void parentMoved() { m_icon_container.parentMoved(); } 65 void parentMoved() { m_icon_container.parentMoved(); }
75 66
76 unsigned int width() const; 67 unsigned int width() const;
77 unsigned int height() const; 68 unsigned int height() const;
78 unsigned int borderWidth() const; 69 unsigned int borderWidth() const;
79 70
80 Mode mode() const { return *m_rc_mode; } 71 std::string mode() const { return *m_rc_mode; }
81 72
82 void setOrientation(FbTk::Orientation orient); 73 void setOrientation(FbTk::Orientation orient);
83 Container::Alignment alignment() const { return m_icon_container.alignment(); } 74 Container::Alignment alignment() const { return m_icon_container.alignment(); }
@@ -85,9 +76,6 @@ public:
85 const BScreen &screen() const { return m_screen; } 76 const BScreen &screen() const { return m_screen; }
86private: 77private:
87 78
88 /// @return button associated with window
89 IconButton *findButton(Focusable &win);
90
91 void updateSizing(); 79 void updateSizing();
92 80
93 /// render single button, and probably apply changes (clear) 81 /// render single button, and probably apply changes (clear)
@@ -99,14 +87,16 @@ private:
99 void renderTheme(unsigned char alpha); 87 void renderTheme(unsigned char alpha);
100 /// destroy all icons 88 /// destroy all icons
101 void deleteIcons(); 89 void deleteIcons();
90 /// add or move a single window
91 void insertWindow(Focusable &win, int pos = -2);
102 /// remove a single window 92 /// remove a single window
103 void removeWindow(Focusable &win); 93 void removeWindow(Focusable &win);
104 /// add a single window 94 /// make a button for the window
105 void addWindow(Focusable &win); 95 IconButton *makeButton(Focusable &win);
96 /// remove all windows and add again
97 void reset();
106 /// add icons to the list 98 /// add icons to the list
107 void updateList(); 99 void updateList();
108 /// check if window is already in the list
109 bool checkDuplicate(Focusable &win);
110 100
111 BScreen &m_screen; 101 BScreen &m_screen;
112 Container m_icon_container; 102 Container m_icon_container;
@@ -114,8 +104,10 @@ private:
114 FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container 104 FbTk::CachedPixmap m_empty_pm; ///< pixmap for empty container
115 105
116 106
117 IconList m_icon_list; 107 std::auto_ptr<FocusableList> m_winlist;
118 FbTk::Resource<Mode> m_rc_mode; 108 IconMap m_icons;
109 std::string m_mode;
110 FbTk::Resource<std::string> m_rc_mode;
119 FbTk::Resource<Container::Alignment> m_rc_alignment; ///< alignment of buttons 111 FbTk::Resource<Container::Alignment> m_rc_alignment; ///< alignment of buttons
120 FbTk::Resource<int> m_rc_client_width; ///< size of client button in LEFT/RIGHT mode 112 FbTk::Resource<int> m_rc_client_width; ///< size of client button in LEFT/RIGHT mode
121 FbTk::Resource<unsigned int> m_rc_client_padding; ///< padding of the text 113 FbTk::Resource<unsigned int> m_rc_client_padding; ///< padding of the text