home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TVTOOL.ZIP / TVAPP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-10-08  |  2.8 KB  |  34 lines

  1. {*
  2. *
  3. *   Copyright (c) 1992 by Richard W. Hansen
  4. *
  5. *   This source code will compile.
  6. *   Unpacked source is available to registered users.
  7. *
  8. *}
  9. UNIT TvApp;{$I TVDEFS.INC}INTERFACE USES App,Dialogs,Drivers,Objects,Views;CONST CNewColor=#$00#$00#$00#$00#$00#$00#$00#$00+
  10. #$7F#$78#$70#$71#$7F#$70#$73#$7E#$78#$7F#$7F#$78#$70#$07#$0F+#$70#$7F#$07#$78#$00#$00#$00#$00#$00#$00#$00#$00#$00#$CF;
  11. CNewBlackWhite=#$00#$00#$00#$00#$00#$00#$00#$00+#$7F#$70#$78#$70#$7F#$70#$78#$0F#$70#$7F#$7F#$70#$70#$07#$0F+
  12. #$70#$7F#$07#$78#$00#$00#$00#$00#$00#$00#$00#$00#$00#$8F;CNewMonochrome=#$00#$00#$00#$00#$00#$00#$00#$00+
  13. #$7F#$70#$78#$70#$7F#$70#$78#$0F#$70#$7F#$7F#$70#$70#$07#$0F+#$70#$7F#$07#$78#$00#$00#$00#$00#$00#$00#$00#$00#$00#$8F;
  14. CBusyWindow=#102#102#102#102#102#102#102#102;TYPE PBusyWindow=^TBusyWindow;TBusyWindow=Object(TWindow)
  15. Constructor Init(AMessage:String);Function GetPalette:PPalette;Virtual;Procedure Show;Virtual;end;
  16. PNewApplication=^TNewApplication;TNewApplication=Object(TApplication)MouseVisible:Boolean;ToggleMouse:Boolean;
  17. Constructor Init;Procedure ShowBusy;Procedure ClearBusy;Procedure GetEvent(var Event:TEvent);Virtual;
  18. Procedure SetMouseToggle(Enable:Boolean);Function GetPalette:PPalette;Virtual;end;CONST BusyWindow:PBusyWindow=nil;
  19. IMPLEMENTATION Constructor TBusyWindow.Init(AMessage:String);var R:TRect;begin R.Assign(0,0,Length(AMessage)+2,3);
  20. TWindow.Init(R,'',wnNoNumber);Flags:=wfMove;DragMode:=dmDragMove;State:=State and not sfVisible;GetExtent(R);R.Grow(-1,-1);
  21. Insert(New(PStaticText,Init(R,AMessage)));end;Function TBusyWindow.GetPalette:PPalette;const
  22. P:String[Length(CBusyWindow)]=CBusyWindow;begin GetPalette:=@P;end;Procedure TBusyWindow.Show;begin TWindow.Show;MakeFirst;
  23. end;Constructor TNewApplication.Init;begin TApplication.Init;MouseVisible:=True;ToggleMouse:=True;
  24. BusyWindow:=New(PBusyWindow,Init('Working...'));if(BusyWindow<>nil)then DeskTop^.Insert(BusyWindow);end;
  25. Procedure TNewApplication.ShowBusy;begin if(BusyWindow<>nil)then BusyWindow^.Show;end;Procedure TNewApplication.ClearBusy;
  26. begin if(BusyWindow<>nil)then BusyWindow^.Hide;end;Procedure TNewApplication.GetEvent(var Event:TEvent);begin
  27. TApplication.GetEvent(Event);if ToggleMouse then Case Event.What of evMouseDown,evMouseUp:begin if not MouseVisible then
  28. ClearEvent(Event);end;evMouseMove:if not MouseVisible then begin MouseVisible:=True;ShowMouse;end;evKeyDown:
  29. if MouseVisible then begin MouseVisible:=False;HideMouse;end;end;end;
  30. Procedure TNewApplication.SetMouseToggle(Enable:Boolean);begin if(not Enable and ToggleMouse)and not MouseVisible then begin
  31. MouseVisible:=True;ShowMouse;end;ToggleMouse:=Enable;end;Function TNewApplication.GetPalette:PPalette;const
  32. P:Array[apColor..apMonochrome]of String[Length(CColor+CNewColor)]=(CColor+CNewColor,CBlackWhite+CNewBlackWhite,
  33. CMonochrome+CNewMonochrome );begin GetPalette:=@P[AppPalette];end;END.
  34.