00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _WX_DOCKHOST_H_
00013 #define _WX_DOCKHOST_H_
00014
00015
00016
00017
00018
00019 #include <wx/defs.h>
00020 #include <wx/panel.h>
00021 #include <wx/laywin.h>
00022
00023 #include <wx/layoutmanager.h>
00024
00025 #include "wx/export.h"
00026
00027 class wxDockPanel;
00028 class wxExSplitter;
00029
00030
00031
00032
00033
00034 WX_DECLARE_USER_EXPORTED_LIST( wxExSplitter, SplitterList, WXDLLIMPEXP_DI );
00035
00036 class WXDLLIMPEXP_DI wxDockHost : public wxPanel
00037 {
00038 DECLARE_CLASS( wxDockHost )
00039 DECLARE_EVENT_TABLE()
00040
00041 public:
00042
00043 wxDockHost() {
00044 Init();
00045 }
00046 ~wxDockHost();
00047
00048 void Init();
00049
00050 wxDockHost( wxWindow *parent, wxWindowID id, wxDirection dir, const wxString& name = wxT("dockhost") ) {
00051 Init();
00052 Create( parent, id, dir, name );
00053 }
00054
00055
00056 bool Create( wxWindow * parent, wxWindowID id, wxDirection dir, const wxString& name = wxT("dockhost") );
00057
00058 void SetLayoutManager( wxLayoutManager * pLayoutManager );
00059 wxLayoutManager * GetLayoutManager();
00060
00061 void SetAreaSize( int size );
00062 int GetAreaSize();
00063
00064
00065 void SetPanelArea( int panelArea ){ panelArea_ = panelArea; }
00066 int GetPanelArea(){ return panelArea_; }
00067 void LockPanelValue( bool state ){ lockPanelValue_ = state; }
00068
00069 DockWindowList & GetDockWindowList();
00070
00071 void DockPanel( wxDockPanel * pDockPanel, wxHostInfo &hi );
00072 void UndockPanel( wxDockPanel * pDockPanel );
00073
00074
00075 wxRect GetScreenArea();
00076 wxRect GetScreenArea( wxHostInfo &hi );
00077 wxRect GetClientArea();
00078 wxRect GetClientArea( wxRect availableArea );
00079 wxOrientation GetOrientation();
00080 wxDirection GetDirection();
00081 wxExSplitter *GetSizingSplitter () const
00082 {
00083 return ( pSizingSplitter_ );
00084 }
00085
00086 wxRect CalcHostPlacement( bool hitTest = false );
00087 bool IsEmpty();
00088 bool TestForPanel( int sx, int sy, wxHostInfo &hi );
00089 wxRect RectToScreen( wxRect &rect );
00090 void RecalcPanelAreas();
00091
00092 void UpdateSize( bool useProportions = false );
00093
00094
00095 void OnSize( wxSizeEvent &event );
00096 void OnSplitterMoved( wxCommandEvent &event );
00097 void OnCalculateLayout( wxCalculateLayoutEvent &event );
00098
00099
00100 void SettingsChanged();
00101
00102 private:
00103 void calcPanelPlacement( bool useProportions = false );
00104 void updateSplitters();
00105 int getAssetCount();
00106
00107 private:
00108 enum eChildType {
00109 CT_NONE,
00110 CT_PANEL,
00111 CT_SPLITTER
00112 };
00113
00114 wxDirection dir_;
00115 int areaSize_;
00116 int panelArea_;
00117 bool lockPanelValue_;
00118 bool internalSizeEvent_;
00119
00120 wxPoint pos_;
00121 wxSize size_;
00122
00123 wxLayoutManager * pLayoutManager_;
00124
00125 int numPanels_;
00126 int numSplitters_;
00127 SplitterList splitters_;
00128 unsigned int splitterFlags_;
00129
00130 wxExSplitter * pSizingSplitter_;
00131
00132 DockWindowList dockWindows_;
00133 };
00134 #endif
00135