Example #1
0
        public Windows.UI.Xaml.UIElement addLabelItem(string text, bool bold = true, cave.Color backgroundColor = null, cave.Color textColor = null)
        {
            var v   = new cave.ui.LayerWidget(context);
            var bgc = backgroundColor;

            if (bgc == null)
            {
                bgc = defaultLabelItemWidgetBackgroundColor;
            }
            var tc = determineTextColor(backgroundColor, textColor, defaultLabelItemWidgetTextColor, bgc);

            if (bgc != null)
            {
                v.addWidget((Windows.UI.Xaml.UIElement)cave.ui.CanvasWidget.forColor(context, bgc));
            }
            var mm3 = context.getHeightValue("3mm");
            var lbl = cave.ui.LabelWidget.forText(context, text);

            lbl.setWidgetFontSize((double)mm3);
            lbl.setWidgetTextColor(tc);
            lbl.setWidgetFontBold(bold);
            v.addWidget((Windows.UI.Xaml.UIElement)cave.ui.LayerWidget.forWidget(context, (Windows.UI.Xaml.UIElement)lbl, mm3));
            addToWidgetItems((Windows.UI.Xaml.UIElement)v);
            return((Windows.UI.Xaml.UIElement) this);
        }
Example #2
0
 public CheckBoxWidget(cave.GuiApplicationContext context)
 {
     widgetContext    = context;
     widgetFontFamily = "Arial";
     widgetTextColor  = cave.Color.black();
     setWidgetTextColor(widgetTextColor);
 }
Example #3
0
        private cave.Color determineTextColor(cave.Color backgroundColor, cave.Color textColor, cave.Color defaultTextColor, cave.Color lowerBackgroundColor)
        {
            var tc = textColor;

            if (tc == null)
            {
                tc = defaultTextColor;
            }
            if (tc == null)
            {
                var cc = lowerBackgroundColor;
                if (cc == null)
                {
                    cc = determineBackgroundColor();
                }
                if (cc.isDarkColor())
                {
                    tc = cave.Color.white();
                }
                else
                {
                    tc = cave.Color.black();
                }
            }
            return(tc);
        }
Example #4
0
        public void updateSelectedTab(int idx)
        {
            var w = cave.ui.Widget.getChildren((Windows.UI.Xaml.UIElement)tabHeaders);

            for (var i = 0; i < w.Count; i++)
            {
                if (i == idx)
                {
                    if (!(widgetSelectedTabBackgroundColor != null))
                    {
                        widgetSelectedTabBackgroundColor = cave.Color.white();
                    }
                    if (!(widgetSelectedTabTextColor != null))
                    {
                        widgetSelectedTabTextColor = cave.Color.black();
                    }
                    (w[idx] as cave.ui.TabWidget.TabHeaderWidget).setHeaderBackground(widgetSelectedTabBackgroundColor);
                    (w[idx] as cave.ui.TabWidget.TabHeaderWidget).setHeaderTextColor(widgetSelectedTabTextColor);
                    continue;
                }
                if (!(widgetUnselectedTabBackgroundColor != null))
                {
                    widgetUnselectedTabBackgroundColor = cave.Color.forRGB(128, 128, 128);
                }
                if (!(widgetUnselectedTabTextColor != null))
                {
                    widgetUnselectedTabTextColor = cave.Color.forRGB(80, 80, 80);
                }
                (w[i] as cave.ui.TabWidget.TabHeaderWidget).setHeaderBackground(widgetUnselectedTabBackgroundColor);
                (w[i] as cave.ui.TabWidget.TabHeaderWidget).setHeaderTextColor(widgetUnselectedTabTextColor);
            }
            updateContent(idx);
        }
Example #5
0
 public void setActionBarBackgroundColor(cave.Color color)
 {
     if (canvas != null)
     {
         canvas.setWidgetColor(color);
     }
 }
Example #6
0
 public void setWidgetContainerBackgroundColor(cave.Color color)
 {
     if (color != null)
     {
         widgetContainerBackgroundColor = cave.ui.CanvasWidget.forColor(widgetContext, color);
     }
 }
Example #7
0
 public static cave.Color black()
 {
     if (!(cave.Color.colorBlack != null))
     {
         cave.Color.colorBlack = cave.Color.instance("black");
     }
     return(cave.Color.colorBlack);
 }
Example #8
0
 public static cave.Color white()
 {
     if (!(cave.Color.colorWhite != null))
     {
         cave.Color.colorWhite = cave.Color.instance("white");
     }
     return(cave.Color.colorWhite);
 }
Example #9
0
 public CanvasWidget(cave.GuiApplicationContext context)
 {
     widgetContext      = context;
     widgetColor        = cave.Color.black();
     widgetOutlineColor = cave.Color.black();
     rectangle          = new Windows.UI.Xaml.Shapes.Rectangle();
     this.Content       = rectangle;
 }
Example #10
0
        public static cave.Color forRGBA(int r, int g, int b, int a)
        {
            var v = new cave.Color();

            v.setRed((double)(r / 255.00));
            v.setGreen((double)(g / 255.00));
            v.setBlue((double)(b / 255.00));
            v.setAlpha((double)(a / 255.00));
            return(v);
        }
Example #11
0
        public static cave.Color forRGBADouble(double r, double g, double b, double a)
        {
            var v = new cave.Color();

            v.setRed(r);
            v.setGreen(g);
            v.setBlue(b);
            v.setAlpha(a);
            return(v);
        }
 public cave.ui.TextButtonWidget setWidgetStyle(string style)
 {
     widgetRoundingRadius         = (double)context.getStylePixels(style, "roundingRadius");
     widgetBackgroundColor        = context.getStyleColor(style, "backgroundColor");
     widgetPressedBackgroundColor = context.getStyleColor(style, "pressedColor");
     widgetTextColor  = context.getStyleColor(style, "textColor");
     widgetFontSize   = context.getStylePixels(style, "fontSize");
     widgetFontFamily = context.getStyleString(style, "fontFamily");
     widgetPadding    = context.getStylePixels(style, "padding");
     return(this);
 }
Example #13
0
 public PopupDialogManager(cave.GuiApplicationContext context, Windows.UI.Xaml.UIElement parent)
 {
     this.context          = context;
     this.parent           = parent;
     positiveButtonColor   = cave.Color.forRGB(128, 204, 128);
     negativeButtonColor   = cave.Color.forRGB(204, 128, 128);
     backgroundColor       = null;
     headerBackgroundColor = null;
     headerTextColor       = null;
     messageTextColor      = null;
 }
Example #14
0
 public FormWidget(cave.GuiApplicationContext context) : base(context)
 {
     fieldsById            = new System.Collections.Generic.Dictionary <string, Windows.UI.Xaml.UIElement>();
     formMargin            = context.getHeightValue("1mm");
     formWidth             = context.getWidthValue("120mm");
     fieldLabelFontSize    = context.getHeightValue("2000um");
     fieldLabelFontFamily  = "Arial";
     elementSpacing        = formMargin;
     customFooterWidget    = new cave.ui.LayerWidget(context);
     widgetBackgroundColor = cave.Color.forString("#EEEEEE");
 }
        private cave.Color createDefaultPressColor(cave.Color bg)
        {
            if (!(bg != null))
            {
                return(null);
            }
            var r = (int)(bg.getRedInt() * (1 - 0.25));
            var g = (int)(bg.getGreenInt() * (1 - 0.25));
            var b = (int)(bg.getBlueInt() * (1 - 0.25));

            return(cave.Color.forRGB(r, g, b));
        }
Example #16
0
 public void setWidgetCellTextColor(cave.Color color)
 {
     widgetTextColor = color;
     if (!(widget != null))
     {
         return;
     }
     if (widget is cave.ui.TextInputWidget)
     {
         ((cave.ui.TextInputWidget)widget).setWidgetTextColor(color);
     }
     else
     {
         ((cave.ui.LabelWidget)widget).setWidgetTextColor(color);
     }
 }
Example #17
0
        public static cave.Color forString(string str)
        {
            if (object.Equals(str, "none"))
            {
                return(null);
            }
            var v = new cave.Color();

            if (!(object.Equals(str, null)))
            {
                if (v.parse(str) == false)
                {
                    v = null;
                }
            }
            return(v);
        }
Example #18
0
            public void setWidgetBackgroundColor(cave.Color color)
            {
                var array = cave.ui.Widget.getChildren((Windows.UI.Xaml.UIElement)widgetCellContainer);

                if (array != null)
                {
                    var n = 0;
                    var m = array.Count;
                    for (n = 0; n < m; n++)
                    {
                        var cell = array[n] as cave.ui.DataGridWidget.CellWidget;
                        if (cell != null)
                        {
                            cell.setWidgetCellBackgroundColor(color);
                        }
                    }
                }
            }
Example #19
0
 public cave.ui.TextInputWidget setWidgetStyle(string style)
 {
     widgetFontFamily = widgetContext.getStyleString(style, "fontFamily");
     if (cape.String.isEmpty(widgetFontFamily))
     {
         widgetFontFamily = "Arial";
     }
     widgetFontSize = (double)widgetContext.getStylePixels(style, "fontSize");
     if (widgetFontSize < 1.00)
     {
         widgetFontSize = (double)widgetContext.getHeightValue("3mm");
     }
     widgetTextColor       = widgetContext.getStyleColor(style, "textColor");
     widgetBackgroundColor = widgetContext.getStyleColor(style, "backgroundColor");
     setWidgetPadding(widgetContext.getStylePixels(style, "padding"));
     updateWidgetFont();
     updateWidgetColors();
     return(this);
 }
Example #20
0
        public cave.Color dup(string arg = null)
        {
            var f = 1.00;

            if (!(object.Equals(arg, null)))
            {
                if (object.Equals(arg, "light"))
                {
                    f = 1.20;
                }
                else if (object.Equals(arg, "dark"))
                {
                    f = 0.80;
                }
                else if (cape.String.endsWith(arg, "%"))
                {
                    f = (double)decimalStringToInteger(arg) / 100.00;
                }
            }
            var v = new cave.Color();

            if (f > 1.00)
            {
                v.setRed(red + (1.00 - red) * (f - 1.00));
                v.setGreen(green + (1.00 - green) * (f - 1.00));
                v.setBlue(blue + (1.00 - blue) * (f - 1.00));
            }
            else if (f < 1.00)
            {
                v.setRed(red * f);
                v.setGreen(green * f);
                v.setBlue(blue * f);
            }
            else
            {
                v.setRed(red);
                v.setGreen(green);
                v.setBlue(blue);
            }
            v.setAlpha(alpha);
            return(v);
        }
Example #21
0
        public void checkForDefaultColors()
        {
            var bgc = backgroundColor;

            if (bgc == null)
            {
                backgroundColor = cave.Color.white();
            }
            var hbg = headerBackgroundColor;

            if (hbg == null)
            {
                headerBackgroundColor = cave.Color.black();
            }
            var htc = headerTextColor;

            if (htc == null)
            {
                if (headerBackgroundColor.isDarkColor())
                {
                    headerTextColor = cave.Color.white();
                }
                else
                {
                    headerTextColor = cave.Color.black();
                }
            }
            var mtc = messageTextColor;

            if (mtc == null)
            {
                if (backgroundColor.isDarkColor())
                {
                    messageTextColor = cave.Color.white();
                }
                else
                {
                    messageTextColor = cave.Color.black();
                }
            }
        }
Example #22
0
 public cave.ui.LabelWidget setWidgetStyle(string style)
 {
     widgetFontFamily = widgetContext.getStyleString(style, "fontFamily");
     if (cape.String.isEmpty(widgetFontFamily))
     {
         widgetFontFamily = "Arial";
     }
     widgetTextColor = widgetContext.getStyleColor(style, "textColor");
     if (!(widgetTextColor != null))
     {
         widgetTextColor = cave.Color.forRGB(0, 0, 0);
     }
     widgetFontSize = (double)widgetContext.getStylePixels(style, "fontSize");
     if (widgetFontSize < 1.00)
     {
         widgetFontSize = (double)widgetContext.getHeightValue("3mm");
     }
     widgetFontBold = cape.Boolean.asBoolean((object)widgetContext.getStyleString(style, "fontBold"));
     updateWidgetFont();
     return(this);
 }
Example #23
0
 public cave.ui.ActionBarWidget setWidgetTextColor(cave.Color v)
 {
     widgetTextColor = v;
     return(this);
 }
Example #24
0
 public cave.ui.ActionBarWidget setWidgetBackgroundColor(cave.Color v)
 {
     widgetBackgroundColor = v;
     return(this);
 }
 public cave.ui.TextButtonWidget setWidgetTextColor(cave.Color v)
 {
     widgetTextColor = v;
     return(this);
 }
 public cave.ui.TextButtonWidget setWidgetPressedBackgroundColor(cave.Color v)
 {
     widgetPressedBackgroundColor = v;
     return(this);
 }
Example #27
0
 public void setWidgetBackgroundColor(cave.Color color)
 {
     widgetBackgroundColor = color;
     System.Diagnostics.Debug.WriteLine("[cave.ui.ButtonWidget.setWidgetBackgroundColor] (ButtonWidget.sling:199:2): Not implemented");
 }
Example #28
0
 public cave.ui.SelectWidget setWidgetBackgroundColor(cave.Color color)
 {
     widgetBackgroundColor = color;
     updateWidgetAppearance();
     return(this);
 }
Example #29
0
 public cave.ui.CheckBoxWidget setWidgetTextColor(cave.Color color)
 {
     widgetTextColor = color;
     updateWidgetFont();
     return(this);
 }
Example #30
0
 public void setStrokeColor(cave.Color color)
 {
     strokeColor = color;
     System.Diagnostics.Debug.WriteLine("[cave.ui.SignatureWidget.setStrokeColor] (SignatureWidget.sling:231:2): Not implemented.");
 }