Esempio n. 1
0
bool CUIDialogWnd::IR_OnMouseWheel (int direction)
{
	if(!IR_process()) return false;
	Fvector2 pos = GetUICursor()->GetPos();

	if(direction>0)
		OnMouse(pos.x,pos.y,WINDOW_MOUSE_WHEEL_UP);
	else
		OnMouse(pos.x,pos.y,WINDOW_MOUSE_WHEEL_DOWN);

	return true;
}
Esempio n. 2
0
// Window Message handler. Interprets windows messages and dispatches
// mouse/keyboard input to the OnMouse/OnKeyboard functions.
LRESULT FxPlayerTiny::MemberWndProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;

        case WM_SETCURSOR:
            if (LOWORD(lParam)==HTCLIENT)
            {
                ::SetCursor(::LoadCursor(0, IDC_ARROW));
                return 0;
            }
            break;
          
        // *** The following logic is used to route input to GFxPlayer.
        
        case WM_MOUSEMOVE:
            OnMouse(GFxEvent::MouseMove, 0, LOWORD(lParam), HIWORD(lParam));
            return 0;
        case WM_LBUTTONDOWN:
            ::SetCapture(hWnd);
            OnMouse(GFxEvent::MouseDown, 0, LOWORD(lParam), HIWORD(lParam));
            return 0;
        case WM_LBUTTONUP:
            ::ReleaseCapture();
            OnMouse(GFxEvent::MouseUp, 0, LOWORD(lParam), HIWORD(lParam));
            return 0;

        case WM_KEYDOWN:
            OnKey((UInt)wParam, 1);
            return 0;
        case WM_KEYUP:          
            OnKey((UInt)wParam, 0);
            return 0;
        case WM_CHAR:
            {
                UInt32 wcharCode = (UInt32)wParam;
                if (pMovie && wcharCode) 
                {
                    GFxCharEvent event(wcharCode);
                    pMovie->HandleEvent(event);
                }
            }
            break;
    }

    return DefWindowProc(hWnd, msg, wParam, lParam);
}
Esempio n. 3
0
void View::MouseDown(int x, int y, int info)
{
	if (!IsLeftButton(info))
		return;

	if (_selected != NULL)
		if (_selected->HitTest(x, y))
		{
			_selected->OnMouseDown(x, y, info);
			
			OnMouse(_selected->GetParamIndex(), 
				MOUSE_DOWN, 
				x - _selected->GetX(), 
				y - _selected->GetY(), info);

			if (_selected->_repaint)
				Redraw(_selected);
			return;
		}

	ControlPtr newsel = NULL;
	for (ClstPtr c = _cl.begin(); c != _cl.end(); c++)
		if ((*c)->HitTest(x, y))
		{   
			newsel = (*c);
			break;
		}

	if (newsel != _selected 
		&& _selected != NULL)
	{
		_selected->OnLostFocus();
		if (_selected->_repaint)
			Redraw(_selected);			
	}

	_selected = newsel;
	if (_selected != NULL)
	{
		_selected->OnMouseDown(x, y, info);

		OnMouse(_selected->GetParamIndex(), 
			MOUSE_DOWN, 
				x - _selected->GetX(), 
				y - _selected->GetY(), info);

		if (_selected->_repaint)
			Redraw(_selected);
	}
}
Esempio n. 4
0
bool CUIDialogWnd::IR_OnKeyboardRelease(int dik)
{
	if(!IR_process()) return false;
	
	//mouse click
	if(dik==MOUSE_1 || dik==MOUSE_2 || dik==MOUSE_3)
	{
		Fvector2 cp = GetUICursor()->GetPos();
		EUIMessages action = (dik==MOUSE_1)?WINDOW_LBUTTON_UP :(dik==MOUSE_2)?WINDOW_RBUTTON_UP:WINDOW_CBUTTON_UP;
		if (OnMouse(cp.x, cp.y, action))
            return true;
	}

	if (OnKeyboard(dik,	WINDOW_KEY_RELEASED))
		return true;

	if( !StopAnyMove() && g_pGameLevel ){
		CObject* O = Level().CurrentEntity();
		if( O ){
			IInputReceiver*		IR	= smart_cast<IInputReceiver*>( smart_cast<CGameObject*>(O) );
			if (!IR)
				return			(false);
			IR->IR_OnKeyboardRelease(get_binded_action(dik));
		}
	}
	return false;
}
Esempio n. 5
0
void menu_Mouse(int x, int y, int buttons)
{
	for(int i = g_itemStack.size() - 1; i >= 0; --i)
	{
		auto ptr = g_itemStack[i];
		if(ptr->OnMouse(x, y , buttons))
			break;
	}
}
Esempio n. 6
0
// Start.Real Wolf.06.11.14.
void CUITrackBar::Update()
{	
	if (m_bState && !pInput->iGetAsyncBtnState(0) )
		OnMouse(0.f, 0.f, WINDOW_LBUTTON_UP);

	if (m_bState)
		UpdatePosRelativeToMouse();

	CUIWindow::Update();
}
Esempio n. 7
0
void CUIListWnd::Update()
{
	if(m_bUpdateMouseMove)
	{
		OnMouse(cursor_pos.x, cursor_pos.y, WINDOW_MOUSE_MOVE);
		m_bUpdateMouseMove = false;
	}

	inherited::Update();
	if(m_ActiveBackgroundFrame)
		m_ActiveBackgroundFrame->Update();
}
Esempio n. 8
0
//
// Deal with new capture lost event
//
void ToolManager::OnCaptureLost( wxMouseCaptureLostEvent & event )
{
   // Can't do anything if we're not dragging.  This also prevents
   // us from intercepting events that don't belong to us from the
   // parent since we're Connect()ed to a couple.
   if( !mDragWindow )
   {
      event.Skip();
      return;
   }

   // Simulate button up
   wxMouseEvent e(wxEVT_LEFT_UP);
   e.SetEventObject(mParent);
   OnMouse(e);
}
Esempio n. 9
0
void View::MouseUp(int x, int y, int info)
{
	if (_selected == NULL)
		return;

	_selected->OnMouseUp(x, y, IsLeftButton(info));

	OnMouse(_selected->GetParamIndex(), 
		MOUSE_UP, 
				x - _selected->GetX(), 
				y - _selected->GetY(), info);

	if (_selected->_repaint)
		Redraw(_selected);
	//_selected = NULL;   
}
Esempio n. 10
0
void View::MouseMove(int x, int y, int info)
{
	if (IsLeftButton(info) && _selected != NULL)
	{
		if (_selected != NULL)
		{
			_selected->OnMouseMove(x, y, info);

			OnMouse(_selected->GetParamIndex(), 
				MOUSE_MOVE, 
				x - _selected->GetX(), 
				y - _selected->GetY(), info);


			if (_selected->_repaint)
				Redraw(_selected);
		}
	}
}
bool CWidgetDisplay::HandleEvent(SDL_Event vEvent, CPaintingParms* pPaintingParms)
{
   // Handle keyboard and mouse events
   switch (vEvent.type)
   {
      case SDL_KEYDOWN:
      //case SDL_KEYUP:
         OnKey(vEvent, pPaintingParms);
         break;
      case SDL_MOUSEMOTION:
      case SDL_MOUSEBUTTONDOWN:
      case SDL_MOUSEBUTTONUP:
         OnMouse(vEvent, pPaintingParms);
         break;

      default:
         break;
   }

   return true;
}
Esempio n. 12
0
bool CUIDialogWnd::IR_OnMouseMove(int dx, int dy)
{
	if(!IR_process()) return false;
	
	if (GetUICursor()->IsVisible())
	{ 
		GetUICursor()->MoveBy(float(dx), float(dy));
		Fvector2 cPos = GetUICursor()->GetPos();
		OnMouse(cPos.x, cPos.y , WINDOW_MOUSE_MOVE);
	}
	else if( !StopAnyMove() && g_pGameLevel ){
		CObject* O = Level().CurrentEntity();
		if( O ){
			IInputReceiver*		IR	= smart_cast<IInputReceiver*>( smart_cast<CGameObject*>(O) );
			if (!IR)
				return			(false);

			IR->IR_OnMouseMove(dx,dy);
		}
	};

	return true;
}
Esempio n. 13
0
/*
 * cPanelSurfaceRightDown : Right Click on the panel, display the popup menu
 */
void cPanelSurface::cPanelSurfaceRightDown(wxMouseEvent& event) {
	
	OnMouse( event );

	// No unit in selected cell, display the map menu
	if(!(*mMapCell)->hasUnit() && !(*mMapCell)->hasStructure()) {
		word tile = g_DuneEngine->scenarioGet()->mapGet()->mapTileTypeGet( (*mMapCell)->mapIndexGet() );

		if( tile == 4 || tile == 5 || tile == 7) {
			return;
		}

		PopupMenu( mPopupTerrain );
		return;
	}

	if( (*mMapCell)->hasStructure() ) {

		PopupMenu( mPopupStructure );
		return;

	} else if( (*mMapCell)->hasUnit() ) {
		// Reset orders menu
		menuOrdersReset();

		// Check the action thats in use by the unit
		cUnit *unit = (cUnit*) (*mMapCell)->objectGet();
		word actionID = unit->actionGet();
		wxMenuItem		*item = mPopupUnit->FindItem(ID_MNU_ORDER_2000 + actionID);
		item->Check();

		// Show the unit menu
		PopupMenu( mPopupUnit );
	}

}
LRESULT LayeredWindowBase::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
	case WM_CREATE:
		//SetTimer(hWnd,1,100,NULL);
		if (Initialize())
			return NULL;
		else
			return -1;

	case WM_SIZE:
		{
			UINT width = LOWORD(lParam);
			UINT height = HIWORD(lParam);
			
			//phLyricsScrollWindow->OnResize(width, height);
			if (width!=0 && height!=0)
			{
				if (SetSize(width,height))
				{
					m_pWin.pAPI->OnSize(width,height);
					RECT rect;
					GetWindowRect(m_hWnd,&rect);
					m_info.m_windowPosition.x = rect.left;
					m_info.m_windowPosition.y = rect.top;
					RedrawWindow(m_hWnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE);
				}
				printf("WM_SIZE : %d %d -> %d %d\n",width,height,m_pWin.pAPI->GetWidth(),m_pWin.pAPI->GetHeight());

			}

			


			//printf("onSize %d %d\n",width,height);
		}
		return 0;

	case WM_GETMINMAXINFO: //window size/position is going to change
		{
			MINMAXINFO* pInfo = (MINMAXINFO*)lParam;
			pInfo->ptMinTrackSize.x = (long)m_info.m_minsize.cx; //apply custom min width/height
			pInfo->ptMinTrackSize.y = (long)m_info.m_minsize.cy;
		}

		return 0;

	case WM_WINDOWPOSCHANGING:
	case WM_WINDOWPOSCHANGED:
		{
			RECT rect;
			GetWindowRect(m_hWnd,&rect);
			m_info.m_windowPosition.x = rect.left;
			m_info.m_windowPosition.y = rect.top;
		}
		return 0;

	case WM_ACTIVATE:
		UpdateLayeredWindow();
		if (hWnd == m_hWnd)
		{
			
			
				//BeforeRender();
				//m_pWin.pAPI->BeginDraw();
				//Render();
				//m_info.Update(m_hWnd,m_pWin.pAPI->GetDC());
				//m_pWin.pAPI->ReleaseDC();
				//m_pWin.pAPI->EndDraw();
				//AfterRender();
		}
		break;

	case WM_TIMER:
	case WM_PAINT:
	case WM_DISPLAYCHANGE:
		{
			//printf("Render!\n");
			//if (m_vRenderCBList.size())
			//{
			//	//((*m_pRanderCBClass).*m_pRanderCBFunc)();
			//	for (int i=0;i<m_vRenderCBList.size();i++)
			//	{
			//		(m_vRenderCBList[i].pClass->*(m_vRenderCBList[i].pCBFunc))();
			//		//(m_pRanderCBClass->*m_pRanderCBFunc)();
			//	}

			//	
			//}
			//else
			if (hWnd == m_hWnd)
			{
				BeforeRender();
				m_pWin.pAPI->BeginDraw();
				Render();
				m_info.Update(m_hWnd,m_pWin.pAPI->GetDC());
				m_pWin.pAPI->ReleaseDC();
				m_pWin.pAPI->EndDraw();
				AfterRender();
			}


		}
		return 0;

	case WM_DESTROY:
		{
			Uninitialize();
			PostQuitMessage(0);
		}
		return 0;
	case WM_COMMAND:
		break;
	case WM_KEYDOWN:
		//printf("%X key down\n",wParam);
		OnKeyboard(wParam,true);
		break;

	case WM_KEYUP:
		//printf("%X key up\n",wParam);
		OnKeyboard(wParam,false);
		break;

	case WM_MOUSEWHEEL:
	case WM_MOUSEMOVE:
	case WM_LBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_LBUTTONDBLCLK:
	case WM_RBUTTONDOWN:
	case WM_RBUTTONUP:
	case WM_RBUTTONDBLCLK:
	case WM_MBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_MBUTTONDBLCLK:
		{
			
			int x=(short)LOWORD(lParam);
			int y=(short)HIWORD(lParam);
			OnMouse(uMsg,x,y,GET_KEYSTATE_WPARAM(wParam),GET_WHEEL_DELTA_WPARAM(wParam));
			//printf("mouse event : %x @ (%d,%d)\n",uMsg,x,y);
		}
		
		break;

	case WM_NCMOUSEMOVE     :
	case WM_NCLBUTTONDOWN   :
	case WM_NCLBUTTONUP     :
	case WM_NCLBUTTONDBLCLK :
	case WM_NCRBUTTONDOWN   :
	case WM_NCRBUTTONUP     :
	case WM_NCRBUTTONDBLCLK :
	case WM_NCMBUTTONDOWN   :
	case WM_NCMBUTTONUP     :
	case WM_NCMBUTTONDBLCLK :
		{
			int x=(short)LOWORD(lParam);
			int y=(short)HIWORD(lParam);
			OnMouse(uMsg,x,y,0,0);
			//printf("NCmouse event : %x @ (%d,%d)\n",uMsg,x,y);
		}

		break;

	case WM_NCHITTEST:
		{
			//printf("Hit Test : %d\n",DefWindowProc(
			//	//hwnd,
			//	message,
			//	wParam,
			//	lParam
			//	//dwMsgMapID
			//	));
			//break;
			/*
			#define BF_LEFT         0x0001
			#define BF_TOP          0x0002
			#define BF_RIGHT        0x0004
			#define BF_BOTTOM       0x0008
			*/
			
			int x=(short)LOWORD(lParam);
			int y=(short)HIWORD(lParam);
			unsigned char type = 0;
			if (x-m_info.m_windowPosition.x<m_info.m_border)
				type|=BF_LEFT;
			if (y-m_info.m_windowPosition.y<m_info.m_border)
				type|=BF_TOP;
			if (m_info.m_windowPosition.x+m_info.m_size.cx-x<m_info.m_border)
				type|=BF_RIGHT;
			if (m_info.m_windowPosition.y+m_info.m_size.cy-y<m_info.m_border)
				type|=BF_BOTTOM;
			//printf("WM_NCHITTEST (%d,%d): pos (%d,%d)  size (%d,%d)  border %d\n",x,y,m_info.m_windowPosition.x,m_info.m_windowPosition.y,m_info.m_size.cx,m_info.m_size.cy,m_info.m_border);

			switch (type)
			{
			case BF_LEFT:
				return HTLEFT;
				break;
			case BF_RIGHT:
				return HTRIGHT;
				break;
			case BF_TOP:
				return HTTOP;
				break;
			case BF_BOTTOM:
				return HTBOTTOM;
				break;

			case BF_LEFT|BF_TOP:
				return HTTOPLEFT;
				break;
			case BF_LEFT|BF_BOTTOM:
				return HTBOTTOMLEFT;
				break;
			case BF_RIGHT|BF_TOP:
				return HTTOPRIGHT;
				break;
			case BF_RIGHT|BF_BOTTOM:
				return HTBOTTOMRIGHT;
				break;

			default:
				return HTCAPTION;


			}


			
			//printf("hit test : %d\n",res);
			
		}
		return 0;

	case WM_MOVING:
		{
			RECT *pRect = (RECT*)lParam;
			//printf("%d %d\n",pRect->left,pRect->top);
			m_info.m_windowPosition.x = pRect->left;
			m_info.m_windowPosition.y = pRect->top;
		}
		return 0;

	case WM_SIZING:
		{
			RECT *pRect = (RECT*)lParam;
			UINT width = pRect->right-pRect->left;
			UINT height = pRect->bottom-pRect->top;
			bool isMove = true;
			printf("%d %d\n",width,height);
			if (SetSize(width,height))
			{
				m_pWin.pAPI->OnSize(width,height);
				m_info.m_windowPosition.x = pRect->left;
				m_info.m_windowPosition.y = pRect->top;
				printf("WM_SIZING : %d %d -> %d %d\n",width,height,m_pWin.pAPI->GetWidth(),m_pWin.pAPI->GetHeight());
				//Render();
//				m_info.Update(m_hWnd,m_pWin.pAPI->GetDC());
				//m_pWin.pAPI->ReleaseDC();

				UpdateLayeredWindow();
				//m_pWin.pAPI->BeginDraw();
				//Render();
				//m_info.Update(m_hWnd,m_pWin.pAPI->GetDC());
				//m_pWin.pAPI->ReleaseDC();
				//m_pWin.pAPI->EndDraw();
				//RedrawWindow(m_hWnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE);
			}
			
		}
		return 0;

	default:
		break;
			//printf("msg %X\n",message);
	}
	// Call default window proc if we haven't handled the message
	return DefWindowProc(hWnd,uMsg,wParam,lParam);
}