diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/c_fl_help_dialog.cpp | 101 | ||||
-rw-r--r-- | src/c_fl_help_dialog.h | 52 | ||||
-rw-r--r-- | src/fltk-help_dialogs.adb | 345 | ||||
-rw-r--r-- | src/fltk-help_dialogs.ads | 145 |
4 files changed, 643 insertions, 0 deletions
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 <FL/Fl_Help_Dialog.H> +#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<Fl_Help_Dialog*>(d); +} + + + + +void fl_help_dialog_show(HELPDIALOG d) { + reinterpret_cast<Fl_Help_Dialog*>(d)->show(); +} + +void fl_help_dialog_hide(HELPDIALOG d) { + reinterpret_cast<Fl_Help_Dialog*>(d)->hide(); +} + +int fl_help_dialog_visible(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->visible(); +} + + + + +void fl_help_dialog_set_topline_number(HELPDIALOG d, int n) { + reinterpret_cast<Fl_Help_Dialog*>(d)->topline(n); +} + +void fl_help_dialog_set_topline_target(HELPDIALOG d, const char * t) { + reinterpret_cast<Fl_Help_Dialog*>(d)->topline(t); +} + + + + +void fl_help_dialog_load(HELPDIALOG d, const char * n) { + reinterpret_cast<Fl_Help_Dialog*>(d)->load(n); +} + +const char * fl_help_dialog_get_value(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->value(); +} + +void fl_help_dialog_set_value(HELPDIALOG d, const char * v) { + reinterpret_cast<Fl_Help_Dialog*>(d)->value(v); +} + + + + +int fl_help_dialog_get_textsize(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->textsize(); +} + +void fl_help_dialog_set_textsize(HELPDIALOG d, int s) { + reinterpret_cast<Fl_Help_Dialog*>(d)->textsize(s); +} + + + + +int fl_help_dialog_get_x(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->x(); +} + +int fl_help_dialog_get_y(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->y(); +} + +int fl_help_dialog_get_w(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->w(); +} + +int fl_help_dialog_get_h(HELPDIALOG d) { + return reinterpret_cast<Fl_Help_Dialog*>(d)->h(); +} + +void fl_help_dialog_resize(HELPDIALOG d, int xx, int yy, int ww, int hh) { + reinterpret_cast<Fl_Help_Dialog*>(d)->resize(xx, yy, ww, hh); +} + +void fl_help_dialog_position(HELPDIALOG d, int xx, int yy) { + reinterpret_cast<Fl_Help_Dialog*>(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; + + |