public static bool DrawIconButton(GUIStyle iconStyle, GUIContent content, Size textSize, TextAlign textAlign, DColor buttonDColor, DColor textDColor, float height, bool expandWidth = true) { float iconSize = height * 0.6f; float iconPadding = height * 0.1f; Vector2 contentSize = LabelStyle(textSize, textAlign).CalcSize(content); var options = new List <GUILayoutOption> { GUILayout.Height(height) }; if (expandWidth) { options.Add(GUILayout.ExpandWidth(true)); } else { float width = 0; width += iconPadding * 3; width += iconSize; width += iconPadding; width += contentSize.x; width += iconPadding; options.Add(GUILayout.Width(width)); } bool result; Color color = GUI.color; GUILayout.BeginVertical(options.ToArray()); { GUI.color = Colors.BarColor(buttonDColor, true); result = GUILayout.Button(GUIContent.none, ButtonStyle(DEFAULT_STATE), options.ToArray()); GUILayout.Space(-height); GUI.color = color; GUILayout.BeginHorizontal(options.ToArray()); { GUILayout.Space(iconPadding * 3); Icon.Draw(iconStyle, iconSize, height, Colors.TextColor(textDColor)); GUILayout.Space(iconPadding); GUILayout.Label(content, new GUIStyle(LabelStyle(textSize, textAlign)) { normal = { textColor = Colors.TextColor(textDColor) } }, GUILayout.Width(contentSize.x), GUILayout.Height(height)); GUILayout.Space(iconPadding); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (result) { Properties.ResetKeyboardFocus(); Event.current.Use(); } return(result); }
public static Rect Draw(Rect position, string text, GUIStyle style, DColor textDColor) { return(Draw(position, text, Colors.ColorTextOfGUIStyle(style, textDColor))); }
public static bool Draw(Rect rect, GUIContent content, GUIStyle buttonStyle, GUIStyle labelStyle, DColor buttonDColor, DColor textDColor) { Color color = GUI.color; GUI.color = Colors.BarColor(buttonDColor, true); bool result = GUI.Button(rect, GUIContent.none, buttonStyle); GUI.color = color; GUI.Label(rect, content, new GUIStyle(labelStyle) { normal = { textColor = Colors.TextColor(textDColor) } }); if (result) { Properties.ResetKeyboardFocus(); Event.current.Use(); } return(result); }
public static bool Draw(GUIContent content, Size textSize, TextAlign textAlign, DColor buttonDColor, bool enabled, float height, float width = -1) { return(Draw(content, textSize, textAlign, buttonDColor, buttonDColor, enabled, height, width)); }
public static void Draw(GUIContent content, Size textSize, DColor textDColor) { Draw(content, Style(textSize, textDColor)); }
public static bool Draw(Rect rect, GUIContent content, DColor buttonDColor, bool enabled) { return(Draw(rect, content, DEFAULT_SIZE, DEFAULT_TEXT_ALIGN, buttonDColor, buttonDColor, enabled)); }
public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle, double strokeWidth, DStrokeCap strokeCap) { // see: // http://groups.google.com/group/microsoft.public.dotnet.framework.drawing/browse_thread/thread/c52a43702fccaab8/838a26535bf6e2e6?lnk=st&q=drawline+outofmemoryexception#838a26535bf6e2e6 // http://www.codeprof.com/dev-archive/123/2-8-1234065.shtm try { g.DrawLine(MakePen(WFHelper.MakeColor(color, alpha), strokeWidth, strokeStyle, DStrokeJoin.Mitre, strokeCap), (float)pt1.X, (float)pt1.Y, (float)pt2.X, (float)pt2.Y); } catch { } }
public static void Draw(GUIContent content, GUIStyle labelStyle, DColor textDColor, float rowHeight) { Draw(content, Colors.ColorTextOfGUIStyle(labelStyle, textDColor), rowHeight); }
public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, DStrokeStyle strokeStyle) { DrawLine(pt1, pt2, color, 1, strokeStyle); }
public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle) { DrawLine(pt1, pt2, color, alpha, strokeStyle, 1, DStrokeCap.Round); }
public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha) { DrawLine(pt1, pt2, color, alpha, DStrokeStyle.Solid); }
public override void DrawLine(DPoint pt1, DPoint pt2, DColor color) { DrawLine(pt1, pt2, color, 1); }
public override void DrawEllipse(DRect rect, DColor color, double alpha) { g.DrawEllipse(new Pen(WFHelper.MakeColor(color, alpha)), MakeRect(rect)); }
public static Rect Draw(Rect position, GUIContent content, GUIStyle style, DColor textDColor) { return(Draw(position, content, Colors.ColorTextOfGUIStyle(style, textDColor))); }
public override void DrawPolyline(DPoints pts, DColor color) { DrawPolyline(pts, color, 1, 1, DStrokeStyle.Solid, DStrokeJoin.Round, DStrokeCap.Round); }
public static void Draw(string text, GUIStyle labelStyle, DColor textDColor, float rowHeight) { Draw(text, Colors.ColorTextOfGUIStyle(labelStyle, textDColor), rowHeight); }
public override void DrawPolyline(DPoints pts, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin, DStrokeCap strokeCap) { if (pts.Count > 1) g.DrawLines(MakePen(WFHelper.MakeColor(color, alpha), strokeWidth, strokeStyle, strokeJoin, strokeCap), MakePoints(pts)); }
public static GUIStyle Style(Size size, DColor textDColor) { return(Colors.ColorTextOfGUIStyle(Style(size), Colors.TextColor(textDColor))); }
public override void DrawRect(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin) { // see: // http://groups.google.com/group/microsoft.public.dotnet.framework.drawing/browse_thread/thread/c52a43702fccaab8/838a26535bf6e2e6?lnk=st&q=drawline+outofmemoryexception#838a26535bf6e2e6 // http://www.codeprof.com/dev-archive/123/2-8-1234065.shtm try { g.DrawRectangle(MakePen(WFHelper.MakeColor(color, alpha), strokeWidth, strokeStyle, strokeJoin, DStrokeCap.Butt), (float)x, (float)y, (float)width, (float)height); } catch { } }
public static bool Draw(Rect rect, string label, Size textSize, DColor buttonDColor, DColor textDColor, bool enabled) { return(Draw(rect, new GUIContent(label), textSize, DEFAULT_TEXT_ALIGN, buttonDColor, textDColor, enabled)); }
public override void DrawRect(double x, double y, double width, double height, DColor color) { DrawRect(x, y, width, height, color, 1, 1); }
public static bool Draw(Rect rect, GUIContent content, Size textSize, TextAlign textAlign, DColor buttonDColor, bool enabled) { return(Draw(rect, content, textSize, textAlign, buttonDColor, buttonDColor, enabled)); }
public override void DrawRect(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth) { DrawRect(x, y, width, height, color, alpha, strokeWidth, DStrokeStyle.Solid, DStrokeJoin.Mitre); }
public static bool Draw(string label, Size textSize, TextAlign textAlign, DColor buttonDColor, DColor textDColor, bool enabled, float height, float width = -1) { return(Draw(new GUIContent(label), textSize, textAlign, buttonDColor, textDColor, enabled, height, width)); }
public override void DrawRect(DRect rect, DColor color) { DrawRect(rect.X, rect.Y, rect.Width, rect.Height, color); }
public static bool Draw(GUIContent content, GUIStyle buttonStyle, GUIStyle labelStyle, DColor buttonDColor, DColor textDColor, float height, float width = -1) { var options = new List <GUILayoutOption> { GUILayout.Height(height) }; if (width > 0) { options.Add(GUILayout.Width(width)); } bool result; Color color = GUI.color; GUILayout.BeginVertical(options.ToArray()); { GUI.color = Colors.BarColor(buttonDColor, true); result = GUILayout.Button(GUIContent.none, buttonStyle, options.ToArray()); GUILayout.Space(-height); GUI.color = color; GUILayout.Label(content, new GUIStyle(labelStyle) { normal = { textColor = Colors.TextColor(textDColor) } }, options.ToArray()); } GUILayout.EndVertical(); if (result) { Properties.ResetKeyboardFocus(); Event.current.Use(); } return(result); }
public override void DrawRect(DRect rect, DColor color, double alpha) { DrawRect(rect.X, rect.Y, rect.Width, rect.Height, color, alpha, 1); }
public override void DrawEllipse(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle) { g.DrawEllipse(MakePen(WFHelper.MakeColor(color, alpha), strokeWidth, strokeStyle, DStrokeJoin.Mitre, DStrokeCap.Butt), (float)x, (float)y, (float)width, (float)height); }
public override void DrawRect(DRect rect, DColor color, double alpha, DStrokeStyle strokeStyle) { DrawRect(rect.X, rect.Y, rect.Width, rect.Height, color, alpha, 1, strokeStyle, DStrokeJoin.Mitre); }
public static Rect Draw(Rect position, GUIContent content, Size size, DColor textDColor) { return(Draw(position, content, Style(size, textDColor))); }
public override void DrawText(string text, string fontName, double fontSize, DPoint pt, DColor color, double alpha) { DrawText(text, fontName, fontSize, false, false, false, false, pt, color, alpha); }
public static void Draw(string text, Size textSize, DColor textDColor, float rowHeight) { Draw(text, Style(textSize, textDColor), rowHeight); }
public override void DrawText(string text, string fontName, double fontSize, bool bold, bool italics, bool underline, bool strikethrough, DPoint pt, DColor color, double alpha) { if (fontSize >= MinFontSize) g.DrawString(text, new Font(fontName, (float)fontSize, MakeFontStyle(bold, italics, underline, strikethrough)), new SolidBrush(WFHelper.MakeColor(color, alpha)), new PointF((float)pt.X, (float)pt.Y), StringFormat.GenericDefault); }
public static void Draw(GUIContent content, Size textSize, DColor textDColor, float rowHeight) { Draw(content, Style(textSize, textDColor), rowHeight); }
public override void FillEllipse(double x, double y, double width, double height, DColor color) { g.FillEllipse(new SolidBrush(WFHelper.MakeColor(color)), (float)x, (float)y, (float)width, (float)height); }
public static void Draw(string text, Size textSize, DColor textDColor) { Draw(text, Style(textSize, textDColor)); }
public override void FillEllipse(DRect rect, DColor color, double alpha) { g.FillEllipse(new SolidBrush(WFHelper.MakeColor(color, alpha)), MakeRect(rect)); }
public static void Draw(string text, GUIStyle labelStyle, DColor textDColor) { Draw(text, Colors.ColorTextOfGUIStyle(labelStyle, textDColor)); }
public override void FillPolygon(DPoints pts, DColor color, double alpha) { FillPolygon(pts, color, alpha, DFillRule.EvenOdd); }
public static void Draw(GUIContent content, GUIStyle labelStyle, DColor textDColor) { Draw(content, Colors.ColorTextOfGUIStyle(labelStyle, textDColor)); }
public override void FillPolygon(DPoints pts, DColor color, double alpha, DFillRule fillRule) { if (pts.Count > 1) g.FillPolygon(MakeBrush(DFillStyle.Solid, color, alpha), MakePoints(pts), MakeFillMode(fillRule)); }
public static bool Draw(Rect rect, string label, Size textSize, TextAlign textAlign, DColor buttonDColor, DColor textDColor, bool enabled) { return(Draw(rect, new GUIContent(label), textSize, textAlign, buttonDColor, textDColor, enabled)); }
// Drawing Functions // public override void FillRect(double x, double y, double width, double height, DColor color, double alpha) { g.FillRectangle(new SolidBrush(WFHelper.MakeColor(color, alpha)), (float)x, (float)y, (float)width, (float)height); }
public static bool Draw(Rect rect, GUIContent content, Size textSize, DColor buttonDColor, DColor textDColor, bool enabled) { return(Draw(rect, content, textSize, DEFAULT_TEXT_ALIGN, buttonDColor, textDColor, enabled)); }
public override void FillRect(double x, double y, double width, double height, DColor color, double alpha, DFillStyle fillStyle) { g.FillRectangle(MakeBrush(fillStyle, color, alpha), (float)x, (float)y, (float)width, (float)height); }
public static bool Draw(Rect rect, GUIContent content, Size textSize, TextAlign textAlign, DColor buttonDColor, DColor textDColor, bool enabled) { return(Draw(rect, content, ButtonStyle(enabled), LabelStyle(textSize, textAlign), buttonDColor, textDColor)); }
// Helper Functions // Brush MakeBrush(DFillStyle fillStyle, DColor color, double alpha) { switch (fillStyle) { case DFillStyle.ForwardDiagonalHatch: return new HatchBrush(HatchStyle.ForwardDiagonal, WFHelper.MakeColor(color, alpha), Color.FromArgb(0, Color.Red)); default: return new SolidBrush(WFHelper.MakeColor(color, alpha)); ; } }
public static bool Draw(string label, Size textSize, DColor buttonDColor, bool enabled, float height, float width = -1) { return(Draw(new GUIContent(label), textSize, DEFAULT_TEXT_ALIGN, buttonDColor, buttonDColor, enabled, height, width)); }
public static Color MakeColor(DColor color) { return Color.FromArgb(color.A, color.R, color.G, color.B); }
public static bool Draw(GUIContent content, Size textSize, DColor buttonDColor, DColor textDColor, bool enabled, float height, float width = -1) { return(Draw(content, textSize, DEFAULT_TEXT_ALIGN, buttonDColor, textDColor, enabled, height, width)); }
public static Color MakeColor(DColor color, double alpha) { return Color.FromArgb((int)(color.A * alpha), color.R, color.G, color.B); }
public static bool Draw(GUIContent content, Size textSize, TextAlign textAlign, DColor buttonDColor, DColor textDColor, bool enabled, float height, float width = -1) { return(Draw(content, ButtonStyle(enabled), LabelStyle(textSize, textAlign), buttonDColor, textDColor, height, width)); }
public static void Draw(SerializedProperty property, string text, DColor dColor, bool drawBackground = true) { Draw(property, new GUIContent(text), dColor, drawBackground); }
public static bool DrawIconButton(GUIStyle iconStyle, string text, Size textSize, TextAlign textAlign, DColor buttonDColor, DColor textDColor, float height, bool expandWidth = true) { return(DrawIconButton(iconStyle, new GUIContent(text), textSize, textAlign, buttonDColor, buttonDColor, height, expandWidth)); }
public static Rect Draw(Rect position, string text, Size size, DColor textDColor) { return(Draw(position, text, Style(size, textDColor))); }
public static bool DrawIconButton(GUIStyle iconStyle, DColor buttonDColor, DColor iconDColor, float height) { float iconSize = height * 0.7f; float iconPadding = height * 0.1f; var options = new List <GUILayoutOption> { GUILayout.Height(height) }; float width = 0; width += iconPadding * 2; width += iconSize; width += iconPadding * 2; options.Add(GUILayout.Width(width)); bool result; Color color = GUI.color; GUILayout.BeginVertical(options.ToArray()); { GUI.color = Colors.BarColor(buttonDColor, true); result = GUILayout.Button(GUIContent.none, ButtonStyle(DEFAULT_STATE), options.ToArray()); GUILayout.Space(-height); GUI.color = color; GUILayout.BeginHorizontal(options.ToArray()); { GUILayout.Space(iconPadding * 2); Icon.Draw(iconStyle, iconSize, height, Colors.IconColor(iconDColor)); GUILayout.Space(iconPadding * 2); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (result) { Properties.ResetKeyboardFocus(); Event.current.Use(); } return(result); }
public override void DrawEllipse(double x, double y, double width, double height, DColor color) { g.DrawEllipse(new Pen(WFHelper.MakeColor(color)), (float)x, (float)y, (float)width, (float)height); }