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

dockwindow.h

Go to the documentation of this file.
00001 
00002 // Name:        wx/dockwindow.h
00003 // Purpose:     wxDockWindowBase class
00004 // Author:      Mark McCormack
00005 // Modified by:
00006 // Created:     23/02/04
00007 // RCS-ID:      $Id: dockwindow.h,v 1.11 2005/05/12 14:02:29 frm Exp $
00008 // Copyright:   (c) 2004 Mark McCormack
00009 // Licence:     wxWindows licence
00011 
00012 #ifndef _WX_DOCKWINDOW_H_BASE_
00013 #define _WX_DOCKWINDOW_H_BASE_
00014 
00015 // ----------------------------------------------------------------------------
00016 // headers
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 // wxDockRect
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;   // XXX: this can't be OK - can it?
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 // wxDockWindow interface is defined by the class wxDockWindowBase
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     // basic interface
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     // access
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     // overrides
00125     virtual bool Show( bool show = true );
00126 
00127     // platform
00128     virtual void StartDragging( int x, int y, bool needMouseCapture = true );
00129     virtual void StopDragging( bool needMouseRelease = true );
00130     virtual bool BlockDocking();
00131     
00132     // events
00133     void OnMouseMove( wxMouseEvent &e );
00134     void OnClose( wxCloseEvent &e );
00135 
00136 protected:
00137     // misc
00138     void createClient();
00139     bool applyLastDock( bool noShowOperation = false );
00140 
00141 protected:
00142     unsigned int flags_;
00143     bool disableShowOverride_;
00144 
00145  wxString title_; // store the window title for menu manipulation
00146 
00147     bool dragging_;
00148     bool haveMoved_;
00149     wxMouseEvent lastMouseEvent_;
00150     
00151     wxDockRect startRect_;    // starting rectangle
00152     wxDockRect prevRect_;     // erase rectangle
00153     wxDockRect dragRect_;     // draw rectangle
00154     
00155     wxPoint startPoint_;    // starting mouse x & y
00156     
00157     wxLayoutManager * pLayoutManager_;    // our layout manager
00158     
00159     wxDockPanel * pClientPanel_;      // the contents
00160     wxBoxSizer * pClientSizer_;       // the contents' sizer
00161     
00162     wxHostInfo newHost_;          // host upon dragging finish
00163     wxHostInfo prevHost_;         // last applied host
00164     
00165     bool docked_;   // are we docked
00166  bool visible_;  // are we visible
00167 };
00168 
00169 // ----------------------------------------------------------------------------
00170 // include the platform-specific class declaration
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     // _WX_DOCKWINDOW_H_BASE_

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