summaryrefslogtreecommitdiff
path: root/src/windows-jump.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows-jump.adb')
-rw-r--r--src/windows-jump.adb111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/windows-jump.adb b/src/windows-jump.adb
new file mode 100644
index 0000000..64bd6f6
--- /dev/null
+++ b/src/windows-jump.adb
@@ -0,0 +1,111 @@
+
+
+with FLTK.Widgets.Groups.Windows.Double;
+with FLTK.Widgets.Buttons.Enter;
+with FLTK.Widgets.Inputs.Int;
+
+
+package body Windows.Jump is
+
+
+ package WD renames FLTK.Widgets.Groups.Windows.Double;
+ package BU renames FLTK.Widgets.Buttons;
+ package EN renames FLTK.Widgets.Buttons.Enter;
+ package IT renames FLTK.Widgets.Inputs.Int;
+
+
+
+
+ procedure Jump_M
+ (Item : in out FLTK.Widgets.Widget'Class)
+ is
+ type Jump_Window_Access is access all Jump_Window;
+ Dialog : access Jump_Window := Jump_Window_Access (Item.Parent);
+
+ Line : Integer := Dialog.To_Line.Get_Value;
+ begin
+ if Dialog.Callback /= null and Line > 0 then
+ Dialog.Callback.all (Line);
+ end if;
+ end Jump_M;
+
+
+
+
+ function Create
+ return Jump_Window
+ is
+ My_Width : Integer := 350;
+ My_Height : Integer := 110;
+
+ Button_Width : Integer := 140;
+ Button_Height : Integer := 40;
+
+ Input_Line : Integer := 10;
+ Button_Line : Integer := 60;
+
+ Input_Width : Integer := 240;
+ Input_Height : Integer := 25;
+ Input_Margin_Right : Integer := 10;
+ begin
+ return This : Jump_Window :=
+ (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Jump")) with
+
+ To_Line => IT.Integer_Input'(IT.Create
+ (My_Width - Input_Width - Input_Margin_Right,
+ Input_Line, Input_Width, Input_Height, "Jump to:")),
+ Cancel => BU.Button'(BU.Create
+ ((My_Width - 2 * Button_Width) / 3,
+ Button_Line, Button_Width, Button_Height, "Cancel")),
+ Go_Jump => EN.Enter_Button'(EN.Create
+ ((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width,
+ Button_Line, Button_Width, Button_Height, "Jump")),
+
+ Callback => null) do
+
+ This.Add (This.To_Line);
+ This.Add (This.Cancel);
+ This.Cancel.Set_Callback (Hide_CB'Access);
+ This.Add (This.Go_Jump);
+ This.Go_Jump.Set_Callback (Jump_M'Access);
+
+ This.Set_Callback (Hide_CB'Access);
+ This.Set_Icon (Logo);
+ This.Set_Modal;
+ end return;
+ end Create;
+
+
+
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Label_Text : in String)
+ return Jump_Window is
+ begin
+ return Create;
+ end Create;
+
+
+
+
+ function Create
+ (W, H : in Integer)
+ return Jump_Window is
+ begin
+ return Create;
+ end Create;
+
+
+
+
+ procedure Set_Jump_Callback
+ (This : in out Jump_Window;
+ Func : in Jump_Callback) is
+ begin
+ This.Callback := Func;
+ end Set_Jump_Callback;
+
+
+end Windows.Jump;
+