Changeset 13 for os/trunk/System
- Timestamp:
- Feb 29, 2016, 3:09:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
os/trunk/System/LDOS.Kernel.pas
r8 r13 55 55 TScreen = class(TComponent) 56 56 private 57 function GetFocusedForm: TForm; 58 procedure SetFocusedForm(const Value: TForm); 57 59 public 58 60 Kernel: TKernel; … … 63 65 procedure HandleResize; 64 66 procedure Paint; 65 pro cedure FocusForm(Form: TForm);67 property FocusedForm: TForm read GetFocusedForm write SetFocusedForm; 66 68 constructor Create; override; 67 69 destructor Destroy; override; … … 78 80 TMouse = class 79 81 Kernel: TKernel; 82 MovedForm: TForm; 80 83 procedure HandleMove(Position: TPoint); 81 84 procedure HandleDown(Position: TPoint); … … 233 236 end; 234 237 235 procedure TScreen.FocusForm(Form: TForm); 236 var 237 I: Integer; 238 FormIndex: Integer; 239 begin 240 FormIndex := Forms.IndexOf(Form); 241 for I := 0 to Forms.Count - 1 do 242 Forms[I].Focused := I = FormIndex; 243 244 Forms.Move(FormIndex, Forms.Count - 1); 245 Paint; 238 function TScreen.GetFocusedForm: TForm; 239 begin 240 if Forms.Count > 0 then 241 Result := Forms[Forms.Count - 1] 242 else Result := nil; 246 243 end; 247 244 … … 272 269 end; 273 270 271 procedure TScreen.SetFocusedForm(const Value: TForm); 272 var 273 I: Integer; 274 FormIndex: Integer; 275 begin 276 FormIndex := Forms.IndexOf(Value); 277 for I := 0 to Forms.Count - 1 do 278 Forms[I].Focused := I = FormIndex; 279 280 Forms.Move(FormIndex, Forms.Count - 1); 281 Paint; 282 end; 283 274 284 { TDriver } 275 285 … … 313 323 try 314 324 for Form in Kernel.Screen.Forms do 325 if Form.Focused then 315 326 if Form.HandleMessage(NewMessage) then begin 316 327 Break; … … 356 367 begin 357 368 NewMessage := TMessageMouseDown.Create; 369 NewMessage.Position := Position; 370 try 371 for Form in Kernel.Screen.Forms do 372 if Form.Bounds.Contains(Position) then begin 373 MovedForm := Form; 374 if Form.HandleMessage(NewMessage) then begin 375 Break; 376 end; 377 end; 378 finally 379 NewMessage.Destroy; 380 end; 381 end; 382 383 procedure TMouse.HandleMove(Position: TPoint); 384 var 385 Form: TForm; 386 NewMessage: TMessageMouseMove; 387 begin 388 NewMessage := TMessageMouseMove.Create; 358 389 NewMessage.Position := Position; 359 390 try … … 364 395 end; 365 396 end; 366 finally 367 NewMessage.Destroy; 368 end; 369 end; 370 371 procedure TMouse.HandleMove(Position: TPoint); 372 var 373 Form: TForm; 374 NewMessage: TMessageMouseMove; 375 begin 376 NewMessage := TMessageMouseMove.Create; 397 if Assigned(Kernel.Screen.FocusedForm) then 398 Kernel.Screen.FocusedForm.HandleMessage(NewMessage); 399 finally 400 NewMessage.Destroy; 401 end; 402 end; 403 404 procedure TMouse.HandleUp(Position: TPoint); 405 var 406 Form: TForm; 407 NewMessage: TMessageMouseUp; 408 begin 409 NewMessage := TMessageMouseUp.Create; 377 410 NewMessage.Position := Position; 378 411 try … … 383 416 end; 384 417 end; 385 finally 386 NewMessage.Destroy; 387 end; 388 end; 389 390 procedure TMouse.HandleUp(Position: TPoint); 391 var 392 Form: TForm; 393 NewMessage: TMessageMouseUp; 394 begin 395 NewMessage := TMessageMouseUp.Create; 396 NewMessage.Position := Position; 397 try 398 for Form in Kernel.Screen.Forms do 399 if Form.Bounds.Contains(Position) then begin 400 if Form.HandleMessage(NewMessage) then begin 401 Break; 402 end; 403 end; 418 if Assigned(Kernel.Screen.FocusedForm) then 419 Kernel.Screen.FocusedForm.HandleMessage(NewMessage); 404 420 finally 405 421 NewMessage.Destroy;
Note:
See TracChangeset
for help on using the changeset viewer.