Exemple #1
0
 public virtual void setTextCallback(IListCallbackUI pCallback)
 {
     mCallback = pCallback;
 }
Exemple #2
0
        public override void drawItemText(ref Graphics graphics, ref Bitmap bitmap, ref Rectangle rcItem)
        {
            if (mOwner == null)
            {
                return;
            }
            TListInfoUI pInfo      = mOwner.getListInfo();
            int         iTextColor = pInfo.mTextColor;

            if ((mButtonState & (int)PaintFlags.UISTATE_HOT) != 0)
            {
                iTextColor = pInfo.mHotTextColor;
            }
            if (isSelected())
            {
                iTextColor = pInfo.mSelectedTextColor;
            }
            if (!isEnabled())
            {
                iTextColor = pInfo.mDisabledTextColor;
            }
            IListCallbackUI pCallback = mOwner.getTextCallback();

            if (pCallback == null)
            {
                return;
            }
            mNumLinks = 0;
            int nLinks = mRectLinks.Length;

            for (int i = 0; i < pInfo.mColumns; i++)
            {
                Rectangle rcItem1   = new Rectangle(pInfo.mListColumn[i].Left, mRectItem.Top, pInfo.mListColumn[i].Width, mRectItem.Height);
                int       newLeft   = rcItem1.Left + pInfo.mRectTextPadding.Left;
                int       newRight  = rcItem1.Right - pInfo.mRectTextPadding.Right;
                int       newTop    = rcItem1.Top + pInfo.mRectTextPadding.Top;
                int       newBottom = rcItem1.Bottom - pInfo.mRectTextPadding.Bottom;
                rcItem1.X      = newLeft;
                rcItem1.Width  = newRight - newLeft;
                rcItem1.Y      = newTop;
                rcItem1.Height = newBottom - newTop;

                string pstrText = pCallback.getItemText(this, mIndex, i);

                if (pInfo.mShowHtml)
                {
                    RenderEngine.drawHtmlText(ref graphics,
                                              ref bitmap,
                                              ref mManager,
                                              ref rcItem1,
                                              pstrText,
                                              iTextColor,
                                              ref mRectLinks,
                                              ref mLinks,
                                              ref nLinks,
                                              (int)FormatFlags.DT_SINGLELINE | pInfo.mTextStyle);
                }
                else
                {
                    RenderEngine.drawText(ref graphics,
                                          ref bitmap,
                                          ref mManager,
                                          ref rcItem1,
                                          pstrText,
                                          iTextColor,
                                          pInfo.mFontIdx,
                                          (int)FormatFlags.DT_SINGLELINE | pInfo.mTextStyle);
                }

                if (nLinks > 0)
                {
                    mNumLinks = nLinks;
                    nLinks    = 0;
                }
                else
                {
                    nLinks = mRectLinks.Length;
                }
            }
        }