home *** CD-ROM | disk | FTP | other *** search
- Unit GVDialog;
-
-
- interface
-
- uses Objects, Drivers, Views, GVViews
-
- , Validate
- ;
-
- Const
-
- { Color Palettes }
-
- CDialog = #76#77#78#79#80#81#82#83#84#85#86#87#88#89#90#91#92#93;
-
- CInputLine = #125#126#127#128#129#130#131;
- CArrowField = #132#133;
- CButton = #103#104#105#106#107#108#109#110#111#112;
- CRegler = #113#114#115#116;
- CCluster = #117#118#119#120#121#122#123#124;
- CStaticText = #94;
- CStaticSign = #94;
- CLabel = #95#96#97#98#99#100;
- CIcon = #101#102;
- CHistory = #103#111#112;
-
- { TArrowField commands }
-
- cmArrowUp = 60;
- cmArrowDn = 61;
-
- { TMultiCheckboxes flags }
- { hibyte = number of bits }
- { lobyte = bit mask }
-
- cfOneBit = $0101;
- cfTwoBits = $0203;
- cfFourBits = $040F;
- cfEightBits = $08FF;
-
- { Dialog broadcast commands }
-
- cmRecordHistory = 60;
-
- Type
-
- { TDialog 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 }
-
- PDialog = ^TDialog;
- TDialog = object(TWindow)
- constructor Init (Bounds: TRect; ATitle: String);
- procedure HandleEvent (var Event: TEvent); virtual;
- function GetPalette: PPalette; virtual;
- function Valid (Command: Word):Boolean; virtual;
- end;
-
- { TInputLine object }
-
- { Palette layout }
- { 1 = Passive }
- { 2 = Active }
- { 3 = Selected }
- { 4 = Arrows }
- { 5 = Frame }
- { 6 = Text }
- { 7 = Cursor }
-
- PValidator = Pointer;
-
- PInputLine = ^TInputLine;
- TInputLine = object(TGView)
- Data: PString;
- MaxLen: Integer;
- CurPos: Integer;
- FirstPos: Integer;
- SelStart: Integer;
- SelEnd: Integer;
- EndPos: Integer;
- Validator: PValidator;
- constructor Init(var Bounds: TRect; AMaxLen: Integer);
- constructor Load(var S: TStream);
- destructor Done; virtual;
- procedure ChMCursor; virtual;
- function DataSize: Word; virtual;
- procedure Draw; virtual;
- procedure DrawText (APos, EPos: Integer); virtual;
- procedure GetData(var Rec); virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure SelectAll(Enable: Boolean);
- procedure SetCurPos (ACurPos: Integer; DoSelect: Boolean);
- procedure SetData(var Rec); virtual;
- procedure SetSelect(NewStart, NewEnd: Integer);
- procedure SetState(AState: Word; Enable: Boolean); virtual;
- procedure SetValidator(AValid: PValidator);
- procedure Store(var S: TStream);
- function Valid(Command: Word): Boolean; virtual;
- end;
-
- { TArrowField object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Icon }
-
- PArrowField = ^TArrowField;
- TArrowField = object (TGView)
- constructor Init (var Bounds: TRect);
- procedure Draw; virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent (var Event: TEvent); virtual;
- end;
-
- { TNumInput object }
-
- { Palette layout = TInputLine }
-
- PNumInput = ^TNumInput;
- TNumInput = object (TInputLine)
- LimitHi, LimitLo, Value: Integer;
- Arrows: PArrowField;
- constructor Init (var Bounds: TRect; ALimitLo, ALimitHi: Integer;
- AArrows: PArrowField);
- constructor Load (var S: TStream);
- function DataSize: Word; virtual;
- procedure GetData (var Rec); virtual;
- procedure HandleEvent (var Event: TEvent); virtual;
- procedure SetData (var Rec); virtual;
- procedure SetLimit (ALimitLo, ALimitHi: Integer);
- procedure Store (var S: TStream);
- end;
-
- { TButton object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Normal text }
- { 3 = Default text }
- { 4 = Selected text }
- { 5 = Disabled text }
- { 6 = Normal shortcut }
- { 7 = Default shortcut }
- { 8 = Selected shortcut }
- { 9 = Borders }
- {10 = Lines }
-
- PButton = ^TButton;
- TButton = Object (TGView)
- Title: PString;
- Command: Word;
- Flags: Byte;
- AmDefault: Boolean;
- constructor Init(var Bounds: TRect; ATitle: TTitleStr; ACommand: Word;
- AFlags: Word);
- constructor Load (var S: TStream);
- destructor Done; virtual;
- procedure Draw; virtual;
- procedure DrawState(Down: Boolean); virtual;
- procedure DrawText (Down: Boolean); virtual;
- procedure CondDrawState(Down:Boolean);
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure MakeDefault(Enable: Boolean);
- procedure Press; virtual;
- procedure SetState(AState: Word; Enable: Boolean); virtual;
- procedure Store (var S: TStream);
- private
- Pressed: Boolean;
- end;
-
- { TGButton object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Normal sign }
- { 3 = Default sign }
- { 4 = Selected sign }
- { 5 = Disabled sign }
- { 6 = nicht benutzt }
- { 7 = nicht benutzt }
- { 8 = nicht benutzt }
- { 9 = Borders }
- {10 = Lines }
-
- PGButton = ^TGButton;
- TGButton = Object (TButton)
- Sign : Pointer;
- constructor Init (var Bounds: TRect; ASign: Pointer; ACommand: Word;
- AFlags: Word);
- constructor Load (var S: TStream);
- procedure Store (var S: TStream);
- destructor Done; virtual;
- procedure DrawText (Down: Boolean); virtual;
- end;
-
- { TRegler object }
-
- { Palette layout }
- { 1 = selected frame }
- { 2 = normal frame }
- { 3 = disabled frame }
- { 4 = background }
-
- PRegler = ^TRegler;
- TRegler = Object (TGView)
- Value:Real;
- Constructor Init (var Bounds:TRect; AMinValue, AMaxValue:Real;
- ABezeichnung, AMinBez, AMidBez, AMaxBez:String);
- destructor Done; virtual;
- constructor Load (var S: TStream);
- Function GetPalette:PPalette; virtual;
- Procedure HandleEvent (Var Event:TEvent); virtual;
- Procedure Draw; virtual;
- Procedure SetState(AState: Word; Enable: Boolean); virtual;
- Procedure SetData (var Rec); virtual;
- Procedure GetData (var Rec); virtual;
- Function DataSize: Word; virtual;
- procedure Store (var S: TStream);
- private
- MinValue, MaxValue, OldValue:Real;
- Bezeichnung, MinBez, MidBez, MaxBez:PString;
- OldY:Word;
- Selected:Boolean;
- Procedure UpDate;
- Function Position (XValue:Real): Integer;
- Function ToValue (XPosition:Integer): Real;
- End;
-
- { TSItem record }
-
- PSItem = ^TSItem;
- TSItem = record
- Value: PString;
- Next: PSItem;
- end;
-
- { TCluster object }
-
- { Palette layout }
- { 1 = Normal text }
- { 2 = Selected text }
- { 3 = Normal shortcut }
- { 4 = Selected shortcut }
- { 5 = Normal background }
- { 6 = Selected background }
- { 7 = Disabled background }
- { 8 = Disabled text }
-
- PCluster = ^TCluster;
- TCluster = object(TGView)
- Value: LongInt;
- Sel: Integer;
- EnableMask: LongInt;
- Strings: TStringCollection;
- constructor Init(var Bounds: TRect; AStrings: PSItem);
- constructor Load(var S: TStream);
- destructor Done; virtual;
- function ButtonState(Item: Integer): Boolean;
- function DataSize: Word; virtual;
- procedure Draw; virtual;
- procedure DrawItem (Item: Integer; Down: Boolean); virtual;
- procedure GetData(var Rec); virtual;
- function GetHelpCtx: Word; virtual;
- function GetIconNum (Id: Byte): Integer; virtual;
- procedure GetItemRect (Item: Integer; var Extent: TRect); virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- function Mark(Item: Integer): Boolean; virtual;
- function MultiMark(Item: Integer): Byte; virtual;
- procedure Press(Item: Integer); virtual;
- procedure MovedTo(Item: Integer); virtual;
- procedure SetButtonState(AMask: Longint; Enable: Boolean);
- procedure SetData(var Rec); virtual;
- procedure SetState(AState: Word; Enable: Boolean); virtual;
- procedure Store(var S: TStream);
- end;
-
- { TRadioButtons object }
-
- { Palette layout }
- { 1 = Normal text }
- { 2 = Selected text }
- { 3 = Normal shortcut }
- { 4 = Selected shortcut }
- { 5 = Normal background }
- { 6 = Selected background }
- { 7 = Disabled background }
- { 8 = Disabled text }
-
- PRadioButtons = ^TRadioButtons;
- TRadioButtons = object(TCluster)
- function GetIconNum (Id: Byte): Integer; virtual;
- function Mark (Item: Integer): Boolean; virtual;
- procedure MovedTo (Item: Integer); virtual;
- procedure Press (Item: Integer); virtual;
- procedure SetData (var Rec); virtual;
- end;
-
- { TCheckBoxes object }
-
- { Palette layout }
- { 1 = Normal text }
- { 2 = Selected text }
- { 3 = Normal shortcut }
- { 4 = Selected shortcut }
- { 5 = Normal background }
- { 6 = Selected background }
- { 7 = Disabled background }
- { 8 = Disabled text }
-
- PCheckBoxes = ^TCheckBoxes;
- TCheckBoxes = object(TCluster)
- function GetIconNum (Id: Byte): Integer; virtual;
- function Mark(Item: Integer): Boolean; virtual;
- procedure Press(Item: Integer); virtual;
- end;
-
- { TMultiCheckBoxes object }
-
- { Palette layout }
- { 1 = Normal text }
- { 2 = Selected text }
- { 3 = Normal shortcut }
- { 4 = Selected shortcut }
- { 5 = Normal background }
- { 6 = Selected background }
- { 7 = Disabled background }
- { 8 = Disabled text }
-
- PMultiCheckBoxes = ^TMultiCheckBoxes;
- TMultiCheckBoxes = object(TCluster)
- SelRange: Byte;
- Flags: Word;
- States: Pointer;
- MyData: Boolean;
- constructor Init(var Bounds: TRect; AStrings: PSItem;
- ASelRange: Byte; AFlags: Word; AStates: Pointer);
- constructor Load(var S: TStream);
- destructor Done; virtual;
- procedure DrawItem(Item: Integer; Down: Boolean); virtual;
- function GetIconNum (Id: Byte): Integer; virtual;
- function MultiMark(Item: Integer): Byte; virtual;
- procedure Press(Item: Integer); virtual;
- procedure Store(var S: TStream);
- private
- function GetIcon (Index: Integer): Pointer;
- end;
-
- { TListBoxRec Record }
-
- PListBoxRec = ^TListBoxRec;
- TListBoxRec = Record
- List: PCollection;
- Index: Integer;
- End;
-
- { TListBox object }
-
- { Palette layout }
- { 1 = Background }
- { 2 = Frame }
- { 3 = Normal Text }
- { 4 = Selected Text }
- { 5 = Normal Background }
- { 6 = Selected Background }
-
- PListBox = ^TListBox;
- TListBox = object(TListViewer)
- List: PCollection;
- constructor Init(var Bounds: TRect; AScrollBar: PScrollBar);
- constructor Load(var S: TStream);
- function DataSize: Word; virtual;
- procedure GetData(var Rec); virtual;
- function GetText(Item: Integer; MaxLen: Integer): String; virtual;
- procedure NewList(AList: PCollection); virtual;
- procedure SetData(var Rec); virtual;
- procedure Store(var S: TStream);
- end;
-
- { TStaticText object }
-
- { Palette layout }
- { 1 = Text }
-
- PStaticText = ^TStaticText;
- TStaticText = Object (TGView)
- Text: PString;
- Constructor Init (var Bounds:TRect; AText:String);
- constructor Load (var S: TStream);
- procedure Store (var S: TStream);
- function GetPalette:PPalette; virtual;
- procedure GetText (var S: String); virtual;
- Procedure Draw; virtual;
- Destructor Done; virtual;
- End;
-
- { TParamText object }
-
- { Palette layout }
- { 1 = Text }
-
- PParamText = ^TParamText;
- TParamText = object(TStaticText)
- ParamCount: Integer;
- ParamList: Pointer;
- constructor Init(var Bounds: TRect; AText: String; AParamCount: Integer);
- constructor Load(var S: TStream);
- function DataSize: Word; virtual;
- procedure GetText(var S: String); virtual;
- procedure SetData(var Rec); virtual;
- procedure Store(var S: TStream);
- end;
-
- { TStaticSign object }
-
- { Palette layout }
- { 1 = Background }
-
- PStaticSign = ^TStaticSign;
- TStaticSign = object (TGView)
- Sign:Pointer;
- Constructor Init (var Bounds:TRect; ASign:Pointer);
- constructor Load (var S: TStream);
- procedure Store (var S: TStream);
- Procedure Draw; virtual;
- function GetPalette: PPalette; virtual;
- Destructor Done; virtual;
- End;
-
- { TLabel object }
-
- { Palette layout }
- { 1 = Normal text }
- { 2 = Selected text }
- { 3 = Normal shortcut }
- { 4 = Selected shortcut }
- { 5 = Normal Background }
- { 6 = Selected Background }
-
- PLabel = ^TLabel;
- TLabel = object(TStaticText)
- Link: PGView;
- Light: Boolean;
- constructor Init(var Bounds: TRect; AText: String; ALink: PGView);
- constructor Load(var S: TStream);
- procedure Draw; virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure Store(var S: TStream);
- end;
-
- { TIcon object }
-
- { Palette layout }
- { 1 = Normal Background }
- { 2 = Selected Background }
-
- PIcon = ^TIcon;
- TIcon = object(TStaticSign)
- Link: PGView;
- Light: Boolean;
- constructor Init(var Bounds: TRect; ASign: Pointer; ALink: PGView);
- constructor Load(var S: TStream);
- procedure Draw; virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- procedure Store(var S: TStream);
- end;
-
- { THistoryViewer object }
-
- { Palette layout = TListBox }
-
- PHistoryViewer = ^THistoryViewer;
- THistoryViewer = object(TListViewer)
- HistoryId: Word;
- constructor Init(var Bounds: TRect; AScrollBar: PScrollBar;
- AHistoryId: Word);
- function GetText(Item: Integer; MaxLen: Integer): String; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- function HistoryWidth: Integer;
- end;
-
- { THistoryWindow object }
-
- { Palette layout = TWindow }
-
- PHistoryWindow = ^THistoryWindow;
- THistoryWindow = object(TWindow)
- Viewer: PListViewer;
- constructor Init(var Bounds: TRect; HistoryId: Word);
- function GetSelection: String; virtual;
- procedure InitViewer(HistoryId: Word); virtual;
- end;
-
- { THistory object }
-
- { Palette layout }
- { 1 = Button }
- { 2 = Button shadow }
- { 3 = Button frame }
-
- PHistory = ^THistory;
- THistory = object(TGView)
- Link: PInputLine;
- HistoryId: Word;
- constructor Init(var Bounds: TRect; ALink: PInputLine; AHistoryId: Word);
- constructor Load(var S: TStream);
- procedure Draw; virtual;
- function GetPalette: PPalette; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- function InitHistoryWindow(var Bounds: TRect): PHistoryWindow; virtual;
- procedure RecordHistory(S: String); virtual;
- procedure Store(var S: TStream);
- private
- Down: Boolean;
- end;
-
- { SItem routines }
-
- function NewSItem(Str: String; ANext: PSItem): PSItem;
-
- procedure FreeSItem (ASItem: PSItem);
-
- { GVDialog registration procedure }
-
- procedure RegisterGVDialog;
-
- { GVDialog MouseCursor procedure }
-
- procedure GetGVDialogCursor (n: Integer);
-
- { Stream registration records }
-
- const
-
- RDialog: TStreamRec = (
- ObjType: 16;
- VmtLink: Ofs(TypeOf(TDialog)^);
- Load: @TDialog.Load;
- Store: @TDialog.Store);
-
- RInputLine: TStreamRec = (
- ObjType: 17;
- VmtLink: Ofs(TypeOf(TInputLine)^);
- Load: @TInputLine.Load;
- Store: @TInputLine.Store);
-
- RArrowField: TStreamRec = (
- ObjType: 18;
- VmtLink: Ofs(TypeOf(TArrowField)^);
- Load: @TArrowField.Load;
- Store: @TArrowField.Store);
-
- RNumInput: TStreamRec = (
- ObjType: 19;
- VmtLink: Ofs(TypeOf(TNumInput)^);
- Load: @TNumInput.Load;
- Store: @TNumInput.Store);
-
- RButton: TStreamRec = (
- ObjType: 20;
- VmtLink: Ofs(TypeOf(TButton)^);
- Load: @TButton.Load;
- Store: @TButton.Store);
-
- RGButton: TStreamRec = (
- ObjType: 21;
- VmtLink: Ofs(TypeOf(TGButton)^);
- Load: @TGButton.Load;
- Store: @TGButton.Store);
-
- RRegler: TStreamRec = (
- ObjType: 22;
- VmtLink: Ofs(TypeOf(TRegler)^);
- Load: @TRegler.Load;
- Store: @TRegler.Store);
-
- RCluster: TStreamRec = (
- ObjType: 23;
- VmtLink: Ofs(TypeOf(TCluster)^);
- Load: @TCluster.Load;
- Store: @TCluster.Store);
-
- RRadioButtons: TStreamRec = (
- ObjType: 24;
- VmtLink: Ofs(TypeOf(TRadioButtons)^);
- Load: @TRadioButtons.Load;
- Store: @TRadioButtons.Store);
-
- RCheckBoxes: TStreamRec = (
- ObjType: 25;
- VmtLink: Ofs(TypeOf(TCheckBoxes)^);
- Load: @TCheckBoxes.Load;
- Store: @TCheckBoxes.Store);
-
- RMultiCheckBoxes: TStreamRec = (
- ObjType: 26;
- VmtLink: Ofs(TypeOf(TMultiCheckBoxes)^);
- Load: @TMultiCheckBoxes.Load;
- Store: @TMultiCheckBoxes.Store);
-
- RListBox: TStreamRec = (
- ObjType: 27;
- VmtLink: Ofs(TypeOf(TListBox)^);
- Load: @TListBox.Load;
- Store: @TListBox.Store);
-
- RStaticText: TStreamRec = (
- ObjType: 28;
- VmtLink: Ofs(TypeOf(TStaticText)^);
- Load: @TStaticText.Load;
- Store: @TStaticText.Store);
-
- RParamText: TStreamRec = (
- ObjType: 29;
- VmtLink: Ofs(TypeOf(TParamText)^);
- Load: @TParamText.Load;
- Store: @TParamText.Store);
-
- RStaticSign: TStreamRec = (
- ObjType: 30;
- VmtLink: Ofs(TypeOf(TStaticSign)^);
- Load: @TStaticSign.Load;
- Store: @TStaticSign.Store);
-
- RLabel: TStreamRec = (
- ObjType: 31;
- VmtLink: Ofs(TypeOf(TLabel)^);
- Load: @TLabel.Load;
- Store: @TLabel.Store);
-
- RIcon: TStreamRec = (
- ObjType: 32;
- VmtLink: Ofs(TypeOf(TIcon)^);
- Load: @TIcon.Load;
- Store: @TIcon.Store);
-
- RHistory: TStreamRec = (
- ObjType: 33;
- VmtLink: Ofs(TypeOf(THistory)^);
- Load: @THistory.Load;
- Store: @THistory.Store);
-
- implementation
-