Example #1
0
                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);
                }
Example #2
0
 public static Rect Draw(Rect position, string text, GUIStyle style, DColor textDColor)
 {
     return(Draw(position, text, Colors.ColorTextOfGUIStyle(style, textDColor)));
 }
Example #3
0
            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);
            }
Example #4
0
 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));
 }
Example #5
0
 public static void Draw(GUIContent content, Size textSize, DColor textDColor)
 {
     Draw(content, Style(textSize, textDColor));
 }
Example #6
0
 public static bool Draw(Rect rect, GUIContent content, DColor buttonDColor, bool enabled)
 {
     return(Draw(rect, content, DEFAULT_SIZE, DEFAULT_TEXT_ALIGN, buttonDColor, buttonDColor, enabled));
 }
Example #7
0
 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 { }
 }
Example #8
0
 public static void Draw(GUIContent content, GUIStyle labelStyle, DColor textDColor, float rowHeight)
 {
     Draw(content, Colors.ColorTextOfGUIStyle(labelStyle, textDColor), rowHeight);
 }
Example #9
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, DStrokeStyle strokeStyle)
 {
     DrawLine(pt1, pt2, color, 1, strokeStyle);
 }
Example #10
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle)
 {
     DrawLine(pt1, pt2, color, alpha, strokeStyle, 1, DStrokeCap.Round);
 }
Example #11
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha)
 {
     DrawLine(pt1, pt2, color, alpha, DStrokeStyle.Solid);
 }
Example #12
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color)
 {
     DrawLine(pt1, pt2, color, 1);
 }
Example #13
0
 public override void DrawEllipse(DRect rect, DColor color, double alpha)
 {
     g.DrawEllipse(new Pen(WFHelper.MakeColor(color, alpha)), MakeRect(rect));
 }
Example #14
0
 public static Rect Draw(Rect position, GUIContent content, GUIStyle style, DColor textDColor)
 {
     return(Draw(position, content, Colors.ColorTextOfGUIStyle(style, textDColor)));
 }
Example #15
0
 public override void DrawPolyline(DPoints pts, DColor color)
 {
     DrawPolyline(pts, color, 1, 1, DStrokeStyle.Solid, DStrokeJoin.Round, DStrokeCap.Round);
 }
Example #16
0
 public static void Draw(string text, GUIStyle labelStyle, DColor textDColor, float rowHeight)
 {
     Draw(text, Colors.ColorTextOfGUIStyle(labelStyle, textDColor), rowHeight);
 }
Example #17
0
 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));
 }
Example #18
0
 public static GUIStyle Style(Size size, DColor textDColor)
 {
     return(Colors.ColorTextOfGUIStyle(Style(size), Colors.TextColor(textDColor)));
 }
Example #19
0
 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 { }
 }
Example #20
0
 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));
 }
Example #21
0
 public override void DrawRect(double x, double y, double width, double height, DColor color)
 {
     DrawRect(x, y, width, height, color, 1, 1);
 }
Example #22
0
 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));
 }
Example #23
0
 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);
 }
Example #24
0
 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));
 }
Example #25
0
 public override void DrawRect(DRect rect, DColor color)
 {
     DrawRect(rect.X, rect.Y, rect.Width, rect.Height, color);
 }
Example #26
0
            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);
            }
Example #27
0
 public override void DrawRect(DRect rect, DColor color, double alpha)
 {
     DrawRect(rect.X, rect.Y, rect.Width, rect.Height, color, alpha, 1);
 }
Example #28
0
 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);
 }
Example #29
0
 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);
 }
Example #30
0
 public static Rect Draw(Rect position, GUIContent content, Size size, DColor textDColor)
 {
     return(Draw(position, content, Style(size, textDColor)));
 }
Example #31
0
 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);
 }
Example #32
0
 public static void Draw(string text, Size textSize, DColor textDColor, float rowHeight)
 {
     Draw(text, Style(textSize, textDColor), rowHeight);
 }
Example #33
0
 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);
 }
Example #34
0
 public static void Draw(GUIContent content, Size textSize, DColor textDColor, float rowHeight)
 {
     Draw(content, Style(textSize, textDColor), rowHeight);
 }
Example #35
0
 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);
 }
Example #36
0
 public static void Draw(string text, Size textSize, DColor textDColor)
 {
     Draw(text, Style(textSize, textDColor));
 }
Example #37
0
 public override void FillEllipse(DRect rect, DColor color, double alpha)
 {
     g.FillEllipse(new SolidBrush(WFHelper.MakeColor(color, alpha)), MakeRect(rect));
 }
Example #38
0
 public static void Draw(string text, GUIStyle labelStyle, DColor textDColor)
 {
     Draw(text, Colors.ColorTextOfGUIStyle(labelStyle, textDColor));
 }
Example #39
0
 public override void FillPolygon(DPoints pts, DColor color, double alpha)
 {
     FillPolygon(pts, color, alpha, DFillRule.EvenOdd);
 }
Example #40
0
 public static void Draw(GUIContent content, GUIStyle labelStyle, DColor textDColor)
 {
     Draw(content, Colors.ColorTextOfGUIStyle(labelStyle, textDColor));
 }
Example #41
0
 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));
 }
Example #42
0
 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));
 }
Example #43
0
 // 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);
 }
Example #44
0
 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));
 }
Example #45
0
 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);
 }
Example #46
0
 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));
 }
Example #47
0
 // 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)); ;
     }
 }
Example #48
0
 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));
 }
Example #49
0
 public static Color MakeColor(DColor color)
 {
     return Color.FromArgb(color.A, color.R, color.G, color.B);
 }
Example #50
0
 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));
 }
Example #51
0
 public static Color MakeColor(DColor color, double alpha)
 {
     return Color.FromArgb((int)(color.A * alpha), color.R, color.G, color.B);
 }
Example #52
0
 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));
 }
Example #53
0
 public static void Draw(SerializedProperty property, string text, DColor dColor, bool drawBackground = true)
 {
     Draw(property, new GUIContent(text), dColor, drawBackground);
 }
Example #54
0
 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));
 }
Example #55
0
 public static Rect Draw(Rect position, string text, Size size, DColor textDColor)
 {
     return(Draw(position, text, Style(size, textDColor)));
 }
Example #56
0
                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);
                }
Example #57
0
 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);
 }