summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2018-05-18 01:29:47 +1000
committerJed Barber <jjbarber@y7mail.com>2018-05-18 01:29:47 +1000
commitee210f26aecaaa19e991773a7be58028223d1cb8 (patch)
treecbdb6e88a185f7ff06fd8ea8f395add730d68774
parent098adf24b20bb7ae71cfd7e6af5517205552e9e5 (diff)
Added FLTK.Widgets.Valuators.Value_Outputs
-rw-r--r--doc/fl_value_output.html176
-rw-r--r--doc/index.html3
-rw-r--r--progress.txt1
-rw-r--r--src/c_fl_value_output.cpp108
-rw-r--r--src/c_fl_value_output.h41
-rw-r--r--src/fltk-widgets-valuators-value_outputs.adb242
-rw-r--r--src/fltk-widgets-valuators-value_outputs.ads101
7 files changed, 671 insertions, 1 deletions
diff --git a/doc/fl_value_output.html b/doc/fl_value_output.html
new file mode 100644
index 0000000..3924e14
--- /dev/null
+++ b/doc/fl_value_output.html
@@ -0,0 +1,176 @@
+
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Fl_Value_Output Binding Map</title>
+ <link href="map.css" rel="stylesheet">
+ </head>
+
+ <body>
+
+
+<h2>Fl_Value_Output Binding Map</h2>
+
+
+<table class="package">
+ <tr><th colspan="2">Package name</th></tr>
+
+ <tr>
+ <td>Fl_Value_Output</td>
+ <td>FLTK.Widgets.Valuators.Value_Outputs</td>
+ </tr>
+
+</table>
+
+
+
+<table class="type">
+ <tr><th colspan="2">Types</th></tr>
+
+ <tr>
+ <td>Fl_Value_Output</td>
+ <td>Value_Output</td>
+ </tr>
+
+ <tr>
+ <td>&nbsp;</td>
+ <td>Value_Output_Reference</td>
+ </tr>
+
+</table>
+
+
+
+<table class="function">
+ <tr><th colspan="2">Functions and Procedures</th></tr>
+
+ <tr>
+<td><pre>
+Fl_Value_Output(int x, int y, int w, int h, const char *l=0);
+</pre></td>
+<td><pre>
+function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Value_Output;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void draw();
+</pre></td>
+<td><pre>
+procedure Draw
+ (This : in out Value_Output);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+int handle(int);
+</pre></td>
+<td><pre>
+function Handle
+ (This : in out Value_Output;
+ Event : in Event_Kind)
+ return Event_Outcome;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void soft(char s);
+</pre></td>
+<td><pre>
+procedure Set_Soft
+ (This : in out Value_Output;
+ To : in Boolean);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+char soft() const;
+</pre></td>
+<td><pre>
+function Is_Soft
+ (This : in Value_Output)
+ return Boolean;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+Fl_Color textcolor() const;
+</pre></td>
+<td><pre>
+function Get_Text_Color
+ (This : in Value_Output)
+ return Color;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void textcolor(Fl_Color n);
+</pre></td>
+<td><pre>
+procedure Set_Text_Color
+ (This : in out Value_Output;
+ Col : in Color);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+Fl_Font textfont() const;
+</pre></td>
+<td><pre>
+function Get_Text_Font
+ (This : in Value_Output)
+ return Font_Kind;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void textfont(Fl_Font s);
+</pre></td>
+<td><pre>
+procedure Set_Text_Font
+ (This : in out Value_Output;
+ Font : in Font_Kind);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+Fl_Fontsize textsize() const;
+</pre></td>
+<td><pre>
+function Get_Text_Size
+ (This : in Value_Output)
+ return Font_Size;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void textsize(Fl_Fontsize s);
+</pre></td>
+<td><pre>
+procedure Set_Text_Size
+ (This : in out Value_Output;
+ Size : in Font_Size);
+</pre></td>
+ </tr>
+
+</table>
+
+
+ </body>
+</html>
+
diff --git a/doc/index.html b/doc/index.html
index e9e3a78..1993a9a 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -119,7 +119,7 @@
<li>Fl_Tree</li>
<li><a href="fl_valuator.html">Fl_Valuator</a></li>
<li><a href="fl_value_input.html">Fl_Value_Input</a></li>
- <li>Fl_Value_Output</li>
+ <li><a href="fl_value_output.html">Fl_Value_Output</a></li>
<li><a href="fl_value_slider.html">Fl_Value_Slider</a></li>
<li><a href="fl_widget.html">Fl_Widget</a></li>
<li><a href="fl_window.html">Fl_Window</a></li>
@@ -218,6 +218,7 @@
<li><a href="fl_value_slider.html">FLTK.Widgets.Valuators.Sliders.Value</a></li>
<li><a href="fl_hor_value_slider.html">FLTK.Widgets.Valuators.Sliders.Value.Horizontal</a></li>
<li><a href="fl_value_input.html">FLTK.Widgets.Valuators.Value_Inputs</a></li>
+ <li><a href="fl_value_output.html">FLTK.Widgets.Valuators.Value_Outputs</a></li>
</ul>
</body>
diff --git a/progress.txt b/progress.txt
index b3740bd..e487fdd 100644
--- a/progress.txt
+++ b/progress.txt
@@ -95,6 +95,7 @@ FLTK.Widgets.Valuators.Sliders.Scrollbars
FLTK.Widgets.Valuators.Sliders.Value
FLTK.Widgets.Valuators.Sliders.Value.Horizontal
FLTK.Widgets.Valuators.Value_Inputs
+FLTK.Widgets.Valuators.Value_Outputs
diff --git a/src/c_fl_value_output.cpp b/src/c_fl_value_output.cpp
new file mode 100644
index 0000000..5e874f9
--- /dev/null
+++ b/src/c_fl_value_output.cpp
@@ -0,0 +1,108 @@
+
+
+#include <FL/Fl_Value_Output.H>
+#include "c_fl_value_output.h"
+#include "c_fl_type.h"
+
+
+
+
+class My_Value_Output : public Fl_Value_Output {
+ public:
+ using Fl_Value_Output::Fl_Value_Output;
+ friend void value_output_set_draw_hook(VALUE_OUTPUT a, void * d);
+ friend void fl_value_output_draw(VALUE_OUTPUT a);
+ friend void value_output_set_handle_hook(VALUE_OUTPUT a, void * h);
+ friend int fl_value_output_handle(VALUE_OUTPUT a, 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_Value_Output::draw() {
+ (*draw_hook)(this->user_data());
+}
+
+void My_Value_Output::real_draw() {
+ Fl_Value_Output::draw();
+}
+
+int My_Value_Output::handle(int e) {
+ return (*handle_hook)(this->user_data(), e);
+}
+
+int My_Value_Output::real_handle(int e) {
+ return Fl_Value_Output::handle(e);
+}
+
+void value_output_set_draw_hook(VALUE_OUTPUT a, void * d) {
+ reinterpret_cast<My_Value_Output*>(a)->draw_hook = reinterpret_cast<d_hook_p>(d);
+}
+
+void fl_value_output_draw(VALUE_OUTPUT a) {
+ reinterpret_cast<My_Value_Output*>(a)->real_draw();
+}
+
+void value_output_set_handle_hook(VALUE_OUTPUT a, void * h) {
+ reinterpret_cast<My_Value_Output*>(a)->handle_hook = reinterpret_cast<h_hook_p>(h);
+}
+
+int fl_value_output_handle(VALUE_OUTPUT a, int e) {
+ return reinterpret_cast<My_Value_Output*>(a)->real_handle(e);
+}
+
+
+
+
+VALUE_OUTPUT new_fl_value_output(int x, int y, int w, int h, char* label) {
+ My_Value_Output *a = new My_Value_Output(x, y, w, h, label);
+ return a;
+}
+
+void free_fl_value_output(VALUE_OUTPUT a) {
+ delete reinterpret_cast<My_Value_Output*>(a);
+}
+
+
+
+
+int fl_value_output_is_soft(VALUE_OUTPUT a) {
+ return reinterpret_cast<Fl_Value_Output*>(a)->soft();
+}
+
+void fl_value_output_set_soft(VALUE_OUTPUT a, int t) {
+ reinterpret_cast<Fl_Value_Output*>(a)->soft(t);
+}
+
+
+
+
+unsigned int fl_value_output_get_text_color(VALUE_OUTPUT v) {
+ return reinterpret_cast<Fl_Value_Output*>(v)->textcolor();
+}
+
+void fl_value_output_set_text_color(VALUE_OUTPUT v, unsigned int c) {
+ reinterpret_cast<Fl_Value_Output*>(v)->textcolor(static_cast<Fl_Color>(c));
+}
+
+int fl_value_output_get_text_font(VALUE_OUTPUT v) {
+ return reinterpret_cast<Fl_Value_Output*>(v)->textfont();
+}
+
+void fl_value_output_set_text_font(VALUE_OUTPUT v, int f) {
+ reinterpret_cast<Fl_Value_Output*>(v)->textfont(static_cast<Fl_Font>(f));
+}
+
+int fl_value_output_get_text_size(VALUE_OUTPUT v) {
+ return reinterpret_cast<Fl_Value_Output*>(v)->textsize();
+}
+
+void fl_value_output_set_text_size(VALUE_OUTPUT v, int s) {
+ reinterpret_cast<Fl_Value_Output*>(v)->textsize(static_cast<Fl_Fontsize>(s));
+}
+
+
diff --git a/src/c_fl_value_output.h b/src/c_fl_value_output.h
new file mode 100644
index 0000000..62e8426
--- /dev/null
+++ b/src/c_fl_value_output.h
@@ -0,0 +1,41 @@
+
+
+#ifndef FL_VALUE_OUTPUT_GUARD
+#define FL_VALUE_OUTPUT_GUARD
+
+
+
+
+typedef void* VALUE_OUTPUT;
+
+
+
+
+extern "C" void value_output_set_draw_hook(VALUE_OUTPUT a, void * d);
+extern "C" void fl_value_output_draw(VALUE_OUTPUT a);
+extern "C" void value_output_set_handle_hook(VALUE_OUTPUT a, void * h);
+extern "C" int fl_value_output_handle(VALUE_OUTPUT a, int e);
+
+
+
+
+extern "C" VALUE_OUTPUT new_fl_value_output(int x, int y, int w, int h, char* label);
+extern "C" void free_fl_value_output(VALUE_OUTPUT a);
+
+
+
+
+extern "C" int fl_value_output_is_soft(VALUE_OUTPUT a);
+extern "C" void fl_value_output_set_soft(VALUE_OUTPUT a, int t);
+
+
+extern "C" unsigned int fl_value_output_get_text_color(VALUE_OUTPUT v);
+extern "C" void fl_value_output_set_text_color(VALUE_OUTPUT v, unsigned int c);
+extern "C" int fl_value_output_get_text_font(VALUE_OUTPUT v);
+extern "C" void fl_value_output_set_text_font(VALUE_OUTPUT v, int f);
+extern "C" int fl_value_output_get_text_size(VALUE_OUTPUT v);
+extern "C" void fl_value_output_set_text_size(VALUE_OUTPUT v, int s);
+
+
+#endif
+
diff --git a/src/fltk-widgets-valuators-value_outputs.adb b/src/fltk-widgets-valuators-value_outputs.adb
new file mode 100644
index 0000000..0330bc5
--- /dev/null
+++ b/src/fltk-widgets-valuators-value_outputs.adb
@@ -0,0 +1,242 @@
+
+
+with
+
+ Interfaces.C.Strings,
+ System;
+
+use type
+
+ Interfaces.C.int,
+ System.Address;
+
+
+package body FLTK.Widgets.Valuators.Value_Outputs is
+
+
+ procedure value_output_set_draw_hook
+ (W, D : in System.Address);
+ pragma Import (C, value_output_set_draw_hook, "value_output_set_draw_hook");
+ pragma Inline (value_output_set_draw_hook);
+
+ procedure value_output_set_handle_hook
+ (W, H : in System.Address);
+ pragma Import (C, value_output_set_handle_hook, "value_output_set_handle_hook");
+ pragma Inline (value_output_set_handle_hook);
+
+
+
+
+ function new_fl_value_output
+ (X, Y, W, H : in Interfaces.C.int;
+ Text : in Interfaces.C.char_array)
+ return System.Address;
+ pragma Import (C, new_fl_value_output, "new_fl_value_output");
+ pragma Inline (new_fl_value_output);
+
+ procedure free_fl_value_output
+ (A : in System.Address);
+ pragma Import (C, free_fl_value_output, "free_fl_value_output");
+ pragma Inline (free_fl_value_output);
+
+
+
+
+ function fl_value_output_is_soft
+ (A : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_value_output_is_soft, "fl_value_output_is_soft");
+ pragma Inline (fl_value_output_is_soft);
+
+ procedure fl_value_output_set_soft
+ (A : in System.Address;
+ T : in Interfaces.C.int);
+ pragma Import (C, fl_value_output_set_soft, "fl_value_output_set_soft");
+ pragma Inline (fl_value_output_set_soft);
+
+
+
+
+ function fl_value_output_get_text_color
+ (TD : in System.Address)
+ return Interfaces.C.unsigned;
+ pragma Import (C, fl_value_output_get_text_color, "fl_value_output_get_text_color");
+ pragma Inline (fl_value_output_get_text_color);
+
+ procedure fl_value_output_set_text_color
+ (TD : in System.Address;
+ C : in Interfaces.C.unsigned);
+ pragma Import (C, fl_value_output_set_text_color, "fl_value_output_set_text_color");
+ pragma Inline (fl_value_output_set_text_color);
+
+ function fl_value_output_get_text_font
+ (TD : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_value_output_get_text_font, "fl_value_output_get_text_font");
+ pragma Inline (fl_value_output_get_text_font);
+
+ procedure fl_value_output_set_text_font
+ (TD : in System.Address;
+ F : in Interfaces.C.int);
+ pragma Import (C, fl_value_output_set_text_font, "fl_value_output_set_text_font");
+ pragma Inline (fl_value_output_set_text_font);
+
+ function fl_value_output_get_text_size
+ (TD : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_value_output_get_text_size, "fl_value_output_get_text_size");
+ pragma Inline (fl_value_output_get_text_size);
+
+ procedure fl_value_output_set_text_size
+ (TD : in System.Address;
+ S : in Interfaces.C.int);
+ pragma Import (C, fl_value_output_set_text_size, "fl_value_output_set_text_size");
+ pragma Inline (fl_value_output_set_text_size);
+
+
+
+
+ procedure fl_value_output_draw
+ (W : in System.Address);
+ pragma Import (C, fl_value_output_draw, "fl_value_output_draw");
+ pragma Inline (fl_value_output_draw);
+
+ function fl_value_output_handle
+ (W : in System.Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_value_output_handle, "fl_value_output_handle");
+ pragma Inline (fl_value_output_handle);
+
+
+
+
+ procedure Finalize
+ (This : in out Value_Output) is
+ begin
+ if This.Void_Ptr /= System.Null_Address and then
+ This in Value_Output'Class
+ then
+ free_fl_value_output (This.Void_Ptr);
+ This.Void_Ptr := System.Null_Address;
+ end if;
+ Finalize (Valuator (This));
+ end Finalize;
+
+
+
+
+ package body Forge is
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Value_Output is
+ begin
+ return This : Value_Output do
+ This.Void_Ptr := new_fl_value_output
+ (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));
+ value_output_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
+ value_output_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
+ end return;
+ end Create;
+
+ end Forge;
+
+
+
+
+ function Is_Soft
+ (This : in Value_Output)
+ return Boolean is
+ begin
+ return fl_value_output_is_soft (This.Void_Ptr) /= 0;
+ end Is_Soft;
+
+
+ procedure Set_Soft
+ (This : in out Value_Output;
+ To : in Boolean) is
+ begin
+ fl_value_output_set_soft (This.Void_Ptr, Boolean'Pos (To));
+ end Set_Soft;
+
+
+
+
+ function Get_Text_Color
+ (This : in Value_Output)
+ return Color is
+ begin
+ return Color (fl_value_output_get_text_color (This.Void_Ptr));
+ end Get_Text_Color;
+
+
+ procedure Set_Text_Color
+ (This : in out Value_Output;
+ Col : in Color) is
+ begin
+ fl_value_output_set_text_color (This.Void_Ptr, Interfaces.C.unsigned (Col));
+ end Set_Text_Color;
+
+
+ function Get_Text_Font
+ (This : in Value_Output)
+ return Font_Kind is
+ begin
+ return Font_Kind'Val (fl_value_output_get_text_font (This.Void_Ptr));
+ end Get_Text_Font;
+
+
+ procedure Set_Text_Font
+ (This : in out Value_Output;
+ Font : in Font_Kind) is
+ begin
+ fl_value_output_set_text_font (This.Void_Ptr, Font_Kind'Pos (Font));
+ end Set_Text_Font;
+
+
+ function Get_Text_Size
+ (This : in Value_Output)
+ return Font_Size is
+ begin
+ return Font_Size (fl_value_output_get_text_size (This.Void_Ptr));
+ end Get_Text_Size;
+
+
+ procedure Set_Text_Size
+ (This : in out Value_Output;
+ Size : in Font_Size) is
+ begin
+ fl_value_output_set_text_size (This.Void_Ptr, Interfaces.C.int (Size));
+ end Set_Text_Size;
+
+
+
+
+ procedure Draw
+ (This : in out Value_Output) is
+ begin
+ fl_value_output_draw (This.Void_Ptr);
+ end Draw;
+
+
+ function Handle
+ (This : in out Value_Output;
+ Event : in Event_Kind)
+ return Event_Outcome is
+ begin
+ return Event_Outcome'Val
+ (fl_value_output_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
+ end Handle;
+
+
+end FLTK.Widgets.Valuators.Value_Outputs;
+
diff --git a/src/fltk-widgets-valuators-value_outputs.ads b/src/fltk-widgets-valuators-value_outputs.ads
new file mode 100644
index 0000000..c935aa6
--- /dev/null
+++ b/src/fltk-widgets-valuators-value_outputs.ads
@@ -0,0 +1,101 @@
+
+
+package FLTK.Widgets.Valuators.Value_Outputs is
+
+
+ type Value_Output is new Valuator with private;
+
+ type Value_Output_Reference (Data : not null access Value_Output'Class) is
+ limited null record with Implicit_Dereference => Data;
+
+
+
+
+ package Forge is
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String)
+ return Value_Output;
+
+ end Forge;
+
+
+
+
+ function Is_Soft
+ (This : in Value_Output)
+ return Boolean;
+
+ procedure Set_Soft
+ (This : in out Value_Output;
+ To : in Boolean);
+
+
+
+
+ function Get_Text_Color
+ (This : in Value_Output)
+ return Color;
+
+ procedure Set_Text_Color
+ (This : in out Value_Output;
+ Col : in Color);
+
+ function Get_Text_Font
+ (This : in Value_Output)
+ return Font_Kind;
+
+ procedure Set_Text_Font
+ (This : in out Value_Output;
+ Font : in Font_Kind);
+
+ function Get_Text_Size
+ (This : in Value_Output)
+ return Font_Size;
+
+ procedure Set_Text_Size
+ (This : in out Value_Output;
+ Size : in Font_Size);
+
+
+
+
+ procedure Draw
+ (This : in out Value_Output);
+
+ function Handle
+ (This : in out Value_Output;
+ Event : in Event_Kind)
+ return Event_Outcome;
+
+
+private
+
+
+ type Value_Output is new Valuator with null record;
+
+ overriding procedure Finalize
+ (This : in out Value_Output);
+
+
+
+
+ pragma Inline (Is_Soft);
+ pragma Inline (Set_Soft);
+
+
+ pragma Inline (Get_Text_Color);
+ pragma Inline (Set_Text_Color);
+ pragma Inline (Get_Text_Font);
+ pragma Inline (Set_Text_Font);
+ pragma Inline (Get_Text_Size);
+ pragma Inline (Set_Text_Size);
+
+
+ pragma Inline (Draw);
+ pragma Inline (Handle);
+
+
+end FLTK.Widgets.Valuators.Value_Outputs;
+