00001
00011 #ifndef _IFM_MANAGER_H_
00012 #define _IFM_MANAGER_H_
00013
00014 #include "ifmdefs.h"
00015
00016 #include <wx/window.h>
00017
00021 wxIFMComponentDataKeyType GetNewDataKey();
00022
00026 int GetNewComponentType();
00027
00031 int GetNewChildType();
00032
00033 DECLARE_IFM_DATA_KEY(IFM_FLOATING_DATA_KEY)
00034
00035 #if IFM_CANFLOAT
00036
00040 class wxIFMFloatingWindowBase : public wxEvtHandler
00041 {
00042 private:
00043 wxIFMInterfacePluginBase *m_ip;
00044
00045 protected:
00046 wxWindow *m_window;
00047 wxIFMInterfacePluginBase *GetIP();
00048 wxInterfaceManager *GetManager();
00049
00050 public:
00051 wxIFMComponent *m_component;
00052 bool m_destroyRoot;
00053
00054 protected:
00055 wxIFMFloatingWindowBase(wxIFMInterfacePluginBase *ip);
00056
00057 void ConnectEvents();
00058 void DisconnectEvents();
00059
00075 wxIFMComponent *GetComponentByPos(const wxPoint &pos, wxIFMComponent *component = NULL);
00076
00077 public:
00078 wxIFMFloatingWindowBase(wxIFMInterfacePluginBase *ip,
00079 wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
00080 const wxSize& size = wxDefaultSize, long style = 0,
00081 const wxString& name = wxPanelNameStr);
00082
00083 virtual ~wxIFMFloatingWindowBase();
00084
00085 private:
00086 void OnSize(wxSizeEvent &event);
00087 void OnMoving(wxMoveEvent &event);
00088 void OnPaint(wxPaintEvent &event);
00089 void OnKeyDown(wxKeyEvent &event);
00090 void OnKeyUp(wxKeyEvent &event);
00091 void OnSetCursor(wxSetCursorEvent &event);
00092 void OnMouseEvent(wxMouseEvent &event);
00093 void OnShow(wxShowEvent &event);
00094 void OnEraseBg(wxEraseEvent &event);
00095
00096 public:
00097 wxWindow *GetWindow() const;
00098 wxIFMComponent *GetComponent() const;
00099
00105 void Update(bool force = false);
00106
00110 void AddPendingUpdate();
00111
00112 DECLARE_EVENT_TABLE()
00113 };
00114
00115 #endif
00116
00122 class wxIFMVersionInfo
00123 {
00124 public:
00125
00126 wxIFMVersionInfo()
00127
00128 { }
00129 };
00130
00135 class WXDLLEXPORT wxInterfaceManager : public wxEvtHandler
00136 {
00137 private:
00138
00139 bool m_initialized;
00140 int m_flags;
00141
00142 wxWindow *m_parent, *m_content;
00143
00144 wxIFMInterfacePluginArray m_interfacePlugins;
00145 int m_activeInterface;
00146
00147 wxIFMComponent *m_capturedComponent;
00148 int m_capturedType;
00149 #if IFM_CANFLOAT
00150 wxIFMFloatingWindowBase *m_floatingCapture;
00151 #endif
00152
00153 wxRect m_updateRect;
00154 bool m_useUpdateRect;
00155
00156 int m_statusbarPane;
00157 bool m_statusMessageDisplayed;
00158 wxString m_oldStatusMessage;
00159
00160 public:
00161
00166 wxInterfaceManager(wxWindow *parent, wxWindow *content = NULL);
00167 ~wxInterfaceManager();
00168
00172 wxWindow *GetParent() const;
00173
00181 const wxRect &GetInterfaceRect() const;
00182
00195 void SetInterfaceRect(const wxRect &rect);
00196
00201 void ResetInterfaceRect();
00202
00208 void SetContentWindow(wxWindow *content);
00209
00213 wxWindow *GetContentWindow() const;
00214
00232 bool Initialize(bool defaultPlugins = true, int flags = IFM_DEFAULT_FLAGS);
00233
00239 void Shutdown();
00240
00244 void SetFlags(int flags);
00245
00249 int GetFlags() const;
00250
00261 bool AddChild(wxIFMChildDataBase *data, bool update = false);
00262
00272 void ShowChild(wxWindow *child, bool show, bool update = true);
00273
00282 void HideChild(wxWindow *child, bool update = true);
00283
00287 bool IsChildVisible(wxWindow *child);
00288
00304 void SetChildSize(wxWindow *child, const wxSize &desired, const wxSize &min = IFM_USE_CURRENT_SIZE,
00305 const wxSize &max = IFM_USE_CURRENT_SIZE, bool update = true);
00306
00307
00308 private:
00319 int AddInterfacePlugin(wxIFMInterfacePluginBase *plugin, bool select = true);
00320
00326 void SetActiveInterface(int plugin);
00327
00336 void RemoveInterfacePlugin(int interface_index = IFM_INTERFACE_ACTIVE);
00337
00341 void RemoveAllInterfacePlugins();
00342
00343
00344 wxIFMInterfacePluginBase *GetActiveIP() const;
00345
00354 bool AddExtensionPlugin(wxIFMExtensionPluginBase *plugin);
00355
00364 void RemoveExtensionPlugin();
00365
00374 void RemoveAllExtensionPlugins();
00375
00376 public:
00382 void CaptureInput(wxIFMComponent *component);
00383
00387 void ReleaseInput();
00388
00392 bool IsInputCaptured() const;
00393
00397 wxIFMComponent *GetCapturedComponent() const;
00398
00403 wxWindow *GetCapturedWindow() const;
00404
00417 void Update(wxRect rect = IFM_DEFAULT_RECT, bool floating = false);
00418
00428 void AddPendingUpdate(wxRect rect = IFM_DEFAULT_RECT, bool floating = false);
00429
00448 void SetStatusMessagePane(int pane);
00449
00460 void DisplayStatusMessage(const wxString &message);
00461
00479 void ResetStatusMessage();
00480 };
00481
00492 #if IFM_USE_WX_RTTI
00493 class wxIFMChildDataBase : public wxObject
00494 #else
00495 class wxIFMChildDataBase
00496 #endif
00497 {
00498 public:
00499
00500 int m_type;
00501 wxSize m_desiredSize;
00502 wxSize m_minSize;
00503 wxSize m_maxSize;
00504 wxWindow *m_child;
00505 bool m_hidden;
00506 bool m_hideable;
00507 bool m_fixed;
00512 wxString m_name;
00513
00514 wxIFMChildDataBase();
00515
00516 wxIFMChildDataBase(wxWindow *child, int type, const wxString &name = IFM_DEFAULT_COMPONENT_NAME,
00517 wxSize size = IFM_DEFAULT_SIZE, bool hidden = false,
00518 wxSize minSize = IFM_NO_MINIMUM_SIZE, wxSize maxSize = IFM_NO_MAXIMUM_SIZE);
00519
00520 wxIFMChildDataBase(const wxIFMChildDataBase &data);
00521
00522 virtual ~wxIFMChildDataBase();
00523
00524 #if IFM_USE_WX_RTTI
00525 DECLARE_DYNAMIC_CLASS(wxIFMChildDataBase)
00526 #endif
00527 };
00528
00532 class wxIFMComponent
00533 {
00534 private:
00535
00536 wxIFMComponentDataMap m_data;
00537 int m_type;
00538 wxIFMInterfacePluginBase *m_ip;
00539 wxInterfaceManager *GetManager();
00540
00541 public:
00542
00543 wxRect m_rect;
00544 wxSize m_minSize;
00545 wxSize m_maxSize;
00546 wxSize m_desiredSize;
00547
00548 bool m_fixed;
00564 wxIFMBorders m_borders;
00565 wxIFMMargins m_margins;
00566
00567 bool m_hidden;
00568 bool m_visible;
00569 bool m_canHide;
00570 bool m_docked;
00571
00572 int m_alignment;
00573 wxIFMComponentArray m_children;
00574 wxIFMComponent *m_parent;
00575
00576 wxString m_name;
00577
00578 int m_childType;
00579 wxWindow *m_child;
00580
00585 wxIFMComponent(wxIFMInterfacePluginBase *ip, int type);
00586 private:
00587 wxIFMComponent(const wxIFMComponent &);
00588 public:
00589
00590 ~wxIFMComponent();
00591
00598 void AddExtensionData(wxIFMExtensionDataBase *data);
00599
00608 wxIFMExtensionDataBase *GetExtensionData(wxIFMComponentDataKeyType key);
00609
00618 wxIFMExtensionDataBase *RemoveExtensionData(wxIFMComponentDataKeyType key);
00619
00635 static int GetNextVisibleComponent(const wxIFMComponentArray &components, int start);
00636
00642 static bool IsChildOf(wxIFMComponent *parent, wxIFMComponent *child);
00643
00650 void Paint(wxDC &dc, const wxRegion ®ion);
00651
00655 int GetType() const;
00656
00660 wxWindow *GetParentWindow();
00661
00666 wxRect GetRect();
00667
00672 wxRect GetBackgroundRect();
00673
00678 wxRect GetClientRect();
00679
00685 wxRect GetConvertedRect(wxRect rect, int coords_from, int coords_to);
00686
00690 wxSize GetDesiredSize();
00691
00695 void SetDesiredSize(const wxSize &size);
00696
00700 wxSize GetMinSize();
00701
00705 wxSize GetMaxSize();
00706
00711 void Show(bool s, bool update);
00712 void Hide() { Show(false, true); }
00713
00717 bool IsShown();
00718
00725 void VisibilityChanged(bool vis);
00726
00730 bool IsVisible();
00731 };
00732
00736 #if IFM_USE_WX_RTTI
00737 class wxIFMExtensionDataBase : public wxObject
00738 #else
00739 class wxIFMExtensionDataBase
00740 #endif
00741 {
00742 public:
00743
00744 virtual ~wxIFMExtensionDataBase();
00745
00749 virtual wxIFMComponentDataKeyType GetDataKey() const = 0;
00750
00756 static wxIFMComponentDataKeyType DataKey();
00757 };
00758
00759 #if IFM_CANFLOAT
00760
00763 class wxIFMFloatingData : public wxIFMExtensionDataBase
00764 {
00765 public:
00766
00767 bool m_floating;
00768 wxIFMFloatingWindowBase *m_window;
00769 wxRect m_rect;
00775 wxIFMFloatingData();
00776
00777 wxIFMComponentDataKeyType GetDataKey() const;
00778 static wxIFMComponentDataKeyType DataKey();
00779 };
00780 #endif
00781
00782 #endif // _IFM_MANAGER_H_