wxrust_base/generated/
methods_o.rs

1use super::*;
2
3// wxObject
4/// This trait represents [C++ `wxObject` class](https://docs.wxwidgets.org/3.2/classwx_object.html)'s methods and inheritance.
5///
6/// See [`ObjectIsOwned`] documentation for the class usage.
7pub trait ObjectMethods: WxRustMethods {
8    // DTOR: fn ~wxObject()
9    /// This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
10    ///
11    /// See [C++ `wxObject::GetClassInfo()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#a9fd1bc8bc3a47c6e14e679a80e3cb8f4).
12    fn get_class_info(&self) -> Option<ClassInfoIsOwned<false>> {
13        unsafe { ClassInfo::option_from(ffi::wxObject_GetClassInfo(self.as_ptr())) }
14    }
15    /// Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
16    ///
17    /// See [C++ `wxObject::GetRefData()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#a0e06d77b52ee4c44a31c7cb62c9a4b68).
18    fn get_ref_data(&self) -> Option<ObjectRefDataIsOwned<false>> {
19        unsafe { ObjectRefData::option_from(ffi::wxObject_GetRefData(self.as_ptr())) }
20    }
21    /// Determines whether this class is a subclass of (or the same class as) the given class.
22    ///
23    /// See [C++ `wxObject::IsKindOf()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#a3c7115ef4132dcee0c4fc34e84d7fced).
24    fn is_kind_of<C: ClassInfoMethods>(&self, info: Option<&C>) -> bool {
25        unsafe {
26            let info = match info {
27                Some(r) => r.as_ptr(),
28                None => ptr::null_mut(),
29            };
30            ffi::wxObject_IsKindOf(self.as_ptr(), info)
31        }
32    }
33    /// Returns true if this object has the same data pointer as obj.
34    ///
35    /// See [C++ `wxObject::IsSameAs()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#a059373c494c2369d7db2a556efef8ecf).
36    fn is_same_as<O: ObjectMethods>(&self, obj: &O) -> bool {
37        unsafe {
38            let obj = obj.as_ptr();
39            ffi::wxObject_IsSameAs(self.as_ptr(), obj)
40        }
41    }
42    /// Makes this object refer to the data in clone.
43    ///
44    /// See [C++ `wxObject::Ref()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#a2f6f1aa51fe9fc2b1415ca4211a90e9e).
45    fn ref_<O: ObjectMethods>(&self, clone: &O) {
46        unsafe {
47            let clone = clone.as_ptr();
48            ffi::wxObject_Ref(self.as_ptr(), clone)
49        }
50    }
51    /// Sets the wxObject::m_refData pointer.
52    ///
53    /// See [C++ `wxObject::SetRefData()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#afab780710f2adc1bb33310e27590140b).
54    fn set_ref_data<O: ObjectRefDataMethods>(&self, data: Option<&O>) {
55        unsafe {
56            let data = match data {
57                Some(r) => r.as_ptr(),
58                None => ptr::null_mut(),
59            };
60            ffi::wxObject_SetRefData(self.as_ptr(), data)
61        }
62    }
63    /// Decrements the reference count in the associated data, and if it is zero, deletes the data.
64    ///
65    /// See [C++ `wxObject::UnRef()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#af51efc6b1ae632fc7f0cd7ebbce9fa36).
66    fn un_ref(&self) {
67        unsafe { ffi::wxObject_UnRef(self.as_ptr()) }
68    }
69    /// This is the same of AllocExclusive() but this method is public.
70    ///
71    /// See [C++ `wxObject::UnShare()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_object.html#a74b40e42d19a4b9e9bec0b57d62a5725).
72    fn un_share(&self) {
73        unsafe { ffi::wxObject_UnShare(self.as_ptr()) }
74    }
75    // BLOCKED: fn operator delete()
76    // BLOCKED: fn operator new()
77}
78
79// wxObjectRefData
80/// This trait represents [C++ `wxObjectRefData` class](https://docs.wxwidgets.org/3.2/classwx_object_ref_data.html)'s methods and inheritance.
81///
82/// See [`ObjectRefDataIsOwned`] documentation for the class usage.
83pub trait ObjectRefDataMethods: WxRustMethods {}