diff options
Diffstat (limited to 'src/ClockTool.hh')
-rw-r--r-- | src/ClockTool.hh | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/ClockTool.hh b/src/ClockTool.hh new file mode 100644 index 0000000..70f80cc --- /dev/null +++ b/src/ClockTool.hh | |||
@@ -0,0 +1,81 @@ | |||
1 | // ClockTool.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: ClockTool.hh,v 1.4 2003/12/04 23:02:23 fluxgen Exp $ | ||
24 | |||
25 | #ifndef CLOCKTOOL_HH | ||
26 | #define CLOCKTOOL_HH | ||
27 | |||
28 | |||
29 | #include "ToolbarItem.hh" | ||
30 | |||
31 | #include "FbTk/TextButton.hh" | ||
32 | #include "FbTk/Observer.hh" | ||
33 | #include "FbTk/Resource.hh" | ||
34 | #include "FbTk/Timer.hh" | ||
35 | |||
36 | #include <string> | ||
37 | |||
38 | class ToolTheme; | ||
39 | class BScreen; | ||
40 | |||
41 | namespace FbTk { | ||
42 | class ImageControl; | ||
43 | class Subject; | ||
44 | class Menu; | ||
45 | } | ||
46 | |||
47 | class ClockTool:public ToolbarItem, public FbTk::Observer { | ||
48 | public: | ||
49 | ClockTool(const FbTk::FbWindow &parent, ToolTheme &theme, BScreen &screen, FbTk::Menu &menu); | ||
50 | virtual ~ClockTool(); | ||
51 | |||
52 | void move(int x, int y); | ||
53 | void resize(unsigned int width, unsigned int height); | ||
54 | void moveResize(int x, int y, | ||
55 | unsigned int width, unsigned int height); | ||
56 | |||
57 | void show(); | ||
58 | void hide(); | ||
59 | void setTimeFormat(const std::string &format); | ||
60 | // accessors | ||
61 | unsigned int width() const; | ||
62 | unsigned int height() const; | ||
63 | unsigned int borderWidth() const; | ||
64 | inline const std::string &timeFormat() const { return *m_timeformat; } | ||
65 | private: | ||
66 | void updateTime(); | ||
67 | void update(FbTk::Subject *subj); | ||
68 | void renderTheme(); | ||
69 | |||
70 | FbTk::TextButton m_button; | ||
71 | |||
72 | const ToolTheme &m_theme; | ||
73 | BScreen &m_screen; | ||
74 | Pixmap m_pixmap; | ||
75 | FbTk::Timer m_timer; | ||
76 | |||
77 | FbTk::Resource<std::string> m_timeformat; | ||
78 | |||
79 | }; | ||
80 | |||
81 | #endif // CLOCKTOOL_HH | ||