00001 00012 #ifndef _IFM_PLUGIN_H_ 00013 #define _IFM_PLUGIN_H_ 00014 00015 #include "manager.h" 00016 #include "events.h" 00017 00021 class wxIFMInterfacePluginBase : public wxEvtHandler 00022 { 00023 private: 00024 wxInterfaceManager *m_manager; 00025 wxIFMExtensionPluginBase *m_topExtensionPlugin; 00026 00027 protected: 00028 wxIFMComponentArray m_components; 00029 wxIFMChildWindowMap m_windows; 00030 00031 #if IFM_CANFLOAT 00032 wxIFMFloatingWindowArray m_floatingWindows; 00033 #endif 00034 00035 public: 00036 wxIFMInterfacePluginBase(); 00037 virtual ~wxIFMInterfacePluginBase(); 00038 00039 wxInterfaceManager *GetManager(); 00040 00041 virtual bool Initialize(wxInterfaceManager *manager); 00042 virtual void Shutdown(); 00043 00052 bool PushExtensionPlugin(wxIFMExtensionPluginBase *plugin); 00053 00057 void PopExtensionPlugin(); 00058 00062 void PopAllExtensionPlugins(); 00063 00067 virtual void Enable(bool val = true); 00068 void Disable() { Enable(false); } 00069 00073 const wxIFMComponentArray &GetComponents() const; 00074 00078 #if IFM_CANFLOAT 00079 const wxIFMFloatingWindowArray &GetFloatingWindows() const; 00080 #endif 00081 00085 virtual bool ProcessPluginEvent(wxIFMPluginEvent &event); 00086 00090 void AddPendingPluginEvent(wxIFMPluginEvent &event); 00091 00103 virtual wxIFMComponent *GetComponentByPos(const wxPoint &pos, wxIFMComponent *component = NULL, 00104 bool floating = false); 00105 00109 wxIFMComponent *FindChildWindow(wxWindow *window); 00110 00120 void AddChildWindow(wxWindow *window, wxIFMComponent *component); 00121 00128 #if IFM_CANFLOAT 00129 virtual wxIFMComponent *GetFloatingComponentByPos(const wxPoint &pos); 00130 #endif 00131 00132 private: 00136 wxEvtHandler *GetTopPlugin(); 00137 00138 void OnMouseEvent(wxMouseEvent &event); 00139 void OnKeyDown(wxKeyEvent &event); 00140 void OnKeyUp(wxKeyEvent &event); 00141 void OnPaint(wxPaintEvent &event); 00142 void OnSetCursor(wxSetCursorEvent &event); 00143 void OnSize(wxSizeEvent &event); 00144 void OnFocus(wxFocusEvent &event); 00145 void OnActivate(wxActivateEvent &event); 00146 00147 #if IFM_USE_WX_RTTI 00148 DECLARE_DYNAMIC_CLASS_NO_COPY(wxIFMInterfacePluginBase) 00149 #endif 00150 }; 00151 00155 class wxIFMExtensionPluginBase : public wxEvtHandler 00156 { 00157 private: 00158 wxIFMInterfacePluginBase *m_ip; 00159 00160 protected: 00161 wxInterfaceManager *GetManager(); 00162 wxIFMInterfacePluginBase *GetIP(); 00163 00164 public: 00165 wxIFMExtensionPluginBase(); 00166 virtual ~wxIFMExtensionPluginBase(); 00167 00177 virtual bool Initialize(wxIFMInterfacePluginBase *plugin); 00178 virtual void Shutdown(); 00179 00180 virtual void Enable(bool val = true); 00181 void Disable(); 00182 00183 #if IFM_USE_WX_RTTI 00184 DECLARE_DYNAMIC_CLASS_NO_COPY(wxIFMExtensionPluginBase) 00185 #endif 00186 }; 00187 00188 #endif