The document defines a Turbo Vision File Manager Demo for a Trash Can object, including its initialization, drawing, event handling, and state management. It allows users to drag and drop files into the trash can, with confirmation prompts for deletion. The implementation includes methods for drawing the trash can and handling mouse events.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views3 pages
Trash
The document defines a Turbo Vision File Manager Demo for a Trash Can object, including its initialization, drawing, event handling, and state management. It allows users to drag and drop files into the trash can, with confirmation prompts for deletion. The implementation includes methods for drawing the trash can and handling mouse events.
begin inherited Init(Bounds); Options := Options or (ofSelectable + ofTopSelect); EventMask := EventMask or evBroadcast; end;
function TTrashCan.GetPalette: PPalette;
begin GetPalette := @CTrashCan; end;
procedure TTrashCan.Draw; var B: TDrawBuffer; C: Word; begin if State and sfDragging <> 0 then C := 3 else if State and sfSelected = 0 then C := 1 else C := 2; C := GetColor(C); MoveStr(B, #209#209#216#209#209, C); WriteLine(0, 0, Size.X, 1, B); MoveStr(B, 'Trash', C); WriteLine(0, 1, Size.X, 1, B); MoveStr(B, #192#193#193#193#217, C); WriteLine(0, 2, Size.X, 1, B); end;
begin inherited SetState(AState, Enable); if AState and sfSelected <> 0 then SetCmdState([cmNext, cmPrev], Enable); if (AState and (sfSelected + sfFocused) <> 0) or (AState and (sfActive + sfDragging) <> 0) then DrawView; end;
procedure TTrashCan.Reposition(var R: TRect);
begin Inc(R.A.X); R.A.Y := R.B.Y - 4; MoveTo(R.A.X, R.A.Y); end;