00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _WX_EXSPLITTER_H_
00013 #define _WX_EXSPLITTER_H_
00014
00015
00016
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
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
00053 bool Create( wxWindow * parent, wxOrientation orientation,
00054 wxWindow * win1, wxWindow * win2, unsigned int flags );
00055
00056
00057 void SetWindows( wxWindow * pWin1, wxWindow * pWin2 );
00058 void SetFlags( unsigned int flags );
00059
00060
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
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
00094
00095
00096 BEGIN_DECLARE_EVENT_TYPES()
00097 DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_DI, wxEVT_SPLITTER_MOVED, wxEVT_FIRST + 1211 )
00098 END_DECLARE_EVENT_TYPES()
00099
00100
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
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