From 1e97ffcd6ec01eaa4b79d4903b721019e12657da Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 5 Nov 2024 06:28:09 +1300 Subject: Fl_Help_Dialog bound --- doc/fl_help_dialog.html | 252 +++++++++++++++++++++++++++++++++ doc/index.html | 3 +- progress.txt | 2 +- src/c_fl_help_dialog.cpp | 101 ++++++++++++++ src/c_fl_help_dialog.h | 52 +++++++ src/fltk-help_dialogs.adb | 345 ++++++++++++++++++++++++++++++++++++++++++++++ src/fltk-help_dialogs.ads | 145 +++++++++++++++++++ 7 files changed, 898 insertions(+), 2 deletions(-) create mode 100644 doc/fl_help_dialog.html create mode 100644 src/c_fl_help_dialog.cpp create mode 100644 src/c_fl_help_dialog.h create mode 100644 src/fltk-help_dialogs.adb create mode 100644 src/fltk-help_dialogs.ads diff --git a/doc/fl_help_dialog.html b/doc/fl_help_dialog.html new file mode 100644 index 0000000..2ae942b --- /dev/null +++ b/doc/fl_help_dialog.html @@ -0,0 +1,252 @@ + + + + + + + Fl_Help_Dialog Binding Map + + + + + + +

Fl_Help_Dialog Binding Map

+ + +Back to Index + + + + + + + + + + +
Package name
Fl_Help_DialogFLTK.Help_Dialogs
+ + + + + + + + + + + + + + + + +
Types
Fl_Help_DialogHelp_Dialog
 Help_Dialog_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Help_Dialog();
+
+function Create
+    return Help_Dialog;
+
+function Create
+       (X, Y, W, H : in Integer)
+    return Help_Dialog;
+
+int h();
+
+function Get_H
+       (This : in Help_Dialog)
+    return Integer;
+
+void hide();
+
+procedure Hide
+       (This : in out Help_Dialog);
+
+void load(const char *f);
+
+procedure Load
+       (This : in out Help_Dialog;
+        Name : in     String);
+
+void position(int xx, int yy);
+
+procedure Reposition
+       (This : in out Help_Dialog;
+        X, Y : in     Integer);
+
+void resize(int xx, int yy, int ww, int hh);
+
+procedure Resize
+       (This       : in out Help_Dialog;
+        X, Y, W, H : in     Integer);
+
+void show();
+
+procedure Show
+       (This : in out Help_Dialog);
+
+void show(int argc, char **argv);
+
 
+Fl_Fontsize textsize();
+
+function Get_Text_Size
+       (This : in Help_Dialog)
+    return Font_Size;
+
+void textsize(Fl_Fontsize s);
+
+procedure Set_Text_Size
+       (This : in out Help_Dialog;
+        Size : in     Font_Size);
+
+void topline(const char *n);
+
+procedure Set_Topline_Target
+       (This  : in out Help_Dialog;
+        Value : in     String);
+
+void topline(int n);
+
+procedure Set_Topline_Number
+       (This : in out Help_Dialog;
+        Line : in     Positive);
+
+const char * value() const;
+
+function Get_Content
+       (This : in Help_Dialog)
+    return String;
+
+void value(const char *f);
+
+procedure Set_Content
+       (This  : in out Help_Dialog;
+        Value : in     String);
+
+int visible();
+
+function Is_Visible
+       (This : in Help_Dialog)
+    return Boolean;
+
+int w();
+
+function Get_W
+       (This : in Help_Dialog)
+    return Integer;
+
+int x();
+
+function Get_X
+       (This : in Help_Dialog)
+    return Integer;
+
+int y();
+
+function Get_Y
+       (This : in Help_Dialog)
+    return Integer;
+
+ + + + + diff --git a/doc/index.html b/doc/index.html index c692083..89e6a49 100644 --- a/doc/index.html +++ b/doc/index.html @@ -53,7 +53,7 @@
  • Fl_Glut_Window
  • Fl_Graphics_Driver
  • Fl_Group
  • -
  • Fl_Help_Dialog
  • +
  • Fl_Help_Dialog
  • Fl_Help_View
  • Fl_Hold_Browser
  • Fl_Hor_Fill_Slider
  • @@ -147,6 +147,7 @@
  • FLTK.Draw
  • FLTK.Environment
  • FLTK.Event
  • +
  • FLTK.Help_Dialogs
  • FLTK.Images
  • FLTK.Images.Bitmaps
  • FLTK.Images.Bitmaps.XBM
  • diff --git a/progress.txt b/progress.txt index 15f15cf..9d13bc2 100644 --- a/progress.txt +++ b/progress.txt @@ -30,6 +30,7 @@ FLTK.Dialogs FLTK.Draw FLTK.Environment FLTK.Event +FLTK.Help_Dialogs FLTK.Images FLTK.Images.Bitmaps FLTK.Images.Bitmaps.XBM @@ -142,7 +143,6 @@ Fl_Display_Device Fl_File_Browser Fl_File_Chooser Fl_Glut_Window -Fl_Help_Dialog Fl_Hold_Browser Fl_Multi_Browser Fl_Postscript_File_Device diff --git a/src/c_fl_help_dialog.cpp b/src/c_fl_help_dialog.cpp new file mode 100644 index 0000000..9888df9 --- /dev/null +++ b/src/c_fl_help_dialog.cpp @@ -0,0 +1,101 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#include +#include "c_fl_help_dialog.h" + + + + +HELPDIALOG new_fl_help_dialog() { + Fl_Help_Dialog *d = new Fl_Help_Dialog(); + return d; +} + +void free_fl_help_dialog(HELPDIALOG d) { + delete reinterpret_cast(d); +} + + + + +void fl_help_dialog_show(HELPDIALOG d) { + reinterpret_cast(d)->show(); +} + +void fl_help_dialog_hide(HELPDIALOG d) { + reinterpret_cast(d)->hide(); +} + +int fl_help_dialog_visible(HELPDIALOG d) { + return reinterpret_cast(d)->visible(); +} + + + + +void fl_help_dialog_set_topline_number(HELPDIALOG d, int n) { + reinterpret_cast(d)->topline(n); +} + +void fl_help_dialog_set_topline_target(HELPDIALOG d, const char * t) { + reinterpret_cast(d)->topline(t); +} + + + + +void fl_help_dialog_load(HELPDIALOG d, const char * n) { + reinterpret_cast(d)->load(n); +} + +const char * fl_help_dialog_get_value(HELPDIALOG d) { + return reinterpret_cast(d)->value(); +} + +void fl_help_dialog_set_value(HELPDIALOG d, const char * v) { + reinterpret_cast(d)->value(v); +} + + + + +int fl_help_dialog_get_textsize(HELPDIALOG d) { + return reinterpret_cast(d)->textsize(); +} + +void fl_help_dialog_set_textsize(HELPDIALOG d, int s) { + reinterpret_cast(d)->textsize(s); +} + + + + +int fl_help_dialog_get_x(HELPDIALOG d) { + return reinterpret_cast(d)->x(); +} + +int fl_help_dialog_get_y(HELPDIALOG d) { + return reinterpret_cast(d)->y(); +} + +int fl_help_dialog_get_w(HELPDIALOG d) { + return reinterpret_cast(d)->w(); +} + +int fl_help_dialog_get_h(HELPDIALOG d) { + return reinterpret_cast(d)->h(); +} + +void fl_help_dialog_resize(HELPDIALOG d, int xx, int yy, int ww, int hh) { + reinterpret_cast(d)->resize(xx, yy, ww, hh); +} + +void fl_help_dialog_position(HELPDIALOG d, int xx, int yy) { + reinterpret_cast(d)->position(xx, yy); +} + + diff --git a/src/c_fl_help_dialog.h b/src/c_fl_help_dialog.h new file mode 100644 index 0000000..03846c2 --- /dev/null +++ b/src/c_fl_help_dialog.h @@ -0,0 +1,52 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#ifndef FL_HELP_DIALOG_GUARD +#define FL_HELP_DIALOG_GUARD + + + + +typedef void* HELPDIALOG; + + + + +extern "C" HELPDIALOG new_fl_help_dialog(); +extern "C" void free_fl_help_dialog(HELPDIALOG d); + + + + +extern "C" void fl_help_dialog_show(HELPDIALOG d); +extern "C" void fl_help_dialog_hide(HELPDIALOG d); +extern "C" int fl_help_dialog_visible(HELPDIALOG d); + + +extern "C" void fl_help_dialog_set_topline_number(HELPDIALOG d, int n); +extern "C" void fl_help_dialog_set_topline_target(HELPDIALOG d, const char * t); + + +extern "C" void fl_help_dialog_load(HELPDIALOG d, const char * n); +extern "C" const char * fl_help_dialog_get_value(HELPDIALOG d); +extern "C" void fl_help_dialog_set_value(HELPDIALOG d, const char * v); + + +extern "C" int fl_help_dialog_get_textsize(HELPDIALOG d); +extern "C" void fl_help_dialog_set_textsize(HELPDIALOG d, int s); + + +extern "C" int fl_help_dialog_get_x(HELPDIALOG d); +extern "C" int fl_help_dialog_get_y(HELPDIALOG d); +extern "C" int fl_help_dialog_get_w(HELPDIALOG d); +extern "C" int fl_help_dialog_get_h(HELPDIALOG d); +extern "C" void fl_help_dialog_resize(HELPDIALOG d, int xx, int yy, int ww, int hh); +extern "C" void fl_help_dialog_position(HELPDIALOG d, int xx, int yy); + + +#endif + + diff --git a/src/fltk-help_dialogs.adb b/src/fltk-help_dialogs.adb new file mode 100644 index 0000000..a98545c --- /dev/null +++ b/src/fltk-help_dialogs.adb @@ -0,0 +1,345 @@ + + +-- Programmed by Jedidiah Barber +-- Released into the public domain + + +with + + Interfaces.C.Strings; + +use type + + Interfaces.C.int; + + +package body FLTK.Help_Dialogs is + + + ------------------------ + -- Functions From C -- + ------------------------ + + function new_fl_help_dialog + return Storage.Integer_Address; + pragma Import (C, new_fl_help_dialog, "new_fl_help_dialog"); + pragma Inline (new_fl_help_dialog); + + procedure free_fl_help_dialog + (D : in Storage.Integer_Address); + pragma Import (C, free_fl_help_dialog, "free_fl_help_dialog"); + pragma Inline (free_fl_help_dialog); + + + + + procedure fl_help_dialog_show + (D : in Storage.Integer_Address); + pragma Import (C, fl_help_dialog_show, "fl_help_dialog_show"); + pragma Inline (fl_help_dialog_show); + + procedure fl_help_dialog_hide + (D : in Storage.Integer_Address); + pragma Import (C, fl_help_dialog_hide, "fl_help_dialog_hide"); + pragma Inline (fl_help_dialog_hide); + + function fl_help_dialog_visible + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_help_dialog_visible, "fl_help_dialog_visible"); + pragma Inline (fl_help_dialog_visible); + + + + + procedure fl_help_dialog_set_topline_number + (D : in Storage.Integer_Address; + N : in Interfaces.C.int); + pragma Import (C, fl_help_dialog_set_topline_number, "fl_help_dialog_set_topline_number"); + pragma Inline (fl_help_dialog_set_topline_number); + + procedure fl_help_dialog_set_topline_target + (D : in Storage.Integer_Address; + T : in Interfaces.C.char_array); + pragma Import (C, fl_help_dialog_set_topline_target, "fl_help_dialog_set_topline_target"); + pragma Inline (fl_help_dialog_set_topline_target); + + + + + procedure fl_help_dialog_load + (D : in Storage.Integer_Address; + N : in Interfaces.C.char_array); + pragma Import (C, fl_help_dialog_load, "fl_help_dialog_load"); + pragma Inline (fl_help_dialog_load); + + function fl_help_dialog_get_value + (D : in Storage.Integer_Address) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_help_dialog_get_value, "fl_help_dialog_get_value"); + pragma Inline (fl_help_dialog_get_value); + + procedure fl_help_dialog_set_value + (D : in Storage.Integer_Address; + V : in Interfaces.C.char_array); + pragma Import (C, fl_help_dialog_set_value, "fl_help_dialog_set_value"); + pragma Inline (fl_help_dialog_set_value); + + + + + function fl_help_dialog_get_textsize + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_help_dialog_get_textsize, "fl_help_dialog_get_textsize"); + pragma Inline (fl_help_dialog_get_textsize); + + procedure fl_help_dialog_set_textsize + (D : in Storage.Integer_Address; + S : in Interfaces.C.int); + pragma Import (C, fl_help_dialog_set_textsize, "fl_help_dialog_set_textsize"); + pragma Inline (fl_help_dialog_set_textsize); + + + + + function fl_help_dialog_get_x + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_help_dialog_get_x, "fl_help_dialog_get_x"); + pragma Inline (fl_help_dialog_get_x); + + function fl_help_dialog_get_y + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_help_dialog_get_y, "fl_help_dialog_get_y"); + pragma Inline (fl_help_dialog_get_y); + + function fl_help_dialog_get_w + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_help_dialog_get_w, "fl_help_dialog_get_w"); + pragma Inline (fl_help_dialog_get_w); + + function fl_help_dialog_get_h + (D : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_help_dialog_get_h, "fl_help_dialog_get_h"); + pragma Inline (fl_help_dialog_get_h); + + procedure fl_help_dialog_resize + (D : in Storage.Integer_Address; + X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_help_dialog_resize, "fl_help_dialog_resize"); + pragma Inline (fl_help_dialog_resize); + + procedure fl_help_dialog_position + (D : in Storage.Integer_Address; + X, Y : in Interfaces.C.int); + pragma Import (C, fl_help_dialog_position, "fl_help_dialog_position"); + pragma Inline (fl_help_dialog_position); + + + + + ----------------------------------- + -- Controlled Type Subprograms -- + ----------------------------------- + + procedure Finalize + (This : in out Help_Dialog) is + begin + if This.Void_Ptr /= Null_Pointer and then + This in Help_Dialog'Class + then + free_fl_help_dialog (This.Void_Ptr); + This.Void_Ptr := Null_Pointer; + end if; + Finalize (Wrapper (This)); + end Finalize; + + + + + ----------------------- + -- Help_Dialog API -- + ----------------------- + + package body Forge is + + function Create + return Help_Dialog is + begin + return This : Help_Dialog do + This.Void_Ptr := new_fl_help_dialog; + end return; + end Create; + + + function Create + (X, Y, W, H : in Integer) + return Help_Dialog is + begin + return This : Help_Dialog do + This.Void_Ptr := new_fl_help_dialog; + This.Resize (X, Y, W, H); + end return; + end Create; + + end Forge; + + + + + procedure Show + (This : in out Help_Dialog) is + begin + fl_help_dialog_show (This.Void_Ptr); + end Show; + + + procedure Hide + (This : in out Help_Dialog) is + begin + fl_help_dialog_hide (This.Void_Ptr); + end Hide; + + + function Is_Visible + (This : in Help_Dialog) + return Boolean is + begin + return fl_help_dialog_visible (This.Void_Ptr) = 1; + end Is_Visible; + + + + + procedure Set_Topline_Number + (This : in out Help_Dialog; + Line : in Positive) is + begin + fl_help_dialog_set_topline_number (This.Void_Ptr, Interfaces.C.int (Line) - 1); + end Set_Topline_Number; + + + procedure Set_Topline_Target + (This : in out Help_Dialog; + Value : in String) is + begin + fl_help_dialog_set_topline_target (This.Void_Ptr, Interfaces.C.To_C (Value)); + end Set_Topline_Target; + + + + + procedure Load + (This : in out Help_Dialog; + Name : in String) is + begin + fl_help_dialog_load (This.Void_Ptr, Interfaces.C.To_C (Name)); + end Load; + + + function Get_Content + (This : in Help_Dialog) + return String + is + Raw_Chars : Interfaces.C.Strings.chars_ptr := fl_help_dialog_get_value (This.Void_Ptr); + use type Interfaces.C.Strings.chars_ptr; + begin + if Raw_Chars = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Raw_Chars); + end if; + end Get_Content; + + + procedure Set_Content + (This : in out Help_Dialog; + Value : in String) is + begin + fl_help_dialog_set_value (This.Void_Ptr, Interfaces.C.To_C (Value)); + end Set_Content; + + + + + function Get_Text_Size + (This : in Help_Dialog) + return Font_Size is + begin + return Font_Size (fl_help_dialog_get_textsize (This.Void_Ptr)); + end Get_Text_Size; + + + procedure Set_Text_Size + (This : in out Help_Dialog; + Size : in Font_Size) is + begin + fl_help_dialog_set_textsize (This.Void_Ptr, Interfaces.C.int (Size)); + end Set_Text_Size; + + + + + function Get_X + (This : in Help_Dialog) + return Integer is + begin + return Integer (fl_help_dialog_get_x (This.Void_Ptr)); + end Get_X; + + + function Get_Y + (This : in Help_Dialog) + return Integer is + begin + return Integer (fl_help_dialog_get_y (This.Void_Ptr)); + end Get_Y; + + + function Get_W + (This : in Help_Dialog) + return Integer is + begin + return Integer (fl_help_dialog_get_w (This.Void_Ptr)); + end Get_W; + + + function Get_H + (This : in Help_Dialog) + return Integer is + begin + return Integer (fl_help_dialog_get_h (This.Void_Ptr)); + end Get_H; + + + procedure Resize + (This : in out Help_Dialog; + X, Y, W, H : in Integer) is + begin + fl_help_dialog_resize + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Resize; + + + procedure Reposition + (This : in out Help_Dialog; + X, Y : in Integer) is + begin + fl_help_dialog_position + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Reposition; + + +end FLTK.Help_Dialogs; + + diff --git a/src/fltk-help_dialogs.ads b/src/fltk-help_dialogs.ads new file mode 100644 index 0000000..ebe59df --- /dev/null +++ b/src/fltk-help_dialogs.ads @@ -0,0 +1,145 @@ + + +-- Programmed by Jedidiah Barber +-- Released into the public domain + + +package FLTK.Help_Dialogs is + + + type Help_Dialog is new Wrapper with private; + + type Help_Dialog_Reference (Data : not null access Help_Dialog'Class) is limited null record + with Implicit_Dereference => Data; + + + + + package Forge is + + function Create + return Help_Dialog; + + function Create + (X, Y, W, H : in Integer) + return Help_Dialog; + + private + + pragma Inline (Create); + + end Forge; + + + + + procedure Show + (This : in out Help_Dialog); + + procedure Hide + (This : in out Help_Dialog); + + function Is_Visible + (This : in Help_Dialog) + return Boolean; + + + + + procedure Set_Topline_Number + (This : in out Help_Dialog; + Line : in Positive); + + procedure Set_Topline_Target + (This : in out Help_Dialog; + Value : in String); + + + + + -- Name here can be either a ftp/http/https/ipp/mailto/news URL or a filename + -- See Load procedure in FLTK.Widgets.Groups.Help_Views + procedure Load + (This : in out Help_Dialog; + Name : in String); + + function Get_Content + (This : in Help_Dialog) + return String; + + procedure Set_Content + (This : in out Help_Dialog; + Value : in String); + + + + + function Get_Text_Size + (This : in Help_Dialog) + return Font_Size; + + procedure Set_Text_Size + (This : in out Help_Dialog; + Size : in Font_Size); + + + + + function Get_X + (This : in Help_Dialog) + return Integer; + + function Get_Y + (This : in Help_Dialog) + return Integer; + + function Get_W + (This : in Help_Dialog) + return Integer; + + function Get_H + (This : in Help_Dialog) + return Integer; + + procedure Resize + (This : in out Help_Dialog; + X, Y, W, H : in Integer); + + procedure Reposition + (This : in out Help_Dialog; + X, Y : in Integer); + + +private + + + type Help_Dialog is new Wrapper with null record; + + overriding procedure Finalize + (This : in out Help_Dialog); + + + pragma Inline (Show); + pragma Inline (Hide); + pragma Inline (Is_Visible); + + pragma Inline (Set_Topline_Number); + pragma Inline (Set_Topline_Target); + + pragma Inline (Load); + pragma Inline (Set_Content); + + pragma Inline (Get_Text_Size); + pragma Inline (Set_Text_Size); + + pragma Inline (Get_X); + pragma Inline (Get_Y); + pragma Inline (Get_W); + pragma Inline (Get_H); + pragma Inline (Resize); + pragma Inline (Reposition); + + +end FLTK.Help_Dialogs; + + -- cgit