1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for wxSplitterWindow
7 // Created: 2-June-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
19 static const wxChar* wxSplitterNameStr = wxT("splitter");
20 DECLARE_DEF_STRING(SplitterNameStr);
24 //---------------------------------------------------------------------------
41 wxSPLIT_HORIZONTAL = 1,
48 wxSPLIT_DRAG_DRAGGING,
49 wxSPLIT_DRAG_LEFT_DOWN
52 //---------------------------------------------------------------------------
55 // wxSplitterWindow maintains one or two panes, with an optional vertical or
56 // horizontal split which can be used with the mouse or programmatically.
57 class wxSplitterWindow: public wxWindow
60 %addtofunc wxSplitterWindow "self._setOORInfo(self)"
61 %addtofunc wxSplitterWindow() ""
63 wxSplitterWindow(wxWindow* parent, wxWindowID id,
64 const wxPoint& point = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
67 const wxString& name = wxPySplitterNameStr);
68 %name(PreSplitterWindow)wxSplitterWindow();
70 bool Create(wxWindow* parent, wxWindowID id,
71 const wxPoint& point = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
74 const wxString& name = wxPySplitterNameStr);
76 // Gets the only or left/top pane
77 wxWindow *GetWindow1() const;
79 // Gets the right/bottom pane
80 wxWindow *GetWindow2() const;
82 // Sets the split mode
83 void SetSplitMode(int mode);
85 // Gets the split mode
86 wxSplitMode GetSplitMode() const;
88 // Initialize with one window
89 void Initialize(wxWindow *window);
91 // Associates the given window with window 2, drawing the appropriate sash
92 // and changing the split mode.
93 // Does nothing and returns False if the window is already split.
94 // A sashPosition of 0 means choose a default sash position,
95 // negative sashPosition specifies the size of right/lower pane as it's
96 // absolute value rather than the size of left/upper pane.
97 virtual bool SplitVertically(wxWindow *window1,
99 int sashPosition = 0);
101 virtual bool SplitHorizontally(wxWindow *window1,
103 int sashPosition = 0);
105 // Removes the specified (or second) window from the view
106 // Doesn't actually delete the window.
107 bool Unsplit(wxWindow *toRemove = NULL);
109 // Replaces one of the windows with another one (neither old nor new
110 // parameter should be NULL)
111 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
113 // Is the window split?
114 bool IsSplit() const;
116 // Sets the sash size
117 void SetSashSize(int width);
119 // Sets the border size
120 void SetBorderSize(int width);
122 // Gets the sash size
123 int GetSashSize() const;
125 // Gets the border size
126 int GetBorderSize() const;
128 // Set the sash position
129 void SetSashPosition(int position, bool redraw = True);
131 // Gets the sash position
132 int GetSashPosition() const;
134 // If this is zero, we can remove panes by dragging the sash.
135 void SetMinimumPaneSize(int min);
136 int GetMinimumPaneSize() const;
139 // Tests for x, y over sash
140 virtual bool SashHitTest(int x, int y, int tolerance = 5);
142 // Resizes subwindows
143 virtual void SizeWindows();
145 void SetNeedUpdating(bool needUpdating);
146 bool GetNeedUpdating() const;
152 // we reuse the same class for all splitter event types because this is the
153 // usual wxWin convention, but the three event types have different kind of
154 // data associated with them, so the accessors can be only used if the real
155 // event type matches with the one for which the accessors make sense
156 class wxSplitterEvent : public wxNotifyEvent
159 wxSplitterEvent(wxEventType type = wxEVT_NULL,
160 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
163 // SASH_POS_CHANGED methods
165 // setting the sash position to -1 prevents the change from taking place at
167 void SetSashPosition(int pos);
168 int GetSashPosition() const;
170 // UNSPLIT event methods
171 wxWindow *GetWindowBeingRemoved() const;
173 // DCLICK event methods
180 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED;
181 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING;
182 %constant wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED;
183 %constant wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT;
187 EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
188 EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
189 EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
190 EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
193 //---------------------------------------------------------------------------