예제 #1
0
void SlideNavmesh::mouseMove(const float x, const float y)
{
	if (m_drag == 1)
	{
		updateDrag(x,y, m_pos);
	}
	else
	{
		hitButtons(x-m_pos[0],y-m_pos[1]);
	}
}
예제 #2
0
void TCompGuiDrag::Clicked()
{
	if (checkEnabled()) {
		if (controller->IsGuiItemDragged()) {
			render_state = RSTATE_OVER;
			updateDrag();
		}
		else {
			notifyValue();
			SetDragState(Over);
		}
	}
}
bool GUIScrollbarGadget::update()
{
    if (hasFocus() && GlbGUIMngr->MouseWheel_)
        scroll(-GlbGUIMngr->MouseWheel_ * 30);
    
    if (!checkDefaultUpdate())
        return false;
    
    if (isEnabled_ && mouseOver(Rect_) && !foreignUsage())
    {
        if (mouseLeft())
        {
            focus();
            
            CursorPosBias_ = GlbGUIMngr->CursorPos_ - dim::point2di(Rect_.Left, Rect_.Top + 1) - dim::point2di(BarPos_);
            
            dim::rect2di BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect;
            getButtonRects(BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect);
            
            if (mouseOver(BarRect))
                useFocus(USAGE_DRAG);
            else if (mouseOver(ButtonARect))
                useFocus(USAGE_FORWARDS);
            else if (mouseOver(ButtonBRect))
                useFocus(USAGE_BACKWARDS);
            else if (mouseOver(PageARect))
                scroll(-PageSize_);
            else if (mouseOver(PageBRect))
                scroll(PageSize_);
        }
    }
    
    if (usage(USAGE_DRAG))
        updateDrag();
    else if (usage(USAGE_FORWARDS))
        scroll(-3);
    else if (usage(USAGE_BACKWARDS))
        scroll(3);
    
    return true;
}