MatOCAD Logo

Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

resize.h

Go to the documentation of this file.
00001 
00012 #ifndef _IFM_RESIZE_H_
00013 #define _IFM_RESIZE_H_
00014 
00015 #include "plugin.h"
00016 #include "events.h"
00017 #include "definterface.h"
00018 
00019 #include <wx/dc.h>
00020 #include <wx/dcscreen.h>
00021 
00022 class wxIFMResizeEvent;
00023 class wxIFMUpdateResizeSashEvent;
00024 
00025 #define IFM_RESIZE_SASH_BORDER  0
00026 #define IFM_RESIZE_SASH_SIZE    (4 + IFM_RESIZE_SASH_BORDER * 2)
00027 
00028 DECLARE_IFM_DATA_KEY(IFM_RESIZE_DATA_KEY)
00029 
00030 DECLARE_EVENT_TYPE(wxEVT_IFM_BEGINRESIZE, 0)
00031 DECLARE_EVENT_TYPE(wxEVT_IFM_ENDRESIZE, 0)
00032 DECLARE_EVENT_TYPE(wxEVT_IFM_RESIZE, 0)
00033 DECLARE_EVENT_TYPE(wxEVT_IFM_RESIZESASHDBLCLICK, 0)
00034 DECLARE_EVENT_TYPE(wxEVT_IFM_GETRESIZESASHRECT, 0)
00035 DECLARE_EVENT_TYPE(wxEVT_IFM_UPDATERESIZESASHES, 0)
00036 
00037 #define EVT_IFM_GETRESIZESASHRECT(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_IFM_GETRESIZESASHRECT, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxIFMRectEventFunction, & func ), (wxObject *) NULL ),
00038 
00042 class wxIFMDefaultResizePlugin : public wxIFMExtensionPluginBase
00043 {
00044 private:
00045     wxIFMDefaultInterfacePlugin *m_ip;
00046 
00047     bool m_resizing, m_realtime;
00048     wxPoint m_oldPos;
00049     wxRect m_resizeRect;
00050     int m_orientation;
00051     int m_offset;
00052 
00053 public:
00054 
00055     wxIFMDefaultResizePlugin();
00056 
00057     bool Initialize(wxIFMInterfacePluginBase *plugin);
00058 
00059     void OnCreateComponent(wxIFMNewComponentEvent &event);
00060     void OnDock(wxIFMDockEvent &event);
00061     void OnUndock(wxIFMUndockEvent &event);
00062     void OnConvertRect(wxIFMConvertRectEvent &event);
00063     void OnPaintDecor(wxIFMPaintEvent &event);
00064     void OnShowChild(wxIFMShowChildEvent &event);
00065     void OnGetRect(wxIFMRectEvent &event);
00066     void OnSetRect(wxIFMRectEvent &event);
00067     void OnSetCursor(wxIFMSetCursorEvent &event);
00068     void OnLeftDown(wxIFMMouseEvent &event);
00069     void OnLeftUp(wxIFMMouseEvent &event);
00070     void OnMouseMove(wxIFMMouseEvent &event);
00071     void OnKeyDown(wxIFMKeyEvent &event);
00072     void OnGetDesiredSize(wxIFMRectEvent &event);
00073 #if IFM_CANFLOAT
00074     void OnFloat(wxIFMFloatEvent &event);
00075 #endif
00076 
00077     void PaintResizeHint(wxScreenDC &dc, const wxRect &rect);
00078 
00079     void OnResizeBegin(wxIFMResizeEvent &event);
00080     void OnResizeEnd(wxIFMResizeEvent &event);
00081     void OnResizing(wxIFMResizeEvent &event);
00082 
00083     void OnAddTopContainer(wxIFMAddTopContainerEvent &event);
00084 
00085     void OnUpdateResizeSashes(wxIFMUpdateResizeSashEvent &event);
00086     void UpdateContainerResizeSashes(wxIFMComponent *container);
00087     void UpdateResizeSashes(wxIFMComponent *component);
00088     void ResizeComponent(wxIFMComponent *component, wxSize size);
00089     bool HasResizeableChildren(wxIFMComponent *component);
00090 
00091     DECLARE_EVENT_TABLE()
00092 
00093 #if IFM_USE_WX_RTTI
00094     DECLARE_DYNAMIC_CLASS_NO_COPY(wxIFMDefaultResizePlugin)
00095 #endif
00096 };
00097 
00101 class wxIFMResizeData : public wxIFMExtensionDataBase
00102 {
00103 public:
00104 
00105     wxIFMResizeData();
00106 
00107     int m_side; 
00109     bool m_display; 
00110     wxRect m_rect; 
00111 
00112     wxIFMComponentDataKeyType GetDataKey() const;
00113     static wxIFMComponentDataKeyType DataKey();
00114 
00115 #if IFM_USE_WX_RTTI
00116     DECLARE_DYNAMIC_CLASS(wxIFMResizeData)
00117 #endif
00118 };
00119 
00123 class wxIFMResizeEvent : public wxIFMPluginEvent
00124 {
00125 private:
00126     const wxPoint &m_pos;
00127     bool m_realtime, m_canceled;
00128 
00129 public:
00130 
00131     wxIFMResizeEvent(wxEventType type, wxIFMComponent *component,
00132         const wxPoint &pos, bool realtime, bool canceled = false)
00133         : wxIFMPluginEvent(type, component),
00134         m_pos(pos),
00135         m_realtime(realtime),
00136         m_canceled(canceled)
00137     { }
00138 
00139     wxIFMResizeEvent(const wxIFMResizeEvent &event)
00140         : wxIFMPluginEvent(event),
00141         m_pos(event.m_pos),
00142         m_realtime(event.m_realtime),
00143         m_canceled(event.m_canceled)
00144     { }
00145 
00146     virtual wxEvent *Clone() const { return new wxIFMResizeEvent(*this); }
00147 
00151     const wxPoint &GetPosition() const { return m_pos; }
00152 
00157     bool WasCanceled() const { return m_canceled; }
00158 
00163     bool RealtimeUpdates() const { return m_realtime; }
00164 };
00165 
00169 class wxIFMUpdateResizeSashEvent : public wxIFMPluginEvent
00170 {
00171 public:
00172     wxIFMUpdateResizeSashEvent(wxIFMComponent *component)
00173         : wxIFMPluginEvent(wxEVT_IFM_UPDATERESIZESASHES, component)
00174     { }
00175 
00176     wxIFMUpdateResizeSashEvent(const wxIFMUpdateResizeSashEvent &event)
00177         : wxIFMPluginEvent(event)
00178     { }
00179 
00180     virtual wxEvent *Clone() const { return new wxIFMUpdateResizeSashEvent(*this); }
00181 };
00182 
00183 typedef void (wxEvtHandler::*wxIFMResizeEventFunction)(wxIFMResizeEvent&);
00184 typedef void (wxEvtHandler::*wxIFMUpdateResizeSashEventFunction)(wxIFMUpdateResizeSashEvent&);
00185 
00186 #define wxIFMResizeEventFunctionHandler(func) \
00187     (wxObjectEventFunction)wxStaticCastEvent(wxIFMResizeEventFunction, &func)
00188 #define wxIFMUpdateResizeSashEventFunctionHandler(func) \
00189     (wxObjectEventFunction)wxStaticCastEvent(wxIFMUpdateResizeSashEventFunction, &func)
00190 
00191 #define EVT_IFM_RESIZE_BEGIN(func)  wx__DECLARE_EVT0( wxEVT_IFM_BEGINRESIZE, wxIFMResizeEventFunctionHandler(func))
00192 #define EVT_IFM_RESIZE_END(func)    wx__DECLARE_EVT0( wxEVT_IFM_ENDRESIZE, wxIFMResizeEventFunctionHandler(func))
00193 #define EVT_IFM_RESIZE_RESIZING(func) wx__DECLARE_EVT0( wxEVT_IFM_RESIZE, wxIFMResizeEventFunctionHandler(func))
00194 #define EVT_IFM_RESIZE_UPDATE_SASHES(func) wx__DECLARE_EVT0( wxEVT_IFM_UPDATERESIZESASHES, wxIFMUpdateResizeSashEventFunctionHandler(func))
00195 
00196 #endif

 

SourceForge Logo