news download themes documentation links










ClockTool.hh

00001 // ClockTool.hh
00002 // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 //                and Simon Bowden    (rathnor at users.sourceforge.net)
00004 //
00005 // Permission is hereby granted, free of charge, to any person obtaining a
00006 // copy of this software and associated documentation files (the "Software"),
00007 // to deal in the Software without restriction, including without limitation
00008 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009 // and/or sell copies of the Software, and to permit persons to whom the
00010 // Software is furnished to do so, subject to the following conditions:
00011 //
00012 // The above copyright notice and this permission notice shall be included in
00013 // all copies or substantial portions of the Software.
00014 //
00015 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00018 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00020 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00021 // DEALINGS IN THE SOFTWARE.
00022 
00023 // $Id: ClockTool.hh,v 1.4 2003/12/04 23:02:23 fluxgen Exp $
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     // accessors
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

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA