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