Example #1
0
        protected TreeFeedsNodeBase(string text, FeedNodeType nodeType, bool editable, int imageIndex, int expandedNodeImageIndex, Image image)
        {
            base.RightImages.Add(_clickableAreaExtenderImage);

            FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.NormalFont);
            this.ForeColor = FontColorHelper.NormalColor;

            _unreadCount  = _highlightCount = 0;
            _initialImage = _initialExpandedImage = null;

            if (image != null)
            {
                _initialImage   = _initialExpandedImage = Override.NodeAppearance.Image = Override.ExpandedNodeAppearance.Image = image;
                m_hasCustomIcon = true;
            }
            else
            {
                if (imageIndex >= 0)
                {
                    Override.NodeAppearance.Image = imageIndex;
                    _imageIndex = imageIndex;
                }
                if (expandedNodeImageIndex >= 0)
                {
                    Override.ExpandedNodeAppearance.Image = expandedNodeImageIndex;
                    _selectedImageIndex = expandedNodeImageIndex;
                }
            }
            _type      = nodeType;
            _editable  = editable;
            _anyUnread = false;
            this.Text  = text;                  // uses some of the above variables, so keep it at last...
        }
Example #2
0
 /// <summary>
 /// Sets the font of the list view item to the color used to denote
 /// an item that links to the user's URL.  Currently this color is
 /// Blue.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="lvItem"></param>
 public void ApplyAction(INewsItem item, ThreadedListViewItem lvItem)
 {
     if (lvItem != null && item != null)
     {
         lvItem.Font      = FontColorHelper.MergeFontStyles(lvItem.Font, FontColorHelper.HighlightStyle);
         lvItem.ForeColor = FontColorHelper.HighlightColor;
     }
 }
Example #3
0
        /// <summary>
        /// Invalidates the node for UI repainting.
        /// </summary>
        protected void InvalidateNode()
        {
            bool yetInvalidated = false;

            if (_highlightCount > 0)
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.HighlightStyle))
                {
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.HighlightFont);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.HighlightColor)
                {
                    this.ForeColor = FontColorHelper.HighlightColor;
                    yetInvalidated = true;
                }
            }
            else if (_unreadCount > 0 || _anyUnread)
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.UnreadStyle))
                {
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.UnreadFont);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.UnreadColor)
                {
                    this.ForeColor = FontColorHelper.UnreadColor;
                    yetInvalidated = true;
                }
            }
            else
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.NormalStyle))
                {
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.NormalFont);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.NormalColor)
                {
                    this.ForeColor = FontColorHelper.NormalColor;
                    yetInvalidated = true;
                }
            }

            //check if we have new comments and merge style with that of others if needed
            if (this._itemsWithNewCommentsCount > 0 || this._anyNewComments)
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.NewCommentsStyle))
                {
                    Font font = FontColorHelper.MergeFontStyles(FontColorHelper.CopyToFont(this.Override.NodeAppearance.FontData), FontColorHelper.NewCommentsStyle);
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, font);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.NewCommentsColor)
                {
                    this.ForeColor = FontColorHelper.NewCommentsColor;
                    yetInvalidated = true;
                }
            }

            if (!yetInvalidated && this.Control != null)
            {
                this.Control.Invalidate();
            }
        }