- Timestamp:
- Dec 17, 2024, 11:10:31 PM (9 days ago)
- Location:
- branches/Independent
- Files:
-
- 4 added
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Independent/Api.pas
r66 r68 26 26 procedure SetWindowRect(Handle: THandle; Rect: TRect); virtual; abstract; 27 27 procedure SetWindowVisible(Handle: THandle; Visible: Boolean); virtual; abstract; 28 function GetMousePosition: TPoint; virtual; abstract; 28 29 end; 29 30 … … 36 37 TApp = class 37 38 Name: string; 39 Terminated: Boolean; 38 40 procedure Run(Context: TAppContext); virtual; abstract; 39 41 constructor Create; virtual; … … 85 87 end; 86 88 87 88 89 end. 89 90 -
branches/Independent/Apps/Test/AppTest.pas
r67 r68 23 23 var 24 24 Handle: THandle; 25 Pos: TPoint; 25 26 begin 26 27 with Context.Api do begin … … 37 38 SetWindowRect(Handle, Bounds(350, 150, 500, 300)); 38 39 SetWindowVisible(Handle, True); 40 41 repeat 42 Pos := GetMousePosition; 43 SetWindowName(Handle, IntToStr(Pos.X) + ', ' + IntToStr(Pos.Y)); 44 Sleep(100 * OneMillisecond); 45 until Terminated; 39 46 end; 40 47 end; -
branches/Independent/Forms/FormMain.lfm
r66 r68 1 1 object FormName: TFormName 2 2 Left = 465 3 Height = 5 353 Height = 569 4 4 Top = 352 5 5 Width = 971 -
branches/Independent/Forms/FormMain.pas
r66 r68 34 34 procedure ConsoleWrite(Text: string); 35 35 function LoadFile(Name: string): string; 36 function GetMousePosition: TPoint; 36 37 public 37 38 FormConsole: TFormConsole; … … 58 59 System.Console.OnWrite := ConsoleWrite; 59 60 System.FileSystem.OnLoadFile := LoadFile; 61 System.Mouse.OnGetPosition := GetMousePosition; 60 62 System.OnDraw := FormScreen.Redraw; 61 63 FormScreen.System := System; … … 115 117 end; 116 118 119 function TFormName.GetMousePosition: TPoint; 120 begin 121 Result := Mouse.CursorPos; 122 end; 123 117 124 end. 118 125 -
branches/Independent/Independent.lpi
r67 r68 24 24 <SearchPaths> 25 25 <IncludeFiles Value="$(ProjOutDir)"/> 26 <OtherUnitFiles Value="Forms;Apps/Code;Apps/Test "/>26 <OtherUnitFiles Value="Forms;Apps/Code;Apps/Test;Devices"/> 27 27 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 28 28 </SearchPaths> … … 93 93 </Unit> 94 94 <Unit> 95 <Filename Value=" Console.pas"/>95 <Filename Value="Devices/Console.pas"/> 96 96 <IsPartOfProject Value="True"/> 97 97 </Unit> 98 98 <Unit> 99 <Filename Value=" FileSystem.pas"/>99 <Filename Value="Devices/FileSystem.pas"/> 100 100 <IsPartOfProject Value="True"/> 101 101 </Unit> … … 122 122 <IsPartOfProject Value="True"/> 123 123 </Unit> 124 <Unit> 125 <Filename Value="Devices/Mouse.pas"/> 126 <IsPartOfProject Value="True"/> 127 </Unit> 124 128 </Units> 125 129 </ProjectOptions> … … 131 135 <SearchPaths> 132 136 <IncludeFiles Value="$(ProjOutDir)"/> 133 <OtherUnitFiles Value="Forms;Apps/Code;Apps/Test "/>137 <OtherUnitFiles Value="Forms;Apps/Code;Apps/Test;Devices"/> 134 138 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 135 139 </SearchPaths> -
branches/Independent/Independent.lpr
r67 r68 9 9 {$ENDIF} 10 10 Interfaces, // this includes the LCL widgetset 11 Forms, FormMain, FormScreen, SysUtils, AppCode, SystemApi 11 Forms, FormMain, FormScreen, SysUtils, AppCode, SystemApi, Mouse 12 12 { you can add units after this }; 13 13 -
branches/Independent/Os.pas
r67 r68 4 4 5 5 uses 6 Classes, SysUtils, Generics.Collections, DateUtils, Api, Console, FileSystem; 6 Classes, SysUtils, Generics.Collections, DateUtils, Api, Console, FileSystem, 7 Mouse; 7 8 8 9 type … … 63 64 Console: TConsole; 64 65 FileSystem: TFileSystem; 66 Mouse: TMouse; 65 67 Apps: TApps; 66 68 RunningApps: TRunningApps; … … 187 189 Windows := TWindows.Create; 188 190 Console := TConsole.Create; 191 Mouse := TMouse.Create; 189 192 FileSystem := TFileSystem.Create; 190 193 RunningApps := TRunningApps.Create; … … 197 200 FreeAndNil(RunningApps); 198 201 FreeAndNil(Console); 202 FreeAndNil(Mouse); 199 203 FreeAndNil(FileSystem); 200 204 FreeAndNil(Windows); -
branches/Independent/SystemApi.pas
r67 r68 25 25 procedure SetWindowRect(Handle: THandle; Rect: TRect); override; 26 26 procedure SetWindowVisible(Handle: THandle; Visible: Boolean); override; 27 function GetMousePosition: TPoint; override; 27 28 end; 28 29 … … 101 102 end; 102 103 104 function TSystemApi.GetMousePosition: TPoint; 105 begin 106 Result := System.Mouse.GetPosition; 107 end; 108 103 109 end. 104 110
Note:
See TracChangeset
for help on using the changeset viewer.