]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
event_gui_type
authorJavier Sancho <jsf@jsancho.org>
Mon, 27 Apr 2020 06:11:27 +0000 (08:11 +0200)
committerJavier Sancho <jsf@jsancho.org>
Mon, 27 Apr 2020 06:11:27 +0000 (08:11 +0200)
src/event-receiver.cpp
src/event-receiver.h

index c0728ff2a01e3e87070f5d4907c50aac607f5e41..f0ec53aa0160208bc4b1e4592aaef47bc07ade23 100644 (file)
@@ -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));
+      }
+  }
+
 }
index c3bc67d3d0d36c527276fe44448941b27012b8b3..876bf0cbdf75843687b85dee49c39692fd196d11 100644 (file)
@@ -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