wxrust_base/generated/methods_d.rs
1use super::*;
2
3// wxDateTime
4/// This trait represents [C++ `wxDateTime` class](https://docs.wxwidgets.org/3.2/classwx_date_time.html)'s methods and inheritance.
5///
6/// See [`DateTimeIsOwned`] documentation for the class usage.
7pub trait DateTimeMethods: WxRustMethods {
8 /// Reset time to midnight (00:00:00) without changing the date.
9 ///
10 /// See [C++ `wxDateTime::ResetTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#acb537b1ef0b83b5a6724140c823a547c).
11 fn reset_time(&self) -> &Self {
12 unsafe {
13 ffi::wxDateTime_ResetTime(self.as_ptr());
14 &self
15 }
16 }
17 // NOT_SUPPORTED: fn Set()
18 // BLOCKED: fn Set1()
19 /// Sets the date and time from the broken down representation in the wxDateTime::Tm structure.
20 ///
21 /// See [C++ `wxDateTime::Set()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aceceac43ca2c9741401e7e34c588f087).
22 fn set_tm(&self, tm: *const c_void) -> &Self {
23 unsafe {
24 ffi::wxDateTime_Set2(self.as_ptr(), tm);
25 &self
26 }
27 }
28 /// Sets the date from the so-called Julian Day Number.
29 ///
30 /// See [C++ `wxDateTime::Set()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ae24090c2c5f3ab830d5edacc2c075f60).
31 fn set_double(&self, jdn: c_double) -> &Self {
32 unsafe {
33 ffi::wxDateTime_Set3(self.as_ptr(), jdn);
34 &self
35 }
36 }
37 // NOT_SUPPORTED: fn Set4()
38 // NOT_SUPPORTED: fn Set5()
39 // NOT_SUPPORTED: fn SetDay()
40 // NOT_SUPPORTED: fn SetFromDOS()
41 // NOT_SUPPORTED: fn SetHour()
42 // NOT_SUPPORTED: fn SetMillisecond()
43 // NOT_SUPPORTED: fn SetMinute()
44 // NOT_SUPPORTED: fn SetMonth()
45 // NOT_SUPPORTED: fn SetSecond()
46 /// Sets the date and time of to the current values.
47 ///
48 /// See [C++ `wxDateTime::SetToCurrent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a10db5e371bada75b91435f4367cbdaa1).
49 fn set_to_current(&self) -> &Self {
50 unsafe {
51 ffi::wxDateTime_SetToCurrent(self.as_ptr());
52 &self
53 }
54 }
55 /// Sets the year without changing other date components.
56 ///
57 /// See [C++ `wxDateTime::SetYear()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ab574229577dcf8b1e430873f6701fa43).
58 fn set_year(&self, year: c_int) -> &Self {
59 unsafe {
60 ffi::wxDateTime_SetYear(self.as_ptr(), year);
61 &self
62 }
63 }
64 // NOT_SUPPORTED: fn operator=()
65 // BLOCKED: fn operator=1()
66 // NOT_SUPPORTED: fn GetAsDOS()
67 /// Initialize using the Windows SYSTEMTIME structure.
68 ///
69 /// See [C++ `wxDateTime::SetFromMSWSysTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ae6eb1bdd0c691d82493a40e714705860).
70 fn set_from_msw_sys_time(&self, st: *const c_void) -> &Self {
71 unsafe {
72 ffi::wxDateTime_SetFromMSWSysTime(self.as_ptr(), st);
73 &self
74 }
75 }
76 /// Returns the date and time in the Windows SYSTEMTIME format.
77 ///
78 /// See [C++ `wxDateTime::GetAsMSWSysTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a9f760ab782406fd9d4db1e983b5490c3).
79 fn get_as_msw_sys_time(&self, st: *mut c_void) {
80 unsafe { ffi::wxDateTime_GetAsMSWSysTime(self.as_ptr(), st) }
81 }
82 /// Returns the century of this date.
83 ///
84 /// See [C++ `wxDateTime::GetCentury()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a7646edf22af11b72e503046c0bff3e17).
85 fn get_century_timezone(&self, tz: *const c_void) -> c_int {
86 unsafe { ffi::wxDateTime_GetCentury(self.as_ptr(), tz) }
87 }
88 /// Returns the object having the same date component as this one but time of 00:00:00.
89 ///
90 /// See [C++ `wxDateTime::GetDateOnly()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a347ff4b250b96471b4ba10806b5e9fc4).
91 fn get_date_only(&self) -> DateTime {
92 unsafe { DateTime::from_ptr(ffi::wxDateTime_GetDateOnly(self.as_ptr())) }
93 }
94 // NOT_SUPPORTED: fn GetDay()
95 // NOT_SUPPORTED: fn GetDayOfYear()
96 // NOT_SUPPORTED: fn GetHour()
97 // NOT_SUPPORTED: fn GetMillisecond()
98 // NOT_SUPPORTED: fn GetMinute()
99 // NOT_SUPPORTED: fn GetMonth()
100 // NOT_SUPPORTED: fn GetSecond()
101 // NOT_SUPPORTED: fn GetTicks()
102 // NOT_SUPPORTED: fn GetValue()
103 // NOT_SUPPORTED: fn GetTm()
104 // NOT_SUPPORTED: fn GetWeekDay()
105 /// Returns the year to which the week containing this date belongs.
106 ///
107 /// See [C++ `wxDateTime::GetWeekBasedYear()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ad083f14ab1094ed025f1634523f2ea44).
108 fn get_week_based_year(&self, tz: *const c_void) -> c_int {
109 unsafe { ffi::wxDateTime_GetWeekBasedYear(self.as_ptr(), tz) }
110 }
111 // NOT_SUPPORTED: fn GetWeekOfMonth()
112 // NOT_SUPPORTED: fn GetWeekOfYear()
113 /// Returns the year in the given timezone (local one by default).
114 ///
115 /// See [C++ `wxDateTime::GetYear()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ab20a8e0aa4aefe4dda3f93b1e75123d3).
116 fn get_year(&self, tz: *const c_void) -> c_int {
117 unsafe { ffi::wxDateTime_GetYear(self.as_ptr(), tz) }
118 }
119 /// Returns true if the object represents a valid time moment.
120 ///
121 /// See [C++ `wxDateTime::IsValid()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#afd5350c926b486e77478d7c7d4fd7b9c).
122 fn is_valid(&self) -> bool {
123 unsafe { ffi::wxDateTime_IsValid(self.as_ptr()) }
124 }
125 // NOT_SUPPORTED: fn IsWorkDay()
126 /// Returns true if this date precedes the given one.
127 ///
128 /// See [C++ `wxDateTime::IsEarlierThan()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a6d83ca062bb51235db017b3d855dbb5d).
129 fn is_earlier_than<D: DateTimeMethods>(&self, datetime: &D) -> bool {
130 unsafe {
131 let datetime = datetime.as_ptr();
132 ffi::wxDateTime_IsEarlierThan(self.as_ptr(), datetime)
133 }
134 }
135 /// Returns true if the two dates are strictly identical.
136 ///
137 /// See [C++ `wxDateTime::IsEqualTo()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ac0cefa368b364f2bde861b668fb1b71f).
138 fn is_equal_to<D: DateTimeMethods>(&self, datetime: &D) -> bool {
139 unsafe {
140 let datetime = datetime.as_ptr();
141 ffi::wxDateTime_IsEqualTo(self.as_ptr(), datetime)
142 }
143 }
144 /// Returns true if the date is equal to another one up to the given time interval, i.e. if the absolute difference between the two dates is less than this interval.
145 ///
146 /// See [C++ `wxDateTime::IsEqualUpTo()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aff57fac0e65af21cb4d55b83a3aed269).
147 fn is_equal_up_to<D: DateTimeMethods>(&self, dt: &D, ts: *const c_void) -> bool {
148 unsafe {
149 let dt = dt.as_ptr();
150 ffi::wxDateTime_IsEqualUpTo(self.as_ptr(), dt, ts)
151 }
152 }
153 /// Returns true if this date is later than the given one.
154 ///
155 /// See [C++ `wxDateTime::IsLaterThan()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a4d3321c1e76f4c132fd2d0b302498824).
156 fn is_later_than<D: DateTimeMethods>(&self, datetime: &D) -> bool {
157 unsafe {
158 let datetime = datetime.as_ptr();
159 ffi::wxDateTime_IsLaterThan(self.as_ptr(), datetime)
160 }
161 }
162 /// Returns true if the date is the same without comparing the time parts.
163 ///
164 /// See [C++ `wxDateTime::IsSameDate()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#abb147359541012d11ca48f6db2be7c32).
165 fn is_same_date<D: DateTimeMethods>(&self, dt: &D) -> bool {
166 unsafe {
167 let dt = dt.as_ptr();
168 ffi::wxDateTime_IsSameDate(self.as_ptr(), dt)
169 }
170 }
171 /// Returns true if the time is the same (although dates may differ).
172 ///
173 /// See [C++ `wxDateTime::IsSameTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a7d22bbf0ccab5c71a7173d8fa8a7cd41).
174 fn is_same_time<D: DateTimeMethods>(&self, dt: &D) -> bool {
175 unsafe {
176 let dt = dt.as_ptr();
177 ffi::wxDateTime_IsSameTime(self.as_ptr(), dt)
178 }
179 }
180 /// Returns true if this date lies strictly between the two given dates.
181 ///
182 /// See [C++ `wxDateTime::IsStrictlyBetween()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a550f265925b235de51e99a50222963fa).
183 fn is_strictly_between<D: DateTimeMethods, D2: DateTimeMethods>(
184 &self,
185 t1: &D,
186 t2: &D2,
187 ) -> bool {
188 unsafe {
189 let t1 = t1.as_ptr();
190 let t2 = t2.as_ptr();
191 ffi::wxDateTime_IsStrictlyBetween(self.as_ptr(), t1, t2)
192 }
193 }
194 /// Returns true if IsStrictlyBetween() is true or if the date is equal to one of the limit values.
195 ///
196 /// See [C++ `wxDateTime::IsBetween()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a0a5d356a798f5c95c729e6b5193dd9b1).
197 fn is_between<D: DateTimeMethods, D2: DateTimeMethods>(&self, t1: &D, t2: &D2) -> bool {
198 unsafe {
199 let t1 = t1.as_ptr();
200 let t2 = t2.as_ptr();
201 ffi::wxDateTime_IsBetween(self.as_ptr(), t1, t2)
202 }
203 }
204 // BLOCKED: fn Add()
205 /// Adds the given date span to this object.
206 ///
207 /// See [C++ `wxDateTime::Add()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a18e32b187b6d6c94be921d4716b6366f).
208 fn add_datespan(&self, diff: *const c_void) -> &Self {
209 unsafe {
210 ffi::wxDateTime_Add1(self.as_ptr(), diff);
211 &self
212 }
213 }
214 // BLOCKED: fn Add2()
215 /// Adds the given time span to this object.
216 ///
217 /// See [C++ `wxDateTime::Add()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ab4cae178a6004ba47a6fbac302c35d3d).
218 fn add_timespan(&self, diff: *const c_void) -> &Self {
219 unsafe {
220 ffi::wxDateTime_Add3(self.as_ptr(), diff);
221 &self
222 }
223 }
224 // BLOCKED: fn Subtract()
225 /// Subtracts the given time span from this object.
226 ///
227 /// See [C++ `wxDateTime::Subtract()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a78a988d03c8cca570d2f0294d987bc24).
228 fn subtract_timespan(&self, diff: *const c_void) -> &Self {
229 unsafe {
230 ffi::wxDateTime_Subtract1(self.as_ptr(), diff);
231 &self
232 }
233 }
234 // BLOCKED: fn Subtract2()
235 /// Subtracts the given date span from this object.
236 ///
237 /// See [C++ `wxDateTime::Subtract()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aa8405d7b2d413775039a8ef5d65b9b80).
238 fn subtract_datespan(&self, diff: *const c_void) -> &Self {
239 unsafe {
240 ffi::wxDateTime_Subtract3(self.as_ptr(), diff);
241 &self
242 }
243 }
244 // NOT_SUPPORTED: fn Subtract4()
245 // NOT_SUPPORTED: fn DiffAsDateSpan()
246 // BLOCKED: fn operator+=()
247 // BLOCKED: fn operator+()
248 // BLOCKED: fn operator-=()
249 // BLOCKED: fn operator-()
250 // BLOCKED: fn operator+=1()
251 // BLOCKED: fn operator+1()
252 // BLOCKED: fn operator-=1()
253 // BLOCKED: fn operator-1()
254 // NOT_SUPPORTED: fn operator-2()
255 /// This function does the same as the standard ANSI C strftime(3) function (http://www.cplusplus.com/reference/clibrary/ctime/strftime.html).
256 ///
257 /// See [C++ `wxDateTime::Format()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a6a60f071d74712eba58153113f5af23a).
258 fn format(&self, format: &str, tz: *const c_void) -> String {
259 unsafe {
260 let format = WxString::from(format);
261 let format = format.as_ptr();
262 WxString::from_ptr(ffi::wxDateTime_Format(self.as_ptr(), format, tz)).into()
263 }
264 }
265 /// Identical to calling Format() with "%x" argument (which means "preferred date representation for the current locale").
266 ///
267 /// See [C++ `wxDateTime::FormatDate()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aeca948cb9628daabf2953a6a635a74b3).
268 fn format_date(&self) -> String {
269 unsafe { WxString::from_ptr(ffi::wxDateTime_FormatDate(self.as_ptr())).into() }
270 }
271 // NOT_SUPPORTED: fn FormatISOCombined()
272 /// This function returns the date representation in the ISO 8601 format "YYYY-MM-DD".
273 ///
274 /// See [C++ `wxDateTime::FormatISODate()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aed6224e62881d28d60e54eefcb6798f1).
275 fn format_iso_date(&self) -> String {
276 unsafe { WxString::from_ptr(ffi::wxDateTime_FormatISODate(self.as_ptr())).into() }
277 }
278 /// This function returns the time representation in the ISO 8601 format "HH:MM:SS".
279 ///
280 /// See [C++ `wxDateTime::FormatISOTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aa370d17862e81fb89d78e6e087374320).
281 fn format_iso_time(&self) -> String {
282 unsafe { WxString::from_ptr(ffi::wxDateTime_FormatISOTime(self.as_ptr())).into() }
283 }
284 /// Identical to calling Format() with "%X" argument (which means "preferred time representation for the current locale").
285 ///
286 /// See [C++ `wxDateTime::FormatTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a6f9e71f21079e007368040322005804f).
287 fn format_time(&self) -> String {
288 unsafe { WxString::from_ptr(ffi::wxDateTime_FormatTime(self.as_ptr())).into() }
289 }
290 // BLOCKED: fn ParseDate()
291 /// Parses the string datetime containing the date and time in free format.
292 ///
293 /// See [C++ `wxDateTime::ParseDateTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a332a41f998bc3be6c0a9a81449112485).
294 fn parse_date_time(&self, datetime: &str, end: *mut c_void) -> bool {
295 unsafe {
296 let datetime = WxString::from(datetime);
297 let datetime = datetime.as_ptr();
298 ffi::wxDateTime_ParseDateTime(self.as_ptr(), datetime, end)
299 }
300 }
301 /// This function parses the string date according to the given format.
302 ///
303 /// See [C++ `wxDateTime::ParseFormat()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a5d01d56c310d505a093f1a7f25086a1b).
304 fn parse_format<D: DateTimeMethods>(
305 &self,
306 date: &str,
307 format: &str,
308 date_def: &D,
309 end: *mut c_void,
310 ) -> bool {
311 unsafe {
312 let date = WxString::from(date);
313 let date = date.as_ptr();
314 let format = WxString::from(format);
315 let format = format.as_ptr();
316 let date_def = date_def.as_ptr();
317 ffi::wxDateTime_ParseFormat(self.as_ptr(), date, format, date_def, end)
318 }
319 }
320 // BLOCKED: fn ParseFormat1()
321 // BLOCKED: fn ParseFormat2()
322 // NOT_SUPPORTED: fn ParseISOCombined()
323 /// This function parses the date in ISO 8601 format "YYYY-MM-DD".
324 ///
325 /// See [C++ `wxDateTime::ParseISODate()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a416e9e5e7395dd11a059cd116da7e6a2).
326 fn parse_iso_date(&self, date: &str) -> bool {
327 unsafe {
328 let date = WxString::from(date);
329 let date = date.as_ptr();
330 ffi::wxDateTime_ParseISODate(self.as_ptr(), date)
331 }
332 }
333 /// This function parses the time in ISO 8601 format "HH:MM:SS".
334 ///
335 /// See [C++ `wxDateTime::ParseISOTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#adc4c1fb178f73958b151eabd36625f59).
336 fn parse_iso_time(&self, date: &str) -> bool {
337 unsafe {
338 let date = WxString::from(date);
339 let date = date.as_ptr();
340 ffi::wxDateTime_ParseISOTime(self.as_ptr(), date)
341 }
342 }
343 /// Parses the string date looking for a date formatted according to the RFC 822 in it.
344 ///
345 /// See [C++ `wxDateTime::ParseRfc822Date()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ab0f2485c52d0d3cf0196aaf0062d2f83).
346 fn parse_rfc822_date(&self, date: &str, end: *mut c_void) -> bool {
347 unsafe {
348 let date = WxString::from(date);
349 let date = date.as_ptr();
350 ffi::wxDateTime_ParseRfc822Date(self.as_ptr(), date, end)
351 }
352 }
353 /// This functions is like ParseDateTime(), but only allows the time to be specified in the input string.
354 ///
355 /// See [C++ `wxDateTime::ParseTime()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ac903b3227620e1b88019e76b807327e8).
356 fn parse_time(&self, time: &str, end: *mut c_void) -> bool {
357 unsafe {
358 let time = WxString::from(time);
359 let time = time.as_ptr();
360 ffi::wxDateTime_ParseTime(self.as_ptr(), time, end)
361 }
362 }
363 // NOT_SUPPORTED: fn GetLastMonthDay()
364 // NOT_SUPPORTED: fn GetLastWeekDay()
365 // NOT_SUPPORTED: fn GetNextWeekDay()
366 // NOT_SUPPORTED: fn GetPrevWeekDay()
367 // NOT_SUPPORTED: fn GetWeekDay1()
368 // NOT_SUPPORTED: fn GetWeekDayInSameWeek()
369 // NOT_SUPPORTED: fn GetYearDay()
370 // NOT_SUPPORTED: fn SetToLastMonthDay()
371 // NOT_SUPPORTED: fn SetToLastWeekDay()
372 // NOT_SUPPORTED: fn SetToNextWeekDay()
373 // NOT_SUPPORTED: fn SetToPrevWeekDay()
374 // NOT_SUPPORTED: fn SetToWeekDay()
375 // NOT_SUPPORTED: fn SetToWeekDayInSameWeek()
376 // NOT_SUPPORTED: fn SetToYearDay()
377 /// Synonym for GetJulianDayNumber().
378 ///
379 /// See [C++ `wxDateTime::GetJDN()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a0dd134019f8aa14da326f692575cbd22).
380 fn get_jdn(&self) -> c_double {
381 unsafe { ffi::wxDateTime_GetJDN(self.as_ptr()) }
382 }
383 /// Returns the JDN corresponding to this date.
384 ///
385 /// See [C++ `wxDateTime::GetJulianDayNumber()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a32b6bf7b2af58f8f3430796008544943).
386 fn get_julian_day_number(&self) -> c_double {
387 unsafe { ffi::wxDateTime_GetJulianDayNumber(self.as_ptr()) }
388 }
389 /// Synonym for GetModifiedJulianDayNumber().
390 ///
391 /// See [C++ `wxDateTime::GetMJD()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#afd05be08550faff9bd1001c91313e637).
392 fn get_mjd(&self) -> c_double {
393 unsafe { ffi::wxDateTime_GetMJD(self.as_ptr()) }
394 }
395 /// Returns the "Modified Julian Day Number" (MJD) which is, by definition, is equal to JDN - 2400000.5.
396 ///
397 /// See [C++ `wxDateTime::GetModifiedJulianDayNumber()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ab44bcea2d91e3562217e83f4a4c583ac).
398 fn get_modified_julian_day_number(&self) -> c_double {
399 unsafe { ffi::wxDateTime_GetModifiedJulianDayNumber(self.as_ptr()) }
400 }
401 /// Return the Rata Die number of this date.
402 ///
403 /// See [C++ `wxDateTime::GetRataDie()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a77384d94d7fbbb393c5b3ac239e744e5).
404 fn get_rata_die(&self) -> c_double {
405 unsafe { ffi::wxDateTime_GetRataDie(self.as_ptr()) }
406 }
407 /// Transform the date from the given time zone to the local one.
408 ///
409 /// See [C++ `wxDateTime::FromTimezone()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a64ecc639352e2fdb393d07131ef1f402).
410 fn from_timezone(&self, tz: *const c_void, no_dst: bool) -> DateTime {
411 unsafe { DateTime::from_ptr(ffi::wxDateTime_FromTimezone(self.as_ptr(), tz, no_dst)) }
412 }
413 // NOT_SUPPORTED: fn IsDST()
414 /// Same as FromTimezone() but modifies the object in place.
415 ///
416 /// See [C++ `wxDateTime::MakeFromTimezone()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ac3311659f9a0c46a19a563e683f076b8).
417 fn make_from_timezone(&self, tz: *const c_void, no_dst: bool) -> &Self {
418 unsafe {
419 ffi::wxDateTime_MakeFromTimezone(self.as_ptr(), tz, no_dst);
420 &self
421 }
422 }
423 /// Modifies the object in place to represent the date in another time zone.
424 ///
425 /// See [C++ `wxDateTime::MakeTimezone()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a4782b88f89f129c7e8127716cf3df58b).
426 fn make_timezone(&self, tz: *const c_void, no_dst: bool) -> &Self {
427 unsafe {
428 ffi::wxDateTime_MakeTimezone(self.as_ptr(), tz, no_dst);
429 &self
430 }
431 }
432 /// This is the same as calling MakeTimezone() with the argument GMT0.
433 ///
434 /// See [C++ `wxDateTime::MakeUTC()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a6c2fdc74ad77726e164b8139fbf2eaf3).
435 fn make_utc(&self, no_dst: bool) -> &Self {
436 unsafe {
437 ffi::wxDateTime_MakeUTC(self.as_ptr(), no_dst);
438 &self
439 }
440 }
441 /// Transform the date to the given time zone.
442 ///
443 /// See [C++ `wxDateTime::ToTimezone()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ac7c94044cece74f9e8b357204c460f5f).
444 fn to_timezone(&self, tz: *const c_void, no_dst: bool) -> DateTime {
445 unsafe { DateTime::from_ptr(ffi::wxDateTime_ToTimezone(self.as_ptr(), tz, no_dst)) }
446 }
447 /// This is the same as calling ToTimezone() with the argument GMT0.
448 ///
449 /// See [C++ `wxDateTime::ToUTC()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a528886a6a80ec4490b2a16679c10a683).
450 fn to_utc(&self, no_dst: bool) -> DateTime {
451 unsafe { DateTime::from_ptr(ffi::wxDateTime_ToUTC(self.as_ptr(), no_dst)) }
452 }
453 /// Converts the year in absolute notation (i.e. a number which can be negative, positive or zero) to the year in BC/AD notation.
454 ///
455 /// See [C++ `wxDateTime::ConvertYearToBC()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a52e2fe22ededf8aaf3922a3e8136ddb0).
456 fn convert_year_to_bc(year: c_int) -> c_int {
457 unsafe { ffi::wxDateTime_ConvertYearToBC(year) }
458 }
459 /// Returns the translations of the strings AM and PM used for time formatting for the current locale.
460 ///
461 /// See [C++ `wxDateTime::GetAmPmStrings()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a9ef535b0db4eeb117858a5b31ac00ae5).
462 fn get_am_pm_strings(am: *mut c_void, pm: *mut c_void) {
463 unsafe { ffi::wxDateTime_GetAmPmStrings(am, pm) }
464 }
465 // NOT_SUPPORTED: fn GetBeginDST()
466 // NOT_SUPPORTED: fn GetEndDST()
467 /// Get the current century, i.e. first two digits of the year, in given calendar (only Gregorian is currently supported).
468 ///
469 /// See [C++ `wxDateTime::GetCentury()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#aa7da8657207e8872291e757bc6065b61).
470 fn get_century_int(year: c_int) -> c_int {
471 unsafe { ffi::wxDateTime_GetCentury1(year) }
472 }
473 // NOT_SUPPORTED: fn GetCountry()
474 // NOT_SUPPORTED: fn GetCurrentMonth()
475 // NOT_SUPPORTED: fn GetCurrentYear()
476 // NOT_SUPPORTED: fn GetEnglishMonthName()
477 // NOT_SUPPORTED: fn GetEnglishWeekDayName()
478 // NOT_SUPPORTED: fn GetMonthName()
479 // NOT_SUPPORTED: fn GetNumberOfDays()
480 // NOT_SUPPORTED: fn GetNumberOfDays1()
481 // NOT_SUPPORTED: fn GetTimeNow()
482 // BLOCKED: fn GetTmNow()
483 /// Returns the current time broken down.
484 ///
485 /// See [C++ `wxDateTime::GetTmNow()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ae55f6ba5606beb7a16e8eae572c90c52).
486 fn get_tm_now() -> *mut c_void {
487 unsafe { ffi::wxDateTime_GetTmNow1() }
488 }
489 // NOT_SUPPORTED: fn GetWeekDayName()
490 // NOT_SUPPORTED: fn IsDSTApplicable()
491 /// Acquires the first weekday of a week based on locale and/or OS settings.
492 ///
493 /// See [C++ `wxDateTime::GetFirstWeekDay()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#ae192eb65585f8b80e127c96ec1f97e83).
494 fn get_first_week_day(first_day: *mut c_void) -> bool {
495 unsafe { ffi::wxDateTime_GetFirstWeekDay(first_day) }
496 }
497 // NOT_SUPPORTED: fn IsLeapYear()
498 // NOT_SUPPORTED: fn IsWestEuropeanCountry()
499 /// Returns the object corresponding to the current time in local time zone.
500 ///
501 /// See [C++ `wxDateTime::Now()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a6e6c37a0414bb4831e2cc03b37f498a2).
502 fn now() -> DateTime {
503 unsafe { DateTime::from_ptr(ffi::wxDateTime_Now()) }
504 }
505 // NOT_SUPPORTED: fn SetCountry()
506 // NOT_SUPPORTED: fn SetToWeekOfYear()
507 /// Returns the object corresponding to the midnight of the current day (i.e. the same as Now(), but the time part is set to 0).
508 ///
509 /// See [C++ `wxDateTime::Today()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#af730202238b9acd5a5df2977fa40c569).
510 fn today() -> DateTime {
511 unsafe { DateTime::from_ptr(ffi::wxDateTime_Today()) }
512 }
513 /// Returns the object corresponding to the current time including the milliseconds.
514 ///
515 /// See [C++ `wxDateTime::UNow()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_date_time.html#a0db1c9bac7b2d27d589cad2a38d1438c).
516 fn u_now() -> DateTime {
517 unsafe { DateTime::from_ptr(ffi::wxDateTime_UNow()) }
518 }
519}