diff options
Diffstat (limited to 'src/windows-find.adb')
-rw-r--r-- | src/windows-find.adb | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/src/windows-find.adb b/src/windows-find.adb new file mode 100644 index 0000000..4adc2ac --- /dev/null +++ b/src/windows-find.adb @@ -0,0 +1,130 @@ + + +with FLTK.Widgets; +with FLTK.Widgets.Groups.Windows.Double; +with FLTK.Widgets.Inputs; +with FLTK.Widgets.Buttons; +with FLTK.Widgets.Buttons.Enter; +with FLTK.Widgets.Buttons.Light.Check; + + +package body Windows.Find is + + + package W renames FLTK.Widgets; + package WD renames FLTK.Widgets.Groups.Windows.Double; + package IP renames FLTK.Widgets.Inputs; + package BU renames FLTK.Widgets.Buttons; + package EN renames FLTK.Widgets.Buttons.Enter; + package LC renames FLTK.Widgets.Buttons.Light.Check; + + + + + Find_M : aliased Find_Marshaller; + + overriding procedure Call + (This : in Find_Marshaller; + Item : in out W.Widget'Class) + is + use type BU.State; + type Find_Window_Access is access all Find_Window; + Dialog : access Find_Window := Find_Window_Access (Item.Parent); + begin + if Dialog.Callback /= null then + Dialog.Callback.Call + (Dialog.Find_What.Get_Value, + Dialog.Match_Case.Get_State = BU.On); + end if; + end Call; + + + + + function Create + return Find_Window + is + My_Width : Integer := 350; + My_Height : Integer := 130; + + Button_Width : Integer := 140; + Button_Height : Integer := 40; + + Input_Line : Integer := 10; + Case_Line : Integer := 50; + Button_Line : Integer := 80; + + Input_Width : Integer := 240; + Input_Height : Integer := 25; + Input_Margin_Right : Integer := 10; + + Check_Width : Integer := 100; + Check_Height : Integer := 20; + Case_Margin_Left : Integer := 50; + + Text_Size : Integer := 12; + begin + return This : Find_Window := + (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Find")) with + + Find_What => IP.Input'(IP.Create + (My_Width - Input_Width - Input_Margin_Right, + Input_Line, Input_Width, Input_Height, "Find what:")), + Match_Case => LC.Check_Button'(LC.Create + (Case_Margin_Left, Case_Line, Check_Width, Check_Height, "Match case")), + Cancel => BU.Button'(BU.Create + ((My_Width - 2 * Button_Width) / 3, + Button_Line, Button_Width, Button_Height, "Cancel")), + Start => EN.Enter_Button'(EN.Create + ((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width, + Button_Line, Button_Width, Button_Height, "Find")), + + Callback => null) do + + This.Add (This.Find_What); + This.Add (This.Match_Case); + This.Add (This.Cancel); + This.Cancel.Set_Callback (Hide_CB'Access); + This.Add (This.Start); + This.Start.Set_Callback (Find_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 Find_Window is + begin + return Create; + end Create; + + + + + function Create + (W, H : in Integer) + return Find_Window is + begin + return Create; + end Create; + + + + + procedure Set_Find_Callback + (This : in out Find_Window; + Func : not null access Find_Callback'Class) is + begin + This.Callback := Func; + end Set_Find_Callback; + + +end Windows.Find; + |