-
Notifications
You must be signed in to change notification settings - Fork 10
/
_menus.pas
159 lines (132 loc) · 3.97 KB
/
_menus.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
unit _Menus;
(******
DN/2 Plugin Interface - object model
Copyright (C) 2002 Aleksej Kozlov (Cat)
2:5030/1326.13
******)
{&Delphi+}
{&Use32+}
interface
uses
_Defines, _Streams, _Views
;
type
PMenuView = ^TMenuView;
TMenuView = object(TView)
ParentMenu: PMenuView;
Menu: PMenu;
Current: PMenuItem;
HaveSubmenu: Boolean;
LastActionIsExpand: Boolean;
constructor Init(var Bounds: TRect);
constructor Load(var S: TStream);
{function Execute: Word; virtual;}
function FindItem(Ch: Char): PMenuItem;
procedure GetItemRect(Item: PMenuItem; var R: TRect); virtual;
{function GetHelpCtx: Word; virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
function HotKey(KeyCode: Word): PMenuItem;
function NewSubView(var Bounds: TRect; AMenu: PMenu;
AParentMenu: PMenuView): PMenuView; virtual;
procedure Store(var S: TStream);
end;
PMenuBar = ^TMenuBar;
TMenuBar = object(TMenuView)
constructor Init(var Bounds: TRect; AMenu: PMenu);
{destructor Done; virtual;}
{procedure Draw; virtual;}
{procedure GetItemRect(Item: PMenuItem; var R: TRect); virtual;}
end;
PMenuBox = ^TMenuBox;
TMenuBox = object(TMenuView)
TopItem: PMenuItem;
ComboBoxPal: Boolean;
constructor Init(var Bounds: TRect; AMenu: PMenu;
AParentMenu: PMenuView);
{procedure Draw; virtual;}
{procedure GetItemRect(Item: PMenuItem; var R: TRect); virtual;}
end;
PMenuPopup = ^TMenuPopup;
TMenuPopup = object(TMenuBox)
constructor Init(var Bounds: TRect; AMenu: PMenu);
{procedure HandleEvent(var Event: TEvent); virtual;}
end;
PStatusLine = ^TStatusLine;
TStatusLine = object(TView)
Items: PStatusItem;
Defs: PStatusDef;
constructor Init(var Bounds: TRect; ADefs: PStatusDef);
constructor Load(var S: TStream);
{destructor Done; virtual;}
{procedure Draw; virtual;}
{function GetPalette: PPalette; virtual;}
{procedure HandleEvent(var Event: TEvent); virtual;}
function Hint(AHelpCtx: Word): String; virtual;
procedure Store(var S: TStream);
{procedure Update; virtual;}
end;
implementation
uses
_DNFuncs
;
constructor TMenuView.Init(var Bounds: TRect);
begin
_TMenuView^.Init(Bounds, nil, @Self);
end;
constructor TMenuView.Load(var S: TStream);
begin
_TMenuView^.Load(_Model1.TStream(S), nil, @Self);
end;
function TMenuView.FindItem(Ch: Char): PMenuItem;
begin
Result := _TMenuView^.FindItem(Ch, @Self);
end;
procedure TMenuView.GetItemRect(Item: PMenuItem; var R: TRect);
assembler; {&Frame-}
asm
end;
function TMenuView.HotKey(KeyCode: Word): PMenuItem;
begin
Result := _TMenuView^.HotKey(KeyCode, @Self);
end;
function TMenuView.NewSubView(var Bounds: TRect; AMenu: PMenu;
AParentMenu: PMenuView): PMenuView;
assembler; {&Frame-}
asm
end;
procedure TMenuView.Store(var S: TStream);
begin
_TMenuView^.Store(_Model1.TStream(S), @Self);
end;
constructor TMenuBar.Init(var Bounds: TRect; AMenu: PMenu);
begin
_TMenuBar^.Init(Bounds, AMenu, nil, @Self);
end;
constructor TMenuBox.Init(var Bounds: TRect; AMenu: PMenu;
AParentMenu: PMenuView);
begin
_TMenuBox^.Init(Bounds, AMenu, _Model1.PMenuView(AParentMenu), nil,
@Self);
end;
constructor TMenuPopup.Init(var Bounds: TRect; AMenu: PMenu);
begin
_TMenuPopup^.Init(Bounds, AMenu, nil, @Self);
end;
constructor TStatusLine.Init(var Bounds: TRect; ADefs: PStatusDef);
begin
_TStatusLine^.Init(Bounds, ADefs, nil, @Self);
end;
constructor TStatusLine.Load(var S: TStream);
begin
_TStatusLine^.Load(_Model1.TStream(S), nil, @Self);
end;
function TStatusLine.Hint(AHelpCtx: Word): String;
assembler; {&Frame-}
asm
end;
procedure TStatusLine.Store(var S: TStream);
begin
_TStatusLine^.Store(_Model1.TStream(S), @Self);
end;
end.