summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-08-03 20:08:23 +1000
committerJed Barber <jjbarber@y7mail.com>2017-08-03 20:08:23 +1000
commite70e81e7f08105474a01858b38a7e27d028a1972 (patch)
treed8ac8f24b82e426c123f3a9d8e758237ab14a5a9
parent229b6b74e7c9cc09ce5c49023afb0eb745ac9db1 (diff)
Added the first of event handling functions, to figure out what key was pressed
-rw-r--r--src/c_fl_event.cpp10
-rw-r--r--src/c_fl_event.h11
-rw-r--r--src/fltk-event.adb26
-rw-r--r--src/fltk-event.ads11
-rw-r--r--src/fltk-widgets.ads5
-rw-r--r--src/fltk.ads7
6 files changed, 65 insertions, 5 deletions
diff --git a/src/c_fl_event.cpp b/src/c_fl_event.cpp
new file mode 100644
index 0000000..526ed44
--- /dev/null
+++ b/src/c_fl_event.cpp
@@ -0,0 +1,10 @@
+
+
+#include <FL/Fl.H>
+#include "c_fl_event.h"
+
+
+int fl_event_key() {
+ return Fl::event_key();
+}
+
diff --git a/src/c_fl_event.h b/src/c_fl_event.h
new file mode 100644
index 0000000..c71618e
--- /dev/null
+++ b/src/c_fl_event.h
@@ -0,0 +1,11 @@
+
+
+#ifndef FL_EVENT_GUARD
+#define FL_EVENT_GUARD
+
+
+extern "C" int fl_event_key();
+
+
+#endif
+
diff --git a/src/fltk-event.adb b/src/fltk-event.adb
new file mode 100644
index 0000000..a62f0ee
--- /dev/null
+++ b/src/fltk-event.adb
@@ -0,0 +1,26 @@
+
+
+with
+
+ Interfaces.C;
+
+
+package body FLTK.Event is
+
+
+ function fl_event_key
+ return Interfaces.C.int;
+ pragma Import (C, fl_event_key, "fl_event_key");
+
+
+
+
+ function Last_Keypress
+ return Shortcut_Key is
+ begin
+ return C_To_Key (Interfaces.C.unsigned_long (fl_event_key));
+ end Last_Keypress;
+
+
+end FLTK.Event;
+
diff --git a/src/fltk-event.ads b/src/fltk-event.ads
new file mode 100644
index 0000000..7a640fe
--- /dev/null
+++ b/src/fltk-event.ads
@@ -0,0 +1,11 @@
+
+
+package FLTK.Event is
+
+
+ function Last_Keypress
+ return Shortcut_Key;
+
+
+end FLTK.Event;
+
diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads
index 5205106..3cea435 100644
--- a/src/fltk-widgets.ads
+++ b/src/fltk-widgets.ads
@@ -23,11 +23,6 @@ package FLTK.Widgets is
type Widget_Callback is access procedure
(Item : in out Widget'Class);
- type Font_Size is new Natural;
- Normal_Size : constant Font_Size := 14;
-
- type Event_Outcome is (Not_Handled, Handled);
-
diff --git a/src/fltk.ads b/src/fltk.ads
index d07435e..8a6a933 100644
--- a/src/fltk.ads
+++ b/src/fltk.ads
@@ -144,6 +144,10 @@ package FLTK is
Free_Font);
+ type Font_Size is new Natural;
+ Normal_Size : constant Font_Size := 14;
+
+
type Label_Kind is
(Normal_Label,
No_Label,
@@ -185,6 +189,9 @@ package FLTK is
Fullscreen);
+ type Event_Outcome is (Not_Handled, Handled);
+
+
private