-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathKryptonCustomPaletteBase.cs
More file actions
5905 lines (5309 loc) · 249 KB
/
KryptonCustomPaletteBase.cs
File metadata and controls
5905 lines (5309 loc) · 249 KB
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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#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), Giduac, Ahmed Abdelhameed, tobitege, KamaniAR, Lesandro Gotardo (aka lesandrog), Jorge A. Avilés (aka mcpbcs) et al. 2017 - 2026. All rights reserved.
*
*/
#endregion
// These are "Only" used here, So will not put into global usings
using XmlTransformer = System.Xml.Xsl.XslCompiledTransform;
namespace Krypton.Toolkit;
/// <summary>
/// Define and modify a palette for styling Krypton controls.
/// </summary>
/// <seealso cref="Krypton.Toolkit.PaletteBase" />
[ToolboxItem(true)]
[ToolboxBitmap(typeof(KryptonCustomPaletteBase), "ToolboxBitmaps.KryptonPalette.bmp")]
[DefaultEvent(nameof(PalettePaint))]
[DesignerCategory(@"code")]
[Designer(typeof(KryptonCustomPaletteBaseDesigner))]
[Description(@"A customisable palette component.")]
public class KryptonCustomPaletteBase : PaletteBase
{
#region Type Definitions
private class ImageDictionary : Dictionary<Bitmap, string>;
private class ImageReverseDictionary : Dictionary<string, Bitmap>;
#endregion
#region Instance Fields
/// <inheritdoc/>
protected override Color[] SchemeColors => _basePalette?.GetSchemeColors() ?? Array.Empty<Color>();
private int _suspendCount;
private IRenderer? _baseRenderer;
private RendererMode _baseRenderMode;
private PaletteBase? _basePalette;
private readonly PaletteRedirect _redirector;
private readonly NeedPaintHandler _needPaintDelegate;
#endregion
#region Identity
/// <summary>
/// Initialize a new instance of the KryptonCustomPaletteBase class.
/// </summary>
public KryptonCustomPaletteBase()
{
// Setup the need paint delegate
_needPaintDelegate = OnNeedPaint;
// Set the default palette/palette mode
_basePalette = KryptonManager.GetPaletteForMode(ThemeManager.DefaultGlobalPalette);
// Set the default renderer
_baseRenderer = null;
_baseRenderMode = RendererMode.Inherit;
// Create the redirector for passing requests onto the inherited palette
_redirector = new PaletteRedirect(_basePalette);
// Create the storage for the common states
Common = new KryptonPaletteCommon(_redirector, _needPaintDelegate);
// Create redirector so other storage inherits from common states
var redirectCommon = new PaletteRedirectCommon(_redirector, Common.StateDisabled, Common.StateOthers);
// Create the storage objects
ButtonStyles = new KryptonPaletteCheckButtons(redirectCommon, _needPaintDelegate);
ButtonSpecs = new KryptonPaletteButtonSpecs(_redirector);
CalendarDay = new KryptonPaletteCalendarDay(_redirector, _needPaintDelegate);
Cargo = new KryptonPaletteCargo(_needPaintDelegate);
ControlStyles = new KryptonPaletteControls(redirectCommon, _needPaintDelegate);
ContextMenu = new KryptonPaletteContextMenu(redirectCommon, _needPaintDelegate);
DragDrop = new PaletteDragDrop(redirectCommon, _needPaintDelegate);
FormStyles = new KryptonPaletteForms(redirectCommon, _needPaintDelegate);
//Font = new KryptonPaletteFont(_redirectCommon, _needPaintDelegate);
GridStyles = new KryptonPaletteGrids(redirectCommon, _needPaintDelegate);
HeaderStyles = new KryptonPaletteHeaders(redirectCommon, _needPaintDelegate);
HeaderGroup = new KryptonPaletteHeaderGroup(_redirector, _needPaintDelegate);
Images = new KryptonPaletteImages(redirectCommon, _needPaintDelegate);
InputControlStyles = new KryptonPaletteInputControls(redirectCommon, _needPaintDelegate);
LabelStyles = new KryptonPaletteLabels(redirectCommon, _needPaintDelegate);
Navigator = new KryptonPaletteNavigator(redirectCommon, _needPaintDelegate);
PanelStyles = new KryptonPalettePanels(redirectCommon, _needPaintDelegate);
Ribbon = new KryptonPaletteRibbon(redirectCommon, _needPaintDelegate);
SeparatorStyles = new KryptonPaletteSeparators(redirectCommon, _needPaintDelegate);
TabStyles = new KryptonPaletteTabButtons(redirectCommon, _needPaintDelegate);
TrackBar = new KryptonPaletteTrackBar(redirectCommon, _needPaintDelegate);
CueHintText = new PaletteCueHintText(_redirector, _needPaintDelegate);
// Hook into the storage change events
ButtonSpecs.ButtonSpecChanged += OnButtonSpecChanged;
// Hook to palette events
ToolMenuStatus = new KryptonPaletteTMS(this, _basePalette.ColorTable, OnMenuToolStatusPaint);
_basePalette.PalettePaintInternal += OnPalettePaint;
_basePalette.ButtonSpecChanged += OnButtonSpecChanged;
_basePalette.BasePaletteChanged += OnBasePaletteChanged;
_basePalette.BaseRendererChanged += OnBaseRendererChanged;
}
/// <summary>
/// Initialize a new instance of the KryptonCustomPaletteBase class.
/// </summary>
/// <param name="container">Container that owns the component.</param>
public KryptonCustomPaletteBase([DisallowNull] IContainer container)
: this()
{
Debug.Assert(container != null);
// Validate reference parameter
if (container == null)
{
throw new ArgumentNullException(nameof(container));
}
container.Add(this);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing)
{
// Must unhook from the palette paint event
if (_basePalette is not null)
{
_basePalette.PalettePaintInternal -= OnPalettePaint;
_basePalette.ButtonSpecChanged -= OnButtonSpecChanged;
_basePalette.BasePaletteChanged -= OnBasePaletteChanged;
_basePalette.BaseRendererChanged -= OnBaseRendererChanged;
}
}
base.Dispose(disposing);
}
#endregion
#region UseThemeFormChromeBorderWidth
/// <summary>
/// Gets or sets a value indicating if KryptonForm instances should UseThemeFormChromeBorderWidth.
/// </summary>
[KryptonPersist(false)]
[Category(@"Visuals")]
[Description(@"Should KryptonForm instances UseThemeFormChromeBorderWidth.")]
[DefaultValue(InheritBool.Inherit)]
public new InheritBool UseThemeFormChromeBorderWidth
{
get => _basePalette!.UseThemeFormChromeBorderWidth;
set => _basePalette!.UseThemeFormChromeBorderWidth = value;
}
#endregion
#region ButtonSpecs
/// <summary>
/// Gets access to the button specifications.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining button specifications.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteButtonSpecs ButtonSpecs
{
get;
set;
}
private bool ShouldSerializeButtonSpecs() => !ButtonSpecs.IsDefault;
#endregion
#region ButtonStyles
/// <summary>
/// Gets access to the appearance for button styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of button styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteCheckButtons ButtonStyles
{
get;
set;
}
private bool ShouldSerializeButtonStyles() => !ButtonStyles.IsDefault;
#endregion
#region CalendarDay
/// <summary>
/// Gets access to the appearance of the calendar day.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of the calendar day.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteCalendarDay CalendarDay { get; set; }
private bool ShouldSerializeCalendarDay() => !CalendarDay.IsDefault;
#endregion
#region Cargo
/// <summary>
/// Gets access to the set of user supplied values.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Set of user supplied values.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteCargo Cargo { get; set; }
private bool ShouldSerializeCargo() => !Cargo.IsDefault;
#endregion
#region Common
/// <summary>
/// Gets access to the common appearance values.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining common appearance values.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteCommon Common { get; set; }
private bool ShouldSerializeCommon() => !Common.IsDefault;
#endregion
#region ControlStyles
/// <summary>
/// Gets access to the appearance for control styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of control styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteControls ControlStyles { get; set; }
private bool ShouldSerializeControlStyles() => !ControlStyles.IsDefault;
#endregion
#region ContextMenu
/// <summary>
/// Gets access to the appearance for context menus.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of context menus.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteContextMenu ContextMenu { get; set; }
private bool ShouldSerializeContextMenu() => !ContextMenu.IsDefault;
#endregion
#region Cue Hint
/// <summary>Gets or sets the cue hint text.</summary>
/// <value>The cue hint text.</value>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Cue hint values.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteCueHintText CueHintText { get; }
private bool ShouldSerializeCueHintText() => !CueHintText.IsDefault;
#endregion
#region DragDrop
/// <summary>
/// Gets access to the appearance of drag and drop.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of drag and drop.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteDragDrop DragDrop { get; set; }
private bool ShouldSerializeDragDrop() => !DragDrop.IsDefault;
#endregion
#region FormStyles
/// <summary>
/// Gets access to the appearance for form styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of form styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteForms FormStyles { get; set; }
private bool ShouldSerializeFormStyles() => !FormStyles.IsDefault;
#endregion
#region HeaderGroup
/// <summary>
/// Gets access to the HeaderGroup appearance entries.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining HeaderGroup appearance.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteHeaderGroup HeaderGroup { get; set; }
private bool ShouldSerializeHeaderGroup() => !HeaderGroup.IsDefault;
#endregion
#region HeaderStyles
/// <summary>
/// Gets access to the appearance for header styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of header styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteHeaders HeaderStyles { get; set; }
private bool ShouldSerializeHeaderStyles() => !HeaderStyles.IsDefault;
#endregion
#region GridStyles
/// <summary>
/// Gets access to the appearance for grid styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of grid styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteGrids GridStyles { get; set; }
private bool ShouldSerializeGridStyles() => !GridStyles.IsDefault;
#endregion
#region Images
/// <summary>
/// Gets access to the images.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining images.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteImages Images { get; set; }
private bool ShouldSerializeImages() => !Images.IsDefault;
#endregion
#region InputControls
/// <summary>
/// Gets access to the input controls styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining input controls.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteInputControls InputControlStyles { get; set; }
private bool ShouldSerializeInputControlStyles() => !InputControlStyles.IsDefault;
#endregion
#region LabelStyles
/// <summary>
/// Gets access to the appearance for label styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of label styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteLabels LabelStyles { get; set; }
private bool ShouldSerializeLabelStyles() => !LabelStyles.IsDefault;
#endregion
#region Navigator
/// <summary>
/// Gets access to the Navigator appearance entries.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining Navigator appearance.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteNavigator Navigator { get; set; }
private bool ShouldSerializeNavigator() => !Navigator.IsDefault;
#endregion
#region PanelStyles
/// <summary>
/// Gets access to the appearance for panel styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of panel styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPalettePanels PanelStyles { get; set; }
private bool ShouldSerializePanelStyles() => !PanelStyles.IsDefault;
#endregion
#region Ribbon
/// <summary>
/// Gets access to the appearance settings for ribbon.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of ribbon.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteRibbon Ribbon { get; set; }
private bool ShouldSerializeRibbon() => !Ribbon.IsDefault;
#endregion
#region SeparatorStyles
/// <summary>
/// Gets access to the appearance for separator styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of separator styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteSeparators SeparatorStyles { get; set; }
private bool ShouldSerializeSeparatorStyles() => !SeparatorStyles.IsDefault;
#endregion
#region TabStyles
/// <summary>
/// Gets access to the appearance for tab styles.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance of tab styles.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteTabButtons TabStyles { get; set; }
private bool ShouldSerializeTabStyles() => !TabStyles.IsDefault;
#endregion
#region TrackBar
/// <summary>
/// Gets access to the appearance for the track bar.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Overrides for defining appearance for the track bar.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteTrackBar TrackBar { get; set; }
private bool ShouldSerializeTrackBar() => !TrackBar.IsDefault;
#endregion
#region ToolMenuStatus
/// <summary>
/// Gets access to the set of color table settings.
/// </summary>
[KryptonPersist]
[Category(@"Visuals")]
[Description(@"Colors associated with tool, menu and status strips.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public KryptonPaletteTMS ToolMenuStatus { get; set; }
private bool ShouldSerializeToolMenuStatus() => !ToolMenuStatus.IsDefault;
#endregion
#region Renderer
/// <summary>
/// Gets the renderer to use for this palette.
/// </summary>
/// <returns>Renderer to use for drawing palette settings.</returns>
public override IRenderer GetRenderer()
=> _baseRenderMode switch
{
RendererMode.Inherit => _basePalette!.GetRenderer(),
RendererMode.Custom => _baseRenderer!,
_ => KryptonManager.GetRendererForMode(_baseRenderMode)
};
#endregion
#region PaletteBase Back
/// <summary>
/// Gets a value indicating if background should be drawn.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetBackDraw(PaletteBackStyle style, PaletteState state) =>
// Find the correct destination in the palette and pass on request
GetPaletteBack(style, state)?.GetBackDraw(state) ?? InheritBool.Inherit;
/// <summary>
/// Gets the graphics drawing hint for the background.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteGraphicsHint value.</returns>
public override PaletteGraphicsHint GetBackGraphicsHint(PaletteBackStyle style, PaletteState state) =>
// Find the correct destination in the palette and pass on request
GetPaletteBack(style, state)?.GetBackGraphicsHint(state) ?? PaletteGraphicsHint.Inherit;
/// <summary>
/// Gets the first background color.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetBackColor1(PaletteBackStyle style, PaletteState state) =>
// Find the correct destination in the palette and pass on request
GetPaletteBack(style, state)?.GetBackColor1(state) ?? GlobalStaticValues.EMPTY_COLOR;
/// <summary>
/// Gets the second back color.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetBackColor2(PaletteBackStyle style, PaletteState state) =>
// Find the correct destination in the palette and pass on request
GetPaletteBack(style, state)?.GetBackColor2(state) ?? GlobalStaticValues.EMPTY_COLOR;
/// <summary>
/// Gets the color background drawing style.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color drawing style.</returns>
public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) =>
// Find the correct destination in the palette and pass on request
GetPaletteBack(style, state)?.GetBackColorStyle(state) ?? PaletteColorStyle.Inherit;
/// <summary>
/// Gets the color alignment.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color alignment style.</returns>
public override PaletteRectangleAlign GetBackColorAlign(PaletteBackStyle style, PaletteState state)
=> GetPaletteBack(style, state)?.GetBackColorAlign(state) ?? PaletteRectangleAlign.Inherit;
/// <summary>
/// Gets the color background angle.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Angle used for color drawing.</returns>
public override float GetBackColorAngle(PaletteBackStyle style, PaletteState state) =>
// Find the correct destination in the palette and pass on request
GetPaletteBack(style, state)?.GetBackColorAngle(state) ?? 0f;
/// <summary>
/// Gets a background image.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image instance.</returns>
public override Image? GetBackImage(PaletteBackStyle style, PaletteState state)
=> GetPaletteBack(style, state)?.GetBackImage(state);
/// <summary>
/// Gets the background image style.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image style value.</returns>
public override PaletteImageStyle GetBackImageStyle(PaletteBackStyle style, PaletteState state)
=> GetPaletteBack(style, state).GetBackImageStyle(state);
/// <summary>
/// Gets the image alignment.
/// </summary>
/// <param name="style">Background style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image alignment style.</returns>
public override PaletteRectangleAlign GetBackImageAlign(PaletteBackStyle style, PaletteState state)
=> GetPaletteBack(style, state).GetBackImageAlign(state);
#endregion
#region PaletteBase Border
/// <summary>
/// Gets a value indicating if border should be drawn.
/// </summary>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <param name="style">Border style.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetBorderDraw(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderDraw(state);
/// <summary>
/// Gets a value indicating which borders to draw.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteDrawBorders value.</returns>
public override PaletteDrawBorders GetBorderDrawBorders(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderDrawBorders(state);
/// <summary>
/// Gets the graphics drawing hint for the border.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteGraphicsHint value.</returns>
public override PaletteGraphicsHint GetBorderGraphicsHint(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderGraphicsHint(state);
/// <summary>
/// Gets the first border color.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetBorderColor1(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderColor1(state);
/// <summary>
/// Gets the second border color.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetBorderColor2(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderColor2(state);
/// <summary>
/// Gets the color border drawing style.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color drawing style.</returns>
public override PaletteColorStyle GetBorderColorStyle(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderColorStyle(state);
/// <summary>
/// Gets the color border alignment.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color alignment style.</returns>
public override PaletteRectangleAlign GetBorderColorAlign(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderColorAlign(state);
/// <summary>
/// Gets the color border angle.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Angle used for color drawing.</returns>
public override float GetBorderColorAngle(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderColorAngle(state);
/// <summary>
/// Gets the border width.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Integer width.</returns>
public override int GetBorderWidth(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderWidth(state);
/// <summary>
/// Gets the border corner rounding.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Float rounding.</returns>
public override float GetBorderRounding(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderRounding(state);
/// <summary>
/// Gets a border image.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image instance.</returns>
public override Image? GetBorderImage(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderImage(state);
/// <summary>
/// Gets the border image style.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image style value.</returns>
public override PaletteImageStyle GetBorderImageStyle(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderImageStyle(state);
/// <summary>
/// Gets the image border alignment.
/// </summary>
/// <param name="style">Border style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image alignment style.</returns>
public override PaletteRectangleAlign GetBorderImageAlign(PaletteBorderStyle style, PaletteState state)
=> GetPaletteBorder(style, state).GetBorderImageAlign(state);
#endregion
#region PaletteBase Content
/// <summary>
/// Gets a value indicating if content should be drawn.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetContentDraw(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentDraw(state);
/// <summary>
/// Gets a value indicating if content should be drawn with focus indication.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetContentDrawFocus(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentDrawFocus(state);
/// <summary>
/// Gets the horizontal relative alignment of the image.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>RelativeAlignment value.</returns>
public override PaletteRelativeAlign GetContentImageH(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentImageH(state);
/// <summary>
/// Gets the vertical relative alignment of the image.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>RelativeAlignment value.</returns>
public override PaletteRelativeAlign GetContentImageV(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentImageV(state);
/// <summary>
/// Gets the effect applied to drawing of the image.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteImageEffect value.</returns>
public override PaletteImageEffect GetContentImageEffect(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentImageEffect(state);
/// <summary>
/// Gets the image color to remap into another color.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetContentImageColorMap(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentImageColorMap(state);
/// <summary>
/// Gets the color to use in place of the image map color.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetContentImageColorTo(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentImageColorTo(state);
/// <inheritdoc />
public override Color GetContentImageColorTransparent(PaletteContentStyle style, PaletteState state) => throw new NotImplementedException();
/// <summary>
/// Gets the font for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Font value.</returns>
public override Font? GetContentShortTextFont(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextFont(state);
/// <summary>
/// Gets the font for the short text by generating a new font instance.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Font value.</returns>
public override Font? GetContentShortTextNewFont(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextFont(state);
/// <summary>
/// Gets the rendering hint for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteTextHint value.</returns>
public override PaletteTextHint GetContentShortTextHint(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextHint(state);
/// <summary>
/// Gets the flag indicating if multiline text is allowed for short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetContentShortTextMultiLine(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextMultiLine(state);
/// <summary>
/// Gets the text trimming to use for short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteTextTrim value.</returns>
public override PaletteTextTrim GetContentShortTextTrim(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextTrim(state);
/// <summary>
/// Gets the prefix drawing setting for short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteTextPrefix value.</returns>
public override PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextPrefix(state);
/// <summary>
/// Gets the horizontal relative alignment of the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>RelativeAlignment value.</returns>
public override PaletteRelativeAlign GetContentShortTextH(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextH(state);
/// <summary>
/// Gets the vertical relative alignment of the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>RelativeAlignment value.</returns>
public override PaletteRelativeAlign GetContentShortTextV(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextV(state);
/// <summary>
/// Gets the horizontal relative alignment of multiline short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>RelativeAlignment value.</returns>
public override PaletteRelativeAlign GetContentShortTextMultiLineH(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextMultiLineH(state);
/// <summary>
/// Gets the first back color for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetContentShortTextColor1(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextColor1(state);
/// <summary>
/// Gets the second back color for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color value.</returns>
public override Color GetContentShortTextColor2(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextColor2(state);
/// <summary>
/// Gets the color drawing style for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color drawing style.</returns>
public override PaletteColorStyle GetContentShortTextColorStyle(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextColorStyle(state);
/// <summary>
/// Gets the color alignment for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Color alignment style.</returns>
public override PaletteRectangleAlign GetContentShortTextColorAlign(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextColorAlign(state);
/// <summary>
/// Gets the color background angle for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Angle used for color drawing.</returns>
public override float GetContentShortTextColorAngle(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextColorAngle(state);
/// <summary>
/// Gets a background image for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image instance.</returns>
public override Image? GetContentShortTextImage(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextImage(state);
/// <summary>
/// Gets the background image style.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image style value.</returns>
public override PaletteImageStyle GetContentShortTextImageStyle(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextImageStyle(state);
/// <summary>
/// Gets the image alignment for the short text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Image alignment style.</returns>
public override PaletteRectangleAlign GetContentShortTextImageAlign(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentShortTextImageAlign(state);
/// <summary>
/// Gets the font for the long text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Font value.</returns>
public override Font? GetContentLongTextFont(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentLongTextFont(state);
/// <summary>
/// Gets the font for the long text by generating a new font instance.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>Font value.</returns>
public override Font? GetContentLongTextNewFont(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentLongTextFont(state);
/// <summary>
/// Gets the rendering hint for the long text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>TextRenderingHint value.</returns>
public override PaletteTextHint GetContentLongTextHint(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentLongTextHint(state);
/// <summary>
/// Gets the prefix drawing setting for long text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteTextPrefix value.</returns>
public override PaletteTextHotkeyPrefix GetContentLongTextPrefix(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentLongTextPrefix(state);
/// <summary>
/// Gets the flag indicating if multiline text is allowed for long text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetContentLongTextMultiLine(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentLongTextMultiLine(state);
/// <summary>
/// Gets the text trimming to use for long text.
/// </summary>
/// <param name="style">Content style.</param>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <returns>PaletteTextTrim value.</returns>
public override PaletteTextTrim GetContentLongTextTrim(PaletteContentStyle style, PaletteState state)
=> GetPaletteContent(style, state).GetContentLongTextTrim(state);