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

exsplitter.h

Go to the documentation of this file.
00001 
00002 // Name:        wx/exsplitter.h
00003 // Purpose:     wxExSplitter class
00004 // Author:      Mark McCormack
00005 // Modified by:
00006 // Created:     23/02/04
00007 // RCS-ID:      $Id: exsplitter.h,v 1.8 2005/05/12 14:02:29 frm Exp $
00008 // Copyright:   (c) 2004 Mark McCormack
00009 // Licence:     wxWindows licence
00011 
00012 #ifndef _WX_EXSPLITTER_H_
00013 #define _WX_EXSPLITTER_H_
00014 
00015 // ----------------------------------------------------------------------------
00016 // headers
00017 // ----------------------------------------------------------------------------
00018 
00019 #include <wx/defs.h>
00020 #include <wx/window.h>
00021 
00022 #define wxSPLITTER_WINDOWS     2
00023 #define wxSPLITTER_SIZE        6
00024 #define wxMINIMUM_WINDOW_SIZE  32
00025 
00026 #include "wx/export.h"
00027 
00028 // ----------------------------------------------------------------------------
00029 // wxExSplitter
00030 // ----------------------------------------------------------------------------
00031 
00032 #define wxESF_LIVE_UPDATE 0x01
00033 #define wxESF_DRAW_GRIPPER 0x02
00034 
00035 class wxExSplitter : public wxWindow {
00036     DECLARE_CLASS( wxExSplitter )
00037     DECLARE_EVENT_TABLE()
00038 
00039 public:
00040     wxExSplitter() {
00041         Init();
00042     }
00043     void Init();
00044     
00045     wxExSplitter( wxWindow * parent, wxOrientation orientation, 
00046   wxWindow * win1, wxWindow * win2, unsigned int flags ) 
00047  {
00048         Init();
00049         Create( parent, orientation, win1, win2, flags );
00050     }
00051     
00052     // basic interface
00053     bool Create( wxWindow * parent, wxOrientation orientation, 
00054   wxWindow * win1, wxWindow * win2, unsigned int flags );
00055     
00056     // basic interface
00057     void SetWindows( wxWindow * pWin1, wxWindow * pWin2 );
00058     void SetFlags( unsigned int flags );
00059     
00060     // event handlers
00061     void OnLeftDown( wxMouseEvent& event );
00062     void OnMouseMove( wxMouseEvent& event );
00063     void OnErase( wxEraseEvent& event );
00064     void OnPaint( wxPaintEvent& event );
00065     void OnLeftUp( wxMouseEvent& event );
00066 
00067     void SetBoundaries ();
00068 
00069 private:
00070     void draw( wxRect r );
00071 
00072 private:
00073     wxWindow * pOwner_;
00074     wxWindow * pWindow_[wxSPLITTER_WINDOWS];
00075     wxOrientation orientation_;
00076     wxPoint startPosition_;
00077     wxRect startRect_[wxSPLITTER_WINDOWS];
00078     wxRect startRectUs_;
00079 
00080     // movement boundary top-left / bottom-left points
00081     wxPoint boundary[2];
00082 
00083     bool dragging_;
00084     bool bounded_;
00085     int minSize_;
00086     wxRect endRect_[wxSPLITTER_WINDOWS];
00087     wxRect endRectUs_;
00088     unsigned int flags_;
00089     wxRect lastDrawnRect_;
00090 };
00091 
00092 // ----------------------------------------------------------------------------
00093 // wxExSplitter events
00094 // ----------------------------------------------------------------------------
00095 
00096 BEGIN_DECLARE_EVENT_TYPES()
00097     DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_DI, wxEVT_SPLITTER_MOVED, wxEVT_FIRST + 1211 )  // TODO: must change id
00098 END_DECLARE_EVENT_TYPES()
00099 
00100 // This should keep wxDockit compatible with wxWidgets 2.4.x
00101 #ifndef WXWIN_COMPATIBILITY_2_4
00102 #define EVT_SPLITTER_MOVED( fn ) \
00103     DECLARE_EVENT_TABLE_ENTRY( wxEVT_SPLITTER_MOVED, -1, -1, \
00104   (wxObjectEventFunction) (wxEventFunction) & fn, NULL ),
00105 #else
00106 // Patch for wxWidgets-2.5.4 compat submitted by Jesus Gonzalez (2005-03-02)
00107 typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
00108 #define EVT_SPLITTER_MOVED( fn ) \
00109     DECLARE_EVENT_TABLE_ENTRY( wxEVT_SPLITTER_MOVED, -1, -1, \
00110   (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), NULL ),
00111 #endif
00112 
00113 #endif
00114     // _WX_EXSPLITTER_H_

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