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