コード例 #1
0
ファイル: slider.cpp プロジェクト: AlwaysGeeky/Vox
void Slider::MouseExited(const MouseEvent& lEvent)
{
	m_bHover = false;
	m_bOverBar = false;
	m_bDragginOutside = true;

	OnMouseExit();
}
コード例 #2
0
ファイル: button.cpp プロジェクト: AlwaysGeeky/Vox
void Button::MouseExited(const MouseEvent& lEvent)
{
	if(IsDisabled())
	{
		return;
	}

	if(IsSelected() && m_Callback_Released)
	{
		// If we have pressed the button, but not released when we move outside of the button
		m_Callback_Released(m_pCallbackData_Released);
	}

	SetHover(false);

	// Call the callback function
	if(m_ExitCallback)
	{
		m_ExitCallback(m_pExitCallbackData);
	}

	// If we are selected when we exit, reposition back the offset
	if(IsSelected() && m_offsetApplied)
	{
		for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++)
		{
			m_vpAddedComponentList[i]->SetLocation(m_vpAddedComponentList[i]->GetLocation().m_x - m_pressedOffsetX, m_vpAddedComponentList[i]->GetLocation().m_y - m_pressedOffsetY);
		}

		m_label.SetLocation(m_label.GetLocation().m_x - m_pressedOffsetX, m_label.GetLocation().m_y - m_pressedOffsetY);

		m_offsetApplied = false;
	}

	if(m_bChangeLabelText)
	{
		for(unsigned int i = 0; i < m_vpAddedComponentList.size(); i++)
		{
			if(m_vpAddedComponentList[i]->GetComponentType() == EComponentType_Label)
			{
				((Label*)m_vpAddedComponentList[i])->SetColour(m_normalLabelColour);
			}
		}
		m_label.SetColour(m_normalLabelColour);
	}

	// Also removed the button selection if we exit it's dimensions
	SetSelected(false);

	OnMouseExit();
}
コード例 #3
0
ファイル: menuitem.cpp プロジェクト: CodeMason/Vox
void MenuItem::MouseExited(const MouseEvent& lEvent)
{
	if(!IsParentMenuOpen())
	{
		return;
	}

	SetHover(false);

	// Also removed the button selection if we exit it's dimensions
	SetSelected(false);

	OnMouseExit();
}
コード例 #4
0
ファイル: Control.cpp プロジェクト: noparity/libsdlgui
void Control::NotificationMouseExit()
{
    // if the mouse leaves the control while a button is down
    // clear the button down flag.  this prevents clicks from
    // being triggered in the following scenario
    // 
    // button A has the mouse button down then the mouse is moved out
    // mouse is pressed down someplace else then moved back over button A
    // mouse button is released over button A
    //
    // this behavior is slightly different from desktop window managers
    // but IMO is a reasonable compromise.
    m_flags ^= State::MouseDown;
    OnMouseExit();
}
コード例 #5
0
ファイル: UIElements.cpp プロジェクト: markitus18/Development
void UIElement::CheckInput()
{
	if (interactive)
	{
		int mouseX, mouseY;
		App->input->GetMousePosition(mouseX, mouseY);
		int elementX = GetWorldRect().x;
		int elementY = GetWorldRect().y;

		if (App->gui->debugMode)
		{
			int colX = GetWorldRect().x;
			int colY = GetWorldRect().y;
			App->render->DrawQuad(SDL_Rect{ colX - App->render->camera.x, colY - App->render->camera.y, collider.w, collider.h }, 255, 0, 0, 50, false);
		}
		if (mouseX > elementX && mouseX < elementX + collider.w && mouseY >elementY && mouseY < elementY + collider.h)
		{
			if (!mouseWasIn)
			{
				//LOG("%s - Mouse Enter", name.GetString());
				mouseWasIn = true;
				App->gui->SetHovering(this);
				OnMouseEnter();
				if (listener)
				{
					listener->OnGUI(MOUSE_ENTER, this);
				}

				App->gui->inputRecieved = true;
			}

			if (App->input->GetMouseButtonDown(SDL_BUTTON_LEFT) == KEY_DOWN)
			{
				//LOG("%s - Mouse Down", name.GetString());
				mouseWasClicked = true;
				OnMouseDown();
				if (listener)
				{
					listener->OnGUI(MOUSE_DOWN, this);
				}

				App->gui->inputRecieved = true;
				App->gui->SetFocus(this);
			}
			else if (App->input->GetMouseButtonDown(SDL_BUTTON_LEFT) == KEY_UP)
			{
				if (mouseWasClicked)
				{
					//LOG("%s - Mouse Up", name.GetString());
					mouseWasClicked = false;
					OnMouseUp();
					if (listener)
					{
						listener->OnGUI(MOUSE_UP, this);
					}
					App->gui->inputRecieved = true;
				}
				else if (App->gui->GetFocus())
				{
					if(App->gui->GetFocus()->mouseWasClicked)
					{
						App->gui->GetFocus()->OnMouseUp();
					}
				}


			}
		}
		else
		{
		//	if (mouseWasClicked)
		//		mouseWasClicked = false;
			if (mouseWasIn)
			{
				//LOG("%s - Mouse Exit", name.GetString());
				mouseWasIn = false;
				OnMouseExit();
				App->gui->SetHovering(NULL);
				if (listener)
				{
					listener->OnGUI(MOUSE_EXIT, this);
				}

				App->gui->inputRecieved = true;
			}
		}
		if (App->gui->GetFocus() == this)
		{
			if (App->input->GetKey(SDL_SCANCODE_RETURN) == KEY_DOWN)
			{
				//LOG("%s - Return down", name.GetString());
				if (listener)
				{
					listener->OnGUI(RETURN_DOWN, this);
				}
			}
		}
	}
}
コード例 #6
0
ファイル: titlebar.cpp プロジェクト: AlwaysGeeky/Vogue
void TitleBar::MouseExited(const MouseEvent& lEvent)
{
	OnMouseExit();
}