aboutsummaryrefslogtreecommitdiff
path: root/src/Focusable.hh
diff options
context:
space:
mode:
authormarkt <markt>2007-03-24 16:31:13 (GMT)
committermarkt <markt>2007-03-24 16:31:13 (GMT)
commit1829dd5780c9cd818884cb84ae1ea51a4d4d35ca (patch)
treeaffbf9ced07d3c52c04dd49a81e14be117326360 /src/Focusable.hh
parent5c811e63012f160b5e60a38deca10d01b5d23e69 (diff)
downloadfluxbox-1829dd5780c9cd818884cb84ae1ea51a4d4d35ca.zip
fluxbox-1829dd5780c9cd818884cb84ae1ea51a4d4d35ca.tar.bz2
colossal multi-patch, encompassing all of what I did yesterday without internet access
Diffstat (limited to 'src/Focusable.hh')
-rw-r--r--src/Focusable.hh42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/Focusable.hh b/src/Focusable.hh
index 21baffa..e2c7e50 100644
--- a/src/Focusable.hh
+++ b/src/Focusable.hh
@@ -23,19 +23,34 @@
23#define FOCUSABLE_HH 23#define FOCUSABLE_HH
24 24
25#include "FbTk/FbPixmap.hh" 25#include "FbTk/FbPixmap.hh"
26#include "FbTk/ITypeAheadable.hh"
27#include "FbTk/Subject.hh"
26 28
27#include <string> 29#include <string>
28 30
31class BScreen;
29class FluxboxWindow; 32class FluxboxWindow;
30 33
31// base class for any object that might be "focused" 34// base class for any object that might be "focused"
32class Focusable { 35class Focusable: public FbTk::ITypeAheadable {
33public: 36public:
34 Focusable(FluxboxWindow *fbwin = 0): m_fbwin(fbwin) { } 37 Focusable(BScreen &scr, FluxboxWindow *fbwin = 0):
38 m_screen(scr), m_fbwin(fbwin),
39 m_focused(false), m_titlesig(*this) { }
35 virtual ~Focusable() { } 40 virtual ~Focusable() { }
36 41
37 virtual bool focus() { return false; } 42 virtual bool focus() { return false; }
38 43
44 virtual bool isFocused() const { return m_focused; }
45 virtual bool acceptsFocus() const { return true; }
46
47 inline BScreen &screen() { return m_screen; }
48 inline const BScreen &screen() const { return m_screen; }
49
50 // for accessing window properties, like shaded, minimized, etc.
51 inline const FluxboxWindow *fbwindow() const { return m_fbwin; }
52 inline FluxboxWindow *fbwindow() { return m_fbwin; }
53
39 // so we can make nice buttons, menu entries, etc. 54 // so we can make nice buttons, menu entries, etc.
40 virtual const FbTk::FbPixmap &iconPixmap() const { return m_icon_pixmap; } 55 virtual const FbTk::FbPixmap &iconPixmap() const { return m_icon_pixmap; }
41 virtual bool usePixmap() const { return iconPixmap().drawable() != None; } 56 virtual bool usePixmap() const { return iconPixmap().drawable() != None; }
@@ -45,15 +60,30 @@ public:
45 60
46 virtual const std::string &title() const { return m_title; } 61 virtual const std::string &title() const { return m_title; }
47 virtual const std::string &iconTitle() const { return m_icon_title; } 62 virtual const std::string &iconTitle() const { return m_icon_title; }
63 const std::string &iTypeString() const { return title(); }
48 64
49 // for accessing window properties, like shaded, minimized, etc. 65 class FocusSubject: public FbTk::Subject {
50 inline const FluxboxWindow *fbwindow() const { return m_fbwin; } 66 public:
51 inline FluxboxWindow *fbwindow() { return m_fbwin; } 67 FocusSubject(Focusable &w):m_win(w) { }
68 Focusable &win() { return m_win; }
69 const Focusable &win() const { return m_win; }
70 private:
71 Focusable &m_win;
72 };
73
74 // used for both title and icon changes
75 FbTk::Subject &titleSig() { return m_titlesig; }
76 const FbTk::Subject &titleSig() const { return m_titlesig; }
52 77
53protected: 78protected:
79 BScreen &m_screen;
80 FluxboxWindow *m_fbwin;
81
82 bool m_focused;
54 std::string m_title, m_icon_title; 83 std::string m_title, m_icon_title;
55 FbTk::FbPixmap m_icon_pixmap, m_icon_mask; 84 FbTk::FbPixmap m_icon_pixmap, m_icon_mask;
56 FluxboxWindow *m_fbwin; 85
86 FocusSubject m_titlesig;
57}; 87};
58 88
59#endif // FOCUSABLE_HH 89#endif // FOCUSABLE_HH