From 722b34ded15dc5317aa45f205b5fc85a78a394b5 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Mon, 27 Apr 2020 08:11:27 +0200 Subject: [PATCH] event_gui_type --- src/event-receiver.cpp | 143 +++++++++++++++++++++++++++++++++++++++++ src/event-receiver.h | 6 ++ 2 files changed, 149 insertions(+) diff --git a/src/event-receiver.cpp b/src/event-receiver.cpp index c0728ff..f0ec53a 100644 --- a/src/event-receiver.cpp +++ b/src/event-receiver.cpp @@ -36,6 +36,7 @@ extern "C" { init_event_receiver_type (); init_event_type (); DEFINE_GSUBR ("event-gui-caller", 1, 0, 0, event_gui_caller); + DEFINE_GSUBR ("event-gui-type", 1, 0, 0, event_gui_type); DEFINE_GSUBR ("event-key-input-key", 1, 0, 0, event_key_input_key); DEFINE_GSUBR ("event-key-input-pressed", 1, 0, 0, event_key_input_pressed); DEFINE_GSUBR ("event-type", 1, 0, 0, event_type); @@ -56,6 +57,12 @@ extern "C" { return wrap_gui_element (unwrap_event (event)->GUIEvent.Caller); } + SCM + event_gui_type (SCM event) + { + return scm_from_gui_event_type (unwrap_event (event)->GUIEvent.EventType); + } + SCM event_key_input_key (SCM event) { @@ -133,4 +140,140 @@ extern "C" { } } + SCM + scm_from_gui_event_type (irr::gui::EGUI_EVENT_TYPE gui_event_type) + { + switch (gui_event_type) + { + case irr::gui::EGET_ELEMENT_FOCUS_LOST: + return scm_from_utf8_symbol ("element-focus-lost"); + break; + + case irr::gui::EGET_ELEMENT_FOCUSED: + return scm_from_utf8_symbol ("element-focused"); + break; + + case irr::gui::EGET_ELEMENT_HOVERED: + return scm_from_utf8_symbol ("element-hovered"); + break; + + case irr::gui::EGET_ELEMENT_LEFT: + return scm_from_utf8_symbol ("element-left"); + break; + + case irr::gui::EGET_ELEMENT_CLOSED: + return scm_from_utf8_symbol ("element-closed"); + break; + + case irr::gui::EGET_BUTTON_CLICKED: + return scm_from_utf8_symbol ("button-clicked"); + break; + + case irr::gui::EGET_SCROLL_BAR_CHANGED: + return scm_from_utf8_symbol ("scrollbar-changed"); + break; + + case irr::gui::EGET_CHECKBOX_CHANGED: + return scm_from_utf8_symbol ("checkbox-changed"); + break; + + case irr::gui::EGET_LISTBOX_CHANGED: + return scm_from_utf8_symbol ("listbox-changed"); + break; + + case irr::gui::EGET_LISTBOX_SELECTED_AGAIN: + return scm_from_utf8_symbol ("listbox-selected-again"); + break; + + case irr::gui::EGET_FILE_SELECTED: + return scm_from_utf8_symbol ("file-selected"); + break; + + case irr::gui::EGET_DIRECTORY_SELECTED: + return scm_from_utf8_symbol ("directory-selected"); + break; + + case irr::gui::EGET_FILE_CHOOSE_DIALOG_CANCELLED: + return scm_from_utf8_symbol ("file-choose-dialog-cancelled"); + break; + + case irr::gui::EGET_MESSAGEBOX_YES: + return scm_from_utf8_symbol ("messagebox-yes"); + break; + + case irr::gui::EGET_MESSAGEBOX_NO: + return scm_from_utf8_symbol ("messagebox-no"); + break; + + case irr::gui::EGET_MESSAGEBOX_OK: + return scm_from_utf8_symbol ("messagebox-ok"); + break; + + case irr::gui::EGET_MESSAGEBOX_CANCEL: + return scm_from_utf8_symbol ("messagebox-cancel"); + break; + + case irr::gui::EGET_EDITBOX_ENTER: + return scm_from_utf8_symbol ("editbox-enter"); + break; + + case irr::gui::EGET_EDITBOX_CHANGED: + return scm_from_utf8_symbol ("editbox-changed"); + break; + + case irr::gui::EGET_EDITBOX_MARKING_CHANGED: + return scm_from_utf8_symbol ("editbox-marking-changed"); + break; + + case irr::gui::EGET_TAB_CHANGED: + return scm_from_utf8_symbol ("tab-changed"); + break; + + case irr::gui::EGET_MENU_ITEM_SELECTED: + return scm_from_utf8_symbol ("menu-item-selected"); + break; + + case irr::gui::EGET_COMBO_BOX_CHANGED: + return scm_from_utf8_symbol ("combo-box-changed"); + break; + + case irr::gui::EGET_SPINBOX_CHANGED: + return scm_from_utf8_symbol ("spinbox-changed"); + break; + + case irr::gui::EGET_TABLE_CHANGED: + return scm_from_utf8_symbol ("table-changed"); + break; + + case irr::gui::EGET_TABLE_HEADER_CHANGED: + return scm_from_utf8_symbol ("table-header-changed"); + break; + + case irr::gui::EGET_TABLE_SELECTED_AGAIN: + return scm_from_utf8_symbol ("table-selected-again"); + break; + + case irr::gui::EGET_TREEVIEW_NODE_DESELECT: + return scm_from_utf8_symbol ("treeview-node-deselect"); + break; + + case irr::gui::EGET_TREEVIEW_NODE_SELECT: + return scm_from_utf8_symbol ("treeview-node-select"); + break; + + case irr::gui::EGET_TREEVIEW_NODE_EXPAND: + return scm_from_utf8_symbol ("treeview-node-expand"); + break; + + case irr::gui::EGET_TREEVIEW_NODE_COLLAPSE: + return scm_from_utf8_symbol ("treeview-node-collapse"); + break; + + default: + SCM type = scm_from_uint (gui_event_type); + scm_error (scm_arg_type_key, NULL, "Wrong GUI event type: ~S", + scm_list_1 (type), scm_list_1 (type)); + } + } + } diff --git a/src/event-receiver.h b/src/event-receiver.h index c3bc67d..876bf0c 100644 --- a/src/event-receiver.h +++ b/src/event-receiver.h @@ -40,6 +40,9 @@ extern "C" { SCM event_gui_caller (SCM event); + SCM + event_gui_type (SCM event); + SCM event_key_input_key (SCM event); @@ -55,6 +58,9 @@ extern "C" { SCM scm_from_event_type (irr::EEVENT_TYPE event_type); + SCM + scm_from_gui_event_type (irr::gui::EGUI_EVENT_TYPE gui_event_type); + } #endif -- 2.39.5