ToolbarItems.Mono.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using FastReport.Design;
  2. using FastReport.Utils;
  3. using System;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. namespace FastReport.Controls
  7. {
  8. public class ToolbarButton : ToolStripButton, IToolbarItem
  9. {
  10. /// <inheritdoc/>
  11. public bool BeginGroup { get; set; }
  12. public ToolbarButton(string name, int imageIndex, EventHandler click)
  13. {
  14. Name = name;
  15. DisplayStyle = ToolStripItemDisplayStyle.Image;
  16. ImageIndex = imageIndex;
  17. Click += click;
  18. }
  19. }
  20. public class ToolbarDropDownButton : ToolStripDropDownButton, IToolbarItem
  21. {
  22. /// <inheritdoc/>
  23. public bool BeginGroup { get; set; }
  24. /// <summary>
  25. /// Updates dropdown images on dpi change.
  26. /// </summary>
  27. /// <param name="designer">The designer.</param>
  28. public void UpdateDpiDependencies(Designer designer)
  29. {
  30. DropDown.ImageList = designer.GetImages();
  31. }
  32. /// <summary>
  33. /// Adds items to the dropdown menu.
  34. /// </summary>
  35. /// <param name="items">Items to add.</param>
  36. public void AddDropDownItems(params IToolbarItem[] items)
  37. {
  38. // convert item.BeginGroup to a separator
  39. foreach (var item in items)
  40. {
  41. if (item.BeginGroup && DropDownItems.Count > 0)
  42. DropDownItems.Add(new ToolStripSeparator());
  43. DropDownItems.Add(item as ToolStripItem);
  44. }
  45. }
  46. public ToolbarDropDownButton(string name, int imageIndex, EventHandler dropDownOpening)
  47. {
  48. Name = name;
  49. ImageIndex = imageIndex;
  50. DropDownOpening += dropDownOpening;
  51. }
  52. }
  53. internal class ToolbarColorButton : ToolStripColorButton, IToolbarItem
  54. {
  55. public bool BeginGroup { get; set; }
  56. public ToolbarColorButton(string name, int imageIndex, Color color, EventHandler click)
  57. {
  58. Name = name;
  59. ImageIndex = imageIndex;
  60. DefaultColor = color;
  61. DisplayStyle = ToolStripItemDisplayStyle.Image;
  62. ButtonClick += click;
  63. }
  64. }
  65. internal class ToolbarLineWidthButton : ToolStripLineWidthButton, IToolbarItem
  66. {
  67. public bool BeginGroup { get; set; }
  68. public ToolbarLineWidthButton(Control control, string name, int imageIndex, EventHandler widthSelected) : base(control)
  69. {
  70. Name = name;
  71. ImageIndex = imageIndex;
  72. WidthSelected += widthSelected;
  73. }
  74. }
  75. internal class ToolbarLineStyleButton : ToolStripLineStyleButton, IToolbarItem
  76. {
  77. public bool BeginGroup { get; set; }
  78. public ToolbarLineStyleButton(Control control, string name, int imageIndex, EventHandler styleSelected) : base(control)
  79. {
  80. Name = name;
  81. ImageIndex = imageIndex;
  82. StyleSelected += styleSelected;
  83. }
  84. }
  85. internal class ToolbarOpenButton : ToolStripOpenButton, IToolbarItem
  86. {
  87. public bool BeginGroup { get; set; }
  88. public ToolbarOpenButton(Designer designer, string name, int imageIndex) : base(designer)
  89. {
  90. Name = name;
  91. ImageIndex = imageIndex;
  92. }
  93. }
  94. internal class ToolbarUndoButton : ToolStripUndoButton, IToolbarItem
  95. {
  96. public bool BeginGroup { get; set; }
  97. public ToolbarUndoButton(Designer designer, string name, int imageIndex) : base(designer)
  98. {
  99. Name = name;
  100. ImageIndex = imageIndex;
  101. }
  102. }
  103. internal class ToolbarRedoButton : ToolStripRedoButton, IToolbarItem
  104. {
  105. public bool BeginGroup { get; set; }
  106. public ToolbarRedoButton(Designer designer, string name, int imageIndex) : base(designer)
  107. {
  108. Name = name;
  109. ImageIndex = imageIndex;
  110. }
  111. }
  112. internal class ToolbarStyleComboBox : ToolStripStyleComboBox, IToolbarItem
  113. {
  114. public bool BeginGroup { get; set; }
  115. public ToolbarStyleComboBox(string name, EventHandler styleSelected)
  116. {
  117. Name = name;
  118. StyleSelected += styleSelected;
  119. }
  120. }
  121. internal class ToolbarFontComboBox : ToolStripFontComboBox, IToolbarItem
  122. {
  123. public bool BeginGroup { get; set; }
  124. public ToolbarFontComboBox(string name, EventHandler fontSelected)
  125. {
  126. Name = name;
  127. FontSelected += fontSelected;
  128. }
  129. }
  130. internal class ToolbarFontSizeComboBox : ToolStripFontSizeComboBox, IToolbarItem
  131. {
  132. public bool BeginGroup { get; set; }
  133. public ToolbarFontSizeComboBox(string name, EventHandler sizeSelected)
  134. {
  135. Name = name;
  136. SizeSelected += sizeSelected;
  137. }
  138. }
  139. internal class ToolbarTextAngleButton : ToolStripTextAngleButton, IToolbarItem
  140. {
  141. public bool BeginGroup { get; set; }
  142. public ToolbarTextAngleButton(Designer designer, Control owner, string name, int imageIndex, EventHandler angleSelected) : base(owner)
  143. {
  144. Name = name;
  145. ImageIndex = imageIndex;
  146. AngleChanged += angleSelected;
  147. }
  148. }
  149. internal class StyledComboBox : ComboBox
  150. {
  151. public void SetStyle(UIStyle style)
  152. {
  153. }
  154. public StyledComboBox()
  155. {
  156. FlatStyle = FlatStyle.Flat;
  157. }
  158. }
  159. internal class StyledListView : ListView
  160. {
  161. public void SetStyle(UIStyle style)
  162. {
  163. }
  164. }
  165. }