setDrawable() public method

public setDrawable ( IDrawable drawable ) : Image
drawable IDrawable
return Image
        private void updateImage()
        {
            IDrawable drawable = null;

            if (_isDisabled && style.imageDisabled != null)
            {
                drawable = style.imageDisabled;
            }
            else if (_mouseDown && style.imageDown != null)
            {
                drawable = style.imageDown;
            }
            else if (isChecked && style.imageChecked != null)
            {
                drawable = (style.imageCheckedOver != null && _mouseOver) ? style.imageCheckedOver : style.imageChecked;
            }
            else if (_mouseOver && style.imageOver != null)
            {
                drawable = style.imageOver;
            }
            else if (style.imageUp != null)              //
            {
                drawable = style.imageUp;
            }
            image.setDrawable(drawable);
        }
Exemplo n.º 2
0
        public override void draw(Graphics graphics, float parentAlpha)
        {
            IDrawable checkbox = null;

            if (_isDisabled)
            {
                if (isChecked && style.checkboxOnDisabled != null)
                {
                    checkbox = style.checkboxOnDisabled;
                }
                else
                {
                    checkbox = style.checkboxOffDisabled;
                }
            }

            if (checkbox == null)
            {
                if (isChecked && style.checkboxOn != null)
                {
                    checkbox = style.checkboxOn;
                }
                else if (_mouseOver && style.checkboxOver != null && !_isDisabled)
                {
                    checkbox = style.checkboxOver;
                }
                else
                {
                    checkbox = style.checkboxOff;
                }
            }

            image.setDrawable(checkbox);
            base.draw(graphics, parentAlpha);
        }