diff options
author | fluxgen <fluxgen> | 2007-03-31 10:16:21 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2007-03-31 10:16:21 (GMT) |
commit | 8f8d8bd0f1ab31eb68d6baf42254b01b1d240510 (patch) | |
tree | aa5cc9bb653e0dd9280a0d9e9eff825510421dad | |
parent | a8f28826097d19d41fb10386a8d8d2d09d95e034 (diff) | |
download | fluxbox-8f8d8bd0f1ab31eb68d6baf42254b01b1d240510.zip fluxbox-8f8d8bd0f1ab31eb68d6baf42254b01b1d240510.tar.bz2 |
added documentation
-rw-r--r-- | src/Focusable.hh | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/src/Focusable.hh b/src/Focusable.hh index 852e1c8..cf14de0 100644 --- a/src/Focusable.hh +++ b/src/Focusable.hh | |||
@@ -33,7 +33,10 @@ | |||
33 | class BScreen; | 33 | class BScreen; |
34 | class FluxboxWindow; | 34 | class FluxboxWindow; |
35 | 35 | ||
36 | // base class for any object that might be "focused" | 36 | /** |
37 | * A Base class for any object that might be "focused". | ||
38 | * Such as FluxboxWindow, Menu etc | ||
39 | */ | ||
37 | class Focusable: public FbTk::ITypeAheadable { | 40 | class Focusable: public FbTk::ITypeAheadable { |
38 | public: | 41 | public: |
39 | Focusable(BScreen &scr, FluxboxWindow *fbwin = 0): | 42 | Focusable(BScreen &scr, FluxboxWindow *fbwin = 0): |
@@ -41,51 +44,80 @@ public: | |||
41 | m_instance_name("fluxbox"), m_class_name("fluxbox"), | 44 | m_instance_name("fluxbox"), m_class_name("fluxbox"), |
42 | m_focused(false), m_titlesig(*this) { } | 45 | m_focused(false), m_titlesig(*this) { } |
43 | virtual ~Focusable() { } | 46 | virtual ~Focusable() { } |
44 | 47 | /** | |
48 | * Take focus. | ||
49 | * @return true if the focuable took focus | ||
50 | */ | ||
45 | virtual bool focus() { return false; } | 51 | virtual bool focus() { return false; } |
46 | 52 | ||
53 | /// @return true if the focusable has input focus | ||
47 | virtual bool isFocused() const { return m_focused; } | 54 | virtual bool isFocused() const { return m_focused; } |
55 | /// @return return true if it can be focused | ||
48 | virtual bool acceptsFocus() const { return true; } | 56 | virtual bool acceptsFocus() const { return true; } |
49 | 57 | /// @return the screen in which this object resides | |
50 | inline BScreen &screen() { return m_screen; } | 58 | inline BScreen &screen() { return m_screen; } |
59 | /// @return the screen in which this object resides | ||
51 | inline const BScreen &screen() const { return m_screen; } | 60 | inline const BScreen &screen() const { return m_screen; } |
52 | 61 | ||
53 | // for accessing window properties, like shaded, minimized, etc. | 62 | /** |
63 | * For accessing window properties, like shaded, minimized, etc. | ||
64 | * @return window context | ||
65 | */ | ||
54 | inline const FluxboxWindow *fbwindow() const { return m_fbwin; } | 66 | inline const FluxboxWindow *fbwindow() const { return m_fbwin; } |
67 | /** | ||
68 | * For accessing window properties, like shaded, minimized, etc. | ||
69 | * @return window context | ||
70 | */ | ||
55 | inline FluxboxWindow *fbwindow() { return m_fbwin; } | 71 | inline FluxboxWindow *fbwindow() { return m_fbwin; } |
56 | 72 | ||
57 | // for pattern matching | 73 | /// @return WM_CLASS class string (for pattern matching) |
58 | virtual const std::string &getWMClassClass() const { return m_class_name; } | 74 | virtual const std::string &getWMClassClass() const { return m_class_name; } |
75 | /// @return WM_CLASS name string (for pattern matching) | ||
59 | virtual const std::string &getWMClassName() const { return m_instance_name; } | 76 | virtual const std::string &getWMClassName() const { return m_instance_name; } |
77 | /// @return wm role string ( for pattern matching) | ||
60 | virtual std::string getWMRole() const { return "Focusable"; } | 78 | virtual std::string getWMRole() const { return "Focusable"; } |
61 | 79 | ||
62 | // so we can make nice buttons, menu entries, etc. | 80 | // so we can make nice buttons, menu entries, etc. |
81 | /// @return icon pixmap of the focusable | ||
63 | virtual const FbTk::PixmapWithMask &icon() const { return m_icon; } | 82 | virtual const FbTk::PixmapWithMask &icon() const { return m_icon; } |
83 | /// @return title string | ||
64 | virtual const std::string &title() const { return m_title; } | 84 | virtual const std::string &title() const { return m_title; } |
85 | /// @return type ahead string | ||
65 | const std::string &iTypeString() const { return title(); } | 86 | const std::string &iTypeString() const { return title(); } |
66 | 87 | /** | |
88 | * Signaling object to attatch observers to. | ||
89 | */ | ||
67 | class FocusSubject: public FbTk::Subject { | 90 | class FocusSubject: public FbTk::Subject { |
68 | public: | 91 | public: |
69 | FocusSubject(Focusable &w):m_win(w) { } | 92 | explicit FocusSubject(Focusable &w):m_win(w) { } |
93 | /// @return context focusable for this signal | ||
70 | Focusable &win() { return m_win; } | 94 | Focusable &win() { return m_win; } |
95 | /// @return context focusable for this signal | ||
71 | const Focusable &win() const { return m_win; } | 96 | const Focusable &win() const { return m_win; } |
72 | private: | 97 | private: |
73 | Focusable &m_win; | 98 | Focusable &m_win; //< the context |
74 | }; | 99 | }; |
75 | 100 | ||
76 | // used for both title and icon changes | 101 | /** |
102 | * Used for both title and icon changes. | ||
103 | * @return title signal subject | ||
104 | */ | ||
77 | FbTk::Subject &titleSig() { return m_titlesig; } | 105 | FbTk::Subject &titleSig() { return m_titlesig; } |
106 | /** | ||
107 | * Used for both title and icon changes. | ||
108 | * @return title signal subject | ||
109 | */ | ||
78 | const FbTk::Subject &titleSig() const { return m_titlesig; } | 110 | const FbTk::Subject &titleSig() const { return m_titlesig; } |
79 | 111 | ||
80 | protected: | 112 | protected: |
81 | BScreen &m_screen; | 113 | BScreen &m_screen; //< the screen in which it works |
82 | FluxboxWindow *m_fbwin; | 114 | FluxboxWindow *m_fbwin; //< the working fluxbox window |
83 | 115 | ||
84 | std::string m_title, m_instance_name, m_class_name; | 116 | std::string m_title, m_instance_name, m_class_name; |
85 | bool m_focused; | 117 | bool m_focused; //< whether or not it has focus |
86 | FbTk::PixmapWithMask m_icon; | 118 | FbTk::PixmapWithMask m_icon; //< icon pixmap with mask |
87 | 119 | ||
88 | FocusSubject m_titlesig; | 120 | FocusSubject m_titlesig; //< for signaling title and icon changes |
89 | }; | 121 | }; |
90 | 122 | ||
91 | #endif // FOCUSABLE_HH | 123 | #endif // FOCUSABLE_HH |