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 General Discussion » ProfSkin suggestions Collapse All
Subject Author Date
Bacsó Gergely Jan 27, 2006 - 6:53 AM

Since I don’t really like the default caption bars of XP, I wanted to implement a custom looking titlebar for Win2000, OfficeXP, Office2003
themes that adapts to the current caption colors, so I looked through your skinning code, and wrote my custom looking titlebar&borders based on that.
As I was testing my version of CExtNcFrameImpl with CMDIFrameWnd and CMDIChildWnd I have some suggestions for you:


In the NcFrameImpl_PreWindowProc you need:


 case WM_NCACTIVATE:
  if(pWndFrameImpl->IsKindOf(RUNTIME_CLASS(CMDIChildWnd)))
  {
   m_bIsActive = wParam == TRUE;
   pWndFrameImpl->SendMessage(WM_NCPAINT);
  }
  lResult = 1;
  return true;


 case WM_MDIACTIVATE:
  m_bIsActive = (HWND)lParam == GetFrameWindow()->m_hWnd; // Undocumented part
  GetFrameWindow()->SendMessage(WM_NCPAINT);
 break;



 case WM_ACTIVATEAPP:
  if( wParam == 0 )
   m_bIsActive = false;
  else
   m_bIsActive = IsActive();
  pWndFrameImpl->SendMessage( WM_NCPAINT );
  if(pWndFrameImpl->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)))
  {
   CMDIFrameWnd* pMDIFrameWnd = (CMDIFrameWnd*)pWndFrameImpl;
   CMDIChildWnd* pMDIChildWnd = pMDIFrameWnd->MDIGetActive();
   if(pMDIChildWnd)
    pMDIChildWnd->SendMessage(WM_NCACTIVATE, m_bIsActive ? TRUE:FALSE);
  }
 break;


In the NcRameImpl_PostWindowProc you need a


 case WM_SYSCOMMAND:
  if(wParam == SC_MINIMIZE)
   GetFrameWindow()->SendMessage(WM_NCPAINT);
 break;


in case an MDI child window is minimized -> no default nc buttons appear.


My GetFrameWindow() is implemented as a virtual function, and in the template class it returns "this", so I can use IsKindOf().



Best regards,


Gergely Bacso

Bacsó Gergely Jan 27, 2006 - 12:43 PM

A floating control bar can deactivate the main window, so its better to use in NcFrameImpl_PreWindowProc:


case WM_ACTIVATE:
    // m_bIsActive = ( LOWORD(wParam) == WA_INACTIVE ) ? false : true;
    m_bIsActive = GetActiveWindow() == pWndFrameImpl->m_hWnd;
    pWndFrameImpl->SendMessage( WM_NCPAINT );
break;

Technical Support Jan 30, 2006 - 6:45 AM

Thank you for the very interesting comments. Your code repaints the non client area in all the cases when it is needed. But CExtNcFrameImpl class and all the specialized versions of the CExtNCW template class simply work differently. The WM_WINDOWPOSCHANGED message is enough to redraw the skinned frame. At least we don’t see any situation when the frame was not repainted. We do not agree that the floating bar can change the border state of the main frame window because the floating mini frame windows use the WS_EX_TOOLWINDOW extended window style. Even if some control is focused inside the floating frame window, the main frame window should have the border in the active state.