summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2018-03-03 17:32:54 +1100
committerJed Barber <jjbarber@y7mail.com>2018-03-03 17:32:54 +1100
commit823f6cc33bc088ab7dbd5e604d34415152cbe181 (patch)
treec0303917e34f39a3f86e951f30dc12289c6a9915
parent098c61c36dfc274a891ef90db2cb46b473c5fde3 (diff)
Added FLTK.Widgets.Valuators.Dials.Fill
-rw-r--r--progress.txt2
-rw-r--r--src/c_fl_fill_dial.cpp70
-rw-r--r--src/c_fl_fill_dial.h27
-rw-r--r--src/fltk-widgets-valuators-dials-fill.adb109
-rw-r--r--src/fltk-widgets-valuators-dials-fill.ads38
5 files changed, 245 insertions, 1 deletions
diff --git a/progress.txt b/progress.txt
index 7387ada..de35773 100644
--- a/progress.txt
+++ b/progress.txt
@@ -50,6 +50,7 @@ FLTK.Widgets.Valuators.Adjusters
FLTK.Widgets.Valuators.Counters
FLTK.Widgets.Valuators.Counters.Simple
FLTK.Widgets.Valuators.Dials
+FLTK.Widgets.Valuators.Dials.Fill
@@ -99,7 +100,6 @@ FL_Tabs
FL_Tile
FL_Tree
FL_Wizard
-FL_Fill_Dial
FL_Line_Dial
FL_Roller
FL_Slider
diff --git a/src/c_fl_fill_dial.cpp b/src/c_fl_fill_dial.cpp
new file mode 100644
index 0000000..94e5795
--- /dev/null
+++ b/src/c_fl_fill_dial.cpp
@@ -0,0 +1,70 @@
+
+
+#include <FL/Fl_Fill_Dial.H>
+#include "c_fl_fill_dial.h"
+#include "c_fl_type.h"
+
+
+
+
+class My_Fill_Dial : public Fl_Fill_Dial {
+ public:
+ using Fl_Fill_Dial::Fl_Fill_Dial;
+ friend void fill_dial_set_draw_hook(FILL_DIAL v, void * d);
+ friend void fl_fill_dial_draw(FILL_DIAL v);
+ friend void fill_dial_set_handle_hook(FILL_DIAL v, void * h);
+ friend int fl_fill_dial_handle(FILL_DIAL v, int e);
+ protected:
+ void draw();
+ void real_draw();
+ int handle(int e);
+ int real_handle(int e);
+ d_hook_p draw_hook;
+ h_hook_p handle_hook;
+};
+
+void My_Fill_Dial::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+void My_Fill_Dial::real_draw() {
+ Fl_Fill_Dial::draw();
+}
+
+int My_Fill_Dial::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+int My_Fill_Dial::real_handle(int e) {
+ return Fl_Fill_Dial::handle(e);
+}
+
+void fill_dial_set_draw_hook(FILL_DIAL v, void * d) {
+ reinterpret_cast<My_Fill_Dial*>(v)->draw_hook = reinterpret_cast<d_hook_p>(d);
+}
+
+void fl_fill_dial_draw(FILL_DIAL v) {
+ reinterpret_cast<My_Fill_Dial*>(v)->real_draw();
+}
+
+void fill_dial_set_handle_hook(FILL_DIAL v, void * h) {
+ reinterpret_cast<My_Fill_Dial*>(v)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+int fl_fill_dial_handle(FILL_DIAL v, int e) {
+ return reinterpret_cast<My_Fill_Dial*>(v)->real_handle(e);
+}
+
+
+
+
+FILL_DIAL new_fl_fill_dial(int x, int y, int w, int h, char* label) {
+ My_Fill_Dial *v = new My_Fill_Dial(x, y, w, h, label);
+ return v;
+}
+
+void free_fl_fill_dial(FILL_DIAL v) {
+ delete reinterpret_cast<My_Fill_Dial*>(v);
+}
+
+
diff --git a/src/c_fl_fill_dial.h b/src/c_fl_fill_dial.h
new file mode 100644
index 0000000..39dced5
--- /dev/null
+++ b/src/c_fl_fill_dial.h
@@ -0,0 +1,27 @@
+
+
+#ifndef FL_FILL_DIAL_GUARD
+#define FL_FILL_DIAL_GUARD
+
+
+
+
+typedef void* FILL_DIAL;
+
+
+
+
+extern "C" void fill_dial_set_draw_hook(FILL_DIAL v, void * d);
+extern "C" void fl_fill_dial_draw(FILL_DIAL v);
+extern "C" void fill_dial_set_handle_hook(FILL_DIAL v, void * h);
+extern "C" int fl_fill_dial_handle(FILL_DIAL v, int e);
+
+
+
+
+extern "C" FILL_DIAL new_fl_fill_dial(int x, int y, int w, int h, char* label);
+extern "C" void free_fl_fill_dial(FILL_DIAL v);
+
+
+#endif
+
diff --git a/src/fltk-widgets-valuators-dials-fill.adb b/src/fltk-widgets-valuators-dials-fill.adb
new file mode 100644
index 0000000..97a915b
--- /dev/null
+++ b/src/fltk-widgets-valuators-dials-fill.adb
@@ -0,0 +1,109 @@
+
+
+with
+
+ Interfaces.C.Strings,
+ System;
+
+use type
+
+ System.Address;
+
+
+package body FLTK.Widgets.Valuators.Dials.Fill is
+
+
+ procedure fill_dial_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, fill_dial_set_draw_hook, "fill_dial_set_draw_hook");
+
+ procedure fill_dial_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, fill_dial_set_handle_hook, "fill_dial_set_handle_hook");
+
+
+
+
+ function new_fl_fill_dial
+ (X, Y, W, H : in Interfaces.C.int;
+ Text : in Interfaces.C.char_array)
+ return System.Address;
+ pragma Import (C, new_fl_fill_dial, "new_fl_fill_dial");
+
+ procedure free_fl_fill_dial
+ (D : in System.Address);
+ pragma Import (C, free_fl_fill_dial, "free_fl_fill_dial");
+
+
+
+
+ procedure fl_fill_dial_draw
+ (W : in System.Address);
+ pragma Import (C, fl_fill_dial_draw, "fl_fill_dial_draw");
+
+ function fl_fill_dial_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_fill_dial_handle, "fl_fill_dial_handle");
+
+
+
+
+ procedure Finalize
+ (This : in out Fill_Dial) is
+ begin
+ if This.Void_Ptr /= System.Null_Address and then
+ This in Fill_Dial'Class
+ then
+ free_fl_fill_dial (This.Void_Ptr);
+ This.Void_Ptr := System.Null_Address;
+ end if;
+ Finalize (Dial (This));
+ end Finalize;
+
+
+
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Fill_Dial is
+ begin
+ return This : Fill_Dial do
+ This.Void_Ptr := new_fl_fill_dial
+ (Interfaces.C.int (X),
+ Interfaces.C.int (Y),
+ Interfaces.C.int (W),
+ Interfaces.C.int (H),
+ Interfaces.C.To_C (Text));
+ fl_widget_set_user_data
+ (This.Void_Ptr,
+ Widget_Convert.To_Address (This'Unchecked_Access));
+ fill_dial_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ fill_dial_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
+ end return;
+ end Create;
+
+
+
+
+ procedure Draw
+ (This : in out Fill_Dial) is
+ begin
+ fl_fill_dial_draw (This.Void_Ptr);
+ end Draw;
+
+
+ function Handle
+ (This : in out Fill_Dial;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_fill_dial_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+end FLTK.Widgets.Valuators.Dials.Fill;
+
diff --git a/src/fltk-widgets-valuators-dials-fill.ads b/src/fltk-widgets-valuators-dials-fill.ads
new file mode 100644
index 0000000..ec01ac0
--- /dev/null
+++ b/src/fltk-widgets-valuators-dials-fill.ads
@@ -0,0 +1,38 @@
+
+
+package FLTK.Widgets.Valuators.Dials.Fill is
+
+
+ type Fill_Dial is new Dial with private;
+
+
+
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Fill_Dial;
+
+
+
+
+ procedure Draw
+ (This : in out Fill_Dial);
+
+ function Handle
+ (This : in out Fill_Dial;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
+private
+
+
+ type Fill_Dial is new Dial with null record;
+
+ overriding procedure Finalize
+ (This : in out Fill_Dial);
+
+
+end FLTK.Widgets.Valuators.Dials.Fill;
+