Exemplo n.º 1
0
bool Widget::TriggerClick(bool handled)
{
	HandleClick();
	if (!handled) handled = onClick.emit();
	if (GetContainer()) handled = GetContainer()->TriggerClick(handled);
	return handled;
}
Exemplo n.º 2
0
bool Widget::TriggerClick(bool emit)
{
	HandleClick();
	if (emit) emit = !onClick.emit();
	if (GetContainer()) GetContainer()->TriggerClick(emit);
	return !emit;
}
Exemplo n.º 3
0
void HandleEvents()
{
	SDL_Event event;
	while(SDL_PollEvent(&event))
	{
		switch(event.type)
		{
		case SDL_QUIT:
			g_quit = true;
			break;
		
		case SDL_KEYDOWN:
			HandleKeyDown(event.key.keysym.sym);
			break;

		case SDL_MOUSEMOTION:
			g_mouseX = event.button.x;
			g_mouseY = event.button.y;
			break;
			
		case SDL_MOUSEBUTTONDOWN:
			g_clickX = event.button.x;
			g_clickY = event.button.y;

			HandleClick( g_clickX, g_clickY );
			
			break;

		default:
			break;
		}
	}
}
GameOverMenu::MenuResult  GameOverMenu::GetMenuResponse(sf::RenderWindow& window)
{
    //EITHER get the button clicked on or use the exit button to exit the menu

    sf::Event menuEvent;
    while(true)
        while(window.pollEvent(menuEvent))
        {
            if(menuEvent.type == sf::Event::MouseButtonPressed)
                return HandleClick(menuEvent.mouseButton.x, menuEvent.mouseButton.y);

            if(menuEvent.type == sf::Event::Closed)
                return Exit;
        }
}
Exemplo n.º 5
0
Bool SpotColor::InputEvent(const BaseContainer &msg)
{
	if(msg.GetInt32(BFM_INPUT_DEVICE) == BFM_INPUT_MOUSE){
		if(msg.GetInt32(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSELEFT){
			if(m_dragable){
				Vector col = m_color.Convert(COLOR_SOURCE_DISPLAY).AsVector();
                ClampColor(col);
				if(!HandleMouseDrag(msg,DRAGTYPE_RGB,&col,0)){
                    HandleClick();
                }
			}
		}
	}
	return FALSE;
}
Exemplo n.º 6
0
TitleMenu::MenuResult TitleMenu::GetMenuResponse(sf::RenderWindow &window) const
{
  sf::Event titleEvent;

  while(true)
  {
    while(window.pollEvent(titleEvent))
    {
			if(titleEvent.type == sf::Event::MouseButtonPressed)
				return HandleClick(titleEvent.mouseButton.x, titleEvent.mouseButton.y);

      if(titleEvent.type == sf::Event::Closed)
        return eExit;
    }
  }
}
Exemplo n.º 7
0
void TExportZone::MouseDown(BPoint where)
{
	// Do nothing if we are playing
	if ( IsPlaying() )
		return;
	
	// Activate cue sheet
	Window()->Activate(true);
					
	// Reset cue drag flag
	static_cast<MuseumApp *>(be_app)->m_IsCueDrag = false;
	
	//	Reset drag type
	m_DragType = kNoDrag;
	
	// Check to see which button is down
	uint32 	buttons = 0;				
	Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons);
								
	uint32 	type;
	int32	count = 0;
	BMessage *message = Window()->CurrentMessage();	
	
	// Determine which button has been clicked
	switch(buttons)
	{
		case B_PRIMARY_MOUSE_BUTTON:
			if (B_OK == message->GetInfo("clicks", &type, &count) )
			{
				int32 clickCount = message->FindInt32("clicks", count-1);
				//	Handle double click
				if ( (clickCount == 2) )
				{
					HandleDoubleClick(where);
				}
				//	Determine where mouse click occured
				else
				{
					HandleClick(where);
				}
			}
			break;
			
		default:
			break;
	}
}
bool CGUIDialogBoxeeLoginWizardMenuCust::OnMessage(CGUIMessage& message)
{
    switch (message.GetMessage())
    {
    case GUI_MSG_CLICKED:
    {
        HandleClick(message);

        m_actionChoseEnum = CActionChoose::NEXT;
        Close();
        return true;
    }
    break;
    }

    return CGUIDialogBoxeeWizardBase::OnMessage(message);
}
Exemplo n.º 9
0
PauseMenu::MenuResult PauseMenu::GetMenuResponse(sf::RenderWindow& window)
{
    sf::Event menuEvent;
    while(true)
    {
        while(window.pollEvent(menuEvent))
        {
            if (menuEvent.type == sf::Event::MouseButtonPressed)
            {
                return HandleClick(menuEvent.mouseButton.x, menuEvent.mouseButton.y);
            }
            if (menuEvent.type == sf::Event::Closed)
            {
                return Exit;
            }
        }
    }
}
Exemplo n.º 10
0
MainMenu::MenuResult MainMenu::GetMenuResponse(sf::RenderWindow & window) {
    sf::Event menuEvent;

    while (true) {
        while (window.pollEvent(menuEvent)) {
            if (menuEvent.type == sf::Event::MouseButtonPressed ||
                menuEvent.type == sf::Event::KeyPressed) {
                if (ServiceLocator::GetAudio()->IsSongPlaying())
                    ServiceLocator::GetAudio()->StopAllSounds();

                return HandleClick(menuEvent.mouseButton.x, menuEvent.mouseButton.y);
            }

            if (menuEvent.type == sf::Event::Closed) {
                return Exit;
            }
        }
    }
}
Exemplo n.º 11
0
MainMenu::MenuResult  MainMenu::GetMenuResponse(sf::RenderWindow& window)
{
  sf::Event menuEvent;

  while(true)
  {
 
    while(window.GetEvent(menuEvent))
    {
      if(menuEvent.Type == sf::Event::MouseButtonPressed)
      {
        return HandleClick(menuEvent.MouseButton.X,menuEvent.MouseButton.Y);
      }
      if(menuEvent.Type == sf::Event::Closed)
      {
        return Exit;
      }
    }
  }
}
Exemplo n.º 12
0
LogInfoScreen::MenuResult LogInfoScreen::show(sf::RenderWindow& window)
{
    window.clear();
    window.draw(_sprite);
    window.display();

    sf::Event event;
    while (1)
    {
        while (window.pollEvent(event))
        {
            switch(event.type)
            {
            case sf::Event::Closed:
                window.close();
                return Nothing;
                break;
            case sf::Event::MouseButtonPressed:
                MenuResult result= HandleClick((int)event.mouseButton.x, (int)event.mouseButton.y);
                if (result != Nothing) return  result;
            }
        }
    }
}