home *** CD-ROM | disk | FTP | other *** search
- {*
- *
- * Copyright (c) 1992 by Richard W. Hansen
- *
- * This source code will compile.
- * Unpacked source is available to registered users.
- *
- *}
- UNIT TvApp;{$I TVDEFS.INC}INTERFACE USES App,Dialogs,Drivers,Objects,Views;CONST CNewColor=#$00#$00#$00#$00#$00#$00#$00#$00+
- #$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;
- CNewBlackWhite=#$00#$00#$00#$00#$00#$00#$00#$00+#$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;CNewMonochrome=#$00#$00#$00#$00#$00#$00#$00#$00+
- #$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;
- CBusyWindow=#102#102#102#102#102#102#102#102;TYPE PBusyWindow=^TBusyWindow;TBusyWindow=Object(TWindow)
- Constructor Init(AMessage:String);Function GetPalette:PPalette;Virtual;Procedure Show;Virtual;end;
- PNewApplication=^TNewApplication;TNewApplication=Object(TApplication)MouseVisible:Boolean;ToggleMouse:Boolean;
- Constructor Init;Procedure ShowBusy;Procedure ClearBusy;Procedure GetEvent(var Event:TEvent);Virtual;
- Procedure SetMouseToggle(Enable:Boolean);Function GetPalette:PPalette;Virtual;end;CONST BusyWindow:PBusyWindow=nil;
- IMPLEMENTATION Constructor TBusyWindow.Init(AMessage:String);var R:TRect;begin R.Assign(0,0,Length(AMessage)+2,3);
- TWindow.Init(R,'',wnNoNumber);Flags:=wfMove;DragMode:=dmDragMove;State:=State and not sfVisible;GetExtent(R);R.Grow(-1,-1);
- Insert(New(PStaticText,Init(R,AMessage)));end;Function TBusyWindow.GetPalette:PPalette;const
- P:String[Length(CBusyWindow)]=CBusyWindow;begin GetPalette:=@P;end;Procedure TBusyWindow.Show;begin TWindow.Show;MakeFirst;
- end;Constructor TNewApplication.Init;begin TApplication.Init;MouseVisible:=True;ToggleMouse:=True;
- BusyWindow:=New(PBusyWindow,Init('Working...'));if(BusyWindow<>nil)then DeskTop^.Insert(BusyWindow);end;
- Procedure TNewApplication.ShowBusy;begin if(BusyWindow<>nil)then BusyWindow^.Show;end;Procedure TNewApplication.ClearBusy;
- begin if(BusyWindow<>nil)then BusyWindow^.Hide;end;Procedure TNewApplication.GetEvent(var Event:TEvent);begin
- TApplication.GetEvent(Event);if ToggleMouse then Case Event.What of evMouseDown,evMouseUp:begin if not MouseVisible then
- ClearEvent(Event);end;evMouseMove:if not MouseVisible then begin MouseVisible:=True;ShowMouse;end;evKeyDown:
- if MouseVisible then begin MouseVisible:=False;HideMouse;end;end;end;
- Procedure TNewApplication.SetMouseToggle(Enable:Boolean);begin if(not Enable and ToggleMouse)and not MouseVisible then begin
- MouseVisible:=True;ShowMouse;end;ToggleMouse:=Enable;end;Function TNewApplication.GetPalette:PPalette;const
- P:Array[apColor..apMonochrome]of String[Length(CColor+CNewColor)]=(CColor+CNewColor,CBlackWhite+CNewBlackWhite,
- CMonochrome+CNewMonochrome );begin GetPalette:=@P[AppPalette];end;END.
-