Exemplo n.º 1
0
        protected override void ApplyStyle(WidgetStyleSheet style)
        {
            m_label.Color = style.GetParameterColor("text_color", 0x0);

            string hoveredStyle = style.GetParameter("hovered_style");

            if (hoveredStyle != null)
            {
                m_hoveredStyle = WidgetManager.GetStyle(hoveredStyle);
            }

            string disabledStyle = style.GetParameter("disabled_style");

            if (disabledStyle != null)
            {
                m_disabledStyle = WidgetManager.GetStyle(disabledStyle);
            }

            int color = style.GetParameterColor("image_color", -1);

            if (color != -1)
            {
                m_image.Color = color;
            }


            //TextAlign = style.Align;

            base.ApplyStyle(style);
        }
Exemplo n.º 2
0
        public WidgetButton(WidgetStyleSheet style, string text = "")
            : base(style)
        {
            m_needLayout = true;

            m_label          = new WidgetLabel();
            m_label.Color    = style.GetParameterColor("text_color", 0x0);
            m_label.FontSize = style.FontSize;
            m_label.Font     = style.Font;
            m_label.Text     = text;
            m_label.Parent   = this;
            m_layout         = ButtonLayout.Center;
            m_textPadding    = style.Padding;

            m_image        = new WidgetImage(WidgetBackgroundStyle.None, string.Empty);
            m_image.Parent = this;
            m_image.Color  = style.GetParameterColor("image_color", 0xffffff);
            m_imagePadding = style.GetParameter <Margin>("image_padding");

            m_hoveredStyle  = WidgetManager.GetStyle(style.GetParameter("hovered_style"));
            m_disabledStyle = WidgetManager.GetStyle(style.GetParameter("disabled_style"));

            m_clickSound = "click";

            Size = style.Size;
        }
Exemplo n.º 3
0
        public WidgetContextMenu(WidgetStyleSheet style)
            : base(style)
        {
            Visible     = false;
            m_itemStyle = WidgetManager.GetStyle(style.GetParameter("item_style"));
            if (m_itemStyle == null)
            {
                m_itemStyle = WidgetManager.DefaultButtonStyle;
            }

            m_itemSize = m_itemStyle.Size;
            m_padding  = style.Padding;
        }
Exemplo n.º 4
0
        public WidgetCheckBox(WidgetStyleSheet style, bool isChecked)
            : base(style)
        {
            m_image        = new WidgetImage(WidgetBackgroundStyle.ImageFit, style.GetParameter("check_image"));
            m_image.Parent = this;
            m_image.Color  = style.GetParameterColor("image_color", 0xffffff);
            m_imagePadding = style.GetParameter <Margin>("image_padding");

            m_imageAlign = WidgetAlign.VerticalCenter | WidgetAlign.HorizontalCenter;

            Size = style.Size;

            m_checked = isChecked;

            m_hoveredStyle  = WidgetManager.GetStyle(style.GetParameter("hovered_style"));
            m_disabledStyle = WidgetManager.GetStyle(style.GetParameter("disabled_style"));
        }
Exemplo n.º 5
0
        public WidgetScrollView(WidgetStyleSheet style)
            : base(style)
        {
            m_contentView        = new WidgetPanel(WidgetManager.DefaultWidgetStyle);
            m_contentView.Parent = this;
            ClipContents         = true;
            m_horizontalScroll   = WidgetScrollType.Normal | WidgetScrollType.Visible | WidgetScrollType.AutoHide;
            m_verticalScroll     = WidgetScrollType.Normal | WidgetScrollType.Visible | WidgetScrollType.AutoHide;

            m_horizontalScrollBar                 = new Widget(WidgetManager.GetStyle("scroll_horizontal"));
            m_horizontalScrollBar.Parent          = this;
            m_horizontalScrollBarIndicator        = new Widget(WidgetManager.GetStyle("scroll_indicator_horizontal"));
            m_horizontalScrollBarIndicator.Parent = this;

            m_verticalScrollBar                 = new Widget(WidgetManager.GetStyle("scroll_vertical"));
            m_verticalScrollBar.Parent          = this;
            m_verticalScrollBarIndicator        = new Widget(WidgetManager.GetStyle("scroll_indicator_vertical"));
            m_verticalScrollBarIndicator.Parent = this;

            m_needLayout = true;
        }
Exemplo n.º 6
0
 public WidgetContextMenu()
     : this(WidgetManager.GetStyle("default_context_menu"))
 {
 }