]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/tchanges.tex
Add incompat and depre changes to manual
[wxWidgets.git] / docs / latex / wx / tchanges.tex
1 \section{Changes since 2.4.x}\label{changes}
2
3 Listed here are the depreciated and incompatable changes made to wxWidgets.
4
5 For other changes (such as additional features, bug fixes, etc.) see the changes.txt file located in the docs directory of your wxWidgets directory.
6
7 \subsection{Incompatable changes since 2.4.x}
8
9 \subsubsection{New window repainting behaviour}
10
11 Windows are no longer fully repainted when resized, use new style wxFULL\_REPAINT\_ON\_RESIZE to force this (wxNO\_FULL\_REPAINT\_ON\_RESIZE still exists but doesn't do anything any more, this behaviour is default now).
12
13 \subsubsection{Window class member changes}
14
15 wxWindow::m\_font and m\_backgroundColour/m\_foregroundColour are no longer always set, use GetFont(), GetBack/ForegroundColour() to access them, and they will be dynamically determined if necessary.
16
17 \subsubsection{Sizers Internal Overhaul}
18
19 The Sizers have had some fundamental internal changes in the 2.5.2 and 2.5.3 releases intended to make them do more of the "Right Thing" but also be as backwards compatible as possible. First a bit about how things used to work:
20
21 * The size that a window had when Add()ed to the sizer was assumed
22 to be its minimal size, and that size would always be used by
23 default when calculating layout size and positions, and the
24 sizer itself would keep track of that minimal size.
25
26 * If the window item was Add()ed with the wxADJUST\_MINSIZE flag
27 then when layout was calculated the item's GetBestSize would be
28 used to reset the minimal size that the sizer used.
29
30 The main thrust of the new Sizer changes was to make behaviour like
31 wxADJUST\_MINSIZE be the default, and also to push the tracking of
32 the minimal size to the window itself (since it knows its own needs)
33 instead of having the sizer take care of it. Consequently these
34 changes were made:
35
36 * The wxFIXED\_MINSIZE flag was added to allow for the old
37 behaviour. When this flag is used the size a window has when
38 Add()ed to the sizer will be treated as its minimal size and it
39 will not be readjusted on each layout.
40
41 * The min size stored in wxWindow and settable with SetSizeHints or
42 SetMinSize will by default be used by the sizer (if it was set)
43 as the minimal size of the sizer item. If the minsize was not
44 set (or was only partially set) then the window's best size is
45 fetched and it is used instead of (or blended with) the minsize.
46 wxWindow:GetBestFittingSize was added to facilitate getting the
47 size to be used by the sizers.
48
49 * The best size of a window is cached so it doesn't need to
50 recalculated on every layout. wxWindow::InvalidateBestSize was
51 added and should be called (usually just internally in control
52 methods) whenever something is done that would make the best
53 size change.
54
55 * All wxControls were changed to set the minsize to what is passed
56 to the constructor or Create method, and also to set the real
57 size of the control to the blending of the minsize and bestsize.
58 wxWindow::SetBestFittingSize was added to help with this,
59 although most controls don't need to call it directly because it
60 is called indirectly via the SetInitialSize called in the base
61 classes.
62
63 At this time, the only situation known not to work the same as
64 before is the following:
65
66 win = new SomeWidget(parent);
67 win->SetSize(SomeNonDefaultSize);
68 sizer->Add(win);
69
70 In this case the old code would have used the new size as the
71 minimum, but now the sizer will use the default size as the minimum
72 rather than the size set later. It is an easy fix though, just move
73 the specification of the size to the constructor (assuming that
74 SomeWidget will set its minsize there like the rest of the controls
75 do) or call SetMinSize instead of SetSize.
76
77 In order to fit well with this new scheme of things, all wxControls
78 or custom controls should do the following things. (Depending on
79 how they are used you may also want to do the same thing for
80 non-control custom windows.)
81
82 * Either override or inherit a meaningful DoGetBestSize method
83 that calculates whatever size is "best" for the control. Once
84 that size is calculated then there should normally be a call to
85 CacheBestSize to save it for later use, unless for some reason
86 you want the best size to be recalculated on every layout.
87
88 * Any method that changes the attributes of the control such that
89 the best size will change should call InvalidateBestSize so it
90 will be recalculated the next time it is needed.
91
92 * The control's constructor and/or Create method should ensure
93 that the minsize is set to the size passed in, and that the
94 control is sized to a blending of the min size and best size.
95 This can be done by calling SetBestFittingSize.
96
97 \subsubsection{Massive wxURL Rewrite}
98
99 wxURL has undergone some radical changes.
100
101 * Many accessors of wxURL - GetHostName, GetProtocolName, and GetPath,
102 have been replaced by its parent's (wxURI) counterparts - GetServer,
103 GetScheme, and GetPath, respectively.
104
105 * ConvertToValidURI has been replaced by wxURI. Do not use
106 ConvertToValidURI for future applications.
107
108 * ConvertFromURI has been replaced by wxURI::Unescape.
109
110 \subsubsection{Less drastic incompatable changes since 2.4.x}
111
112 - no initialization/cleanup can be done in wxApp/~wxApp because they are
113 now called much earlier/later than before; please move any exiting code
114 from there to wxApp::OnInit()/OnExit()
115
116 - also, OnExit() is not called if OnInit() fails
117
118 - finally the program exit code is OnRun() return value, not OnExit() one
119
120 - wxTheApp can't be assigned to any longer, use wxApp::SetInstance() instead
121
122 - wxFileType::GetIcon() returns wxIconLocation, not wxIcon
123
124 - wxColourDatabase is not a wxList any more, use AddColour to add new colours
125
126 - wxWindow::Clear() is now called ClearBackground()
127
128 - pointer returned by wxFont::GetNativeFontInfo() must not be deleted now
129
130 - wxMouseEvent::Moving() doesn't return true if mouse is being dragged any more
131
132 - (most) controls now inherit parents colours by default, override
133 ShouldInheritColours() to return false if you don't want this to happen
134
135 - wxApp::SendIdleEvent() now takes 2 arguments
136
137 - wxTabView::GetLayers() changed return type from wxList& to wxTabLayerList&
138 (when WXWIN\_COMPATIBILITY\_2\_4 == 0)
139
140 - wxID\_SEPARATOR (id used for the menu separators) value changed from -1 to -2
141
142 - wxGetNumberFromUser() is now in separate wx/numdlg.h, not wx/textdlg.h
143
144 - wxChoice and wxCombobox now handle their size in the same way as in all the
145 other ports under MSW, new code is actually correct but different from weird
146 stuff they were doing before so the behaviour of your programs might change
147
148 - wxTaskBarIcon objects must now be destroyed before the application can exit.
149 Previously, the application terminated if there were no top level windows;
150 now it terminates if there are no top level windows or taskbar icons left.
151
152 - wxZlibInputStream is not by default compatible with the output of the
153 2.4.x version of wxZlibOutputStream. However, there is a compatibility mode,
154 switched on by passing wxZLIB\_24COMPATIBLE to the constructor.
155
156 - when WXWIN\_COMPATIBILITY\_2\_4 == 0 wxHashTable uses a new implementation
157 not using wxList keyed interface (the same used when wxUSE\_STL == 1),
158 the only incompatibility being that Next() returns a wxHashTable::Node*
159 instead of a wxNode*.
160
161 - non-const wxDC methods GetBackground(), GetBrush(), GetFont() and GetPen()
162 as well as wxWindow methods GetFont() and GetCursor() don't exist any more,
163 please fix your code -- it never worked correctly anyhow if you modified the
164 objects returned by these methods so you should simply switch to using const
165 methods.
166
167 - wxWindow::GetFont() now returns wxFont object instead of reference
168
169 - EVT\_XXX macros are now type-safe; code that uses wrong type for event
170 handler's argument will no longer compile.
171
172 - Identical functionality of wxFileDialog::ParseWildcard,
173 wxGenericDirCtrl::ParseFilter, Motif and MSW parsing native dialogs
174 is now accessible in ::wxParseCommonDialogsFilter
175
176 - wxNotebookSizer and wxBookCtrlSizer are now deprecated -- they are no longer
177 needed, you can treat wxNotebook as any other control and put it directly
178 into the sizer that was wxNotebookSizer's parent sizer in old code.
179
180 - wxFile methods now return either wxFileOffset or wxFileSize\_t which may be a
181 64 bit integer type, even on 32 bit platforms, instead of off\_t and so the
182 return value of wxFile::Length(), for example, shouldn't be assigned to off\_t
183 variable any more (the compiler might warn you about this)
184
185 - wxListItem::m\_data is now of type wxUIntPtr, not long, for compatibility
186 with 64 bit systems
187
188 - wxSizer::Add/Insert returns pointer to wxSizerItem just added so conditions
189 writeen with if(Add(..)==true) will not work. Use if(Add(..)) instead.
190
191 \subsection{Depreciated changes since 2.4.x}
192
193 - wxURL::GetInputStream() and similar functionality has been depreciated in
194 favor of other ways of connecting, such as though sockets or wxFileSystem.
195
196 - wxDocManager::GetNoHistoryFiles() renamed to GetHistoryFilesCount()
197
198 - wxSizer::Remove(wxWindow *), use Detach() instead [it is more clear]
199
200 - wxSizer::Set/GetOption(): use Set/GetProportion() instead
201
202 - wxKeyEvent::KeyCode(): use GetKeyCode instead
203
204 - wxList::Number, First, Last, Nth: use GetCount, GetFirst/Last, Item instead
205
206 - wxNode::Next, Previous, Data: use GetNext, GetPrevious, GetData instead
207
208 - wxListBase::operator wxList&(): use typesafe lists instead
209
210 - wxTheFontMapper: use wxFontMapper::Get() instead
211
212 - wxStringHashTable: use wxHashMap instead
213
214 - wxHashTableLong: use wxHashMap instead
215
216 - wxArrayString::GetStringArray: use wxCArrayString or alternative wxWidgets
217 methods taking wxArrayString
218
219 - wxArrayString::Remove(index, count): use RemoveAt instead
220
221 - wxTreeItemId conversion to long is deprecated and shouldn't be used
222
223 - wxTreeCtrl::GetFirst/NextChild() 2nd argument now has type wxTreeItemIdValue
224 and not long, please change declarations of "cookie"s in your code
225 accordingly -- otherwise your code won't work on 64 bit platforms
226
227 - [MSW only] wxWindow::GetUseCtl3D(), GetTransparentBackground() and
228 SetTransparent() as well as wxNO\_3D and wxUSER\_COLOURS styles
229
230 - wxList keyed interface: use wxHashMap instead
231
232 - wxColourDatabase::FindColour(): use Find() instead (NB: different ret type)
233
234 - wxHashTable::Next: use wxHashTable::Node* or
235 wxHashTable::compatibility\_iterator to store the return
236 value
237
238 - wxWave class; use wxSound instead
239
240 - The wxHIDE\_READONLY flag for wxFileDialog was not implemented
241 and has now been removed
242
243 - wxTaskBarIcon::OnXXX() virtual methods: use events instead
244
245 - obsolete and not used wxUSE\_GENERIC\_DIALOGS\_IN\_MSW has been removed
246
247 - wxDbTable::wxDbTable with wxChar* deprecated, same with wxString& instead