using FastReport.Design;
using FastReport.Utils;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace FastReport.Controls
{
public class ToolbarButton : ToolStripButton, IToolbarItem
{
///
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
{
///
public bool BeginGroup { get; set; }
///
/// Updates dropdown images on dpi change.
///
/// The designer.
public void UpdateDpiDependencies(Designer designer)
{
DropDown.ImageList = designer.GetImages();
}
///
/// Adds items to the dropdown menu.
///
/// Items to add.
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)
{
}
}
}