00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_WORKAREARENDERER_H 00026 #define __SYNFIG_WORKAREARENDERER_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 00030 #include <ETL/handle> 00031 #include <sigc++/signal.h> 00032 #include <sigc++/object.h> 00033 #include <synfig/vector.h> 00034 #include <gdkmm/drawable.h> 00035 #include <gdkmm/rectangle.h> 00036 00037 /* === M A C R O S ========================================================= */ 00038 00039 /* === T Y P E D E F S ===================================================== */ 00040 00041 /* === C L A S S E S & S T R U C T S ======================================= */ 00042 00043 namespace studio { 00044 class WorkArea; 00045 00046 class WorkAreaRenderer : public etl::shared_object, public sigc::trackable 00047 { 00048 public: 00049 typedef etl::handle<WorkAreaRenderer> Handle; 00050 typedef etl::loose_handle<WorkAreaRenderer> LooseHandle; 00051 00052 private: 00053 bool enabled_; 00054 int priority_; 00055 00056 sigc::signal<void> signal_changed_; 00057 00058 WorkArea* work_area_; 00059 00060 public: 00061 00062 sigc::signal<void>& signal_changed() { return signal_changed_; } 00063 00064 public: 00065 int get_w()const; 00066 int get_h()const; 00067 00068 float get_pw()const; 00069 float get_ph()const; 00070 00072 synfig::Point screen_to_comp_coords(synfig::Point pos)const; 00073 00075 synfig::Point comp_to_screen_coords(synfig::Point pos)const; 00076 00077 WorkAreaRenderer(); 00078 virtual ~WorkAreaRenderer(); 00079 00080 bool get_enabled()const { return get_enabled_vfunc(); } 00081 int get_priority()const { return priority_; } 00082 WorkArea* get_work_area()const { return work_area_; } 00083 00084 void set_enabled(bool x); 00085 void set_priority(int x); 00086 void set_work_area(WorkArea* work_area_); 00087 00088 virtual void render_vfunc( 00089 const Glib::RefPtr<Gdk::Drawable>& window, 00090 const Gdk::Rectangle& expose_area 00091 ); 00092 00093 virtual bool event_vfunc( 00094 GdkEvent* event 00095 ); 00096 00097 protected: 00098 00099 virtual bool get_enabled_vfunc()const; 00100 00101 public: 00102 bool operator<(const WorkAreaRenderer &rhs) 00103 { return priority_<rhs.priority_; } 00104 }; 00105 00106 inline bool operator<(const WorkAreaRenderer::Handle &lhs,const WorkAreaRenderer::Handle &rhs) 00107 { return lhs->get_priority() < rhs->get_priority(); } 00108 00109 inline bool operator<(const WorkAreaRenderer::LooseHandle &lhs,const WorkAreaRenderer::LooseHandle &rhs) 00110 { return lhs->get_priority() < rhs->get_priority(); } 00111 00112 }; // END of namespace studio 00113 00114 /* === E N D =============================================================== */ 00115 00116 #endif