Main Page | Namespace List | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

dockhost.h

Go to the documentation of this file.
00001 
00002 // Name:        wx/dockpanel.h
00003 // Purpose:     wxDockHost class
00004 // Author:      Mark McCormack
00005 // Modified by:
00006 // Created:     23/02/04
00007 // RCS-ID:      $Id: dockhost.h,v 1.9 2005/05/12 14:02:28 frm Exp $
00008 // Copyright:   (c) 2004 Mark McCormack
00009 // Licence:     wxWindows licence
00011 
00012 #ifndef _WX_DOCKHOST_H_
00013 #define _WX_DOCKHOST_H_
00014 
00015 // ----------------------------------------------------------------------------
00016 // headers
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 // wxDockHost
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     // basic interface
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     // access
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     // access
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     // event handlers
00095     void OnSize( wxSizeEvent &event );
00096     void OnSplitterMoved( wxCommandEvent &event );
00097     void OnCalculateLayout( wxCalculateLayoutEvent &event );
00098     
00099     // internal event
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_;   // dock edge
00115     int areaSize_;      // docking host size in direction
00116     int panelArea_;     // area available to panels
00117     bool lockPanelValue_;
00118  bool internalSizeEvent_;
00119     
00120     wxPoint pos_;
00121     wxSize size_;
00122     
00123     wxLayoutManager * pLayoutManager_; // our layout manager
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     // _WX_DOCKHOST_H_

Generated on Sat May 14 14:54:39 2005 for wxDockIt by  doxygen 1.4.2