Ejemplo n.º 1
0
 internal wTreeNodeItem(wTreeNode ownerNode, WhiteSpaceTypes type)
 {
     _type           = wTreeNodeItemTypes.WhiteSpace;
     _whiteSpaceType = type;
     _ownerNode      = ownerNode;
     Init();
 }
Ejemplo n.º 2
0
        public wTreeNodeItem Add(WhiteSpaceTypes space)
        {
            wTreeNodeItem item = new wTreeNodeItem(_parent, space);

            Add(item);
            return(item);
        }
Ejemplo n.º 3
0
        public void ChangeItem(WhiteSpaceTypes type)
        {
            if (_type != wTreeNodeItemTypes.WhiteSpace || _whiteSpaceType != type)
            {
                _type           = wTreeNodeItemTypes.WhiteSpace;
                _whiteSpaceType = type;

                if (E_ItemChanged != null)
                {
                    E_ItemChanged(this);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Reads until the next non-whitespace character is reached.
        /// </summary>
        /// <param name="whiteSpaceType">Whitespace type flags.</param>
        protected void EatWhiteSpace(WhiteSpaceTypes whiteSpaceType)
        {
            int data = _reader.Peek();

            while (data > 0)
            {
                char ch = (char)data;

                if ((((whiteSpaceType & WhiteSpaceTypes.Space) == WhiteSpaceTypes.Space) && ch == ' ') ||
                    (((whiteSpaceType & WhiteSpaceTypes.Tab) == WhiteSpaceTypes.Tab) && ch == '\t') ||
                    (((whiteSpaceType & WhiteSpaceTypes.CarriageReturn) == WhiteSpaceTypes.CarriageReturn) && ch == '\r') ||
                    (((whiteSpaceType & WhiteSpaceTypes.Linefeed) == WhiteSpaceTypes.Linefeed) && ch == '\n'))
                {
                    TryReadChar();
                }
                else
                {
                    return;
                }

                data = _reader.Peek();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Reads until the next non-whitespace character is reached.
        /// </summary>
        /// <param name="whiteSpaceType">Whitespace type flags.</param>
        protected void EatWhiteSpace(WhiteSpaceTypes whiteSpaceType)
        {
            int data = _reader.Peek();
            while (data > 0)
            {
                char ch = (char)data;

                if ((((whiteSpaceType & WhiteSpaceTypes.Space) == WhiteSpaceTypes.Space) && ch == ' ') ||
                    (((whiteSpaceType & WhiteSpaceTypes.Tab) == WhiteSpaceTypes.Tab) && ch == '\t') ||
                    (((whiteSpaceType & WhiteSpaceTypes.CarriageReturn) == WhiteSpaceTypes.CarriageReturn) && ch == '\r') ||
                    (((whiteSpaceType & WhiteSpaceTypes.Linefeed) == WhiteSpaceTypes.Linefeed) && ch == '\n'))
                {
                    TryReadChar();
                }
                else
                {
                    return;
                }

                data = _reader.Peek();
            }
        }
Ejemplo n.º 6
0
 public WhiteSpace(WhiteSpaceTypes type)
 {
     _type = type;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// E_ItemChanged 이벤트를 발생시키지 않고 내부의 값만 바꾼다.
        /// </summary>
        /// <param name="value"></param>
        /// <returns>값이 기존값과 다른 값으로 셋팅되었으면 true..</returns>
        internal bool SetValue(object value)
        {
            bool isChanged = false;

            if (_type == wTreeNodeItemTypes.CheckBox)
            {
                if (value != null && (value is bool?) == false)
                {
                    throw new Exception("value must be bool!");
                }
                if (_isChecked != (bool?)value)
                {
                    isChanged = true;
                }
                _isChecked = (bool?)value;
            }
            else if (_type == wTreeNodeItemTypes.Image)
            {
                if (value == null)
                {
                    if (_image == null)
                    {
                        isChanged = false;
                    }
                    else
                    {
                        isChanged = true;
                    }
                }
                else if ((value is Image) == false)
                {
                    throw new Exception("value must be image!");
                }
                else if (value.Equals(_image) == false)
                {
                    isChanged = true;
                }
                _image = value as Image;
            }
            else if (_type == wTreeNodeItemTypes.Text)
            {
                if ((value is string) == false)
                {
                    throw new Exception("value must be string!");
                }
                if (_text.Equals(value) == false)
                {
                    isChanged = true;
                }
                _text = value as String;
            }
            else if (_type == wTreeNodeItemTypes.TextArray)
            {
                if (value is String[])
                {
                    _texts = value as String[];
                }
                else if (value is int)
                {
                    TextArraySelectedIndex = (int)value;
                }
                else
                {
                    throw new Exception("Value of TextArray Type must be int or String[]");
                }
            }
            else if (_type == wTreeNodeItemTypes.Control)
            {
                if ((value is Control) == false)
                {
                    throw new Exception("value must be Control!");
                }
                if (_control.Equals(value) == false)
                {
                    isChanged = true;
                }
                _control = value as Control;
            }
            else//whiteSpace
            {
                if ((value is WhiteSpaceTypes) == false)
                {
                    throw new Exception("value must be WhiteSpaceTypes!");
                }
                if (_whiteSpaceType != (WhiteSpaceTypes)value)
                {
                    isChanged = true;
                }
                _whiteSpaceType = (WhiteSpaceTypes)value;
            }
            return(isChanged);
        }