aboutsummaryrefslogtreecommitdiff
path: root/src/Focusable.hh
diff options
context:
space:
mode:
authormarkt <markt>2007-03-21 21:48:34 (GMT)
committermarkt <markt>2007-03-21 21:48:34 (GMT)
commit51bcee666516ffdbe205b0e74ca209f82fcb1f31 (patch)
tree6f4b21b34882178962958bf64ef9c9072abced50 /src/Focusable.hh
parent54dee2bff7242b2f6d3f6814679d0024e3189e86 (diff)
downloadfluxbox-51bcee666516ffdbe205b0e74ca209f82fcb1f31.zip
fluxbox-51bcee666516ffdbe205b0e74ca209f82fcb1f31.tar.bz2
added Focusable.hh -- a base class for all focusable windows
Diffstat (limited to 'src/Focusable.hh')
-rw-r--r--src/Focusable.hh59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/Focusable.hh b/src/Focusable.hh
new file mode 100644
index 0000000..21baffa
--- /dev/null
+++ b/src/Focusable.hh
@@ -0,0 +1,59 @@
1// Focusable.hh
2// Copyright (c) 2007 Fluxbox Team (fluxgen at fluxbox dot org)
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#ifndef FOCUSABLE_HH
23#define FOCUSABLE_HH
24
25#include "FbTk/FbPixmap.hh"
26
27#include <string>
28
29class FluxboxWindow;
30
31// base class for any object that might be "focused"
32class Focusable {
33public:
34 Focusable(FluxboxWindow *fbwin = 0): m_fbwin(fbwin) { }
35 virtual ~Focusable() { }
36
37 virtual bool focus() { return false; }
38
39 // so we can make nice buttons, menu entries, etc.
40 virtual const FbTk::FbPixmap &iconPixmap() const { return m_icon_pixmap; }
41 virtual bool usePixmap() const { return iconPixmap().drawable() != None; }
42
43 virtual const FbTk::FbPixmap &iconMask() const { return m_icon_mask; }
44 virtual bool useMask() const { return iconMask().drawable() != None; }
45
46 virtual const std::string &title() const { return m_title; }
47 virtual const std::string &iconTitle() const { return m_icon_title; }
48
49 // for accessing window properties, like shaded, minimized, etc.
50 inline const FluxboxWindow *fbwindow() const { return m_fbwin; }
51 inline FluxboxWindow *fbwindow() { return m_fbwin; }
52
53protected:
54 std::string m_title, m_icon_title;
55 FbTk::FbPixmap m_icon_pixmap, m_icon_mask;
56 FluxboxWindow *m_fbwin;
57};
58
59#endif // FOCUSABLE_HH