00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _WX_DOCKWINDOW_H_BASE_
00013 #define _WX_DOCKWINDOW_H_BASE_
00014
00015
00016
00017
00018
00019 #include <wx/defs.h>
00020 #include <wx/minifram.h>
00021 #include <wx/layoutmanager.h>
00022
00023 class wxDockPanel;
00024 class wxBoxSizer;
00025 class wxPanel;
00026
00027 #include "wx/export.h"
00028
00029
00030
00031
00032
00033 class WXDLLIMPEXP_DI wxDockRect
00034 {
00035 public:
00036
00037 wxDockRect() {
00038 Reset();
00039 }
00040
00041 virtual ~wxDockRect() {
00042 }
00043
00044 int operator =(wxRect r) {
00045 rect = r;
00046 valid = true;
00047 return 0;
00048 }
00049 void Reset() {
00050 valid = false;
00051 rect.SetPosition( wxPoint( 0, 0 ) );
00052 rect.SetSize( wxSize( 0, 0 ) );
00053 }
00054 bool valid;
00055 wxRect rect;
00056 };
00057
00058
00059
00060
00061
00062 #define wxDWC_NO_CONTROLS 0x0001
00063 #define wxDWC_DEFAULT 0x0000
00064
00065 class WXDLLIMPEXP_DI wxDockWindowBase : public wxMiniFrame
00066 {
00067 DECLARE_CLASS( wxDockWindowBase )
00068 DECLARE_EVENT_TABLE()
00069
00070 public:
00071 wxDockWindowBase() {
00072 Init();
00073 }
00074 ~wxDockWindowBase() {
00075 }
00076 void Init();
00077
00078 wxDockWindowBase( wxWindow * parent, wxWindowID id, const wxString& title,
00079 const wxPoint& pos = wxDefaultPosition,
00080 const wxSize& size = wxDefaultSize,
00081 const wxString& name = wxT("dockwindow"),
00082 unsigned int flags = wxDWC_DEFAULT )
00083 {
00084 Init();
00085 Create( parent, id, title, pos, size, name, flags );
00086 }
00087
00088
00089 bool Create( wxWindow * parent, wxWindowID id, const wxString& title,
00090 const wxPoint& pos = wxDefaultPosition,
00091 const wxSize& size = wxDefaultSize,
00092 const wxString& name = wxT("dockwindow"),
00093 unsigned int flags = wxDWC_DEFAULT );
00094
00095 void Appear();
00096 void Remove();
00097
00098 void SetDockingManager( wxLayoutManager * pLayoutManager );
00099 wxLayoutManager * GetLayoutManager();
00100
00101 void SetClient( wxWindow * pClient, bool autoPane = false );
00102 wxWindow * GetClient();
00103 wxWindow * RemoveClient( wxWindow * pNewParent = NULL );
00104
00105 void AutoFitSingleChild();
00106
00107
00108 wxDockPanel * GetDockPanel();
00109
00110 void SetDocked( bool state );
00111 bool IsDocked();
00112 bool IsVisible();
00113 wxString GetTitle() { return title_; }
00114
00115 void SetDockingInfo( wxHostInfo &hi );
00116 void ClearDockingInfo();
00117 wxHostInfo & GetDockingInfo();
00118
00119 bool ActualShow( bool show = true );
00120 void DisableShowOverride();
00121
00122 void RepeatLastMouseEvent();
00123
00124
00125 virtual bool Show( bool show = true );
00126
00127
00128 virtual void StartDragging( int x, int y, bool needMouseCapture = true );
00129 virtual void StopDragging( bool needMouseRelease = true );
00130 virtual bool BlockDocking();
00131
00132
00133 void OnMouseMove( wxMouseEvent &e );
00134 void OnClose( wxCloseEvent &e );
00135
00136 protected:
00137
00138 void createClient();
00139 bool applyLastDock( bool noShowOperation = false );
00140
00141 protected:
00142 unsigned int flags_;
00143 bool disableShowOverride_;
00144
00145 wxString title_;
00146
00147 bool dragging_;
00148 bool haveMoved_;
00149 wxMouseEvent lastMouseEvent_;
00150
00151 wxDockRect startRect_;
00152 wxDockRect prevRect_;
00153 wxDockRect dragRect_;
00154
00155 wxPoint startPoint_;
00156
00157 wxLayoutManager * pLayoutManager_;
00158
00159 wxDockPanel * pClientPanel_;
00160 wxBoxSizer * pClientSizer_;
00161
00162 wxHostInfo newHost_;
00163 wxHostInfo prevHost_;
00164
00165 bool docked_;
00166 bool visible_;
00167 };
00168
00169
00170
00171
00172
00173 #if defined(__WXMSW__)
00174 #include "wx/msw/dockwindow.h"
00175 #elif defined(__WXGTK__)
00176 #include "wx/gtk/dockwindow.h"
00177 #else
00178 #error "Your platform does not currently support wxDockWindow"
00179 #endif
00180
00181 #endif
00182