-
Notifications
You must be signed in to change notification settings - Fork 53
/
Definitions.cs
475 lines (408 loc) · 14.6 KB
/
Definitions.cs
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
#region BSD License
/*
*
* Original BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE)
* © Component Factory Pty Ltd, 2006 - 2016, (Version 4.5.0.0) All rights reserved.
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2022. All rights reserved.
*
*/
#endregion
namespace Krypton.Ribbon
{
#region IQuickAccessToolbarButton
/// <summary>
/// Information needed for a quick access toolbar entry.
/// </summary>
public interface IQuickAccessToolbarButton
{
/// <summary>
/// Occurs when the quick access toolbar button has been clicked.
/// </summary>
event EventHandler Click;
/// <summary>
/// Occurs after the value of a property has changed.
/// </summary>
event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Provides a back reference to the owning ribbon control instance.
/// </summary>
/// <param name="ribbon">Reference to owning instance.</param>
void SetRibbon(KryptonRibbon ribbon);
/// <summary>
/// Gets the entry image.
/// </summary>
/// <returns>Image value.</returns>
Image GetImage();
/// <summary>
/// Gets the entry text.
/// </summary>
/// <returns>Text value.</returns>
string GetText();
/// <summary>
/// Gets the entry enabled state.
/// </summary>
/// <returns>Enabled value.</returns>
bool GetEnabled();
/// <summary>
/// Gets the entry shortcut keys state.
/// </summary>
/// <returns>ShortcutKeys value.</returns>
Keys GetShortcutKeys();
/// <summary>
/// Gets the entry visible state.
/// </summary>
/// <returns>Visible value.</returns>
bool GetVisible();
/// <summary>
/// Sets a new value for the visible state.
/// </summary>
/// <param name="visible"></param>
void SetVisible(bool visible);
/// <summary>
/// Gets the tooltip label style.
/// </summary>
LabelStyle GetToolTipStyle();
/// <summary>
/// Gets the image for the item ToolTip.
/// </summary>
Image GetToolTipImage();
/// <summary>
/// Gets the color to draw as transparent in the ToolTipImage.
/// </summary>
Color GetToolTipImageTransparentColor();
/// <summary>
/// Gets the title text for the item ToolTip.
/// </summary>
string GetToolTipTitle();
/// <summary>
/// Gets the body text for the item ToolTip.
/// </summary>
string GetToolTipBody();
/// <summary>
/// Generates a Click event for a button.
/// </summary>
void PerformClick();
}
#endregion
#region IRibbonGroupItem
/// <summary>
/// Information for a ribbon group item.
/// </summary>
public interface IRibbonGroupItem
{
/// <summary>
/// Gets and sets the owning ribbon control instance.
/// </summary>
KryptonRibbon Ribbon { get; set; }
/// <summary>
/// Gets and sets the owning ribbon tab instance.
/// </summary>
KryptonRibbonTab RibbonTab { get; set; }
/// <summary>
/// Gets and sets the owning ribbon container instance.
/// </summary>
KryptonRibbonGroupContainer RibbonContainer { get; set; }
/// <summary>
/// Gets the visible state of the item.
/// </summary>
bool Visible { get; }
/// <summary>
/// Gets and sets the maximum allowed size of the item.
/// </summary>
GroupItemSize ItemSizeMaximum { get; set; }
/// <summary>
/// Gets and sets the minimum allowed size of the item.
/// </summary>
GroupItemSize ItemSizeMinimum { get; set; }
/// <summary>
/// Gets and sets the current item size.
/// </summary>
GroupItemSize ItemSizeCurrent { get; set; }
/// <summary>
/// Return the spacing gap between the provided previous item and this item.
/// </summary>
/// <param name="previousItem">Previous item.</param>
/// <returns>Pixel gap between previous item and this item.</returns>
int ItemGap(IRibbonGroupItem previousItem);
/// <summary>
/// Creates an appropriate view element for this item.
/// </summary>
/// <param name="ribbon">Reference to the owning ribbon control.</param>
/// <param name="needPaint">Delegate for notifying changes in display.</param>
/// <returns>ViewBase derived instance.</returns>
ViewBase CreateView(KryptonRibbon ribbon, NeedPaintHandler needPaint);
ToolTipValues ToolTipValues
{
// Return base objects tooltip
get;
}
}
#endregion
#region IRibbonGroupContainer
/// <summary>
/// Information for a ribbon group container.
/// </summary>
public interface IRibbonGroupContainer
{
/// <summary>
/// Gets an array of all the child components.
/// </summary>
/// <returns></returns>
Component[] GetChildComponents();
}
#endregion
#region IRibbonViewGroupItemView
internal interface IRibbonViewGroupItemView
{
/// <summary>
/// Override the group item size if possible.
/// </summary>
/// <param name="size">New size to use.</param>
void SetGroupItemSize(GroupItemSize size);
/// <summary>
/// Reset the group item size to the item definition.
/// </summary>
void ResetGroupItemSize();
/// <summary>
/// Gets the first focus item from the item.
/// </summary>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetFirstFocusItem();
/// <summary>
/// Gets the last focus item from the item.
/// </summary>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetLastFocusItem();
/// <summary>
/// Gets the next focus item based on the current item as provided.
/// </summary>
/// <param name="current">The view that is currently focused.</param>
/// <param name="matched">Has the current focus item been matched yet.</param>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetNextFocusItem(ViewBase current, ref bool matched);
/// <summary>
/// Gets the previous focus item based on the current item as provided.
/// </summary>
/// <param name="current">The view that is currently focused.</param>
/// <param name="matched">Has the current focus item been matched yet.</param>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetPreviousFocusItem(ViewBase current, ref bool matched);
/// <summary>
/// Gets the array of group level key tips.
/// </summary>
/// <param name="keyTipList">List to add new entries into.</param>
/// <param name="lineHint">Provide hint to item about its location.</param>
void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint);
}
#endregion
#region IRibbonViewGroupContainerView
internal interface IRibbonViewGroupContainerView
{
/// <summary>
/// Gets an array of the allowed possible sizes of the container.
/// </summary>
/// <param name="context">Context used to calculate the sizes.</param>
/// <returns>Array of size values.</returns>
ItemSizeWidth[] GetPossibleSizes(ViewLayoutContext context);
/// <summary>
/// Update the group with the provided sizing solution.
/// </summary>
/// <param name="size">Value for the container.</param>
void SetSolutionSize(ItemSizeWidth size);
/// <summary>
/// Reset the container back to its requested size.
/// </summary>
void ResetSolutionSize();
/// <summary>
/// Gets the first focus item from the container.
/// </summary>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetFirstFocusItem();
/// <summary>
/// Gets the last focus item from the container.
/// </summary>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetLastFocusItem();
/// <summary>
/// Gets the next focus item based on the current item as provided.
/// </summary>
/// <param name="current">The view that is currently focused.</param>
/// <param name="matched">Has the current focus item been matched yet.</param>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetNextFocusItem(ViewBase current, ref bool matched);
/// <summary>
/// Gets the previous focus item based on the current item as provided.
/// </summary>
/// <param name="current">The view that is currently focused.</param>
/// <param name="matched">Has the current focus item been matched yet.</param>
/// <returns>ViewBase of item; otherwise false.</returns>
ViewBase GetPreviousFocusItem(ViewBase current, ref bool matched);
/// <summary>
/// Gets the array of group level key tips.
/// </summary>
/// <param name="keyTipList">List to add new entries into.</param>
void GetGroupKeyTips(KeyTipInfoList keyTipList);
}
#endregion
#region IRibbonViewGroupContainerSize
internal interface IRibbonViewGroupSize
{
/// <summary>
/// Get an array of available widths for the group with associated sizing values.
/// </summary>
/// <param name="context">Context used to calculate the sizes.</param>
/// <returns>Array of size values.</returns>
GroupSizeWidth[] GetPossibleSizes(ViewLayoutContext context);
/// <summary>
/// Update the group with the provided sizing solution.
/// </summary>
/// <param name="size">Array of values for the group containers.</param>
void SetSolutionSize(ItemSizeWidth[] size);
}
#endregion
#region IRibbonKeyTipTarget
internal interface IRibbonKeyTipTarget
{
/// <summary>
/// Perform actual selection of the item.
/// </summary>
/// <param name="ribbon">Reference to owning ribbon instance.</param>
void KeyTipSelect(KryptonRibbon ribbon);
}
#endregion
#region Enum GroupItemSize
/// <summary>
/// Specifies the size of a group item or container.
/// </summary>
public enum GroupItemSize
{
/// <summary>
/// Specifies a group item display in its smallest display state.
/// </summary>
Small = 0,
/// <summary>
/// Specifies a group item display in its medium display state.
/// </summary>
Medium = 1,
/// <summary>
/// Specifies a group item display in its largest display state.
/// </summary>
Large = 2
}
#endregion
#region Enum GroupItemSizeSM
/// <summary>
/// Specifies the size of a group item or container but restricted to just small or medium.
/// </summary>
public enum GroupItemSizeSM
{
/// <summary>
/// Specifies a group item display in its smallest display state.
/// </summary>
Small = 0,
/// <summary>
/// Specifies a group item display in its medium display state.
/// </summary>
Medium = 1
}
#endregion
#region Enum GroupButtonType
/// <summary>
/// Specifies the type of operation for a group button.
/// </summary>
public enum GroupButtonType
{
/// <summary>
/// Specifies a simple push button operation.
/// </summary>
Push,
/// <summary>
/// Specifies a check button that toggles between checked and not checked.
/// </summary>
Check,
/// <summary>
/// Specifies a button that when pressed shows a drop down.
/// </summary>
DropDown,
/// <summary>
/// Specifies a button that is split between push area and drop down area.
/// </summary>
Split
}
#endregion
#region Enum QATLocation
/// <summary>
/// Specifies the location of the quick access toolbar.
/// </summary>
public enum QATLocation
{
/// <summary>
/// Specifies the quick access toolbar is above the ribbon.
/// </summary>
Above,
/// <summary>
/// Specifies the quick access toolbar is below the ribbon.
/// </summary>
Below,
/// <summary>
/// Specifies the quick access toolbar is hidden from view.
/// </summary>
Hidden
}
#endregion
#region Enum KeyTipMode
internal enum KeyTipMode
{
/// <summary>
/// Specifies the key tips are for root items.
/// </summary>
Root,
/// <summary>
/// Specifies the key tips are for the selected tabs groups.
/// </summary>
SelectedGroups,
/// <summary>
/// Specifies the key tips are for a popup group.
/// </summary>
PopupGroup,
/// <summary>
/// Specifies the key tips are for a popup QAT overflow.
/// </summary>
PopupQATOverflow,
/// <summary>
/// Specifies the key tips are for a minimized mode popup.
/// </summary>
PopupMinimized
}
#endregion
#region Enum RibbonItemAlignment
/// <summary>
/// Specifies how items are aligned within a ribbon container.
/// </summary>
public enum RibbonItemAlignment
{
/// <summary>
/// Specifies all items are aligned to the near edge.
/// </summary>
Near,
/// <summary>
/// Specifies all items are centered.
/// </summary>
Center,
/// <summary>
/// Specifies all items are aligned to the far edge.
/// </summary>
Far
}
#endregion
#region Delegates
/// <summary>
/// Signature of a click event that expects the provided finish delegate to be called when associated actions are completed.
/// </summary>
/// <param name="sender">Event source.</param>
/// <param name="clickFinished">Delegate for finish notication.</param>
public delegate void ClickAndFinishHandler(object sender, EventHandler clickFinished);
#endregion
}