예제 #1
0
            public MyRadioButtonWidget(cave.GuiApplicationContext context) : base(context)
            {
                var thisWidget = (dynamic)this;

                setWidgetSpacing(context.getHeightValue("2000um"));
                var widget  = new cave.ui.AlignWidget(context);
                var widget2 = new cave.ui.LayerWidget(context);

                widget2.setWidgetHeightRequest(context.getHeightValue("4000um"));
                widget2.setWidgetWidthRequest(context.getHeightValue("4000um"));
                outline = new cave.ui.CanvasWidget(context);
                outline.setWidgetColor(cave.Color.black());
                outline.setWidgetRoundingRadius((double)context.getHeightValue("2000um"));
                widget2.addWidget((Windows.UI.Xaml.UIElement)outline);
                var widget3 = new cave.ui.LayerWidget(context);

                widget3.setWidgetMargin(context.getHeightValue("500um"));
                canvas = new cave.ui.CanvasWidget(context);
                widget3.addWidget((Windows.UI.Xaml.UIElement)canvas);
                widget2.addWidget((Windows.UI.Xaml.UIElement)widget3);
                widget.addWidget((Windows.UI.Xaml.UIElement)widget2);
                addWidget((Windows.UI.Xaml.UIElement)widget);
                label = new cave.ui.LabelWidget(context);
                addWidget((Windows.UI.Xaml.UIElement)label, 1.00);
            }
        public override void initializeWidget()
        {
            base.initializeWidget();
            var scroller = cave.ui.VerticalScrollerWidget.forWidget(context, widgetContent);

            scroller.setOnScrolledHandler((int direction) => {
                if (autohideToolbar)
                {
                    if (direction == 0 && shown == true)
                    {
                        hideToolbar();
                        shown = false;
                    }
                    else if (direction == 1 && shown == false)
                    {
                        showToolbar();
                        shown = true;
                    }
                }
            });
            if (autohideToolbar)
            {
                addWidget((Windows.UI.Xaml.UIElement)scroller);
                var align = new cave.ui.AlignWidget(context);
                align.addWidget((Windows.UI.Xaml.UIElement)widgetToolbar, (double)0, 1.00, true);
                addWidget((Windows.UI.Xaml.UIElement)align);
            }
            else
            {
                var vbox = cave.ui.VerticalBoxWidget.forContext(context);
                vbox.addWidget((Windows.UI.Xaml.UIElement)scroller, 1.00);
                vbox.addWidget((Windows.UI.Xaml.UIElement)widgetToolbar);
                addWidget((Windows.UI.Xaml.UIElement)vbox);
            }
        }
예제 #3
0
        public static cave.ui.AlignWidget forWidget(cave.GuiApplicationContext context, Windows.UI.Xaml.UIElement widget, double alignX = 0.50, double alignY = 0.50, int margin = 0)
        {
            var v = new cave.ui.AlignWidget(context);

            v.widgetMarginLeft   = margin;
            v.widgetMarginRight  = margin;
            v.widgetMarginTop    = margin;
            v.widgetMarginBottom = margin;
            v.addWidget(widget, alignX, alignY);
            return(v);
        }