home *** CD-ROM | disk | FTP | other *** search
- Unit GVViews;
-
-
- interface
-
- uses Objects, Drivers, Views, Memory;
-
- Const
-
- { Color Palettes }
-
- CBackground = #1;
- CFrame = #2#3#4#5#6#7#8#9#10#11#12#13;
- CScrollBar = #14#15#16#17#18;
- CScroller = #19#20#21#22;
- CListViewer = #134#135#136#137#138#139;
-
- CWhiteWindow = #10#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#27#28+
- #29#30#31;
- CGrayWindow = #32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48#49#50+
- #51#52#53;
- CCyanWindow = #54#55#56#57#58#59#60#61#62#63#64#65#66#67#68#69#70#71#72+
- #73#74#75;
-
- { TView State masks (Auszug aus VIEWS.INT) }
-
- sfVisible = $0001; sfCursorVis = $0002; sfCursorIns = $0004;
- sfShadow = $0008; sfActive = $0010; sfSelected = $0020;
- sfFocused = $0040; sfDragging = $0080; sfDisabled = $0100;
- sfModal = $0200; sfDefault = $0400; sfExposed = $0800;
-
- sfBuffer = $1000;
-
- { TView Option masks }
-
- ofSelectable = $0001; ofTopSelect = $0002; ofFirstClick = $0004;
- ofFramed = $0008; ofPreProcess = $0010; ofPostProcess = $0020;
- ofBuffer = $0040; ofTileable = $0080; ofCenterX = $0100;
- ofCenterY = $0200; ofCentered = $0300;
- ofClip = $0400; ofMetaFile = $0800; ofValidate = $1000;
-
- { Standard command codes }
-
- cmValid = 0; cmQuit = 1; cmError = 2;
- cmMenu = 3; cmClose = 4; cmZoom = 5;
- cmResize = 6; cmNext = 7; cmPrev = 8;
- cmHelp = 9;
-
- { TDialog standard commands }
-
- cmOK = 10; cmCancel = 11; cmYes = 12;
- cmNo = 13; cmDefault = 14;
-
- { TButton message commands }
-
- cmGrabDefault = 15; cmReleaseDefault = 16;
-
- { TWindow message commands }
-
- cmRestoreBackground = 17;
-
- { Standard messages }
-
- cmReceivedFocus = 50;
- cmReleasedFocus = 51;
- cmCommandSetChanged = 52;
-
- { Standard mouse cursors }
-
- mcInput = 50;
- mcMove = 51;
- mcResizeDnRi = 52;
- mcResizeDnLe = 53;
- mcResizeVert = 54;
- mcResizeHori = 55;
-
- { TButton flags }
-
- bfNormal = $00;
- bfDefault = $01;
- bfLeftJust = $02;
- bfBroadcast = $04;
- bfGrabFocus = $08;
-
- { StandardScrollbar flags }
-
- sbHorizontal = $0001;
- sbVertical = $0002;
- sbHandleKeyBoard = $0004;
- sbDoScrolling = $0008;
-
- { ScrollBar flags }
-
- sbLeftArrow = 0; sbRightArrow = 1; sbPageLeft = 2; sbPageRight = 3;
- sbUpArrow = 4; sbDownArrow = 5; sbPageUp = 6; sbPageDown = 7;
- sbIndicator = 8;
-
- { TWindow palette entries }
-
- wpWhiteWindow = 0;
- wpGrayWindow = 1;
- wpCyanWindow = 2;
-
- { ResMode values }
-
- rmDnRi = 1; rmUpRi = 2; rmDnLe = 3; rmUpLe = 4; rmLeft = 5;
- rmRight = 6; rmUp = 7; rmDown = 8;
-
- { Minimal window size }
-
- GMinWinSize : TPoint = (X: 170; Y: 100);
-
- { Window field size }
-
- IconSize = 20;
-
- { Window dragging add constant }
-
- WinDragAdd = 5;
-
- { Window commands to enable/disable }
-
- WindowCmds: TCommandSet = [cmNext, cmPrev, cmTile, cmCascade];
-
- var
-
- { Window message rectangle }
-
- msgClip: TRect;
-
- Type
-
- PVRect = ^TVRect;
- TVRect = record
- Count: Byte;
- Next: PVRect;
- R: Array [0..0] Of TRect;
- end;
-
- PGGroup = ^TGGroup;
- PGView = ^TGView;
-
- TGView = Object (TView)
- GOwner:PGGroup;
- GNext:PGView;
- CursorSize: TPoint;
- CursorFlag, Restore: Boolean;
- constructor Init (var Bounds: TRect);
- destructor Done; virtual;
- constructor Load (var S: TStream);
- procedure ChangeBounds (var R: TRect); virtual;
- procedure ChMCursor; virtual;
- procedure DeleteRectList (var RectList: PVRect);
- procedure Draw; virtual;
- procedure DrawCursor;
- procedure DrawRectList (var RectList: PVRect);
- procedure DrawView;
- procedure EndModal (Command: Word); virtual;
- function Exposed: Boolean;
- function Focus: Boolean;
- function GetColor (Color:Word):Word;
- procedure GetPeerViewPtr (var S:TStream; var P);
- { procedure GetBGIPoint (GVPoint: TPoint; var BGIPoint: TPoint); }
- procedure GetVisibleRect (var RectList: PVRect);
- procedure GetInVisibleRect (var RectList: PVRect);
- function GetStandardFont: Word;
- procedure KeyEvent (var Event: TEvent);
- procedure Locate (var Bounds: TRect); virtual;
- function MouseEvent (var Event: TEvent; Mask: Word): Boolean;
- function NextView: PGView;
- function Prev: PGView;
- function PrevView: PGView;
- procedure PutInFrontOf (Target: PGView); virtual;
- procedure PutPeerViewPtr (var S:TStream; P: PGView);
- procedure SetViewPort; virtual;
- procedure RestoreViewPort; virtual;
- procedure HandleEvent (var Event:TEvent); virtual;
- procedure Select;
- procedure SetCursor (X, Y: Integer);
- procedure SetState (AState: Word; Enable: Boolean); virtual;
- procedure Store (var S: TStream);
- private
- OldOrigin: TPoint;
- OldClipRect: TRect;
- OldCriticalArea: TRect;
- SetManual: Boolean;
- End;
-
- { TFrame object }
-
- { Palette layout }
- { 1 = Selected frame }
- { 2 = Normal frame }
- { 3 = Modal frame }
- { 4 = Zoomfield }
- { 5 = Normal background }
- { 6 = Selected background }
- { 7 = Normal title }
- { 8 = Selected title }
- { 9 = Close-/Zoomfield outside }
- { 10 = Closefield frame }
- { 11 = Closefield inside }
- { 12 = Closefield shadow }
-
- PFrame = ^TFrame;
- TFrame = Object (TGView)
- TitleSize:Integer;
- Zoomed: Boolean;
- constructor Init (var Bounds:TRect; AFlags: Byte);
- constructor Load (var S: TStream);
- procedure Store (var S: TStream);
- procedure ChMCursor; virtual;
- function GetPalette:PPalette; virtual;
- procedure Draw; virtual;
- procedure DrawZoomField (Down: Boolean); virtual;
- procedure HandleEvent (var Event: TEvent); virtual;
- procedure SetState (AState: Word; Enable: Boolean); virtual;
- function Valid (Command: Word): Boolean; virtual;
- private
- OldC: Integer;
- End;
-
- { TBackGround object }
-
- PBackGround = ^TBackGround;
- TBackGround = Object (TGView)
- constructor Init (var Bounds:TRect);
- constructor Load (var S: TStream);
- procedure Store (var S: TStream);
- procedure draw; virtual;
- End;
-
- { TScrollBar object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Frame }
- { 3 = Buttons }
- { 4 = Button shadows }
- { 5 = Page area }
-
- PScrollBar = ^TScrollBar;
- TScrollBar = object(TGView)
- ButtonSize: Byte;
- Flags: Byte;
- Value: Integer;
- Min: Integer;
- Max: Integer;
- PgStep: Integer;
- ArStep: Integer;
- constructor Init(var Bounds: TRect);
- constructor Load(var S: TStream);
- { procedure ChangeBounds (var Bounds: TRect); virtual; }
- procedure Draw; virtual;
- procedure DrawUpButton (Down: Boolean); virtual;
- procedure DrawDnButton (Down: Boolean); virtual;
- procedure DrawIndicator (V: Integer; Down: Boolean); virtual;
- function GetPalette: PPalette; virtual;
- function GetPosition (V: Integer): Integer; virtual;
- procedure HandleEvent (var Event: TEvent); virtual;
- procedure RestoreIndicator (OldV: Integer);
- procedure ScrollDraw; virtual;
- function ScrollStep (Part: Integer): Integer; virtual;
- procedure SetParams (AValue, AMin, AMax, APgStep, AArStep: Integer);
- procedure SetRange (AMin, AMax: Integer);
- procedure SetState (AState: Word; Enable: Boolean); virtual;
- procedure SetStep (APgStep, AArStep: Integer);
- procedure SetValue (AValue: Integer);
- procedure Store (var S: TStream);
- end;
-
- { TScroller object }
-
- { Palette Layout }
- { 1 = Normal text }
- { 2 = Selected text }
- { 3 = Normal background }
- { 4 = Selected background }
-
- PScroller = ^TScroller;
- TScroller = object(TGView)
- HScrollBar: PScrollBar;
- VScrollBar: PScrollBar;
- Delta: TPoint;
- Limit: TPoint;
- TextSize: TPoint;
- constructor Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
- constructor Load(var S: TStream);
- procedure ChangeBounds(var Bounds: TRect); virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure ScrollDraw; virtual;
- procedure ScrollTo(X, Y: Integer);
- procedure SetLimit(X, Y: Integer);
- procedure Store(var S: TStream);
- private
- DrawLock: Byte;
- DrawFlag: Boolean;
- procedure CheckDraw;
- procedure HelpDraw (LnCol1, Line: Boolean);
- end;
-
- { TListViewer object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Frame }
- { 3 = Normal Text }
- { 4 = Selected Text }
- { 5 = Normal Background }
- { 6 = Selected Background }
-
- PListViewer = ^TListViewer;
- TListViewer = object(TGView)
- ScrollBar: PScrollBar;
- TopItem: Integer;
- Focused: Integer;
- Range: Integer;
- constructor Init(var Bounds: TRect; AScrollBar: PScrollBar);
- constructor Load(var S: TStream);
- procedure ChangeBounds(var Bounds: TRect); virtual;
- procedure Draw; virtual;
- procedure DrawItem (Item: Integer); virtual;
- procedure FocusItem(Item: Integer); virtual;
- function GetPalette: PPalette; virtual;
- function GetText(Item: Integer; MaxLen: Integer): String; virtual;
- function IsSelected(Item: Integer): Boolean; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure SelectItem(Item: Integer); virtual;
- procedure SetRange(ARange: Integer);
- procedure SetState(AState: Word; Enable: Boolean); virtual;
- procedure Store(var S: TStream);
- end;
-
- { TPeerList record }
-
- PPeerList = ^TPeerList;
- TPeerList = record
- Number: Integer;
- Master: ^PGView;
- Next: PPeerList
- End;
-
- { TGGroup object }
-
- TGGroup = object(TGView)
- Last: PGView;
- Current: PGView;
- AlreadyDrawn: Boolean;
- Phase: (phFocused, phPreProcess, phPostProcess);
- StandardFont: Word;
- constructor Init(var Bounds: TRect);
- constructor Load (var S: TStream);
- destructor Done; virtual;
- procedure ChangeBounds(var Bounds: TRect); virtual;
- procedure ChMCursor; virtual;
- function DataSize: Word; virtual;
- procedure Delete(P: PGView);
- procedure Draw; virtual;
- procedure EndModal(Command: Word); virtual;
- procedure EventError(var Event: TEvent); virtual;
- function ExecView(P: PGView): Word;
- function Execute: Word; virtual;
- function First: PGView;
- function FirstThat (Test: Pointer): PGView;
- procedure ForEach (Action: Pointer);
- procedure GetData(var Rec); virtual;
- function GetHelpCtx: Word; virtual;
- procedure GetSubViewPtr (var S: TStream; var P);
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure Insert(P: PGView);
- {procedure InsertBefore(P, Target: PGView);}
- procedure Lock;
- procedure PutSubViewPtr (var S: TStream; P: PGView);
- procedure Redraw;
- procedure SelectNext(Forwards: Boolean);
- procedure SetData(var Rec); virtual;
- procedure SetState(AState: Word; Enable: Boolean); virtual;
- procedure Store (var S: TStream);
- procedure UnLock;
- function Valid(Command: Word): Boolean; virtual;
- private
- EndState: Word;
- PeerList: PPeerList;
- LockFlag: Byte;
- function NextSelectable(P: PGView): PGView;
- end;
-
- { TWindow object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Frame active }
- { 3 = Frame not active }
- { 4 = Frame modal }
- { 5 = Zoomfield }
- { 6 = Title background normal}
- { 7 = Title background selected }
- { 8 = Title normal}
- { 9 = Title selected }
- { 10 = Close- and Zoomfield outside }
- { 11 = Closefield frame }
- { 12 = Closefield inside }
- { 13 = Closefield shadow }
- { 14 = Scrollbar background }
- { 15 = Scrollbar frame }
- { 16 = Scrollbar buttons }
- { 17 = Scrollbar button shadows }
- { 18 = Scrollbar page area }
- { 19 = Scroller normal text }
- { 20 = Scroller selected text }
- { 21 = Scroller normal background }
- { 22 = Scroller selected background }
-
- PWindow = ^TWindow;
- TWindow = Object (TGGroup)
- Title: PString;
- Frame:PFrame;
- BackGround:PBackGround;
- Palette: Integer;
- ZoomRect: TRect;
- Flags: Byte;
- Constructor Init (var Bounds:TRect; ATitle:String);
- constructor Load (var S: TStream);
- procedure Store (var S: TStream);
- destructor Done; virtual;
- procedure ChangeBounds (var Bounds: TRect); virtual;
- procedure Close; virtual;
- procedure DragView (Event: TEvent; Mode: Byte; var Limits: TRect;
- MinSize, MaxSize: TPoint; ResMode: Byte);
- procedure Draw; virtual;
- procedure EndModal (Command: Word); virtual;
- Function GetPalette:PPalette; virtual;
- Function GetTitle (MaxSize: Integer): TTitleStr; virtual;
- Procedure HandleEvent (var Event: TEvent); virtual;
- Procedure InitFrame; virtual;
- Procedure InitBackGround; virtual;
- procedure RestoreBackground; virtual;
- procedure SetState (AState: Word; Enable: Boolean); virtual;
- procedure SizeLimits (var Min, Max: TPoint); virtual;
- function StandardScrollBar (AOptions: Word): PScrollBar;
- procedure Zoom; virtual;
- private
- ScrBBck: PBackground;
- End;
-
- { GVViews registration procedure }
-
- procedure RegisterGVViews;
-
- { GVViews MouseCursor procedure }
-
- procedure GetGVViewsCursor (n: Integer);
-
- { Stream registration records }
-
- const
-
- RGView: TStreamRec = (
- ObjType: 2;
- VmtLink: Ofs(TypeOf(TGView)^);
- Load: @TGView.Load;
- Store: @TGView.Store);
-
- RFrame: TStreamRec = (
- ObjType: 3;
- VmtLink: Ofs(TypeOf(TFrame)^);
- Load: @TFrame.Load;
- Store: @TFrame.Store);
-
- RBackground: TStreamRec = (
- ObjType: 4;
- VmtLink: Ofs(TypeOf(TBackground)^);
- Load: @TBackground.Load;
- Store: @TBackground.Store);
-
- RScrollBar: TStreamRec = (
- ObjType: 5;
- VmtLink: Ofs(TypeOf(TScrollBar)^);
- Load: @TScrollBar.Load;
- Store: @TScrollBar.Store);
-
- RScroller: TStreamRec = (
- ObjType: 6;
- VmtLink: Ofs(TypeOf(TScroller)^);
- Load: @TScroller.Load;
- Store: @TScroller.Store);
-
- RListViewer: TStreamRec = (
- ObjType: 7;
- VmtLink: Ofs(TypeOf(TListViewer)^);
- Load: @TListViewer.Load;
- Store: @TListViewer.Store);
-
- RGGroup: TStreamRec = (
- ObjType: 8;
- VmtLink: Ofs(TypeOf(TGGroup)^);
- Load: @TGGroup.Load;
- Store: @TGGroup.Store);
-
- RWindow: TStreamRec = (
- ObjType: 9;
- VmtLink: Ofs(TypeOf(TWindow)^);
- Load: @TWindow.Load;
- Store: @TWindow.Store);
-
- implementation
-