diff options
Diffstat (limited to 'src/ClockTool.hh')
-rw-r--r-- | src/ClockTool.hh | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/ClockTool.hh b/src/ClockTool.hh new file mode 100644 index 0000000..ceaebae --- /dev/null +++ b/src/ClockTool.hh | |||
@@ -0,0 +1,77 @@ | |||
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.1 2003/08/11 14:32:39 fluxgen Exp $ | ||
24 | |||
25 | #ifndef CLOCKTOOL_HH | ||
26 | #define CLOCKTOOL_HH | ||
27 | |||
28 | |||
29 | #include "ToolbarItem.hh" | ||
30 | #include "TextButton.hh" | ||
31 | |||
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 | } | ||
45 | |||
46 | class ClockTool:public ToolbarItem, public FbTk::Observer { | ||
47 | public: | ||
48 | ClockTool(const FbTk::FbWindow &parent, ToolTheme &theme, BScreen &screen); | ||
49 | virtual ~ClockTool(); | ||
50 | |||
51 | void move(int x, int y); | ||
52 | void resize(unsigned int width, unsigned int height); | ||
53 | void moveResize(int x, int y, | ||
54 | unsigned int width, unsigned int height); | ||
55 | |||
56 | void show(); | ||
57 | void hide(); | ||
58 | unsigned int width() const; | ||
59 | unsigned int height() const; | ||
60 | |||
61 | private: | ||
62 | void updateTime(); | ||
63 | void update(FbTk::Subject *subj); | ||
64 | void renderTheme(); | ||
65 | |||
66 | TextButton m_button; | ||
67 | |||
68 | const ToolTheme &m_theme; | ||
69 | BScreen &m_screen; | ||
70 | Pixmap m_pixmap; | ||
71 | FbTk::Timer m_timer; | ||
72 | |||
73 | FbTk::Resource<std::string> m_timeformat; | ||
74 | |||
75 | }; | ||
76 | |||
77 | #endif // CLOCKTOOL_HH | ||