// // Button - Destroys the button. // void EZ_button_Destroy(ez_control_t *self, qbool destroy_children) { ez_button_t *button = (ez_button_t *)self; CONTROL_EVENT_HANDLER_CALL(NULL, self, ez_control_t, OnDestroy, destroy_children); EZ_control_Destroy(&button->super, destroy_children); EZ_eventhandler_Remove(button->event_handlers.OnAction, NULL, true); EZ_eventhandler_Remove(button->event_handlers.OnTextAlignmentChanged, NULL, true); }
// // Window - Destroys a window. // int EZ_window_Destroy(ez_control_t *self, qbool destroy_children) { // ez_window_t *window = (ez_window_t *)self; CONTROL_EVENT_HANDLER_CALL(NULL, self, ez_control_t, OnDestroy, destroy_children); EZ_control_Destroy(self, destroy_children); // TODO : Remove any event handlers. return 0; }
// // Scrollbar - Destroys the scrollbar. // int EZ_scrollbar_Destroy(ez_control_t *self, qbool destroy_children) { ez_scrollbar_t *scrollbar = (ez_scrollbar_t *)self; CONTROL_EVENT_HANDLER_CALL(NULL, self, ez_control_t, OnDestroy, destroy_children); EZ_eventhandler_Remove(scrollbar->event_handlers.OnTargetChanged, NULL, true); EZ_control_Destroy(self, destroy_children); return 0; }
// // Label - Destroys a label control. // int EZ_label_Destroy(ez_control_t *self, qbool destroy_children) { ez_label_t *label = (ez_label_t *)self; CONTROL_EVENT_HANDLER_CALL(NULL, self, ez_control_t, OnDestroy, destroy_children); Q_free(label->text); EZ_eventhandler_Remove(label->event_handlers.OnCaretMoved, NULL, true); EZ_eventhandler_Remove(label->event_handlers.OnTextChanged, NULL, true); EZ_eventhandler_Remove(label->event_handlers.OnTextFlagsChanged, NULL, true); EZ_eventhandler_Remove(label->event_handlers.OnTextScaleChanged, NULL, true); // TODO: Can we just free a part like this here? How about children, will they be properly destroyed? EZ_control_Destroy(&label->super, destroy_children); return 0; }
// // Listview item - Destroys a listview item. // int EZ_listviewitem_Destroy(ez_control_t *self, qbool destroy_children) { int i; ez_listviewitem_t *listviewitem = (ez_listviewitem_t *)self; CONTROL_EVENT_HANDLER_CALL(NULL, self, ez_control_t, OnDestroy, destroy_children); // TODO : Remove any event handlers. EZ_eventhandler_Remove(listviewitem->event_handlers.OnColumnAdded, NULL, true); EZ_eventhandler_Remove(listviewitem->event_handlers.OnColumnVisibilityChanged, NULL, true); //EZ_eventhandler_Remove(listviewitem->event_handlers.OnSubItemChanged, NULL, true); // Cleanup columns. for (i = 0; i < listviewitem->item_count; i++) { // TODO: Hmm should we raise it like this? CONTROL_RAISE_EVENT(NULL, listviewitem->items[i], ez_control_t, OnDestroy, true); } EZ_control_Destroy((ez_control_t *)self, destroy_children); return 0; }