Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtBarSpinButton Question Collapse All
Subject Author Date
JM Kwon Oct 30, 2009 - 12:06 AM

Dear Porf-Uis


I need help.


class CExtSpinRibbonNode : public CExtRibbonNode

{

public:

 DECLARE_SERIAL( CExtSpinRibbonNode );

 CExtSpinRibbonNode(

  UINT nCmdIdBasic = 0L,

  UINT nCmdIdEffective = 0L,

  CExtRibbonNode * pParentNode = NULL,

  DWORD dwFlags = 0L,

  __EXT_MFC_SAFE_LPCTSTR strTextInToolbar = NULL,

  __EXT_MFC_SAFE_LPCTSTR strTextInMenu = NULL,

  __EXT_MFC_SAFE_LPCTSTR strTextUser = NULL,

  LPARAM lParam = 0L

  )

  : CExtRibbonNode(

   nCmdIdBasic,

   nCmdIdEffective,

   pParentNode,

   dwFlags,

   strTextInToolbar,

   strTextInMenu,

   strTextUser,

   lParam

   )

 {

  RibbonILE_RuleArrayGet().RemoveAll();

 }

 CExtSpinRibbonNode( CExtSpinRibbonNode  & other )

  : CExtRibbonNode( other )

    {

        RibbonILE_RuleArrayGet().RemoveAll();

    }

 virtual ~CExtSpinRibbonNode()

 {

 }

 virtual CRuntimeClass * _OnRibbonGetButtonRTC()

 {

  ASSERT_VALID( this );

  //RibbonILE_RuleArrayGet().RemoveAll();

  return RUNTIME_CLASS( CExtBarSpinButton );

 }

};


 How to use CExtBarSpinButton in RibbonBar ?


thanks.

JM Kwon Nov 3, 2009 - 7:56 PM

Thank your help very much.

There are however a few problems.


1. __ECTN_TBB_TEXT_FIELD | __ECTN_TBB_DATE


2.  pCmdScreenTip = new CExtCustomizeCmdScreenTip;

     pCmdScreenTip->CaptionMainSet( _T("Font Size") );

     pCmdScreenTip->TextMainSet( _T("Change then font size.") );


3. Spin UP, Dwon Event.


in CExtBarSpinButton.


Thanks.

Technical Support Nov 5, 2009 - 2:48 AM

The CExtBarSpinButton::SetPos() method is virtual. You can catch the position changing event.

Technical Support Nov 2, 2009 - 5:20 AM

You need the following updated version of the CExtBarSpinButton class. Here is the class declaration:

/////////////////////////////////////////////////////////////////////////////
// CExtBarSpinButton

class __PROF_UIS_API CExtBarSpinButton : public CExtBarTextFieldButton
{
public:
            DECLARE_DYNCREATE( CExtBarSpinButton );

            CExtBarSpinButton(
                        INT nTextFieldWidth = __EXT_MENU_DEF_INPLACE_EDIT_WIDTH,
                        CExtToolControlBar * pBar = NULL,
                        UINT nCmdID = ID_SEPARATOR,
                        UINT nStyle = 0
                        );
            virtual ~CExtBarSpinButton();

#ifdef _DEBUG
            virtual void AssertValid() const;
            virtual void Dump(CDumpContext& dc) const;
#endif

public:
            virtual INT SetPos( INT nPos );
            virtual INT GetPos() const;
            virtual void SetRange( INT nLower, INT nUpper );
            virtual void GetRange( INT & nLower, INT & nUpper ) const;
            virtual INT SetStep( INT nStep );
            virtual INT GetStep() const;
protected:
            mutable CExtSafeString m_strTextCache;
            INT m_nRangeLower, m_nRangeUpper, m_nPos, m_nStep;
            CRect m_rcButtonUp, m_rcButtonDown;
            virtual void _UpdateSpinRectParts();
            bool m_bButtonUpHovered:1, m_bButtonDownHovered:1, m_bButtonUpPressed:1, m_bButtonDownPressed:1;
            virtual void _TrackSpinPressing();
            virtual void _SetTrackPos( INT nPos );
public:
            virtual bool IsAbleToTrackMenu(
                        bool bCustomizeMode = false
                        ) const;
            virtual CRect OnInplaceControlCalcRect( 
                        const RECT & rcBtnArea 
                        ) const;
            virtual void OnHovering(
                        CPoint point,
                        bool & bSuspendTips
                        );
            virtual void OnHover(
                        CPoint point,
                        bool bOn,
                        bool & bSuspendTips
                        );
            virtual void OnClick(
                        CPoint point,
                        bool bDown
                        );
            virtual __EXT_MFC_SAFE_LPCTSTR GetFieldText() const;
            virtual bool SetFieldText(
                        __EXT_MFC_SAFE_LPCTSTR sText,
                        bool bVerify = true
                        );
            virtual bool OnInplaceControlWndProcCall(
                        LRESULT & lResult,
                        UINT message,
                        WPARAM wParam,
                        LPARAM lParam,
                        CEdit & wndEdit
                        );
            virtual CSize CalculateLayout(
                        CDC & dc,
                        CSize sizePreCalc,
                        BOOL bHorz
                        );
            virtual void PaintCompound(
                        CDC & dc,
                        bool bPaintParentChain,
                        bool bPaintChildren,
                        bool bPaintOneNearestChildrenLevelOnly
                        );
            virtual CRect OnCalcSpinButtonsRect( 
                        const RECT & rcBtnArea 
                        ) const;
            virtual CRect OnCalcSpinButtonsMarginSizes() const;
}; // class CExtBarSpinButton

Here is the class implementation:
 /////////////////////////////////////////////////////////////////////////////
// CExtBarSpinButton

IMPLEMENT_DYNCREATE(CExtBarSpinButton, CExtBarTextFieldButton)

CExtBarSpinButton::CExtBarSpinButton(
            INT nTextFieldWidth, // = __EXT_MENU_DEF_INPLACE_EDIT_WIDTH
            CExtToolControlBar * pBar, // = NULL
            UINT nCmdID, // = ID_SEPARATOR
            UINT nStyle // = 0
            )
            : CExtBarTextFieldButton( false, nTextFieldWidth, pBar, nCmdID, nStyle )
            , m_nRangeLower( 0 )
            , m_nRangeUpper( 100 )
            , m_nPos( 0 )
            , m_nStep( 1 )
            , m_rcButtonUp( 0, 0, 0, 0 )
            , m_rcButtonDown( 0, 0, 0, 0 )
            , m_bButtonUpHovered( false )
            , m_bButtonDownHovered( false )
            , m_bButtonUpPressed( false )
            , m_bButtonDownPressed( false )
{
}

CExtBarSpinButton::~CExtBarSpinButton()
{
}

#ifdef _DEBUG
void CExtBarSpinButton::AssertValid() const
{
            CExtBarTextFieldButton::AssertValid();
            ASSERT( m_bComboField == false );
}
void CExtBarSpinButton::Dump( CDumpContext & dc ) const
{
            CExtBarTextFieldButton::Dump( dc );
}
#endif // _DEBUG

bool CExtBarSpinButton::IsAbleToTrackMenu(
            bool bCustomizeMode // = false
            ) const
{
            ASSERT_VALID( this );
            bCustomizeMode;
            return false;
}

void CExtBarSpinButton::SetRange( INT nLower, INT nUpper )
{
            ASSERT_VALID( this );
            if( nUpper < nLower )
            {
                        ASSERT( FALSE );
                        return;
            }
            if( m_nStep > (nUpper - nLower) )
            {
                        ASSERT( FALSE );
                        return;
            }
            m_nRangeLower = nLower;
            m_nRangeUpper = nUpper;
            m_nPos = m_nRangeLower;
}

void CExtBarSpinButton::GetRange( INT & nLower, INT & nUpper ) const
{
            ASSERT_VALID( this );
            nLower = m_nRangeLower;
            nUpper = m_nRangeUpper;
}

INT CExtBarSpinButton::GetPos() const
{
            ASSERT_VALID( this );
            return m_nPos;
}

INT CExtBarSpinButton::SetPos( INT nPos )
{
            ASSERT_VALID( this );
            if( nPos > m_nRangeUpper )
            {
                        ASSERT( FALSE );
                        return -1;
            }
INT nPosOld = m_nPos;
            m_nPos = nPos;
            m_strTextCache.Format( _T("%d"), m_nPos );
            SetFieldText( LPCTSTR(m_strTextCache) );
            return nPosOld;
}

INT CExtBarSpinButton::SetStep( INT nStep )
{
            ASSERT_VALID( this );
            if( nStep > (m_nRangeUpper - m_nRangeLower) )
            {
                        ASSERT( FALSE );
                        return -1;
            }
INT nStepOld = m_nStep;
            m_nStep = nStep;
            return nStepOld;
}

INT CExtBarSpinButton::GetStep() const
{
            ASSERT_VALID( this );
            return m_nStep;
}

CRect CExtBarSpinButton::OnCalcSpinButtonsRect( const RECT & rcBtnArea ) const
{
            ASSERT_VALID( this );
CRect rcSpinButtonsRect( rcBtnArea );
            rcSpinButtonsRect.left = 
                        rcSpinButtonsRect.right - GetBar()->PmBridge_GetPM()->GetSpinButtonWidth( (CObject*)this );
CRect rcMargins;
           rcMargins = OnCalcSpinButtonsMarginSizes();
            rcSpinButtonsRect.left -= ( rcMargins.left + rcMargins.right );
            rcSpinButtonsRect.DeflateRect( rcMargins );
            return rcSpinButtonsRect;
}

void CExtBarSpinButton::OnHovering(
            CPoint point,
            bool & bSuspendTips
            )
{
            ASSERT_VALID( this );
            ASSERT_VALID( m_pBar );
            CExtBarTextFieldButton::OnHovering( point, bSuspendTips );
            _UpdateSpinRectParts();
bool bButtonUpHoveredPrev   = m_bButtonUpHovered;
bool bButtonDownHoveredPrev = m_bButtonDownHovered;
bool bButtonUpHoveredNext   = false;
bool bButtonDownHoveredNext = false;
            if(                     (! m_rcButtonUp.IsRectEmpty() )
                        &&        m_rcButtonUp.PtInRect( point )
                        )
                        bButtonUpHoveredNext = true;
            if(                     (! m_rcButtonDown.IsRectEmpty() )
                        &&        m_rcButtonDown.PtInRect( point )
                        )
                        bButtonDownHoveredNext = true;
            m_bButtonUpHovered = bButtonUpHoveredNext;
            m_bButtonDownHovered = bButtonDownHoveredNext;
            if( bButtonUpHoveredPrev != bButtonUpHoveredNext || bButtonDownHoveredPrev != bButtonDownHoveredNext )
                        RedrawButton();
}

void CExtBarSpinButton::OnHover(
            CPoint point,
            bool bOn,
            bool & bSuspendTips
            )
{
            ASSERT_VALID( this );
            ASSERT_VALID( m_pBar );
            point;
            bSuspendTips = false;

bool bDockSiteCustomizeMode =
                        m_pBar->_IsDockSiteCustomizeMode();
            if( bDockSiteCustomizeMode )
                        return;
            if(                     GetBar()->m_pDockSite == NULL
                        ||           (! GetBar()->m_pDockSite->m_bHelpMode )
                        )
            {
                        CExtPopupMenuWnd::ITEMCOVERINGNOTIFICATON _icn(
                                    NULL,
                                    this,
                                    bOn
                                                ? CExtPopupMenuWnd::ITEMCOVERINGNOTIFICATON::__EICN_SET
                                                : CExtPopupMenuWnd::ITEMCOVERINGNOTIFICATON::__EICN_CANCEL
                                    );
                        HWND hWndOwn = GetBar()->GetSafeHwnd();
                        _icn.Notify();
                        bSuspendTips = _icn.m_bSuspendTips;
                        if( ! ::IsWindow( hWndOwn ) )
                                    return;
            }

            _UpdateSpinRectParts();
bool bButtonUpHoveredPrev   = m_bButtonUpHovered;
bool bButtonDownHoveredPrev = m_bButtonDownHovered;
bool bButtonUpHoveredNext   = false;
bool bButtonDownHoveredNext = false;
            if(                     (! m_rcButtonUp.IsRectEmpty() )
                        &&        m_rcButtonUp.PtInRect( point )
                        )
                        bButtonUpHoveredNext = true;
            if(                     (! m_rcButtonDown.IsRectEmpty() )
                        &&        m_rcButtonDown.PtInRect( point )
                        )
                        bButtonDownHoveredNext = true;
            m_bButtonUpHovered = bButtonUpHoveredNext;
            m_bButtonDownHovered = bButtonDownHoveredNext;
            if( bButtonUpHoveredPrev != bButtonUpHoveredNext || bButtonDownHoveredPrev != bButtonDownHoveredNext )
                        RedrawButton();

            if( bOn )
            {
                        if( CExtToolControlBar::g_bMenuTracking )
                        {
//                                  if( ! OnQueryHoverBasedMenuTracking() )
//                                              return;
//                                  OnTrackPopup( point, false, false );
                        }
                        else
                        {
                                    CExtControlBar::stat_SetMessageString(
                                                GetCmdTargetWnd(),
                                                (UINT)(
                                                            (           //          ( ! m_pBar->IsKindOf(RUNTIME_CLASS(CExtMenuControlBar)) )
                                                                                    ( ! m_pBar->_IsSimplifiedDropDownButtons() )
                                                                        &&        ( ! IsKindOf(RUNTIME_CLASS(CExtBarContentExpandButton)) )
                                                                        &&        CExtCmdManager::IsCommand( GetCmdID(false) )
                                                            )
                                                                        ? GetCmdID(true)
                                                                        : AFX_IDS_IDLEMESSAGE
                                                            )
                                                );
                        }
                        CWnd * pCtrl = CtrlGet();
                        if( pCtrl == NULL
                                    || (pCtrl->GetStyle() & WS_VISIBLE) == 0
                                    )
                                    ((CExtMouseCaptureSink *)m_pBar)->SetCapture( m_pBar->GetSafeHwnd() );
            } // if( bOn )
            else
            {
                        CExtControlBar::stat_SetMessageString( GetCmdTargetWnd() );
                        CExtMouseCaptureSink::ReleaseCapture();
            } // else from if( bOn )
}

void CExtBarSpinButton::_TrackSpinPressing()
{
            ASSERT_VALID( this );
            ASSERT_VALID( GetBar() );
            if( ! ( m_bButtonUpPressed || m_bButtonDownPressed ) )
                        return;
            _UpdateSpinRectParts();
const UINT nTimerID = 401;
const UINT nTimerEllapse = 100;
INT nPos = GetPos(), nAdvance = m_bButtonUpPressed ? (+GetStep()) : (-GetStep());
CRect rcArea = m_bButtonUpPressed ? m_rcButtonUp : m_rcButtonDown;
CExtToolControlBar * pBar = GetSafeBar();
HWND hWndOwnBar = pBar->GetSafeHwnd();
            ASSERT( hWndOwnBar != NULL );
CPoint ptCursor;
            ::GetCursorPos( &ptCursor );
            pBar->ScreenToClient( &ptCursor );
            ::SetCapture( hWndOwnBar );
            ::SetTimer( hWndOwnBar, nTimerID, nTimerEllapse, NULL );
bool bStopFlag = false, bSuspendTips = false;
            for( MSG msg; ::IsWindow( hWndOwnBar ) && (!bStopFlag); )
            {
                        if( !PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
                        {
                                    if( ! ::IsWindow( hWndOwnBar ) )
                                                break;
                                    ::WaitMessage();
                                    continue;
                        } // if( !PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
                        bool bAnalyzeButton = false;
                        switch( msg.message )
                        {
                        case WM_LBUTTONDBLCLK:
                        case WM_LBUTTONUP:
                        case WM_RBUTTONDBLCLK:
                        case WM_RBUTTONDOWN:
                        case WM_RBUTTONUP:
                        case WM_MBUTTONDBLCLK:
                        case WM_MBUTTONDOWN:
                        case WM_MBUTTONUP:
                        case WM_CANCELMODE:
                        case WM_ACTIVATEAPP:
                        case WM_KEYDOWN:
                        case WM_KEYUP:
                                    bStopFlag = true;
                        break;
                        case WM_CAPTURECHANGED:
                                    if( (HWND)msg.wParam != hWndOwnBar )
                                                bStopFlag = true;
                        break;
                        case WM_MOUSEMOVE:
                                    if(                     ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON) )
                                                ||           CExtPopupMenuWnd::IsKeyPressed(VK_MBUTTON)
                                                ||           CExtPopupMenuWnd::IsKeyPressed(VK_RBUTTON)
                                                ||           CExtPopupMenuWnd::IsMenuTracking()
                                                )
                                    {
                                                bStopFlag = true;
                                                break;
                                    }
                                    PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
                                    bAnalyzeButton = true;
                                    ::GetCursorPos( &ptCursor );
                                    ::ScreenToClient( hWndOwnBar, &ptCursor );
                        break;
                        case WM_TIMER:
                                    if(                     ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON) )
                                                ||           CExtPopupMenuWnd::IsKeyPressed(VK_MBUTTON)
                                                ||           CExtPopupMenuWnd::IsKeyPressed(VK_RBUTTON)
                                                ||           CExtPopupMenuWnd::IsMenuTracking()
                                                )
                                    {
                                                bStopFlag = true;
                                                break;
                                    }
                                    if( msg.message == WM_TIMER )
                                    {
                                                if( msg.wParam != nTimerID )
                                                            break;
                                    } // if( msg.message == WM_TIMER )
                                    PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
                                    ::GetCursorPos( &ptCursor );
                                    ::ScreenToClient( hWndOwnBar, &ptCursor );
                                    OnHovering( ptCursor, bSuspendTips );
                                    if( ! rcArea.PtInRect(ptCursor) )
                                    {
                                                RedrawButton();
                                                continue;
                                    }
                                    nPos += nAdvance;
                                    _SetTrackPos( nPos );
                                    nPos = GetPos();
                        break;
                        default:
                                    if(                     ( ! CExtPopupMenuWnd::IsKeyPressed(VK_LBUTTON) )
                                                ||           CExtPopupMenuWnd::IsKeyPressed(VK_MBUTTON)
                                                ||           CExtPopupMenuWnd::IsKeyPressed(VK_RBUTTON)
                                                ||           CExtPopupMenuWnd::IsMenuTracking()
                                                )
                                                bStopFlag = true;
                        break;
                        } // switch( msg.message )
                        if( bStopFlag )
                                    break;
                        if( bAnalyzeButton )
                        {
                                    OnHovering( ptCursor, bSuspendTips );
                                    if( ! rcArea.PtInRect(ptCursor) )
                                    {
                                                RedrawButton();
                                    }
                                    continue;
                        } // if( bAnalyzeButton )
                        if( !AfxGetThread()->PumpMessage() )
                                    break;
            } // for( MSG msg; ::IsWindow( hWndOwnBar ) && (!bStopFlag); )
            if( ! ::IsWindow( hWndOwnBar ) )
                        return;
            ::KillTimer( hWndOwnBar, nTimerID );
            m_bButtonUpHovered = m_bButtonDownHovered = m_bButtonUpPressed = m_bButtonDownPressed = false;
            RedrawButton();
            if( ::GetCapture() == hWndOwnBar )
                        ::ReleaseCapture();
}

void CExtBarSpinButton::_SetTrackPos( INT nPos )
{
            ASSERT_VALID( this );
            ASSERT_VALID( GetBar() );
INT nLower, nUpper;
            GetRange( nLower, nUpper );
            nPos = max( nPos, nLower );
            nPos = min( nPos, nUpper );
            if( nPos == GetPos() )
                        return;
            SetPos( nPos );
            RedrawButton();
}

void CExtBarSpinButton::OnClick(
            CPoint point,
            bool bDown
            )
{
            ASSERT_VALID( this );
            ASSERT_VALID( GetBar() );

bool bDockSiteCustomizeMode =
                        m_pBar->_IsDockSiteCustomizeMode();
            if( bDockSiteCustomizeMode )
                        return;

            if(                     m_bVertDocked
                        &&        (! GetCtrlVisibleVertically() )
                        )
            {
                        CExtBarButton::OnClick( point, bDown );
                        return;
            }

            _UpdateSpinRectParts();
bool bButtonUpHoveredPrev = m_bButtonUpHovered;
bool bButtonDownHoveredPrev = m_bButtonDownHovered;
bool bButtonUpHoveredNext = false;
bool bButtonDownHoveredNext = false;
bool bButtonUpPressedPrev = m_bButtonUpPressed;
bool bButtonDownPressedPrev = m_bButtonDownPressed;
bool bButtonUpPressedNext = false;
bool bButtonDownPressedNext = false;
            if(                     (! m_rcButtonUp.IsRectEmpty() )
                        &&        m_rcButtonUp.PtInRect( point )
                        )
            {
                        bButtonUpHoveredNext = true;
                        if( bDown )
                                    bButtonUpPressedNext = true;
            }
            if(                     (! m_rcButtonDown.IsRectEmpty() )
                        &&        m_rcButtonDown.PtInRect( point )
                        )
            {
                        bButtonDownHoveredNext = true;
                        if( bDown )
                                    bButtonDownPressedNext = true;
            }
            m_bButtonUpHovered = bButtonUpHoveredNext;
            m_bButtonDownHovered = bButtonDownHoveredNext;
            m_bButtonUpPressed = bButtonUpPressedNext;
            m_bButtonDownPressed = bButtonDownPressedNext;
            if(                     bButtonUpHoveredPrev != bButtonUpHoveredNext || bButtonDownHoveredPrev != bButtonDownHoveredNext
                        ||           bButtonUpPressedPrev != bButtonUpPressedNext || bButtonDownPressedPrev != bButtonDownPressedNext
                        )
                        RedrawButton();
            if( m_bButtonUpPressed || m_bButtonDownPressed )
            {
                        _TrackSpinPressing();
                        return;
            }

            if( bDown )
            {
                        CExtToolControlBar::_CloseTrackingMenus();

                        CExtControlBar::stat_SetMessageString(
                                    GetCmdTargetWnd(),
                                    (UINT)GetCmdID(false)
                                    );

                        return;
            } // if( bDown )

            CExtControlBar::stat_SetMessageString( GetCmdTargetWnd() );

CRect rcButton = Rect();
            if( ! m_bTextFieldIsNotEditable )
            {
                        CRect rcTextField = OnInplaceControlCalcRect( rcButton );
                        if( rcTextField.PtInRect(point) )
                        {
                                    OnInplaceControlRun();
                                    return;
                        }
            } // if( !m_bTextFieldIsNotEditable )
            if( ! IsComboTextField() )
                        return;
bool bTrackComboPopup = m_bTextFieldIsNotEditable;
            if( ! bTrackComboPopup )
            {
                        CRect rcComboDropRect = OnCalcComboDropRect( rcButton );
                        if( rcComboDropRect.PtInRect(point) )
                                    bTrackComboPopup = true;
            }
            if( bTrackComboPopup )
                        OnTrackPopup( point, false, false );
}

CRect CExtBarSpinButton::OnInplaceControlCalcRect( const RECT & rcBtnArea ) const
{
            ASSERT_VALID( this );
CRect rcCtrl( rcBtnArea );
CRect rcControlMarginSizes = OnInplaceControlCalcMarginSizes();
            rcCtrl.DeflateRect(
                        rcControlMarginSizes.left,
                        rcControlMarginSizes.top,
                        rcControlMarginSizes.right,
                        rcControlMarginSizes.bottom
                        );
            rcCtrl.right -= GetBar()->PmBridge_GetPM()->GetSpinButtonWidth( (CObject*)this );
CRect rcMargins;
           rcMargins = OnCalcSpinButtonsMarginSizes();
            rcCtrl.right -= ( rcMargins.left + rcMargins.right );
            return rcCtrl;
}

__EXT_MFC_SAFE_LPCTSTR CExtBarSpinButton::GetFieldText() const
{
            ASSERT_VALID( this );
LPCTSTR strText = CExtBarTextFieldButton::GetFieldText();
            if( strText != NULL && _tcslen(strText) > 0 )
                        return strText;
            m_strTextCache.Format( _T("%d"), GetPos() );
            return LPCTSTR(m_strTextCache);
}

bool CExtBarSpinButton::SetFieldText(
            __EXT_MFC_SAFE_LPCTSTR sText,
            bool bVerify // = true
            )
{
            ASSERT_VALID( this );
            if(                     bVerify
                        &&        (!          OnInplaceControlVerifyTextInput(
                                                            NULL,
                                                            ( GetFieldText() == NULL ) ? _T("") : GetFieldText(),
                                                            ( sText == NULL ) ? _T("") : sText
                                                )
                                    )
                        )
                        return false;
LPCTSTR sNewText = ( sText == NULL ) ? _T("") : sText;
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
CExtCustomizeSite * pSite = m_pBar->GetCustomizeSite();
            if( pSite != NULL )
            {
                        CExtCustomizeCmdTreeNode * pNode = GetCmdNode( false );
                        if( pNode != NULL )
                        {
                                    ASSERT_VALID( pNode );
                                    pNode->m_sDefInplaceEditBuffer = m_sTextField;
                        } // m_sTextField
                        pSite->OnTextFieldInplaceTextSet(
                                    this,
                                    GetCmdNode( false ),
                                    m_sTextField,
                                    sNewText
                                    );
            }
            else
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
            {
                        INT nPos = _ttoi( sNewText );
                        if( nPos > m_nRangeUpper )
                                    nPos = m_nRangeUpper;
                        if( nPos < m_nRangeLower )
                                    nPos = m_nRangeLower;
                        m_nPos = nPos;
                        TCHAR szBuf[100] = _T("");
                        memset( szBuf, 0, sizeof(szBuf) );
                        INT nBufSize = sizeof(szBuf)/sizeof(szBuf[0]);
                        __EXT_MFC_ITOA( nPos, szBuf, nBufSize, 10 );
                        m_sTextField = szBuf;
            }
            if( m_strTextCache != m_sTextField )
            {
                        m_strTextCache = m_sTextField;
                        INT nPos = _ttoi( sNewText );
                        if( nPos > m_nRangeUpper )
                                    nPos = m_nRangeUpper;
                        if( nPos < m_nRangeLower )
                                    nPos = m_nRangeLower;
                        m_nPos = nPos;
            }
            return true;
}

bool CExtBarSpinButton::OnInplaceControlWndProcCall(
            LRESULT & lResult,
            UINT message,
            WPARAM wParam,
            LPARAM lParam,
            CEdit & wndEdit
            )
{
            ASSERT_VALID( this );
            ASSERT_VALID( m_pBar );
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
CExtCustomizeSite * pSite = m_pBar->GetCustomizeSite();
            if( pSite != NULL )
                        return
                                    pSite->OnTextFieldWndProcHook(
                                                lResult,
                                                message,
                                                wParam,
                                                lParam,
                                                wndEdit,
                                                this,
                                                GetCmdNode( false )
                                                );
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
            lResult;
            lParam;
            if( message == WM_KEYDOWN )
            {
                        switch( wParam ) 
                        {
                        case VK_DOWN:
                        case VK_UP:
                                    {
                                                INT nPos = m_nPos;
                                                if( wParam == VK_DOWN )
                                                            nPos -= GetStep();
                                                else
                                                            nPos += GetStep();
                                                if( nPos > m_nRangeUpper )
                                                            nPos = m_nRangeUpper;
                                                if( nPos < m_nRangeLower )
                                                            nPos = m_nRangeLower;

                                                TCHAR szBuf[100] = _T("");
                                                memset( szBuf, 0, sizeof(szBuf) );
                                                INT nBufSize = sizeof(szBuf)/sizeof(szBuf[0]);
                                                
                                                __EXT_MFC_ITOA( 
                                                            nPos, 
                                                            szBuf, nBufSize, 
                                                            10 
                                                            );
                                                
                                                SetFieldText( szBuf, false );

                                                ::SetWindowText( wndEdit, szBuf );

                                                return true;
                                    }
                                    break;
                        }
            }
            return false;
}

CRect CExtBarSpinButton::OnCalcSpinButtonsMarginSizes() const
{
            ASSERT_VALID( this );
            return GetBar()->PmBridge_GetPM()->GetSpinButtonMargins( (CObject*) this );
}

CSize CExtBarSpinButton::CalculateLayout(
            CDC & dc,
            CSize sizePreCalc,
            BOOL bHorz
            )
{
            ASSERT_VALID( this );
            ASSERT_VALID( m_pBar );
            ASSERT_VALID( (&dc) );
CSize szActiveSize = CExtBarTextFieldButton::CalculateLayout( dc, sizePreCalc, bHorz );
            _UpdateSpinRectParts();
            return szActiveSize;
}

void CExtBarSpinButton::_UpdateSpinRectParts()
{
            ASSERT_VALID( this );
CRect rcButton = Rect();
CRect rcSpinButtonsRect = OnCalcSpinButtonsRect( rcButton );
            m_rcButtonUp = m_rcButtonDown = rcSpinButtonsRect;
            m_rcButtonUp.bottom = m_rcButtonUp.top + (rcSpinButtonsRect.Height() / 2);
            m_rcButtonDown.top = m_rcButtonUp.bottom;
}

void CExtBarSpinButton::PaintCompound(
            CDC & dc,
            bool bPaintParentChain,
            bool bPaintChildren,
            bool bPaintOneNearestChildrenLevelOnly
            )
{
            ASSERT_VALID( this );
            ASSERT_VALID( GetBar() );

bool bHorz = IsHorzBarOrientation();
            if( ! bHorz )
            {
                        CExtBarButton::PaintCompound( dc, false, bPaintChildren, bPaintOneNearestChildrenLevelOnly );
                        return;
            }

            if( ! IsPaintAble( dc ) )
                        return;
            if( AnimationClient_StatePaint( dc ) )
                        return;
            if( bPaintParentChain )
                        PaintParentChain( dc );

            _UpdateSpinRectParts();
CRect rcButton = Rect();
CRect rcTextField = rcButton;
            rcTextField.DeflateRect( OnInplaceControlCalcMarginSizes() );

bool bDockSiteCustomizeMode =
                        m_pBar->_IsDockSiteCustomizeMode();
bool bPushed =
                        (           (!bDockSiteCustomizeMode)
                        &&        (           IsComboPopupDropped()
                                    ||           (                       CtrlGet() != NULL
                                                &&        ( ! IsComboTextField() )
                                                )
                                    )
                        )
                        ? true : false;
bool bEnabled =
                        ( IsDisabled() && (!bDockSiteCustomizeMode) )
                                    ? false : true;
bool bHover =
                        (           (!bDockSiteCustomizeMode)
                        &&        (           IsHover()
                                    ||           CtrlGet() != NULL
                                    ||           IsComboPopupDropped()
                                    )
                        )
                                    ? true : false;
            if(                     (! bEnabled )
                        ||           (           CExtPopupMenuWnd::IsMenuTracking()
                                    &&        (! IsComboPopupDropped() )
                                    )
                        )
                        bPushed = bHover = false;

CExtSafeString sText;
            if( !IsComboPopupDropped() )
                        sText = (GetFieldText() == NULL) ? _T("") : GetFieldText();
            else
                        sText = m_sTextInplaceBuffer;

CExtToolControlBar * pBar = GetBar();
            if( bEnabled )
            {
                        CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pBar );
                        if( pMenuBar != NULL )
                        {
                                    int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
                                    if( nFlatTrackingIndex >= 0 )
                                    {
                                                int nOwnIndex = pBar->_GetIndexOf( this );
                                                if( nOwnIndex == nFlatTrackingIndex )
                                                            bHover = true;
                                    } // if( nFlatTrackingIndex >= 0 )
                        } // if( pMenuBar != NULL )
            } // if( bEnabled )

CExtPaintManager::PAINTTOOLBARTEXTFIELDDATA _ptbtfd(
                        this,
                        sText,
                        rcButton,
                        rcTextField,
                        IsComboTextField(),
                        bHover,
                        bPushed,
                        bEnabled
                        );
            pBar->PmBridge_GetPM()->PaintToolbarTextField( dc, _ptbtfd );

            pBar->PmBridge_GetPM()->PaintSpinButton(
                        dc,
                        m_rcButtonUp,
                        true,                  
                        false,
                        bEnabled,
                        false,
                        true,
                        m_bButtonUpPressed,
                        m_bButtonUpHovered,
                        false,// bHotTrack,
                        this,
                        0L
                        );

            pBar->PmBridge_GetPM()->PaintSpinButton(
                        dc,
                        m_rcButtonDown,
                        false,                
                        false,
                        bEnabled,
                        false,
                        true,
                        m_bButtonDownPressed,
                        m_bButtonDownHovered,
                        false,// bHotTrack,
                        this,
                        0L
                        );

            if( bPaintChildren )
                        PaintChildren( dc, bPaintOneNearestChildrenLevelOnly );
}