Ejemplo n.º 1
0
void CAdvComboBox::OnTimer(UINT nIDEvent) 
{
	if( nIDEvent == 1 )
	{
		CPoint point;
		GetCursorPos( &point );
		ScreenToClient( &point );
		if( (GetStyle() & CBS_DROPDOWN) && !(GetStyle() & CBS_SIMPLE) )  // == CBS_DROPDOWN
		{
			if( !m_rcDropButton.PtInRect( point ) )
			{
				KillTimer( 1 );
				OnMouseLeave();
			}
		}
		else
		if( (GetStyle() & CBS_DROPDOWN) && (GetStyle() & CBS_SIMPLE) )  // == CBS_DROPDOWNLIST
		{
			GetClientRect( &m_rcCombo );
			if( !m_rcCombo.PtInRect( point ) )
			{
				KillTimer( 1 );
				OnMouseLeave();
			}
		}
	}
	CWnd::OnTimer(nIDEvent);
}
Ejemplo n.º 2
0
LRESULT CDreamSkinSpinCtrl::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	LRESULT nResult = ERROR_SUCCESS;

	switch(message)
	{
	case WM_ERASEBKGND:
		break;
	case WM_LBUTTONDBLCLK:
		nResult = ::SendMessageW(m_hWnd, WM_LBUTTONDOWN, wParam, lParam);
		break;
	case WM_LBUTTONDOWN:
		nResult = OnLButtonDown(wParam, MAKEPOINTS(lParam));
		break;
	case WM_LBUTTONUP:
		nResult = OnLButtonUp(wParam, MAKEPOINTS(lParam));
		break;
	case WM_MOUSELEAVE:
		nResult = OnMouseLeave();
		break;
	case WM_MOUSEMOVE:
		nResult = OnMouseMove(wParam, MAKEPOINTS(lParam));
		break;
	case WM_PAINT:
		nResult = OnPaint();
		break;
	default:
		nResult = CDreamSkinWindow::DefWindowProc(message, wParam, lParam);
	}

	return nResult;
}
Ejemplo n.º 3
0
	bool iWidget::ProcessMessage(eGuiMessage a_Message, cGuiMessageData &a_Data)
	{
		if (IsEnabled()==false) return false;

		a_Data.m_Message = a_Message;

		bool bRet = false;
		bRet = OnMessage(a_Message, a_Data);

		if (bRet==false)
		{
			switch(a_Message)
			{
			case eGuiMessage_MouseMove:			bRet = OnMouseMove(a_Data);break;
			case eGuiMessage_MouseDown:			bRet = OnMouseDown(a_Data);break;
			case eGuiMessage_MouseUp:			bRet = OnMouseUp(a_Data);break;
			case eGuiMessage_MouseDoubleClick:	bRet = OnMouseDoubleClick(a_Data);break;
			case eGuiMessage_MouseEnter:		bRet = OnMouseEnter(a_Data);break;
			case eGuiMessage_MouseLeave:		bRet = OnMouseLeave(a_Data);break;
			case eGuiMessage_GotFocus:			bRet = OnGotFocus(a_Data);break;
			case eGuiMessage_LostFocus:			bRet = OnLostFocus(a_Data);break;
			case eGuiMessage_KeyPress:			bRet = OnKeyPress(a_Data);break;
			}
		}

		if (ProcessCallbacks(a_Message, a_Data))
			bRet = true;

		return bRet;
	}
Ejemplo n.º 4
0
	bool iWidget::ProcessMessage(eGuiMessage aMessage, cGuiMessageData &aData)
	{
		if(IsEnabled()==false) return false;
		
		aData.mMessage = aMessage;

		bool bRet = false;
		bRet = OnMessage(aMessage,aData); //This can override any message.

		/////////////////////////////////////////
		//Call the correct virtual function
		if(bRet==false)
		{
			switch(aMessage)
			{
				case eGuiMessage_MouseMove:			bRet = OnMouseMove(aData); break;
				case eGuiMessage_MouseDown:			bRet = OnMouseDown(aData); break;
				case eGuiMessage_MouseUp:			bRet = OnMouseUp(aData); break;
				case eGuiMessage_MouseDoubleClick:	bRet = OnMouseDoubleClick(aData); break;
				case eGuiMessage_MouseEnter:		bRet = OnMouseEnter(aData); break;
				case eGuiMessage_MouseLeave:		bRet = OnMouseLeave(aData); break;
				case eGuiMessage_KeyPress:			bRet = OnKeyPress(aData); break;
				case eGuiMessage_GotFocus:			bRet = OnGotFocus(aData); break;
				case eGuiMessage_LostFocus:			bRet = OnLostFocus(aData); break;
			}
		}

		/////////////////////////////////////////
		//Process user callbacks for the event.
		if(ProcessCallbacks(aMessage,aData)) bRet = true;
		
		return bRet;
	}
	BOOL URLLabel::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
	{
		if (message == WM_MOUSELEAVE) {
			OnMouseLeave();
			return TRUE;
		} else
		return __super::OnWndMsg(message, wParam, lParam, pResult);
	}
Ejemplo n.º 6
0
void OUGUIObject::SetMouseEnter(bool bEnter)
{
    if(bEnter == m_bMouseEnter) return;

    m_bMouseEnter = bEnter;

    if(m_bMouseEnter) OnMouseEnter();
    else OnMouseLeave();
}
Ejemplo n.º 7
0
void SLink::OnMouseMove( UINT nFlags,CPoint pt )
{
    if(!m_rcText.PtInRect(pt))
    {
        if(m_dwState&WndState_Hover) OnMouseLeave();
    }
    else
    {
        if(!(m_dwState&WndState_Hover)) OnMouseHover(nFlags,pt);
    }
}
Ejemplo n.º 8
0
void CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return;

  switch (pMessage->GetClassID()) {
    case CFWL_MessageType::Activate: {
      OnActivate(pMessage);
      break;
    }
    case CFWL_MessageType::SetFocus: {
      OnFocusChanged(pMessage, TRUE);
      break;
    }
    case CFWL_MessageType::KillFocus: {
      OnFocusChanged(pMessage, FALSE);
      break;
    }
    case CFWL_MessageType::Mouse: {
      CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
      switch (pMsg->m_dwCmd) {
        case FWL_MouseCommand::LeftButtonDown: {
          OnLButtonDown(pMsg);
          break;
        }
        case FWL_MouseCommand::LeftButtonUp: {
          OnLButtonUp(pMsg);
          break;
        }
        case FWL_MouseCommand::Move: {
          OnMouseMove(pMsg);
          break;
        }
        case FWL_MouseCommand::Leave: {
          OnMouseLeave(pMsg);
          break;
        }
        default:
          break;
      }
      break;
    }
    case CFWL_MessageType::Key: {
      CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
      if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown)
        OnKeyDown(pKey);
      break;
    }
    default: {
      break;
    }
  }

  CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
Ejemplo n.º 9
0
int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return 0;
  if (!m_pOwner->IsEnabled()) {
    return 1;
  }
  int32_t iRet = 1;
  FX_DWORD dwMsgCode = pMessage->GetClassID();
  switch (dwMsgCode) {
    case FWL_MSGHASH_SetFocus:
    case FWL_MSGHASH_KillFocus: {
      OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus);
      break;
    }
    case FWL_MSGHASH_Mouse: {
      CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
      FX_DWORD dwCmd = pMsg->m_dwCmd;
      switch (dwCmd) {
        case FWL_MSGMOUSECMD_LButtonDown: {
          OnLButtonDown(pMsg);
          break;
        }
        case FWL_MSGMOUSECMD_LButtonUp: {
          OnLButtonUp(pMsg);
          break;
        }
        case FWL_MSGMOUSECMD_MouseMove: {
          OnMouseMove(pMsg);
          break;
        }
        case FWL_MSGMOUSECMD_MouseLeave: {
          OnMouseLeave(pMsg);
          break;
        }
        default: {}
      }
      break;
    }
    case FWL_MSGHASH_Key: {
      CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
      if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) {
        OnKeyDown(pKey);
      }
      break;
    }
    default: {
      iRet = 0;
      break;
    }
  }
  CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
  return iRet;
}
Ejemplo n.º 10
0
XU32 XHTMLButton::OnMouseUp(XEVENTDATA *pData)
{
	XU32 s=0;
	s=OnMouseLeave(pData);
	XDomItem*p=GetParent();
	if(p!=XNULL)
	{
		PostVariable(pData);
		s|=p->Handle(XDO_SUBMIT,
					 0,(XU32)pData);
	}
	return s;
}
Ejemplo n.º 11
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);
	}
Ejemplo n.º 12
0
//***********************************************************************************************************
LRESULT CBCGPBaseVisualCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	if (message == WM_MOUSELEAVE)
	{
		m_bIsTracked = FALSE;
		OnMouseLeave();
	}
	else if (message == WM_ACTIVATEAPP && m_bIsPopup && wParam == 0)
	{
		PostMessage(WM_CLOSE);
	}
	
	return CStatic::WindowProc(message, wParam, lParam);
}
Ejemplo n.º 13
0
int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage(
    CFWL_Message* pMessage) {
  if (!pMessage)
    return 0;
  FX_DWORD dwMsgCode = pMessage->GetClassID();
  int32_t iRet = 1;
  switch (dwMsgCode) {
    case FWL_MSGHASH_SetFocus:
    case FWL_MSGHASH_KillFocus: {
      OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus);
      break;
    }
    case FWL_MSGHASH_Mouse: {
      CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
      FX_DWORD dwCmd = pMouse->m_dwCmd;
      switch (dwCmd) {
        case FWL_MSGMOUSECMD_LButtonDown: {
          OnLButtonDown(pMouse);
          break;
        }
        case FWL_MSGMOUSECMD_LButtonUp: {
          OnLButtonUp(pMouse);
          break;
        }
        case FWL_MSGMOUSECMD_MouseMove: {
          OnMouseMove(pMouse);
          break;
        }
        case FWL_MSGMOUSECMD_MouseLeave: {
          OnMouseLeave(pMouse);
          break;
        }
        default: {}
      }
      break;
    }
    default: { iRet = 0; }
  }
  if (dwMsgCode == FWL_MSGHASH_Key &&
      m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
    IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL);
    return pDelegate->OnProcessMessage(pMessage);
  }
  return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
Ejemplo n.º 14
0
bool CGUITextBox::HandleMouse( UINT uMsg, WPARAM wParam, LPARAM lParam ) {
	GetCursorPos(&m_MousePos);
	switch(uMsg){
		case WM_MOUSEMOVE:
			if(!m_bMouseOver && PtInBB(m_MousePos) && GetVisible()){
				OnMouseEnter();
			}if(m_bMouseOver && !PtInBB(m_MousePos)){
				OnMouseLeave();
			}
			if(m_bButtonDown)
				PlaceCaret(m_MousePos);
			break;
		case WM_LBUTTONDOWN:
			if(m_bMouseOver){
				if(!m_bButtonDown){
					if(GetFocus() || RequestFocus())
						m_bButtonDown=true;

				}
				PlaceCaret(m_MousePos);
				if( GetKeyState( VK_SHIFT ) >= 0 )
					SyncSelStart();
				return true;
			}
			break;
		case WM_LBUTTONUP:
			m_bButtonDown=false;
			break;
		case WM_MOUSEWHEEL:
			if(m_bMouseOver){
				if((int)wParam>0){//Scroll Up
					m_Scrolly=max((int)m_Scrolly-1, 0);
				}else{
					m_Scrolly=min((int)m_Scrolly+1, max((int)m_MaxCarety-((int)(m_height/13))+1, 0));
				}
				//m_Scrollx=min(max(m_Scrollx, 0), m_MaxCaretx+((int)(width/8)));
				SetTextDraw();
			}
			break; 
	}
	if(m_bMouseOver)
		return true;
	return false;
}
Ejemplo n.º 15
0
void IFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return;

  switch (pMessage->GetClassID()) {
    case CFWL_MessageType::SetFocus:
      OnFocusChanged(pMessage, true);
      break;
    case CFWL_MessageType::KillFocus:
      OnFocusChanged(pMessage, false);
      break;
    case CFWL_MessageType::Mouse: {
      CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
      switch (pMouse->m_dwCmd) {
        case FWL_MouseCommand::LeftButtonDown:
          OnLButtonDown(pMouse);
          break;
        case FWL_MouseCommand::LeftButtonUp:
          OnLButtonUp(pMouse);
          break;
        case FWL_MouseCommand::Move:
          OnMouseMove(pMouse);
          break;
        case FWL_MouseCommand::Leave:
          OnMouseLeave(pMouse);
          break;
        default:
          break;
      }
      break;
    }
    case CFWL_MessageType::Key: {
      if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
        m_pEdit->GetDelegate()->OnProcessMessage(pMessage);
        return;
      }
      break;
    }
    default:
      break;
  }

  IFWL_Widget::OnProcessMessage(pMessage);
}
Ejemplo n.º 16
0
void CFWL_PushButton::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return;
  if (!IsEnabled())
    return;

  switch (pMessage->GetType()) {
    case CFWL_Message::Type::SetFocus:
      OnFocusChanged(pMessage, true);
      break;
    case CFWL_Message::Type::KillFocus:
      OnFocusChanged(pMessage, false);
      break;
    case CFWL_Message::Type::Mouse: {
      CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
      switch (pMsg->m_dwCmd) {
        case FWL_MouseCommand::LeftButtonDown:
          OnLButtonDown(pMsg);
          break;
        case FWL_MouseCommand::LeftButtonUp:
          OnLButtonUp(pMsg);
          break;
        case FWL_MouseCommand::Move:
          OnMouseMove(pMsg);
          break;
        case FWL_MouseCommand::Leave:
          OnMouseLeave(pMsg);
          break;
        default:
          break;
      }
      break;
    }
    case CFWL_Message::Type::Key: {
      CFWL_MessageKey* pKey = static_cast<CFWL_MessageKey*>(pMessage);
      if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown)
        OnKeyDown(pKey);
      break;
    }
    default:
      break;
  }
  CFWL_Widget::OnProcessMessage(pMessage);
}
Ejemplo n.º 17
0
bool CGUIHorizontalScrollBar::HandleMouse( UINT uMsg, WPARAM wParam, LPARAM lParam ) {
	POINT MousePos;
	GetCursorPos(&MousePos);
	switch(uMsg){
		case WM_MOUSEMOVE:
			
			if(!m_bMouseOver && PtInBB(MousePos) && GetVisible()){
				OnMouseEnter();
			}if(m_bMouseOver && !PtInBB(MousePos)){
				OnMouseLeave();
			}
			if(m_bButtonDown && m_bMouseOver){
				Scroll((MousePos.x-m_mouseStart.x)*(m_maxValue/(m_maxBarWidth-m_barWidth)));
				m_mouseStart=MousePos;
			}
			//if(Parent && ((CGUIWindow*)Parent)->GetFocusElement()==this)
				//return true;

			break;
		case WM_LBUTTONDOWN:
			if(m_bMouseOver){
				if(GetFocus() || RequestFocus()){
					m_bButtonDown=true;
					m_mouseStart=MousePos;
				}
				return true;
			}
			break;
		case WM_LBUTTONUP:
			if(m_bButtonDown && m_bMouseOver){
				OnHotkey();
				m_bButtonDown=false; 
				return true;
			}
			m_bButtonDown=false; 
			break;
	}
	if(m_bMouseOver)
		return true;
	return false;
}
Ejemplo n.º 18
0
XU32 XHTMLButton::Handle(XU32 nOpera, XU32 pData1, XU32 pData2)
{
	if(!IsVisiable()) return 0;
	switch(nOpera)
	{
	case XDO_SELECT:
	      return (XU32)XDomItem::SelectItem((SELECTMARK*)pData1);
	case XDO_HITTEST:
		{
		  XRect rect(m_nPosX,m_nPosY,m_nPosX+m_nWidth,m_nPosY+m_nHeight);
		  if(rect.PtInRect(pData1,pData2))
			  return (XU32)this;
		}
		 return 0;
	case XDO_GET_STYLE:
		{
			XU32 s=XDomBlock::Handle(nOpera,pData1,pData2)|DOM_SELECTABLE;
			return s;
		}break;
	case XDO_PAINT:
		 return Paint((DRAWCONTEXT*)pData1);
	case XDO_EVENT_ONKEYDOWN:
		 if(pData1!=XK_RETURN) break;
	case XDO_EVENT_ONMOUSEUP:
		 return OnMouseUp((XEVENTDATA*)pData2);
	case XDO_EVENT_ONMOUSEOUT:
		 return OnMouseLeave((XEVENTDATA*)pData2);
	case XDO_EVENT_ONMOUSEDOWN:
		 return OnMouseDown(*(XPoint*)pData1,(XEVENTDATA*)pData2);
//	case XDO_ADD_CHILD:
//		 return XDomNode::Handle(nOpera,pData1,pData2);
//	case XDO_GET_STYLE:
//		 return XDomInput::Handle(nOpera,pData1,pData2)|DOM_NODE;
	case XDO_LAYEROUT_CELLS:
		 return LayeroutCells((DRAWCONTEXT*)pData1,(CELLDATA*)pData2);
	case XDO_LAYEROUT_CELL:
		 return LayeroutCell((DRAWCONTEXT*)pData1,(CELLDATA*)pData2);
	}
	return XDomBlock::Handle(nOpera,pData1,pData2);
}
Ejemplo n.º 19
0
void UIBase::Input(){

    int key = InputManager::GetInstance().GetMouseMousePressKey();

    Point mpos = InputManager::GetInstance().GetMouse();
    if (IsInside(mpos.x,mpos.y)){

        if (key != 0 && OnMousePress){
            OnMousePress(this,key,mpos);
        }
        key = InputManager::GetInstance().GetMouseMouseReleaseKey();
        if (key != 0 && OnMouseRelease){
            OnMouseRelease(this,key,mpos);
        }
        if (!MouseInside){
            if (OnMouseEnter){
                OnMouseEnter(this,mpos);
            }
            MouseInside = true;
        }
    }else{
        if (MouseInside){
            if (OnMouseLeave){
                OnMouseLeave(this,mpos);
            }
            MouseInside = false;
        }
    }

    key = InputManager::GetInstance().IsAnyKeyPressed();
    if (key != -1 && OnKeyPress){
        OnKeyPress(this,key);
    }

    /*for (unsigned i = 0; i < Components.size(); ++i) {
        if (!Components[i]->IsDead()){
            Components[i]->Input();
        }
    }*/
}
Ejemplo n.º 20
0
bool CMouseLeaveTrack::OnMessage(UINT Msg,WPARAM wParam,LPARAM lParam)
{
	switch (Msg) {
	case WM_MOUSEMOVE:
		OnMouseMove();
		return true;

	case WM_MOUSELEAVE:
		OnMouseLeave();
		return true;

	case WM_NCMOUSEMOVE:
		OnNcMouseMove();
		return true;

	case WM_NCMOUSELEAVE:
		OnNcMouseLeave();
		return true;
	}

	return false;
}
Ejemplo n.º 21
0
	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_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_MOUSEHOVER:	lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSELEAVE:		lRes = OnMouseLeave(uMsg,wParam,lParam,bHandled);	break;
		default:				bHandled = FALSE; break;
		}
		if (bHandled) return lRes;

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

		if (m_PaintManager.MessageHandler(uMsg, wParam, lParam, lRes))
			return lRes;
		return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	}
Ejemplo n.º 22
0
bool CGUIHorizontalScrollBar::WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ){

	if(!m_bEnabled)
		return false;

	if(!m_bButtonDown && (m_pLeft->WndProc(hWnd, uMsg, wParam, lParam) || m_pRight->WndProc(hWnd, uMsg, wParam, lParam))){
		OnMouseLeave();
		return true;
	}

	switch(uMsg){
		// Keyboard messages
        case WM_KEYDOWN:
        case WM_SYSKEYDOWN:
        case WM_KEYUP:
        case WM_SYSKEYUP:
			return HandleKeyboard( uMsg, wParam, lParam );
		//Mouse Messages
				case WM_MOUSEMOVE:
        case WM_LBUTTONDOWN:
        case WM_LBUTTONUP:
        case WM_MBUTTONDOWN:
        case WM_MBUTTONUP:
        case WM_RBUTTONDOWN:
        case WM_RBUTTONUP:
        case WM_XBUTTONDOWN:
        case WM_XBUTTONUP:
        case WM_LBUTTONDBLCLK:
        case WM_MBUTTONDBLCLK:
        case WM_RBUTTONDBLCLK:
        case WM_XBUTTONDBLCLK:
        case WM_MOUSEWHEEL:
			return HandleMouse( uMsg, wParam, lParam );
		default:
			return false;
	}
}
void CTuotuoCategoryCtrl::OnLButtonUp(UINT /* nFlags */, CPoint ptCursor)
{
	if (::GetCapture() != m_hWnd)
		return;
	::ReleaseCapture();

	// 检查鼠标是否已经移出了tab栏
	RECT rcClient;
	GetClientRect(&rcClient);
	if (!::PtInRect(&rcClient, ptCursor))
	{
		OnMouseLeave();
		return;
	}

	if (m_ePosition == CatePos_TabItemClose)
	{
		CategoryPosition pos;
		CCategoryItem *pItem = HitTest(ptCursor, &pos);
		if (pItem == m_pHotItem && pos == CatePos_TabItemClose)
		{
			//m_bClosingTabs = true;
			FS()->MDI()->CloseCategory(pItem);
		}
	}
	else if (m_ePosition == CatePos_ScrollLLeftBtn)
	{
		SetScrollDir(0);
		ScrollToEnsureVisibleAfterScroll(true);
	}
	else if (m_ePosition == CatePos_ScrollRRightBtn)
	{
		SetScrollDir(0);
		ScrollToEnsureVisibleAfterScroll(false);
	}
	SetMousePosAndStatus(m_ePosition, Btn_MouseOut);
}
Ejemplo n.º 24
0
LRESULT CDreamSkinTab::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	LRESULT nResult = ERROR_SUCCESS;

	switch(message)
	{
	case WM_ERASEBKGND:
		break;
	case WM_MOUSELEAVE:
		nResult = OnMouseLeave();
		break;
	case WM_MOUSEMOVE:
		nResult = OnMouseMove(wParam, MAKEPOINTS(lParam));
		break;
	case WM_PAINT:
		nResult = OnPaint();
		break;
	default:
		nResult = CDreamSkinWindow::DefWindowProc(message, wParam, lParam);
	}

	return nResult;

}
Ejemplo n.º 25
0
int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return 0;
  int32_t iRet = 1;
  FX_DWORD dwMsgCode = pMessage->GetClassID();
  if (dwMsgCode == FWL_MSGHASH_Mouse) {
    CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
    FX_DWORD dwCmd = pMsg->m_dwCmd;
    switch (dwCmd) {
      case FWL_MSGMOUSECMD_LButtonDown: {
        OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
        break;
      }
      case FWL_MSGMOUSECMD_LButtonUp: {
        OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
        break;
      }
      case FWL_MSGMOUSECMD_MouseMove: {
        OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
        break;
      }
      case FWL_MSGMOUSECMD_MouseLeave: {
        OnMouseLeave();
        break;
      }
      default: { iRet = 0; }
    }
  } else if (dwMsgCode == FWL_MSGHASH_MouseWheel) {
    CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage);
    OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX,
                 pMsg->m_fDeltaY);
  } else {
    iRet = 0;
  }
  return iRet;
}
Ejemplo n.º 26
0
void UUserWidget::NativeOnMouseLeave( const FPointerEvent& InMouseEvent )
{
	OnMouseLeave( InMouseEvent );
}
Ejemplo n.º 27
0
void Widget::HandleEvent( const sf::Event& event ) {
	if( !IsVisible() ) {
		return;
	}

	// Set widget active in context.
	Context::Get().SetActiveWidget( shared_from_this() );

	Container::Ptr parent( m_parent.lock() );

	switch( event.Type ) {
		case sf::Event::MouseMoved:
			// Check if pointer inside of widget's allocation.
			if( GetAllocation().Contains( static_cast<float>( event.MouseMove.X ), static_cast<float>( event.MouseMove.Y ) ) ) {
				// Check for enter event.
				if( m_mouse_in == false ) {
					m_mouse_in = true;
					OnMouseEnter();
					HandleMouseEnter( event.MouseMove.X, event.MouseMove.Y );
				}

				OnMouseMove();
			}
			else if( m_mouse_in == true ) { // Check for leave event.
				m_mouse_in = false;
				OnMouseLeave();
				HandleMouseLeave( event.MouseMove.X, event.MouseMove.Y );
			}

			HandleMouseMoveEvent( event.MouseMove.X, event.MouseMove.Y );
			break;

		case sf::Event::MouseButtonPressed:
			// If a mouse button has already been pressed for this widget, drop further
			// presses. This maybe needs changing, but up to now, I can't think of any
			// cases where it would be useful to have such a functionality.
			if( m_mouse_button_down == -1 ) {
				if( m_mouse_in ) {
					m_mouse_button_down = event.MouseButton.Button;

					HandleMouseButtonEvent( event.MouseButton.Button, true, event.MouseButton.X, event.MouseButton.Y );
					OnMouseButtonPress();
				}
			}

			break;

		case sf::Event::MouseButtonReleased:
			// Only process when mouse button has been clicked inside the widget before.
			if( m_mouse_button_down == event.MouseButton.Button ) {
				m_mouse_button_down = -1;

				// When released inside the widget, the event can be considered a click.
				if( m_mouse_in ) {
					HandleMouseClick( event.MouseButton.Button, event.MouseButton.X, event.MouseButton.Y );
				}

				OnMouseButtonRelease();
			}

			HandleMouseButtonEvent( event.MouseButton.Button, false, event.MouseButton.X, event.MouseButton.Y );
			break;

		case sf::Event::KeyPressed:
			if( GetState() == Active ) {
				// TODO: Delegate event too when widget's not active?
				HandleKeyEvent( event.Key.Code, true );
				OnKeyPress();
			}

			break;

		case sf::Event::KeyReleased:
			if( GetState() == Active ) {
				// TODO: Delegate event too when widget's not active?
				HandleKeyEvent( event.Key.Code, false );
				OnKeyRelease();
			}
			break;

		case sf::Event::TextEntered:
			if( GetState() == Active ) {
				// TODO: Delegate event too when widget's not active?
				HandleTextEvent( event.Text.Unicode );
				OnText();
			}
			break;

		default:
			break;
	}
}
Ejemplo n.º 28
0
BOOL CBSObject::OnEraseBkgnd(CDC* pDC)
{
    BOOL bRet = TRUE;

    RECT rt;
    GetWindowRect(&rt);
    ScreenToClient(&rt);

    HDC hDC = NULL;
    
	if (m_bHasPaintDC)
	{
		hDC = m_hPaintDC;
	} 
    else
    {
        hDC = pDC->GetSafeHdc();
    }

    if (m_bIsUseBGColor)
    {
        FillRect(hDC, PAINTDC(rt), m_crBackgroundColor);
    }

    int iState = GetState();

    if (m_bIsEnable && (FALSE == m_bLastState))
    {
        OnMouseLeave();
        m_bLastState = TRUE;
    }

    if (m_piPanelBG[iState] == NULL)
    {        
        if (!m_bIsUseBGPicRect)
        {   
            if (m_uiBGPictureIDs[iState] != 0)
            {
                m_piPanelBG[iState] = LoadImage(m_uiBGPictureIDs[iState], AfxGetInstanceHandle());
            }
			else if (!m_csGBPicture[iState].IsEmpty())
			{
				m_piPanelBG[iState] = LoadImage(m_csGBPicture[iState], AfxGetInstanceHandle());
			}
            else
            {
                m_piPanelBG[iState] = LoadImage(m_uiBGPictureIDs[BS_NORMAL], AfxGetInstanceHandle());
            }
        }
        else
        {
            if (m_uiBGPictureIDs[iState] != 0)
            {
                m_piPanelBG[iState] = LoadImage(m_uiBGPictureIDs[iState], AfxGetInstanceHandle());
            }
			else if (!m_csGBPicture[iState].IsEmpty())
			{
				m_piPanelBG[iState] = LoadImage(m_csGBPicture[iState], AfxGetInstanceHandle());
            }
            else
            {
                m_piPanelBG[iState] = LoadImage(m_uiBGPictureIDs[BS_NORMAL], AfxGetInstanceHandle());
            }
        }    
    }

    if (m_piPanelBG[iState] != NULL)
    {
        if (!m_bIsUseBGPicRect)
        {
            DrawPNG(hDC, PAINTDC(rt), m_piPanelBG[iState]);
        }
        else
        {
            DrawPNG(hDC, PAINTDC(m_rtBGPicRect), m_piPanelBG[iState]);
        }
    }
    
    return bRet;
}
Ejemplo n.º 29
0
void GUIControl::Process()
{
	__super::Process();

	if(IsVisible() && IsEnabled())
	{
		if(PointInBox(mouseX, mouseY, GetX(), GetY(), GetWidth(), GetHeight()))
		{

			int cursor = GetLastCursorPos();
			SetLastCursorPos(1); // mouse is in

			// here
			// 0 - init
			// 1 - mouse was IN control
			// 2 - mouse was OUT control

			if(cursor == 0 || cursor == 2)
			{
				OnMouseEnter();
			}
			else
			{
				OnMouseMove();
			}

			if(mouse[0] || mouse[1])
			{
				if(GetLastPressState() == 0)
				{
					OnMouseDown();

					if(mouse[0])
						SetLastPressState(1);
					else if(mouse[1])
						SetLastPressState(2);
				}
			}
			else
			{
				int press_state = GetLastPressState();
				SetLastPressState(0);

				// here
				// 0 - init
				// 1 - left mouse down
				// 2 - right mouse down
				// 3 - all up

				if(press_state == 1)
				{
					OnLeftClick();
					OnMouseUp();
				}
				else if(press_state == 2)
				{
					OnRightClick();
					OnMouseUp();
				}
			}
		}
		else
		{
			int cursor = GetLastCursorPos();
			SetLastCursorPos(2); // mouse is out

			if(cursor == 1)
			{
				OnMouseLeave();
				SetLastPressState(0);
			}
		}


		// TODO:
		// fix it somehow :(
		if(IsFocused())
		{
			static UCHAR count = 0;
			int delay = 0;
			for(UCHAR i = 0; i < 255; i++)
			{			
				if(GetAsyncKeyState(i) & 0x8000)
				{
					count++;
					static int prev;
					count == 1 ? delay = KEY_FIRST_DELAY : delay = KEY_DELAY;

					if(current_time - prev >= delay)
					{
						if(i != VK_SHIFT)
						{
							OnKeyDown(i);
							prev = current_time;
						}
					}
				}
			}
		}
	}
}
Ejemplo n.º 30
0
LRESULT CSkinScrollBar::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	BOOL bMsgHandled = FALSE;

	switch (uMsg)
	{
// 	case WM_PAINT:
// 		OnPaint((HDC)wParam);
// 		break;

	case WM_LBUTTONDOWN:
		{
			CPoint point = _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
			if (IsVisible() && IsEnabled() && ::PtInRect(&m_rcScrollBar, point))
			{
				OnLButtonDown((UINT)wParam, point);
				bMsgHandled = TRUE;
			}
		}
		break;

	case WM_LBUTTONUP:
		{
			if (IsVisible() && IsEnabled() && IsCaptured())
			{
				OnLButtonUp((UINT)wParam, _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
				bMsgHandled = TRUE;
			}
		}
		break;

	case WM_MOUSEMOVE:
		{
			CPoint point = _WTYPES_NS::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
			if (IsVisible() && IsEnabled() && (IsCaptured() || IsMouseTracking() || ::PtInRect(&m_rcScrollBar, point)))
			{
				OnMouseMove((UINT)wParam, point);
				bMsgHandled = TRUE;
			}
		}
		break;

	case WM_MOUSELEAVE:
		{
			if (IsMouseTracking())
			{
				OnMouseLeave();
				bMsgHandled = TRUE;
			}
		}
		break;

	case WM_TIMER:
		{
			UINT_PTR nIDEvent = (UINT_PTR)wParam;
			if (nIDEvent == m_dwTimerId)
			{
				OnTimer(nIDEvent);
				bMsgHandled = TRUE;
			}
		}
		break;
	}

	return bMsgHandled;
}