123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- using FastReport.Design;
- using FastReport.Utils;
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace FastReport.Controls
- {
- public class ToolbarButton : ToolStripButton, IToolbarItem
- {
- /// <inheritdoc/>
- public bool BeginGroup { get; set; }
- public ToolbarButton(string name, int imageIndex, EventHandler click)
- {
- Name = name;
- DisplayStyle = ToolStripItemDisplayStyle.Image;
- ImageIndex = imageIndex;
- Click += click;
- }
- }
- public class ToolbarDropDownButton : ToolStripDropDownButton, IToolbarItem
- {
- /// <inheritdoc/>
- public bool BeginGroup { get; set; }
- /// <summary>
- /// Updates dropdown images on dpi change.
- /// </summary>
- /// <param name="designer">The designer.</param>
- public void UpdateDpiDependencies(Designer designer)
- {
- DropDown.ImageList = designer.GetImages();
- }
- /// <summary>
- /// Adds items to the dropdown menu.
- /// </summary>
- /// <param name="items">Items to add.</param>
- public void AddDropDownItems(params IToolbarItem[] items)
- {
- // convert item.BeginGroup to a separator
- foreach (var item in items)
- {
- if (item.BeginGroup && DropDownItems.Count > 0)
- DropDownItems.Add(new ToolStripSeparator());
- DropDownItems.Add(item as ToolStripItem);
- }
- }
- public ToolbarDropDownButton(string name, int imageIndex, EventHandler dropDownOpening)
- {
- Name = name;
- ImageIndex = imageIndex;
- DropDownOpening += dropDownOpening;
- }
- }
- internal class ToolbarColorButton : ToolStripColorButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarColorButton(string name, int imageIndex, Color color, EventHandler click)
- {
- Name = name;
- ImageIndex = imageIndex;
- DefaultColor = color;
- DisplayStyle = ToolStripItemDisplayStyle.Image;
- ButtonClick += click;
- }
- }
- internal class ToolbarLineWidthButton : ToolStripLineWidthButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarLineWidthButton(Control control, string name, int imageIndex, EventHandler widthSelected) : base(control)
- {
- Name = name;
- ImageIndex = imageIndex;
- WidthSelected += widthSelected;
- }
- }
- internal class ToolbarLineStyleButton : ToolStripLineStyleButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarLineStyleButton(Control control, string name, int imageIndex, EventHandler styleSelected) : base(control)
- {
- Name = name;
- ImageIndex = imageIndex;
- StyleSelected += styleSelected;
- }
- }
- internal class ToolbarOpenButton : ToolStripOpenButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarOpenButton(Designer designer, string name, int imageIndex) : base(designer)
- {
- Name = name;
- ImageIndex = imageIndex;
- }
- }
- internal class ToolbarUndoButton : ToolStripUndoButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarUndoButton(Designer designer, string name, int imageIndex) : base(designer)
- {
- Name = name;
- ImageIndex = imageIndex;
- }
- }
- internal class ToolbarRedoButton : ToolStripRedoButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarRedoButton(Designer designer, string name, int imageIndex) : base(designer)
- {
- Name = name;
- ImageIndex = imageIndex;
- }
- }
- internal class ToolbarStyleComboBox : ToolStripStyleComboBox, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarStyleComboBox(string name, EventHandler styleSelected)
- {
- Name = name;
- StyleSelected += styleSelected;
- }
- }
- internal class ToolbarFontComboBox : ToolStripFontComboBox, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarFontComboBox(string name, EventHandler fontSelected)
- {
- Name = name;
- FontSelected += fontSelected;
- }
- }
- internal class ToolbarFontSizeComboBox : ToolStripFontSizeComboBox, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarFontSizeComboBox(string name, EventHandler sizeSelected)
- {
- Name = name;
- SizeSelected += sizeSelected;
- }
- }
- internal class ToolbarTextAngleButton : ToolStripTextAngleButton, IToolbarItem
- {
- public bool BeginGroup { get; set; }
- public ToolbarTextAngleButton(Designer designer, Control owner, string name, int imageIndex, EventHandler angleSelected) : base(owner)
- {
- Name = name;
- ImageIndex = imageIndex;
- AngleChanged += angleSelected;
- }
- }
- internal class StyledComboBox : ComboBox
- {
- public void SetStyle(UIStyle style)
- {
- }
- public StyledComboBox()
- {
- FlatStyle = FlatStyle.Flat;
- }
- }
- internal class StyledListView : ListView
- {
- public void SetStyle(UIStyle style)
- {
- }
- }
- }
|