00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef CLOCKTOOL_HH
00026 #define CLOCKTOOL_HH
00027
00028
00029 #include "ToolbarItem.hh"
00030
00031 #include "FbTk/TextButton.hh"
00032 #include "FbTk/Observer.hh"
00033 #include "FbTk/Resource.hh"
00034 #include "FbTk/Timer.hh"
00035
00036 #include <string>
00037
00038 class ToolTheme;
00039 class BScreen;
00040
00041 namespace FbTk {
00042 class ImageControl;
00043 class Subject;
00044 class Menu;
00045 }
00046
00047 class ClockTool:public ToolbarItem, public FbTk::Observer {
00048 public:
00049 ClockTool(const FbTk::FbWindow &parent, ToolTheme &theme, BScreen &screen, FbTk::Menu &menu);
00050 virtual ~ClockTool();
00051
00052 void move(int x, int y);
00053 void resize(unsigned int width, unsigned int height);
00054 void moveResize(int x, int y,
00055 unsigned int width, unsigned int height);
00056
00057 void show();
00058 void hide();
00059 void setTimeFormat(const std::string &format);
00060
00061 unsigned int width() const;
00062 unsigned int height() const;
00063 unsigned int borderWidth() const;
00064 inline const std::string &timeFormat() const { return *m_timeformat; }
00065 private:
00066 void updateTime();
00067 void update(FbTk::Subject *subj);
00068 void renderTheme();
00069
00070 FbTk::TextButton m_button;
00071
00072 const ToolTheme &m_theme;
00073 BScreen &m_screen;
00074 Pixmap m_pixmap;
00075 FbTk::Timer m_timer;
00076
00077 FbTk::Resource<std::string> m_timeformat;
00078
00079 };
00080
00081 #endif // CLOCKTOOL_HH