diff options
Diffstat (limited to 'src/editor_windows.adb')
-rw-r--r-- | src/editor_windows.adb | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/src/editor_windows.adb b/src/editor_windows.adb index 7fdf744..4fdf2ae 100644 --- a/src/editor_windows.adb +++ b/src/editor_windows.adb @@ -2,11 +2,17 @@ with FLTK.Enums; use FLTK.Enums; +with FLTK.Widgets; +use FLTK.Widgets; +with FLTK.Widgets.Groups.Windows; +use FLTK.Widgets.Groups.Windows; package body Editor_Windows is + -- Editor_Window functions and procedures + function Create (X, Y, W, H : in Integer; Label_Text : in String) @@ -114,5 +120,131 @@ package body Editor_Windows is end Delete; + + + -- used to hide about/find/replace/etc windows instead + -- of constantly creating and destroying them + + Hide_CB : aliased Hide_Callback; + + overriding procedure Call + (This : in Hide_Callback; + Item : in out Widget'Class) is + begin + if Item in Window'Class then + Window (Item).Hide; + end if; + end Call; + + + + + -- About_Window functions and procedures + + function Create + (X, Y, W, H : in Integer; + Label_Text : in String) + return About_Window is + + Heading_Text : String := "AdaPad 0.9"; + Blurb_Text : String := "FLTK based simple text editor written in Ada"; + Author_Text : String := "Written by Jed Barber"; + + begin + return This : About_Window := + (Double_Window'(Create (X, Y, W, H, Label_Text)) with + Heading => Box'(Create (0, Y * 7 / 16, W, H / 8, Heading_Text)), + Blurb => Box'(Create (0, Y * 10 / 16, W, H / 8, Blurb_Text)), + Author => Box'(Create (0, Y * 12 / 16, W, H / 8, Author_Text))) do + This.Add (This.Heading); + This.Add (This.Blurb); + This.Add (This.Author); + This.Set_Callback (Hide_CB'Access); + end return; + end Create; + + + + + function Create + (W, H : in Integer) + return About_Window is + begin + return Create (0, 0, W, H, "About AdaPad"); + end Create; + + + + + -- Find_Window functions and procedures + + function Create + (X, Y, W, H : in Integer; + Label_Text : in String) + return Find_Window is + begin + return This : Find_Window := + (Double_Window'(Create (X, Y, W, H, Label_Text)) with + Placeholder => 0) do + This.Set_Callback (Hide_CB'Access); + end return; + end Create; + + + + + function Create + (W, H : in Integer) + return Find_Window is + begin + return Create (0, 0, W, H, "Find"); + end Create; + + + + + procedure Reset + (This : in out Find_Window) is + begin + null; + end Reset; + + + + + -- Replace_Window functions and procedures + + function Create + (X, Y, W, H : in Integer; + Label_Text : in String) + return Replace_Window is + begin + return This : Replace_Window := + (Double_Window'(Create (X, Y, W, H, Label_Text)) with + Placeholder => 0) do + This.Set_Callback (Hide_CB'Access); + end return; + end Create; + + + + + function Create + (W, H : in Integer) + return Replace_Window is + begin + return Create (0, 0, W, H, "Replace"); + end Create; + + + + + procedure Reset + (This : in out Replace_Window) is + begin + null; + end Reset; + + end Editor_Windows; |