]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_splitter.i
PS can output to ta stream (but still need to make output streams more
[wxWidgets.git] / wxPython / src / _splitter.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _splitter.i
3 // Purpose: SWIG interface defs for wxSplitterWindow
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 2-June-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 MAKE_CONST_WXSTRING2(SplitterNameStr, wxT("splitter"));
19
20 //---------------------------------------------------------------------------
21 %newgroup
22
23 enum {
24 wxSP_NOBORDER,
25 wxSP_NOSASH,
26 wxSP_PERMIT_UNSPLIT,
27 wxSP_LIVE_UPDATE,
28 wxSP_3DSASH,
29 wxSP_3DBORDER,
30 wxSP_BORDER,
31 wxSP_3D,
32 };
33
34
35 enum wxSplitMode
36 {
37 wxSPLIT_HORIZONTAL = 1,
38 wxSPLIT_VERTICAL
39 };
40
41 enum
42 {
43 wxSPLIT_DRAG_NONE,
44 wxSPLIT_DRAG_DRAGGING,
45 wxSPLIT_DRAG_LEFT_DOWN
46 };
47
48 //---------------------------------------------------------------------------
49
50
51 // wxSplitterWindow maintains one or two panes, with an optional vertical or
52 // horizontal split which can be used with the mouse or programmatically.
53 class wxSplitterWindow: public wxWindow
54 {
55 public:
56 %pythonPrepend wxSplitterWindow "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point']"
57 %pythonPrepend wxSplitterWindow() ""
58 %pythonAppend wxSplitterWindow "self._setOORInfo(self)"
59 %pythonAppend wxSplitterWindow() ""
60
61 wxSplitterWindow(wxWindow* parent, wxWindowID id,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style=wxSP_3D,
65 const wxString& name = wxPySplitterNameStr);
66 %name(PreSplitterWindow)wxSplitterWindow();
67
68 bool Create(wxWindow* parent, wxWindowID id,
69 const wxPoint& pos = wxDefaultPosition,
70 const wxSize& size = wxDefaultSize,
71 long style=wxSP_3D,
72 const wxString& name = wxPySplitterNameStr);
73
74 // Gets the only or left/top pane
75 wxWindow *GetWindow1() const;
76
77 // Gets the right/bottom pane
78 wxWindow *GetWindow2() const;
79
80 // Sets the split mode
81 void SetSplitMode(int mode);
82
83 // Gets the split mode
84 wxSplitMode GetSplitMode() const;
85
86 // Initialize with one window
87 void Initialize(wxWindow *window);
88
89 // Associates the given window with window 2, drawing the appropriate sash
90 // and changing the split mode.
91 // Does nothing and returns False if the window is already split.
92 // A sashPosition of 0 means choose a default sash position,
93 // negative sashPosition specifies the size of right/lower pane as it's
94 // absolute value rather than the size of left/upper pane.
95 virtual bool SplitVertically(wxWindow *window1,
96 wxWindow *window2,
97 int sashPosition = 0);
98
99 virtual bool SplitHorizontally(wxWindow *window1,
100 wxWindow *window2,
101 int sashPosition = 0);
102
103 // Removes the specified (or second) window from the view
104 // Doesn't actually delete the window.
105 bool Unsplit(wxWindow *toRemove = NULL);
106
107 // Replaces one of the windows with another one (neither old nor new
108 // parameter should be NULL)
109 bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
110
111 // Is the window split?
112 bool IsSplit() const;
113
114 // Sets the sash size
115 void SetSashSize(int width);
116
117 // Sets the border size
118 void SetBorderSize(int width);
119
120 // Gets the sash size
121 int GetSashSize() const;
122
123 // Gets the border size
124 int GetBorderSize() const;
125
126 // Set the sash position
127 void SetSashPosition(int position, bool redraw = True);
128
129 // Gets the sash position
130 int GetSashPosition() const;
131
132 // If this is zero, we can remove panes by dragging the sash.
133 void SetMinimumPaneSize(int min);
134 int GetMinimumPaneSize() const;
135
136
137 // Tests for x, y over sash
138 virtual bool SashHitTest(int x, int y, int tolerance = 5);
139
140 // Resizes subwindows
141 virtual void SizeWindows();
142
143 void SetNeedUpdating(bool needUpdating);
144 bool GetNeedUpdating() const;
145 };
146
147
148
149
150 // we reuse the same class for all splitter event types because this is the
151 // usual wxWin convention, but the three event types have different kind of
152 // data associated with them, so the accessors can be only used if the real
153 // event type matches with the one for which the accessors make sense
154 class wxSplitterEvent : public wxNotifyEvent
155 {
156 public:
157 wxSplitterEvent(wxEventType type = wxEVT_NULL,
158 wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
159
160
161 // SASH_POS_CHANGED methods
162
163 // setting the sash position to -1 prevents the change from taking place at
164 // all
165 void SetSashPosition(int pos);
166 int GetSashPosition() const;
167
168 // UNSPLIT event methods
169 wxWindow *GetWindowBeingRemoved() const;
170
171 // DCLICK event methods
172 int GetX() const;
173 int GetY() const;
174 };
175
176
177
178 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED;
179 %constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING;
180 %constant wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED;
181 %constant wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT;
182
183
184 %pythoncode {
185 EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
186 EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
187 EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
188 EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
189 }
190
191 //---------------------------------------------------------------------------
192