00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GENERICTOOL_HH
00025 #define GENERICTOOL_HH
00026
00027 #include "ToolbarItem.hh"
00028 #include "ToolTheme.hh"
00029
00030 #include "FbTk/NotCopyable.hh"
00031 #include "FbTk/Observer.hh"
00032
00033 #include <memory>
00034
00035 namespace FbTk {
00036 class FbWindow;
00037 }
00038
00040 class GenericTool: public ToolbarItem, public FbTk::Observer, private FbTk::NotCopyable {
00041 public:
00042 GenericTool(FbTk::FbWindow *new_window, ToolbarItem::Type type, ToolTheme &theme);
00043 virtual ~GenericTool();
00044 void move(int x, int y);
00045 void resize(unsigned int x, unsigned int y);
00046 void moveResize(int x, int y,
00047 unsigned int width, unsigned int height);
00048 void show();
00049 void hide();
00050
00051 unsigned int width() const;
00052 unsigned int height() const;
00053 unsigned int borderWidth() const;
00054
00055 const ToolTheme &theme() const { return m_theme; }
00056 FbTk::FbWindow &window() { return *m_window; }
00057 const FbTk::FbWindow &window() const { return *m_window; }
00058
00059 protected:
00060 virtual void renderTheme();
00061
00062 private:
00063 void update(FbTk::Subject *subj);
00064
00065 std::auto_ptr<FbTk::FbWindow> m_window;
00066 ToolTheme &m_theme;
00067 };
00068
00069 #endif // GENERICTOOL_HH