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 » CExtControlBar question Collapse All
Subject Author Date
tera tera Jun 4, 2009 - 4:04 AM

Hello.


I want to always draw background colors of the caption title of the bars with blue.

Please teach a way.


Technical Support Jun 9, 2009 - 12:32 PM

We changed the declaration of the CExtDynAutoHideSlider class to fix this issue:

class __PROF_UIS_API CExtDynAutoHideSlider
      : public CWnd
      , CExtPmBridge
{
protected: ///////////////////////////////////////////////////////// THIS LINE WAS ADDED
      HWND m_hWndAnimateSrc, m_hWndBar;
public:    ///////////////////////////////////////////////////////// THIS LINE WAS ADDED
      CExtDynAutoHideArea * _GetWndAnimateSrc();
      CExtControlBar * _GetBar();
protected: ///////////////////////////////////////////////////////// THIS LINE WAS ADDED
      //CExtDynAutoHideArea * m_pWndAnimateSrc;
      //CExtControlBar * m_pBar;
      CSize m_sizeControlBar;
      bool m_bActiveState:1;
      bool m_bWndActive:1;
      bool m_bDeactivateTesting:1;
      bool m_bAnimation:1;
      UINT m_nResizingMode;
      INT m_nResizingStart, m_nResizingMetric;
      CExtBarNcAreaButton
            * m_pLastHitTestM,
            * m_pLastHitTestT,
            * m_pLastHitTestB;
      CToolTipCtrl m_wndToolTip;
      CRect m_rcMax;
      
      void _AnalyzeButtonsHover();
. . .
Please also do not add the following line into the MuControlBar.cpp file:
IMPLEMENT_DYNCREATE( CMuControlBar, CExtControlBar );
Then you can do a small experiment in your test project. You can find the following lines in the CMuControlBar::DoPaintNC() method:
       if( pFlashingBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
            {
                  _pgd.m_bFlashCaptionHighlightedState = bFlashCaptionHighlightedState;
                  _pgd.m_clrFlashCaptionText = pFlashingBar->m_clrFlashCaptionText;
                  _pgd.m_clrFlashCaptionBackground = pFlashingBar->m_clrFlashCaptionBackground;
                  if(   pFlashingBar->FlashCaption_DoPaintNC(
                              *pDC,
                              (LPVOID)(&_pgd)
                              )
                        )
                        bDrawDefaultCaption = false;
            } // if( pFlashingBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )

And replace them with the following lines:
<pre>// if( pFlashingBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
{
_pgd.m_bFlashCaptionHighlightedState = true; // bFlashCaptionHighlightedState;
_pgd.m_clrFlashCaptionText = RGB(255,255,0); // pFlashingBar->m_clrFlashCaptionText;
_pgd.m_clrFlashCaptionBackground = RGB(255,0,0); // pFlashingBar->m_clrFlashCaptionBackground;
if( pFlashingBar->FlashCaption_DoPaintNC(
*pDC,
(LPVOID)(&_pgd)
)
)
bDrawDefaultCaption = false;
} // if( pFlashingBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
<pre>As a result, each CMuControlBar window will have red caption with yellow text on it.
Here is the modified version of your project:
http://www.prof-uis.com/download/forums/tmp/MDI-for-tera.zip

Technical Support Jun 4, 2009 - 4:47 AM

You should override the CExtControlBar::DoPaintNC() virtual method. This method paints the non-client area (including borders and caption/gripper) for all Prof-UIS control bars. You can copy the source code from the original method and then modify it. The following part of the CExtControlBar::DoPaintNC() paints a caption:

               CExtPaintManager::PAINTGRIPPERDATA _pgd(
                                    pFlashingBar, // this
                                    rcGrip,
                                    rcText,
                                    IsBarWindowActive(),
                                    false,
                                    bHorz && !bGripperAtTop,
                                    !bFixedMode,
                                    sCaption.IsEmpty() ? LPCTSTR( NULL ) : sCaption,
                                    ( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false
                                    );
                        bool bDrawDefaultCaption = true, bFlashCaptionHighlightedState = false;
                        if( pFlashingBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
                        {
                                    _pgd.m_bFlashCaptionHighlightedState = bFlashCaptionHighlightedState;
                                    _pgd.m_clrFlashCaptionText = pFlashingBar->m_clrFlashCaptionText;
                                    _pgd.m_clrFlashCaptionBackground = pFlashingBar->m_clrFlashCaptionBackground;
                                    if(         pFlashingBar->FlashCaption_DoPaintNC(
                                                            *pDC,
                                                            (LPVOID)(&_pgd)
                                                            )
                                                )
                                                bDrawDefaultCaption = false;
                        } // if( pFlashingBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
                        if( bDrawDefaultCaption )
                        {
                                    PmBridge_GetPM()->PaintGripper( *pDC, _pgd );
                                    NcButtons_Paint( *pDC );
                        } // if( bDrawDefaultCaption )
The CExtControlBar class supports the caption flashing feature. This feature is very similar to what you need. The flashing captions of the CExtControlBar windows are implemented using timer based caption repainting: one period of time is an alternative caption background is painted and next period of time is the standard themed caption is painted. You need to do the similar thing but without timers.

tera tera Jun 5, 2009 - 1:57 AM

I performed the derivation of the class

Because the following functions are protection, I cannot access it.


if( pFlashingBar->FlashCaption_DoPaintNC(



 

Technical Support Jun 5, 2009 - 11:42 AM

We made public the following methods of the CExtControlBar class :

bool FlashCaption_DoPaintNC(
                        CDC & dc,
                        LPVOID pPGD
                        );
virtual void FlashCaption_OnRepaint();

tera tera Jun 7, 2009 - 8:27 PM

>We made public the following methods of the CExtControlBar class :


Will it be necessary to copy a source in the user side?

When I copy a source in the user side

An error comes at the following points.


void CMuControlBar::FlashCaption_OnRepaint() {  ASSERT_VALID( this );  ASSERT( GetSafeHwnd() != NULL ); #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)  if( AutoHideModeGet())  {   CFrameWnd * pFrame = GetParentFrame();   ASSERT_VALID( pFrame );   ASSERT( pFrame->GetSafeHwnd() != NULL );   ASSERT( ! pFrame->IsKindOf( RUNTIME_CLASS( CExtMiniDockFrameWnd ) ) );   CExtDynAutoHideArea * pDAHA = NULL;   CWnd * pWnd = pFrame->GetWindow( GW_CHILD );   for( ; pWnd != NULL; pWnd = pWnd->GetWindow( GW_HWNDNEXT ) )   {    CExtDynAutoHideArea * pDAHA2 = DYNAMIC_DOWNCAST( CExtDynAutoHideArea, pWnd );    if( pDAHA2 == NULL ) continue;    LONG nIndex = pDAHA2->FindControlBar( this );    if( nIndex < 0 ) continue;    pDAHA = pDAHA2;    break;   }   if( pDAHA->IsWindowVisible() )    pDAHA->Invalidate();   CExtDynAutoHideSlider * pDAHS = pDAHA->GetAutoHideSlider();   if(  pDAHS != NULL    && pDAHS->_GetBar() == this

 


 


 


Should I download the support version from Prof-UIS com?


 

Technical Support Jun 8, 2009 - 10:58 AM

Please add the following lines to the top of the .CPP file where source code of the CMuControlBar::FlashCaption_OnRepaint() method is present:

#if ( ! defined __EXT_MFC_NO_TAB_CONTROLBARS )
            #if ( ! defined __EXT_CONTROLBAR_TABBED_FEATURES_H )
                        #include <../Src/ExtControlBarTabbedFeatures.h>
            #endif
#endif

tera tera Jun 8, 2009 - 7:18 PM

A build error comes even if I revise it.

I prepared a sample.

Will you check it?

Give my best regards


 


http://ifreeta.dee.cc/20090609/MDI.LZH