LRESULT CIPAddressWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		if( uMsg == WM_KILLFOCUS )
		{
			bHandled = TRUE;
			return 0;
			lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
		}
		else if (uMsg == WM_KEYUP && (wParam == VK_DELETE || wParam == VK_BACK))
		{
			LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
			m_pOwner->m_nIPUpdateFlag = IP_DELETE;
			m_pOwner->UpdateText();
			PostMessage(WM_CLOSE);
			return lRes;
		}
		else if (uMsg == WM_KEYUP && wParam == VK_ESCAPE)
		{
			LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
			m_pOwner->m_nIPUpdateFlag = IP_KEEP;
			PostMessage(WM_CLOSE);
			return lRes;
		}
		else if( uMsg == OCM_COMMAND ) {
			if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_KILLFOCUS )
			{
				lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
			}
		}
		else bHandled = FALSE;
		if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		return lRes;
	}
Example #2
0
//
//	Update the lineheight based on current font settings
//
VOID TextView::RecalcLineHeight()
{
	m_nLineHeight	= 0;
	m_nMaxAscent	= 0;

	// find the tallest font in the TextView
	for(int i = 0; i < m_nNumFonts; i++)
	{
		// always include a font's external-leading
		int fontheight = m_uspFontList[i].tm.tmHeight + 
						 m_uspFontList[i].tm.tmExternalLeading;

		m_nLineHeight = max(m_nLineHeight, fontheight);
		m_nMaxAscent  = max(m_nMaxAscent, m_uspFontList[i].tm.tmAscent);
	}

	// add on the above+below spacings
	m_nLineHeight += m_nHeightAbove + m_nHeightBelow;

	// force caret resize if we've got the focus
	if(GetFocus() == m_hWnd)
	{
		OnKillFocus(0);
		OnSetFocus(0);
	}
}
Example #3
0
LRESULT CDateTimeWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	if( uMsg == WM_KILLFOCUS )
	{
		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
	}
	else if (uMsg == WM_KEYUP && (wParam == VK_DELETE || wParam == VK_BACK))
	{
		LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
		m_pOwner->m_nDTUpdateFlag = DT_DELETE;
		m_pOwner->UpdateText();
		PostMessage(WM_CLOSE);
		return lRes;
	}
	else if (uMsg == WM_KEYUP && wParam == VK_ESCAPE)
	{
		LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
		m_pOwner->m_nDTUpdateFlag = DT_KEEP;
		PostMessage(WM_CLOSE);
		return lRes;
	}
	else bHandled = FALSE;
	if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	return lRes;
}
Example #4
0
LRESULT CMultiMenuUI::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch( uMsg )
	{
	case WM_CREATE:       
		lRes = OnCreate(uMsg, wParam, lParam, bHandled); 
		break;
	case WM_KILLFOCUS:       
		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); 
		break;
	case WM_DESTROY:
		lRes = OnDestroy(uMsg, wParam, lParam, bHandled);
	default:
		bHandled = FALSE;
		break;
	}
	if( bHandled ) 
		return lRes;
	if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) 
		return lRes;
	//应用层和 DUILIB 都不处理的消息交由系统默认处理 
	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch (uMsg)
	{
	case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
	case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
	case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
	case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
	case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
	case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
	case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
	case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
	case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;	
	case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
	case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
	case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEMOVE:		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) return lRes;

	lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled);
	if (bHandled) return lRes;

	if (paint_manager_.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes;
	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
Example #6
0
	LRESULT CEditWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		if( uMsg == WM_KILLFOCUS ) lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
		else if( uMsg == OCM_COMMAND ) {
			if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
			else if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_UPDATE ) {
				RECT rcClient;
				::GetClientRect(m_hWnd, &rcClient);
				::InvalidateRect(m_hWnd, &rcClient, FALSE);
			}
		}
		else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ) {
			m_pOwner->GetManager()->SendNotify(m_pOwner, _T("return"));
		}
		else if( uMsg == OCM__BASE + WM_CTLCOLOREDIT  || uMsg == OCM__BASE + WM_CTLCOLORSTATIC ) {
			if( m_pOwner->GetNativeEditBkColor() == 0xFFFFFFFF ) return NULL;
			::SetBkMode((HDC)wParam, TRANSPARENT);
			DWORD dwTextColor = m_pOwner->GetTextColor();
			::SetTextColor((HDC)wParam, RGB(GetBValue(dwTextColor),GetGValue(dwTextColor),GetRValue(dwTextColor)));
			if( m_hBkBrush == NULL ) {
				DWORD clrColor = m_pOwner->GetNativeEditBkColor();
				m_hBkBrush = ::CreateSolidBrush(RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor)));
			}
			return (LRESULT)m_hBkBrush;
		}
		else if( uMsg == WM_CHAR && TCHAR(wParam) == VK_RETURN && (0 == (::GetWindowLong(m_hWnd,GWL_STYLE) & ES_MULTILINE)))
		{
			//È¥µô°´RETURN¼üʱ ßË ÉùÏì by rz.li 2013/01/10
		}
		else bHandled = FALSE;
		if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		return lRes;
	}
Example #7
0
LRESULT CActiveXWnd::HandleMessage( UINT uMsg, WPARAM wParam, LPARAM lParam, bool &bHandled )
{
   LRESULT lRes = 0;
   bHandled = true;

   switch( uMsg )
   {
   case WM_PAINT:         
	   lRes = OnPaint(uMsg, wParam, lParam, bHandled); 
	   break;
   case WM_SETFOCUS:      
	   lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); 
	   break;
   case WM_KILLFOCUS:     
	   lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
	   break;
   case WM_ERASEBKGND:    
	   lRes = OnEraseBkgnd(uMsg, wParam, lParam, bHandled); 
	   break;
   case WM_MOUSEACTIVATE: 
	   lRes = OnMouseActivate(uMsg, wParam, lParam, bHandled);
	   break;
   default:
	  bHandled = FALSE;
   }
  
   return lRes;
}
Example #8
0
	LRESULT CDateTimeWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		if( uMsg == WM_CREATE ) {
			m_pOwner->GetManager()->AddNativeWindow(m_pOwner, m_hWnd);
			bHandled = FALSE;
		}
		else if( uMsg == WM_KILLFOCUS )
		{
			lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
		}
		else if (uMsg == WM_KEYUP && (wParam == VK_DELETE || wParam == VK_BACK))
		{
			LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
			m_pOwner->m_nDTUpdateFlag = DT_DELETE;
			m_pOwner->UpdateText();
			PostMessage(WM_CLOSE);
			return lRes;
		}
		else if (uMsg == WM_KEYUP && wParam == VK_ESCAPE)
		{
			LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
			m_pOwner->m_nDTUpdateFlag = DT_KEEP;
			PostMessage(WM_CLOSE);
			return lRes;
		}
		//	else if( uMsg == OCM_COMMAND ) {
		// 		if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
		// 		else if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_UPDATE ) {
		// 			RECT rcClient;
		// 			::GetClientRect(m_hWnd, &rcClient);
		// 			::InvalidateRect(m_hWnd, &rcClient, FALSE);
		// 		}
		//	}
		//	else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ) {
		// 		m_pOwner->GetManager()->SendNotify(m_pOwner, DUI_MSGTYPE_RETURN);
		//	}
		// 		else if( uMsg == OCM__BASE + WM_CTLCOLOREDIT  || uMsg == OCM__BASE + WM_CTLCOLORSTATIC ) {
		// 			if( m_pOwner->GetNativeEditBkColor() == 0xFFFFFFFF ) return NULL;
		// 			::SetBkMode((HDC)wParam, TRANSPARENT);
		// 			DWORD dwTextColor = m_pOwner->GetTextColor();
		// 			::SetTextColor((HDC)wParam, RGB(GetBValue(dwTextColor),GetGValue(dwTextColor),GetRValue(dwTextColor)));
		// 			if( m_hBkBrush == NULL ) {
		// 				DWORD clrColor = m_pOwner->GetNativeEditBkColor();
		// 				m_hBkBrush = ::CreateSolidBrush(RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor)));
		// 			}
		// 			return (LRESULT)m_hBkBrush;
		// 		}
		else if( uMsg == WM_PAINT) {
			if (m_pOwner->GetManager()->IsLayered()) {
				m_pOwner->GetManager()->AddNativeWindow(m_pOwner, m_hWnd);
			}
			bHandled = FALSE;
		}
		else bHandled = FALSE;
		if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		return lRes;
	}
Example #9
0
void
Window::ClearFocus()
{
  if (focused) {
    OnKillFocus();

    assert(!focused);
  }
}
Example #10
0
LRESULT CSingleLineEditWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
   LRESULT lRes = 0;
   BOOL bHandled = TRUE;
   if( uMsg == WM_KILLFOCUS ) lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
   else if( uMsg == OCM_COMMAND && GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
   else bHandled = FALSE;
   if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
   return lRes;
}
Example #11
0
	LRESULT CDateTimeWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		if( uMsg == WM_KILLFOCUS )
		{
			lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
		}
		else if (uMsg == WM_KEYUP && (wParam == VK_DELETE || wParam == VK_BACK))
		{
			LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
			m_pOwner->m_nDTUpdateFlag = DT_DELETE;
			m_pOwner->UpdateText();
			PostMessage(WM_CLOSE);
			return lRes;
		}
		else if (uMsg == WM_KEYUP && wParam == VK_ESCAPE)
		{
			LRESULT lRes = ::DefWindowProc(m_hWnd, uMsg, wParam, lParam);
			m_pOwner->m_nDTUpdateFlag = DT_KEEP;
			PostMessage(WM_CLOSE);
			return lRes;
		}
		else if (uMsg == WM_NOTIFY)
		{

			NMHDR* pHeader=(NMHDR*)lParam;
			HWND hWndDTP1=pHeader->hwndFrom;
			if(pHeader->code==DTN_DATETIMECHANGE)
				LPNMDATETIMECHANGE lpChage=(LPNMDATETIMECHANGE)lParam; 
			bHandled = false;



		}
		
		//	else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ) {
		// 		m_pOwner->GetManager()->SendNotify(m_pOwner, DUI_MSGTYPE_RETURN);
		//	}
		// 		else if( uMsg == OCM__BASE + WM_CTLCOLOREDIT  || uMsg == OCM__BASE + WM_CTLCOLORSTATIC ) {
		// 			if( m_pOwner->GetNativeEditBkColor() == 0xFFFFFFFF ) return NULL;
		// 			::SetBkMode((HDC)wParam, TRANSPARENT);
		// 			DWORD dwTextColor = m_pOwner->GetTextColor();
		// 			::SetTextColor((HDC)wParam, RGB(GetBValue(dwTextColor),GetGValue(dwTextColor),GetRValue(dwTextColor)));
		// 			if( m_hBkBrush == NULL ) {
		// 				DWORD clrColor = m_pOwner->GetNativeEditBkColor();
		// 				m_hBkBrush = ::CreateSolidBrush(RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor)));
		// 			}
		// 			return (LRESULT)m_hBkBrush;
		// 		}
		else bHandled = FALSE;
		if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		return lRes;
	}
void CXTPFlowGraphEditItem::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if (nChar == VK_ESCAPE || nChar == VK_RETURN)
	{
		m_bEscapeKey = (nChar == VK_ESCAPE);
		OnKillFocus(NULL);

		return;
	}
	CEdit::OnChar(nChar, nRepCnt, nFlags);
}
Example #13
0
	LRESULT CWin::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		switch (uMsg)
		{
		case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
		case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
		//case WM_NCCREATE:		lRes = OnNcCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCMOUSEMOVE:    lRes = OnNCMouseMove(uMsg, wParam, lParam, bHandled); break;
		case WM_NCMOUSELEAVE:   lRes = OnNCMouseLeave(uMsg, wParam, lParam, bHandled); break;
		case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
		case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
		case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
		case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
		case WM_ERASEBKGND:     lRes = OnEraseBkGnd(uMsg, wParam, lParam, bHandled); break;
		case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
		case WM_CHAR:		    lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
		case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
		case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
		case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEMOVE:		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSELEAVE:     lRes = OnMouseLeave(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEHOVER:	    lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break;
		case WM_HOTKEY:			lRes = OnHotKey(uMsg, wParam, lParam, bHandled); break;
//		case WM_TIMER:			lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;//OnTimer响应有小问题
		case WM_MOVING:			lRes = OnMoving(uMsg, wParam, lParam, bHandled); break;
		case WM_SIZING:			lRes = OnSizing(uMsg, wParam, lParam, bHandled); break;
		case WM_SHOWWINDOW:		lRes = OnShowWindow(uMsg, wParam, lParam, bHandled); break;
		case WM_COMMAND:		lRes = OnCommand(uMsg, wParam, lParam, bHandled); break;
//		case WM_PAINT:			lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;//OnPaint响应有问题
		case WM_MENUCOMMAND:    lRes = OnMenuCommand(uMsg, wParam, lParam, bHandled); break;
		default:				bHandled = FALSE; break;
		}
		if (bHandled) return lRes;

		lRes = ProcessWindowMessage(uMsg, wParam, lParam, bHandled);
		if (bHandled) return lRes;

		if(_paintManager && _paintManager->MessageHandler(uMsg,wParam,lParam,lRes))
			return lRes;
		return __super::HandleMessage(uMsg,wParam,lParam);
	}
Example #14
0
LRESULT CShortcutEditWnd::HandleMessage( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	if( uMsg == WM_KILLFOCUS ) lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
	else if( uMsg == OCM_COMMAND ) {
		if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
		else if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_UPDATE ) {
			RECT rcClient;
			::GetClientRect(m_hWnd, &rcClient);
			::InvalidateRect(m_hWnd, &rcClient, FALSE);
		}
	}
	else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ) {
		m_pOwner->GetManager()->SendNotify(m_pOwner, DUI_MSGTYPE_RETURN);
		::SetFocus(NULL);
	}
	else if (uMsg == WM_KEYDOWN )
	{
		if (TCHAR(wParam) == VK_BACK)
		{
			Edit_SetText(m_hWnd, _T("нч"));
		}
		else if (IsKeyLpressed(VK_CONTROL))
		{
			TCHAR szTip[100] = {0};

			StringCchPrintf(szTip, _countof(szTip), _T("ctrl + %d"), wParam);
			Edit_SetText(m_hWnd, szTip);
		}
		else
		{
			Edit_SetText(m_hWnd, _T("нч"));
		}
	}
	else if( uMsg == OCM__BASE + WM_CTLCOLOREDIT  || uMsg == OCM__BASE + WM_CTLCOLORSTATIC ) {
		if( m_pOwner->GetNativeEditBkColor() == 0xFFFFFFFF ) return NULL;
		::SetBkMode((HDC)wParam, TRANSPARENT);
		DWORD dwTextColor = m_pOwner->GetTextColor();
		::SetTextColor((HDC)wParam, RGB(GetBValue(dwTextColor),GetGValue(dwTextColor),GetRValue(dwTextColor)));
		if( m_hBkBrush == NULL ) {
			DWORD clrColor = m_pOwner->GetNativeEditBkColor();
			m_hBkBrush = ::CreateSolidBrush(RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor)));
		}
		return (LRESULT)m_hBkBrush;
	}
	else bHandled = FALSE;
	if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	return lRes;
}
Example #15
0
LRESULT CMenuWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch( uMsg ) {
		case WM_CREATE:        lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_KILLFOCUS:     lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_KEYDOWN:       lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
		case WM_CLOSE:         lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
		default:
			bHandled = FALSE;
	}
	if( bHandled ) return lRes;
	if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
Example #16
0
	LRESULT CHotKeyWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		if( uMsg == WM_KILLFOCUS ) lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
		else if( uMsg == OCM_COMMAND ) {
			if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
			else if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_UPDATE ) {
				RECT rcClient;
				::GetClientRect(m_hWnd, &rcClient);
				::InvalidateRect(m_hWnd, &rcClient, FALSE);
			}
		}
		else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ) {
			m_pOwner->GetManager()->SendNotify(m_pOwner, _T("return"));
		}
		else if ( (uMsg == WM_NCACTIVATE) || (uMsg == WM_NCACTIVATE) || (uMsg == WM_NCCALCSIZE) )
		{
			return 0;
		}
		else if (uMsg == WM_PAINT)
		{
			PAINTSTRUCT ps = { 0 };
			HDC hDC = ::BeginPaint(m_hWnd, &ps);
			DWORD dwTextColor = m_pOwner->GetTextColor();
			DWORD dwBkColor = m_pOwner->GetNativeBkColor();
			CDuiString strText = GetHotKeyName();
			::RECT rect;
			::GetClientRect(m_hWnd, &rect);
			::SetBkMode(hDC, TRANSPARENT);
			::SetTextColor(hDC, RGB(GetBValue(dwTextColor), GetGValue(dwTextColor), GetRValue(dwTextColor)));
			HBRUSH hBrush =  CreateSolidBrush( RGB(GetBValue(dwBkColor), GetGValue(dwBkColor), GetRValue(dwBkColor)) );
			::FillRect(hDC, &rect, hBrush);
			::DeleteObject(hBrush);
			HFONT hOldFont = (HFONT)SelectObject(hDC, GetWindowFont(m_hWnd));
			::SIZE size = { 0 };
			::GetTextExtentPoint32(hDC, strText.GetData(), strText.GetLength(), &size) ;
			::DrawText(hDC, strText.GetData(), -1, &rect, DT_LEFT|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX);
			::SelectObject(hDC, hOldFont);
			::SetCaretPos(size.cx, 0);
			::EndPaint(m_hWnd, &ps);
			bHandled = TRUE;
		}
		else bHandled = FALSE;
		if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		return lRes;
	}
Example #17
0
LRESULT CActiveXWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    LRESULT lRes=0;
    BOOL bHandled = TRUE;
    switch( uMsg ) {
    case WM_PAINT:         lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;
    case WM_SETFOCUS:      lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
    case WM_KILLFOCUS:     lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
    case WM_ERASEBKGND:    lRes = OnEraseBkgnd(uMsg, wParam, lParam, bHandled); break;
    case WM_MOUSEACTIVATE: lRes = OnMouseActivate(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL: break;
    default:
        bHandled = FALSE;
    }
    if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
    return lRes;
}
Example #18
0
	LRESULT CMenuWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		switch( uMsg )
		{
		case WM_CREATE:       
			lRes = OnCreate(uMsg, wParam, lParam, bHandled); 
			break;
		case WM_KILLFOCUS:       
			lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); 
			break;
		case WM_KEYDOWN:
			if( wParam == VK_ESCAPE || wParam == VK_LEFT)
				Close();
			break;
		case WM_SIZE:
			lRes = OnSize(uMsg, wParam, lParam, bHandled);
			break;
		case WM_CLOSE:
			if( m_pOwner != NULL )
			{
				m_pOwner->SetManager(m_pOwner->GetManager(), m_pOwner->GetParent(), false);
				m_pOwner->SetPos(m_pOwner->GetPos());
				m_pOwner->SetFocus();
			}
			break;
		case WM_RBUTTONDOWN:
		case WM_CONTEXTMENU:
		case WM_RBUTTONUP:
		case WM_RBUTTONDBLCLK:
			return 0L;
			break;
		default:
			bHandled = FALSE;
			break;
		}

		if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
		return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	}
Example #19
0
LRESULT CMenuWnd::HandleMessage( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    LRESULT lRes = 0;
    BOOL bHandled = TRUE;

    switch( uMsg )
    {
    case WM_KILLFOCUS:    
        lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); 
        break; 

    default:
        bHandled = FALSE;
    }

    if(bHandled || m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes)) 
    {
        return lRes;
    }

    return __super::HandleMessage(uMsg, wParam, lParam);
}
Example #20
0
LRESULT CWkeWebkitWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if ( uMsg != WM_CREATE && m_pWebView == NULL) return -1;
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch (uMsg)
	{
	case WM_PAINT:			lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;
	case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
	case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
	case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
	case WM_CHAR:			lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYUP:			lRes = OnKeyUp(uMsg, wParam, lParam, bHandled); break;
	case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_TIMER:			lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;
	case WM_IME_STARTCOMPOSITION: lRes = OnImeStartComposition(uMsg, wParam, lParam, bHandled); break;	
	case WM_CONTEXTMENU:	lRes= OnContextMenu(uMsg, wParam, lParam, bHandled); break;	
	case WM_LBUTTONDOWN:	
	case WM_MBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_RBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_RBUTTONUP:
	case WM_LBUTTONDBLCLK:
	case WM_MBUTTONDBLCLK:
	case WM_RBUTTONDBLCLK:
	case WM_MOUSEMOVE:
	case WM_MOUSELEAVE:
		lRes = OnMouseEvent(uMsg, wParam, lParam, bHandled); break;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) return lRes;

	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
void CMainWindow::Notify( TNotifyUI &msg )
{
	DUI__Trace(msg.sType);
	if (msg.sType==_T("windowinit"))
	{
		OnInitWindow(msg);
	}
	else if (msg.sType==_T("click"))
	{
		OnClick(msg);
	}
	else if (msg.sType==_T("selectchanged"))
	{
		OnSelectChanged(msg);
	}
	else if (msg.sType==_T("itemactivate"))
	{
		OnItemActive(msg);
	}
	else if (msg.sType==_T("itemclick"))
	{
		OnItemClick(msg);
	}
	else if (msg.sType==_T("menu"))
	{
		OnMenu(msg);
	}
	else if (msg.sType==_T("killfocus"))
	{
		OnKillFocus(msg);
	}
	else if (msg.sType==_T("return"))
	{
		OnReturn(msg);
	}
}
Example #22
0
/*----------------------------------------------------------------------------------------------
	Show the popup (using a modal loop) at the given location. *pival will contain the selected
	icon index when this method returns. If the icon selection is cancelled, pival will contain
	the previous selected index (the initial value of *pival).
	DoPopup returns false if the user cancels the color selection.
	@param cval number of buttons
	@param rid resource id of bitmap containing buttons. They are assumed to be 16 pixels wide
	and 15 high, as in a toolbar. Pink pixels are to be masked out.
	It is further assumed that rids from rid + 1 to rid + cval identify tooltip help for the
	buttons.
	@param prgfPressed is the button pressed
----------------------------------------------------------------------------------------------*/
bool IconComboPopup::DoPopup(WndCreateStruct & wcs, int * pival, POINT pt, int cval, int rid,
                             int cColumns, bool * prgfPressed, HIMAGELIST himl)
{
    AssertPtr(pival);

    m_cvals = cval;
    m_pival = pival;
    m_pt = pt;
    m_cColumns = cColumns;
    m_cRows = (cval + cColumns - 1) / cColumns;
    m_himl = himl;
    m_prgfPressed = prgfPressed;

    SuperClass::CreateAndSubclassHwnd(wcs);

    m_ivalOld = *m_pival;

    // Tooltip stuff
    UiToolTipPtr qwnd;
    qwnd.Create();
    m_hwndToolTip = qwnd->Create(m_hwnd);

    Rect rc;
    TOOLINFO ti = { isizeof(ti) };
    ti.hwnd = m_hwnd;
    ti.hinst = ModuleEntry::GetModuleHandle();
    for (int i = 0; i < cval; i++)
    {
        GetCellRect(i, rc);
        ti.lpszText = reinterpret_cast<achar *>(rid + i + 1);
        ti.rect = rc;
        ::SendMessage(m_hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
    }

    // Find which cell corresponds to the initial color.
    m_fMouseDown = true;

    ::SetCapture(m_hwnd);
    MSG msg;
    bool fContinue = true;
    // Start a modal message loop.
    while (fContinue && ::GetMessage(&msg, NULL, 0, 0))
    {
        if (msg.hwnd == m_hwnd)
        {
            ::SendMessage(m_hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
            switch (msg.message)
            {
            case WM_LBUTTONDOWN:
                m_fMouseDown = true;
                ::InvalidateRect(m_hwnd, NULL, true);
                break;
            case WM_LBUTTONUP:
                fContinue = OnLButtonUp(msg.wParam, MakePoint(msg.lParam));
                break;
            case WM_PAINT:
                OnPaint();
                break;
            case WM_MOUSEMOVE:
                OnMouseMove(msg.wParam, LOWORD(msg.lParam), HIWORD(msg.lParam));
                break;
            case WM_KEYDOWN:
                fContinue = OnKeyDown(msg.wParam, LOWORD(msg.lParam));
                break;
            case WM_KILLFOCUS:
                fContinue = OnKillFocus((HWND)msg.wParam);
                break;
            default:
                DefWndProc(msg.message, msg.wParam, msg.lParam);
                break;
            }
        }
        else
        {
            // Dispatch the message the normal way.
            ::TranslateMessage(&msg);
            ::DispatchMessage(&msg);
        }
    }
    ::ReleaseCapture();

    return !m_fCanceled;
}
Example #23
0
	LRESULT CEditWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		if( uMsg == WM_CREATE ) {
			if( m_pOwner->GetManager()->IsLayered() ) {
				m_pOwner->GetManager()->AddPaintChildWnd(m_hWnd);
				::SetTimer(m_hWnd, CARET_TIMERID, ::GetCaretBlinkTime(), NULL);
			}
			bHandled = FALSE;
		}
		else if( uMsg == WM_KILLFOCUS ) lRes = OnKillFocus(uMsg, wParam, lParam, bHandled);
		else if( uMsg == OCM_COMMAND ) {
			if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE ) lRes = OnEditChanged(uMsg, wParam, lParam, bHandled);
			else if( GET_WM_COMMAND_CMD(wParam, lParam) == EN_UPDATE ) {
				RECT rcClient;
				::GetClientRect(m_hWnd, &rcClient);
				::InvalidateRect(m_hWnd, &rcClient, FALSE);
			}
		}
		else if( uMsg == WM_KEYDOWN && TCHAR(wParam) == VK_RETURN ){
			m_pOwner->GetManager()->SendNotify(m_pOwner, DUI_MSGTYPE_RETURN);
		}
		else if( uMsg == OCM__BASE + WM_CTLCOLOREDIT  || uMsg == OCM__BASE + WM_CTLCOLORSTATIC ) {
			if( m_pOwner->GetNativeEditBkColor() == 0xFFFFFFFF ) return NULL;
			::SetBkMode((HDC)wParam, TRANSPARENT);

			DWORD dwTextColor;
			if (m_pOwner->GetNativeEditTextColor() != 0x000000)
				dwTextColor = m_pOwner->GetNativeEditTextColor();
			else
				dwTextColor = m_pOwner->GetTextColor();

			::SetTextColor((HDC)wParam, RGB(GetBValue(dwTextColor),GetGValue(dwTextColor),GetRValue(dwTextColor)));
			if( m_hBkBrush == NULL ) {
				DWORD clrColor = m_pOwner->GetNativeEditBkColor();
				m_hBkBrush = ::CreateSolidBrush(RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor)));
			}
			return (LRESULT)m_hBkBrush;
		}
		else if( uMsg == WM_PRINT ) {
			if (m_pOwner->GetManager()->IsLayered()) {
				lRes = CWindowWnd::HandleMessage(uMsg, wParam, lParam);
				if( m_pOwner->IsEnabled() && m_bDrawCaret ) {
					RECT rcClient;
					::GetClientRect(m_hWnd, &rcClient);
					POINT ptCaret;
					::GetCaretPos(&ptCaret);
					RECT rcCaret = { ptCaret.x, ptCaret.y, ptCaret.x, ptCaret.y+rcClient.bottom-rcClient.top };
					CRenderEngine::DrawLine((HDC)wParam, rcCaret, 1, 0xFF000000);
				}
				return lRes;
			}
			bHandled = FALSE;
		}
		else if( uMsg == WM_TIMER ) {
			if (wParam == CARET_TIMERID) {
				m_bDrawCaret = !m_bDrawCaret;
				RECT rcClient;
				::GetClientRect(m_hWnd, &rcClient);
				::InvalidateRect(m_hWnd, &rcClient, FALSE);
				return 0;
			}
			bHandled = FALSE;
		}
		else bHandled = FALSE;

		if( !bHandled ) return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		return lRes;
	}
Example #24
0
void    CZiMainFrame::Notify(TNotifyUI & msg)
{
	if(msg.sType == _T("windowinit"))
	{
		OnPrepare(msg);
	}
	else if(msg.sType == _T("killfocus"))
	{
		OnKillFocus(msg);
	}
	else if (msg.sType == _T("setfocus")) {
		/*
		int a= 1;
		if (msg.pSender->GetName() == _T("SearchCombo")) {
			CComboUI * pSearchCombo = DuiControl(CComboUI, _T("SearchCombo"));
			pSearchCombo->Activate();
		}
		*/
	}
	else if(msg.sType == _T("return"))
	{
		DuiClickButtonMap(_T("SearchEdit"),    OnReturnSearch);
	}
	else if(msg.sType == _T("click"))
	{
		DuiClickButtonMap(_T("MinBtn"),        OnClickMin);
		DuiClickButtonMap(_T("CloseBtn"),      OnClickClose);
		DuiClickButtonMap(_T("SearchTip"),     OnClickMatchButton);
		DuiClickButtonMap(_T("SettingBtn"),    OnClickSettingButton);
		DuiClickButtonMap(_T("SearchBtn"),     OnClickSearchButton);
	}
	else if(msg.sType == _T("selectchanged"))
	{
		// tab 切换. ( friends 和 group )
		OnSelectTab(msg);
	}
	else if(msg.sType == _T("itemselect"))
	{
		// search item click. 
		OnSelectSearch(msg);
	}
	else if(msg.sType == _T("itemclick"))
	{
		// List . 
		OnSelectItemList(msg);
	}
	else if(msg.sType == _T("itemactivate"))
	{
		// 增加 select 响应双击操作. 
		OnItemChat(msg);
		OnSelectItemList(msg);
	}
	else if(msg.sType == _T("menu"))
	{
		// 右键支持
		//char szLog[256] = {0};
		//sprintf(szLog, "Class: %ws, Name = %ws\n", 
		//	msg.pSender->GetClass(), msg.pSender->GetName());
		//::OutputDebugStringA(szLog);
		DuiClickButtonMap(_T("FriendsList"),    OnClickRightButton);
		DuiClickButtonMap(_T("GroupsList"),     OnClickRightButton);
	}
	else if(msg.sType == _T("menuclick"))
	{
		// 右键点击
		//char szLog[256] = {0};
		//sprintf(szLog, "Class: %ws, Name = %ws\n", 
		//	msg.pSender->GetClass(), msg.pSender->GetName()
		//	);
		//::OutputDebugStringA(szLog);

		DuiClickMenuMap(Event_OpenItem,         OnClickRightMenu);
		DuiClickMenuMap(Event_ModifyItem,       OnClickRightMenu);
		DuiClickMenuMap(Event_DeleteItem,       OnClickRightMenu);
		DuiClickMenuMap(Event_CreateGroup,      OnCreateGroup);
	}
}
Example #25
0
/*----------------------------------------------------------------------------------------------
	This processes Windows messages on the window. In general, it normally calls the
	appropriate method on the edit class.
----------------------------------------------------------------------------------------------*/
bool TssEdit::FWndProc(uint wm, WPARAM wp, LPARAM lp, long & lnRet)
{
	bool fRet;

	switch (wm)
	{
	case WM_GETDLGCODE:
		// This is essential when embedded in a dialog to tell the dialog manager that it
		// wants to get key strokes. (We could try DLGC_WANTALLKEYS but I think we would then
		// get the Tab and Return keys...we may get them anyway with this combination...)
		// The last value tells Windows that when tabbing to this control we should use
		// EM_SETSEL to select all the text.
		lnRet = DLGC_WANTCHARS | DLGC_WANTARROWS | DLGC_HASSETSEL;
		return true;
	case EM_GETLINE:	// Use FW_EM_GETLINE.
	case EM_REPLACESEL:	// Use FW_EM_REPLACESEL.
		// We don't support these methods. Use the replacement TsString versions instead.
		Assert(false);
		lnRet = LB_ERR;
		return true;

	// NOTE: DO NOT send this message to a TssEdit if you want the actual text. Send the
	// FW_EM_GETTEXT message instead. This method is required for TssEdit controls on a
	// dialog because Windows will send the message to the control anytime the user hits a
	// key.
	case WM_GETTEXT:
		{
			ITsStringPtr qtss;
			GetText(&qtss);
			const wchar * pwrgch;
			int cch;
			HRESULT hr;
			IgnoreHr(hr = qtss->LockText(&pwrgch, &cch));
			if (FAILED(hr))
				return true;
			StrApp str(pwrgch, cch);
			qtss->UnlockText(pwrgch);
			lnRet = Min(cch + 1, (int)wp);
			achar * psz = reinterpret_cast<achar *>(lp);
			StrCpyN(psz, str.Chars(), lnRet);
		}
		return true;

	// NOTE: You should be sending an FW_EM_SETTEXT message instead of this.
	case WM_SETTEXT:
		{
			achar * psz = reinterpret_cast<achar *>(lp);
			StrUni stu(psz);
			ITsStrFactoryPtr qtsf;
			qtsf.CreateInstance(CLSID_TsStrFactory);
			ITsStringPtr qtss;
			CheckHr(qtsf->MakeStringRgch(stu.Chars(), stu.Length(), m_wsBase, &qtss));
			SetText(qtss);
		}
		return true;

	case EM_CANUNDO:
	case EM_CHARFROMPOS:
	case EM_EMPTYUNDOBUFFER:
	case EM_FMTLINES:
	case EM_GETFIRSTVISIBLELINE:
	case EM_GETHANDLE:
	case EM_GETMODIFY:
	case EM_GETPASSWORDCHAR:
	case EM_GETRECT:
	case EM_GETTHUMB:
	case EM_GETWORDBREAKPROC:
	case EM_POSFROMCHAR:
	case EM_SETHANDLE:
	case EM_SETMODIFY:
	case EM_SETPASSWORDCHAR:
	case EM_SETRECT:
	case EM_SETRECTNP:
	case EM_SETTABSTOPS:
	case EM_SETWORDBREAKPROC:
	case EM_UNDO:
	case WM_GETFONT:
	case WM_SETFONT:
		// We don't support these methods.
		Assert(false);
		lnRet = LB_ERR;
		return true;

	case EM_GETLIMITTEXT:
		lnRet = GetLimitText();
		return true;

	case FW_EM_GETLINE:
		lnRet = GetLine(wp, (ITsString **)lp);
		return true;

	case EM_GETLINECOUNT:
		lnRet = GetLineCount();
		return true;

	case EM_GETMARGINS:
		lnRet = GetMargins();
		return true;

	case FW_EM_GETSTYLE:
		GetStyle((StrUni *)lp, (COLORREF *)wp);
		return true;

	case EM_GETSEL:
		lnRet = GetSel((int *)wp, (int *)lp);
		return true;

	case EM_LINEFROMCHAR:
		lnRet = LineFromChar(wp);
		return true;

	case EM_LINEINDEX:
		lnRet = LineIndex(wp);
		return true;

	case EM_LINELENGTH:
		lnRet = LineLength(wp);
		return true;

	case EM_LINESCROLL:
		LineScroll(lp, wp);
		return true;

	case FW_EM_REPLACESEL:
		ReplaceSel((ITsString *)lp);
		return true;

	case EM_SCROLL:
		lnRet = ::SendMessage(m_hwnd, WM_VSCROLL, LOWORD(wp), 0);
		return true;

	case EM_SCROLLCARET:
		ScrollCaret();
		return true;

	case EM_SETLIMITTEXT:
		SetLimitText(wp);
		return true;

	case EM_SETMARGINS:
		SetMargins(wp, LOWORD(lp), HIWORD(lp));
		return true;

	case EM_SETREADONLY:
		SetReadOnly(wp);
		return true;

	case EM_SETSEL:
		SetSel(wp, lp);
		return true;

	case FW_EM_SETSTYLE:
		SetStyle((StrUni *)lp, (COLORREF)wp);
		return true;

	case WM_GETTEXTLENGTH:
		lnRet = GetTextLength();
		return true;

	case FW_EM_GETTEXT:
		GetText((ITsString **)lp);
		return true;

	case FW_EM_SETTEXT:
		SetText((ITsString *)lp);
		return true;

	case WM_COPY:
		Copy();
		return true;

	case WM_CUT:
		Cut();
		return true;

	case WM_PASTE:
		Paste();
		return true;

	case WM_HSCROLL:
		if (!OnHScroll(LOWORD(wp), HIWORD(wp), (HWND)lp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_HSCROLL), (LPARAM)m_hwnd);
		}
		return true;

	case WM_VSCROLL:
		if (!OnVScroll(LOWORD(wp), HIWORD(wp), (HWND)lp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_VSCROLL), (LPARAM)m_hwnd);
		}
		return true;

	case WM_KILLFOCUS:
		if (!OnKillFocus((HWND)wp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_KILLFOCUS), (LPARAM)m_hwnd);
		}
		return true;

	case WM_SETFOCUS:
		if (!OnSetFocus((HWND)wp))
		{
			::SendMessage(::GetParent(m_hwnd), WM_COMMAND,
				MAKEWPARAM(::GetDlgCtrlID(m_hwnd), EN_SETFOCUS), (LPARAM)m_hwnd);
		}
		return true;
		// Calling SuperClass here causes two OnSetFocus calls for each OnKillFocus.
		//return SuperClass::FWndProc(wm, wp, lp, lnRet);

	case WM_CHAR:
		fRet = false;
		if (wp == VK_TAB)  // '\t'
		{
			fRet = OnCharTab();
		}
		else if (wp == VK_RETURN) // '\r'
		{
			fRet = OnCharEnter();
		}
		else if (wp == VK_ESCAPE) // '\33'
		{
			fRet = OnCharEscape();
		}
		if (fRet)
			return fRet;
		else
			return SuperClass::FWndProc(wm, wp, lp, lnRet);

	case WM_LBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_MBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_RBUTTONDOWN:
	case WM_RBUTTONUP:
	case WM_MOUSEMOVE:
		if (HasToolTip())
		{
			// Notify the tooltip belonging to the parent toolbar of the mouse message.
			Assert(m_hwndToolTip);
			MSG msg;
			msg.hwnd = m_hwnd; // ::GetParent(m_hwnd);
			msg.message = wm;
			msg.wParam = wp;
			msg.lParam = lp;
			::SendMessage(m_hwndToolTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
		}
		break;

	default:
		break;
	}
	return SuperClass::FWndProc(wm, wp, lp, lnRet);
}
Example #26
0
LRESULT
Window::OnMessage(HWND _hWnd, UINT message,
                       WPARAM wParam, LPARAM lParam)
{
  switch (message) {
  case WM_CREATE:
    OnCreate();
    return 0;

  case WM_DESTROY:
    OnDestroy();
    return 0;

  case WM_SIZE:
    OnResize({LOWORD(lParam), HIWORD(lParam)});
    return 0;

  case WM_MOUSEMOVE:
    if (OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam))
      return 0;
    break;

  case WM_LBUTTONDOWN:
    if (OnMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }
    break;

  case WM_LBUTTONUP:
    if (OnMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }
    break;

  case WM_LBUTTONDBLCLK:
    if (!double_clicks)
      /* instead of disabling CS_DBLCLKS (which would affect all
         instances of a window class), we just translate
         WM_LBUTTONDBLCLK to WM_LBUTTONDOWN here; this even works for
         built-in window class such as BUTTON */
      return OnMessage(_hWnd, WM_LBUTTONDOWN, wParam, lParam);

    if (OnMouseDouble(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }

    break;

#ifdef WM_MOUSEWHEEL
  case WM_MOUSEWHEEL:
    if (OnMouseWheel(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam),
                       GET_WHEEL_DELTA_WPARAM(wParam))) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }
    break;
#endif

  case WM_KEYDOWN:
    if (OnKeyDown(wParam)) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }
    break;

  case WM_KEYUP:
    if (OnKeyUp(wParam)) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }
    break;

  case WM_CHAR:
    if (OnCharacter((TCHAR)wParam))
      /* true returned: message was handled */
      return 0;

    break;

  case WM_COMMAND:
    if (OnCommand(LOWORD(wParam), HIWORD(wParam))) {
      /* true returned: message was handled */
      ResetUserIdle();
      return 0;
    }
    break;

  case WM_CANCELMODE:
    OnCancelMode();
    /* pass on to DefWindowProc(), there may be more to do */
    break;

  case WM_SETFOCUS:
    OnSetFocus();
    /* pass on to DefWindowProc() so the underlying window class knows
       it's focused */
    break;

  case WM_KILLFOCUS:
    OnKillFocus();
    /* pass on to DefWindowProc() so the underlying window class knows
       it's not focused anymore */
    break;

  case WM_TIMER:
    if (OnTimer(*(WindowTimer *)wParam))
      return 0;
    break;

  case WM_PAINT:
    if (custom_painting) {
      PaintCanvas canvas(*this);
      OnPaint(canvas, canvas.get_dirty());
      return 0;
    }
    break;

  case WM_GETDLGCODE:
    if (OnKeyCheck(wParam))
      return DLGC_WANTMESSAGE;
    break;
  }

  if (message >= WM_USER && message <= 0x7FFF && OnUser(message - WM_USER))
    return 0;

  return OnUnhandledMessage(_hWnd, message, wParam, lParam);
}
Example #27
0
LRESULT CALLBACK Window::WinMsgHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    switch (uMsg) {
        case WM_CLOSE:
            if (OnClose()) return 0;
            break;
        case WM_DESTROY:
            OnDestroy();
            break;
        case WM_SIZE:
            if(OnSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) return 0;
            break;
        case WM_SYSKEYDOWN:
            /*
             * http://msdn.microsoft.com/en-us/library/windows/desktop/ms646286(v=vs.85).aspx
             * Bit 29 of lParam :
             * The context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the
             * WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.
             */
            if(!((lParam>>29)&0x01)) {
                if(OnKeyDown(wParam)) return 0;
            }
            break;
        case WM_KEYDOWN:
            if(OnKeyDown(wParam)) return 0;
            break;
        case WM_KEYUP:
            if(OnKeyUp(wParam)) return 0;
            break;
        case WM_LBUTTONDBLCLK:
            if(OnLButtonDblClick((POINT){GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)})) return 0;
            break;
        case WM_MOUSEMOVE:
            if(OnMouseMove((POINT){GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)})) return 0;
            break;
        case WM_LBUTTONDOWN:
            if(OnLButtonDown((POINT){GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)})) return 0;
            break;
        case WM_LBUTTONUP:
            if(OnLButtonUp((POINT){GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)})) return 0;
            break;
        case WM_SETFOCUS:
            OnSetFocus();
            break;
        case WM_KILLFOCUS:
            OnKillFocus();
            break;
        case WM_CTLCOLORSTATIC:
        case WM_CTLCOLOREDIT:
            if(lParam) {
                Window * pChildWnd = Window::GetObjectFromWindow((HWND)lParam);
                if(pChildWnd) {
                    HBRUSH hBrush = pChildWnd->OnCtlColor((HDC)wParam);
                    if(hBrush) {
                        return (LRESULT)hBrush;
                    }
                }
            }
            break;
        case WM_TIMER:
            OnTimer();
            break;
        default:
            break;
    }
    Window * pOwner = GetParent();
    if(pOwner && pOwner->Notify(this, uMsg, wParam, lParam)) {
        return 0;
    }

    if(_OriginalWndProc) {
        return CallWindowProc(_OriginalWndProc, hWnd, uMsg, wParam, lParam);
    }
    return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
Example #28
0
void CLockedEdit::focusOutEvent(QFocusEvent *)
{
   OnKillFocus(NULL);
}
Example #29
0
void CBannerEdit::focusOutEvent(QFocusEvent *)
{
   OnKillFocus(NULL);
}
Example #30
0
	//--------------------------------------------------------------------------------
	long CTreeView::OnNotify( NotificationMessageHeader* pHdr )
	{
		_WINQ_FCONTEXT( "CTreeView::OnNotify" );
		long lResult = 0;

		if( pHdr != 0 )
		{
			switch ( pHdr->m_uiCode )
			{
			case NM_CLICK:
				{
					lResult = static_cast< long >( OnClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_CUSTOMDRAW:
				{
					lResult = OnCustomDraw( reinterpret_cast< NMTVCUSTOMDRAW* >( pHdr ) );
				}
				break;
			case NM_DBLCLK:
				{
					lResult = static_cast< long >( OnDblClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_KILLFOCUS:
				{
					OnKillFocus( pHdr );
				}
				break;
			case NM_RCLICK:
				{
					lResult = static_cast< long >( OnRClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_RDBLCLK:
				{
					lResult = static_cast< long >( OnRDblClick( pHdr ) ? 0 : 1 );
				}
				break;
			case NM_RETURN:
				{
					lResult = static_cast< long >( OnReturn( pHdr ) ? 0 : 1 );
				}
				break;
#if		( _WIN32_IE >= 0x0400 )
			case NM_SETCURSOR:
				{
					lResult = static_cast< long >( OnSetCursor( reinterpret_cast< NMMOUSE* >( pHdr ) ) ? 0 : 1 );
				}
				break;
#endif//( _WIN32_IE >= 0x0400 )
			case NM_SETFOCUS:
				{
					OnSetFocus( pHdr );
				}
				break;
#if		( _WIN32_IE >= 0x0600 )
			case TVN_ASYNCDRAW:
				{
					OnAsyncDraw( reinterpret_cast< NMTVASYNCDRAW* >( pHdr ) );
				}
				break;
#endif//( _WIN32_IE >= 0x0600 )
			case TVN_BEGINDRAG:
				{
					OnBeginDrag( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_BEGINLABELEDIT:
				{
					lResult = static_cast< long >( OnBeginLabelEdit( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_BEGINRDRAG:
				{
					OnBeginRDrag( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_DELETEITEM:
				{
					OnDeleteItem( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_ENDLABELEDIT:
				{
					lResult = static_cast< long >( OnEndLabelEdit( reinterpret_cast< NMTVDISPINFO* >( pHdr ) ) ? 1 : 0 );
				}
				break;
			case TVN_GETDISPINFO:
				{
					OnGetDispInfo( reinterpret_cast< NMTVDISPINFO* >( pHdr ) );
				}
				break;
#if		( _WIN32_IE >= 0x0400 )
			case TVN_GETINFOTIP:
				{
					OnGetInfoTip( reinterpret_cast< NMTVGETINFOTIP* >( pHdr ) );
				}
				break;
#endif//( _WIN32_IE >= 0x0400 )
#if		( _WIN32_IE > 0x0600 )
			case TVN_ITEMCHANGED:
				{
					lResult = static_cast< long >( OnItemChanged( reinterpret_cast< NMTVITEMCHANGE* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_ITEMCHANGING:
				{
					lResult = static_cast< long >( OnItemChanging( reinterpret_cast< NMTVITEMCHANGE* >( pHdr ) ) ? 0 : 1 );
				}
				break;
#endif//( _WIN32_IE > 0x0600 )
			case TVN_ITEMEXPANDED:
				{
					OnItemExpanded( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_ITEMEXPANDING:
				{
					lResult = static_cast< long >( OnItemExpanding( reinterpret_cast< NMTREEVIEW* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_KEYDOWN:
				{
					lResult = static_cast< long >( OnKeyDown( reinterpret_cast< NMTVKEYDOWN* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_SELCHANGED:
				{
					OnSelChanged( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
			case TVN_SELCHANGING:
				{
					lResult = static_cast< long >( OnSelChanging( reinterpret_cast< NMTREEVIEW* >( pHdr ) ) ? 0 : 1 );
				}
				break;
			case TVN_SETDISPINFO:
				{
					OnSetDispInfo( reinterpret_cast< NMTVDISPINFO* >( pHdr ) );
				}
				break;
#if		( _WIN32_IE >= 0x0400 )
			case TVN_SINGLEEXPAND:
				{
					lResult = OnSingleExpand( reinterpret_cast< NMTREEVIEW* >( pHdr ) );
				}
				break;
#endif//( _WIN32_IE >= 0x0400 )
			default:
				{
					lResult = OnUnknownNotification( pHdr );
				}
				break;
			}
		}
		return lResult;
	}