wxrust_base/generated/
methods_e.rs

1use super::*;
2
3// wxEvent
4/// This trait represents [C++ `wxEvent` class](https://docs.wxwidgets.org/3.2/classwx_event.html)'s methods and inheritance.
5///
6/// See [`EventIsOwned`] documentation for the class usage.
7pub trait EventMethods: ObjectMethods {
8    /// Returns a copy of the event.
9    ///
10    /// See [C++ `wxEvent::Clone()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a1458e0e59752bd8753ec20cb719e088b).
11    fn clone(&self) -> Event {
12        unsafe { Event::from_ptr(ffi::wxEvent_Clone(self.as_ptr())) }
13    }
14    /// Returns the object (usually a window) associated with the event, if any.
15    ///
16    /// See [C++ `wxEvent::GetEventObject()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a1ed12f8a9b61af6a76c6746cb8acfeae).
17    fn get_event_object(&self) -> Option<ObjectIsOwned<false>> {
18        unsafe { Object::option_from(ffi::wxEvent_GetEventObject(self.as_ptr())) }
19    }
20    // NOT_SUPPORTED: fn GetEventType()
21    // NOT_SUPPORTED: fn GetEventCategory()
22    /// Returns the identifier associated with this event, such as a button command id.
23    ///
24    /// See [C++ `wxEvent::GetId()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#ac5fa5c10d4845d903e58026a42b403c7).
25    fn get_id(&self) -> c_int {
26        unsafe { ffi::wxEvent_GetId(self.as_ptr()) }
27    }
28    /// Return the user data associated with a dynamically connected event handler.
29    ///
30    /// See [C++ `wxEvent::GetEventUserData()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#aa46a14bdca4d0ebcd4f42e5805db1df9).
31    fn get_event_user_data(&self) -> Option<ObjectIsOwned<false>> {
32        unsafe { Object::option_from(ffi::wxEvent_GetEventUserData(self.as_ptr())) }
33    }
34    /// Returns true if the event handler should be skipped, false otherwise.
35    ///
36    /// See [C++ `wxEvent::GetSkipped()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#aa770dbcd0f1714ba097836af6534b4c5).
37    fn get_skipped(&self) -> bool {
38        unsafe { ffi::wxEvent_GetSkipped(self.as_ptr()) }
39    }
40    /// Gets the timestamp for the event.
41    ///
42    /// See [C++ `wxEvent::GetTimestamp()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a48662230971127737d2500cef7be549d).
43    fn get_timestamp(&self) -> c_long {
44        unsafe { ffi::wxEvent_GetTimestamp(self.as_ptr()) }
45    }
46    /// Returns true if the event is or is derived from wxCommandEvent else it returns false.
47    ///
48    /// See [C++ `wxEvent::IsCommandEvent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a31f6a4377d6d36964b8eae4e56ec43e0).
49    fn is_command_event(&self) -> bool {
50        unsafe { ffi::wxEvent_IsCommandEvent(self.as_ptr()) }
51    }
52    /// Sets the propagation level to the given value (for example returned from an earlier call to wxEvent::StopPropagation).
53    ///
54    /// See [C++ `wxEvent::ResumePropagation()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a0acb5c75f6e67b8822ad8ba3c5bdc4fe).
55    fn resume_propagation(&self, propagation_level: c_int) {
56        unsafe { ffi::wxEvent_ResumePropagation(self.as_ptr(), propagation_level) }
57    }
58    /// Sets the originating object.
59    ///
60    /// See [C++ `wxEvent::SetEventObject()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a3460217d04c36393ab868ba453fde13d).
61    fn set_event_object<O: ObjectMethods>(&self, object: Option<&O>) {
62        unsafe {
63            let object = match object {
64                Some(r) => r.as_ptr(),
65                None => ptr::null_mut(),
66            };
67            ffi::wxEvent_SetEventObject(self.as_ptr(), object)
68        }
69    }
70    // NOT_SUPPORTED: fn SetEventType()
71    /// Sets the identifier associated with this event, such as a button command id.
72    ///
73    /// See [C++ `wxEvent::SetId()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#ab9973f687bfa8a60318d8d9bd629d0d4).
74    fn set_id(&self, id: c_int) {
75        unsafe { ffi::wxEvent_SetId(self.as_ptr(), id) }
76    }
77    /// Sets the timestamp for the event.
78    ///
79    /// See [C++ `wxEvent::SetTimestamp()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#ad4380dff3144a986cb960473051a1d8d).
80    fn set_timestamp(&self, time_stamp: c_long) {
81        unsafe { ffi::wxEvent_SetTimestamp(self.as_ptr(), time_stamp) }
82    }
83    /// Test if this event should be propagated or not, i.e. if the propagation level is currently greater than 0.
84    ///
85    /// See [C++ `wxEvent::ShouldPropagate()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#ac7a178c3c781c80f1308945042f76e7f).
86    fn should_propagate(&self) -> bool {
87        unsafe { ffi::wxEvent_ShouldPropagate(self.as_ptr()) }
88    }
89    /// This method can be used inside an event handler to control whether further event handlers bound to this event will be called after the current one returns.
90    ///
91    /// See [C++ `wxEvent::Skip()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a98eb20b76106f9a933c2eb3ee119f66c).
92    fn skip(&self, skip: bool) {
93        unsafe { ffi::wxEvent_Skip(self.as_ptr(), skip) }
94    }
95    /// Stop the event from propagating to its parent window.
96    ///
97    /// See [C++ `wxEvent::StopPropagation()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_event.html#a060a7d222404daff4d3cef30cddeaae3).
98    fn stop_propagation(&self) -> c_int {
99        unsafe { ffi::wxEvent_StopPropagation(self.as_ptr()) }
100    }
101}
102
103// wxEvtHandler
104/// This trait represents [C++ `wxEvtHandler` class](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html)'s methods and inheritance.
105///
106/// See [`EvtHandlerIsOwned`] documentation for the class usage.
107pub trait EvtHandlerMethods: ObjectMethods {
108    /// Queue event for a later processing.
109    ///
110    /// See [C++ `wxEvtHandler::QueueEvent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#acffd03bf407a856166ea71ef0318b59a).
111    fn queue_event<E: EventMethods>(&self, event: Option<&E>) {
112        unsafe {
113            let event = match event {
114                Some(r) => r.as_ptr(),
115                None => ptr::null_mut(),
116            };
117            ffi::wxEvtHandler_QueueEvent(self.as_ptr(), event)
118        }
119    }
120    /// Post an event to be processed later.
121    ///
122    /// See [C++ `wxEvtHandler::AddPendingEvent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a0737c6d2cbcd5ded4b1ecdd53ed0def3).
123    fn add_pending_event<E: EventMethods>(&self, event: &E) {
124        unsafe {
125            let event = event.as_ptr();
126            ffi::wxEvtHandler_AddPendingEvent(self.as_ptr(), event)
127        }
128    }
129    // NOT_SUPPORTED: fn CallAfter()
130    // BLOCKED: fn CallAfter1()
131    /// Processes an event, searching event tables and calling zero or more suitable event handler function(s).
132    ///
133    /// See [C++ `wxEvtHandler::ProcessEvent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a65968dd27f3aac7718f2dd6b2ddd5a08).
134    fn process_event<E: EventMethods>(&self, event: &E) -> bool {
135        unsafe {
136            let event = event.as_ptr();
137            ffi::wxEvtHandler_ProcessEvent(self.as_ptr(), event)
138        }
139    }
140    /// Try to process the event in this handler and all those chained to it.
141    ///
142    /// See [C++ `wxEvtHandler::ProcessEventLocally()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#ac0f5d2cb29a04c1f7f82eb6b351f79fb).
143    fn process_event_locally<E: EventMethods>(&self, event: &E) -> bool {
144        unsafe {
145            let event = event.as_ptr();
146            ffi::wxEvtHandler_ProcessEventLocally(self.as_ptr(), event)
147        }
148    }
149    /// Processes an event by calling ProcessEvent() and handles any exceptions that occur in the process.
150    ///
151    /// See [C++ `wxEvtHandler::SafelyProcessEvent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a8205cb1a5a00d8b550b3ead22266b16b).
152    fn safely_process_event<E: EventMethods>(&self, event: &E) -> bool {
153        unsafe {
154            let event = event.as_ptr();
155            ffi::wxEvtHandler_SafelyProcessEvent(self.as_ptr(), event)
156        }
157    }
158    /// Processes the pending events previously queued using QueueEvent() or AddPendingEvent(); you must call this function only if you are sure there are pending events for this handler, otherwise a wxCHECK will fail.
159    ///
160    /// See [C++ `wxEvtHandler::ProcessPendingEvents()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a6f643dbdcf8e914ae1c8b70dd305e6f2).
161    fn process_pending_events(&self) {
162        unsafe { ffi::wxEvtHandler_ProcessPendingEvents(self.as_ptr()) }
163    }
164    /// Deletes all events queued on this event handler using QueueEvent() or AddPendingEvent().
165    ///
166    /// See [C++ `wxEvtHandler::DeletePendingEvents()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a6e7f9cf4ebd0623c1d94979855d096f8).
167    fn delete_pending_events(&self) {
168        unsafe { ffi::wxEvtHandler_DeletePendingEvents(self.as_ptr()) }
169    }
170    // NOT_SUPPORTED: fn Connect()
171    // NOT_SUPPORTED: fn Connect1()
172    // NOT_SUPPORTED: fn Connect2()
173    // NOT_SUPPORTED: fn Disconnect()
174    // NOT_SUPPORTED: fn Disconnect1()
175    // NOT_SUPPORTED: fn Disconnect2()
176    // NOT_SUPPORTED: fn Bind()
177    // BLOCKED: fn Bind1()
178    // NOT_SUPPORTED: fn Unbind()
179    // BLOCKED: fn Unbind1()
180    // BLOCKED: fn GetClientData()
181    /// Returns a pointer to the user-supplied client data object.
182    ///
183    /// See [C++ `wxEvtHandler::GetClientObject()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a537d17d644e48bc1735c4dd28b8b8c04).
184    fn get_client_object(&self) -> Option<ClientDataIsOwned<false>> {
185        unsafe { ClientData::option_from(ffi::wxEvtHandler_GetClientObject(self.as_ptr())) }
186    }
187    // BLOCKED: fn SetClientData()
188    /// Set the client data object.
189    ///
190    /// See [C++ `wxEvtHandler::SetClientObject()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#af1e33a06087b8b2ddc43c7d15a91b326).
191    fn set_client_object<C: ClientDataMethods>(&self, data: Option<&C>) {
192        unsafe {
193            let data = match data {
194                Some(r) => r.as_ptr(),
195                None => ptr::null_mut(),
196            };
197            ffi::wxEvtHandler_SetClientObject(self.as_ptr(), data)
198        }
199    }
200    /// Returns true if the event handler is enabled, false otherwise.
201    ///
202    /// See [C++ `wxEvtHandler::GetEvtHandlerEnabled()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a7742d81c5eb7849a0ad75b9de8575153).
203    fn get_evt_handler_enabled(&self) -> bool {
204        unsafe { ffi::wxEvtHandler_GetEvtHandlerEnabled(self.as_ptr()) }
205    }
206    /// Returns the pointer to the next handler in the chain.
207    ///
208    /// See [C++ `wxEvtHandler::GetNextHandler()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a6de721ad9f331826a5c925d6008116e5).
209    fn get_next_handler(&self) -> WeakRef<EvtHandler> {
210        unsafe { WeakRef::<EvtHandler>::from(ffi::wxEvtHandler_GetNextHandler(self.as_ptr())) }
211    }
212    /// Returns the pointer to the previous handler in the chain.
213    ///
214    /// See [C++ `wxEvtHandler::GetPreviousHandler()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#abbf9904ea5108b816f5f4faab1a33db9).
215    fn get_previous_handler(&self) -> WeakRef<EvtHandler> {
216        unsafe { WeakRef::<EvtHandler>::from(ffi::wxEvtHandler_GetPreviousHandler(self.as_ptr())) }
217    }
218    /// Enables or disables the event handler.
219    ///
220    /// See [C++ `wxEvtHandler::SetEvtHandlerEnabled()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a7388ae19c8657e5656471b658c320036).
221    fn set_evt_handler_enabled(&self, enabled: bool) {
222        unsafe { ffi::wxEvtHandler_SetEvtHandlerEnabled(self.as_ptr(), enabled) }
223    }
224    /// Sets the pointer to the next handler.
225    ///
226    /// See [C++ `wxEvtHandler::SetNextHandler()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a68e2ef2d2b7d68c4c9c18ca92933031b).
227    fn set_next_handler<E: EvtHandlerMethods>(&self, handler: Option<&E>) {
228        unsafe {
229            let handler = match handler {
230                Some(r) => r.as_ptr(),
231                None => ptr::null_mut(),
232            };
233            ffi::wxEvtHandler_SetNextHandler(self.as_ptr(), handler)
234        }
235    }
236    /// Sets the pointer to the previous handler.
237    ///
238    /// See [C++ `wxEvtHandler::SetPreviousHandler()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#aff0d1836464be82e2ad723ad3a58eccc).
239    fn set_previous_handler<E: EvtHandlerMethods>(&self, handler: Option<&E>) {
240        unsafe {
241            let handler = match handler {
242                Some(r) => r.as_ptr(),
243                None => ptr::null_mut(),
244            };
245            ffi::wxEvtHandler_SetPreviousHandler(self.as_ptr(), handler)
246        }
247    }
248    /// Unlinks this event handler from the chain it's part of (if any); then links the "previous" event handler to the "next" one (so that the chain won't be interrupted).
249    ///
250    /// See [C++ `wxEvtHandler::Unlink()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a22e5db2ec1d19c8252c056fd116975d7).
251    fn unlink(&self) {
252        unsafe { ffi::wxEvtHandler_Unlink(self.as_ptr()) }
253    }
254    /// Returns true if the next and the previous handler pointers of this event handler instance are NULL.
255    ///
256    /// See [C++ `wxEvtHandler::IsUnlinked()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#ac0734578a8d929b8b0be440ce0b53ad6).
257    fn is_unlinked(&self) -> bool {
258        unsafe { ffi::wxEvtHandler_IsUnlinked(self.as_ptr()) }
259    }
260    /// Add an event filter whose FilterEvent() method will be called for each and every event processed by wxWidgets.
261    ///
262    /// See [C++ `wxEvtHandler::AddFilter()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a7dc3c701781f4044372049de5004137e).
263    fn add_filter(filter: *mut c_void) {
264        unsafe { ffi::wxEvtHandler_AddFilter(filter) }
265    }
266    /// Remove a filter previously installed with AddFilter().
267    ///
268    /// See [C++ `wxEvtHandler::RemoveFilter()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_evt_handler.html#a67a57b759c447b121bf70a7c9804c8f2).
269    fn remove_filter(filter: *mut c_void) {
270        unsafe { ffi::wxEvtHandler_RemoveFilter(filter) }
271    }
272    // DTOR: fn ~wxEvtHandler()
273}