Exemplo n.º 1
0
	bool cWidgetComboBox::OnLostFocus(cGuiMessageData &a_Data)
	{
		cVector3f vLocal = WorldToLocalPosition(a_Data.m_vPos);

		if (m_bMenuOpen &&m_pSlider->IsEnabled()==false)
			CloseMenu();

		return false;
	}
Exemplo n.º 2
0
	bool cWidgetComboBox::OnMouseDown(cGuiMessageData &a_Data)
	{
		if (m_bMenuOpen==false) return false;

		cVector3f vLocal = WorldToLocalPosition(a_Data.m_vPos);

		if (vLocal.y < m_pText->GetSize().y)
			CloseMenu();

		return true;
	}
Exemplo n.º 3
0
	bool cWidgetComboBox::OnMouseUp(cGuiMessageData &aData)
	{
		if(mbMenuOpen == false) return false;

		cVector3f vLocal = WorldToLocalPosition(aData.mvPos);

		if(vLocal.y > mpText->GetSize().y)
		{
			SetSelectedItem(mlMouseOverSelection);
			CloseMenu();
		}

		return true;
	}
Exemplo n.º 4
0
bool cWidgetListBox::OnMouseDown(cGuiMessageData &aData)
{
    cVector3f vLocalPos = WorldToLocalPosition(aData.mvPos);

    int lSelection = (int)((vLocalPos.y - 2) / (mvDefaultFontSize.y+2));
    if(lSelection <0) lSelection =0;

    lSelection = lSelection + mlFirstItem;

    if(lSelection >= (int)mvItems.size()) lSelection = (int)mvItems.size()-1;

    SetSelectedItem(lSelection);

    return true;
}
Exemplo n.º 5
0
	int cWidgetTextBox::WorldToCharPos(const cVector2f &avWorldPos)
	{
		float fTextPos =	WorldToLocalPosition(avWorldPos).x - 
							mvGfxCorners[0]->GetActiveSize().x + 3;

		int lMarkerCharPos;
		if(fTextPos >0)
		{
			lMarkerCharPos = GetLastCharInSize(mlFirstVisibleChar,fTextPos,3.0f);
		}
		else
		{
			lMarkerCharPos =mlFirstVisibleChar;
		}

		return lMarkerCharPos;
	}
Exemplo n.º 6
0
	bool cWidgetComboBox::OnMouseMove(cGuiMessageData &aData)
	{
		if(mbMenuOpen==false) return false;

		if(GetMouseIsOver()==false) return false;

		cVector3f vLocalPos = WorldToLocalPosition(aData.mvPos);

		if(vLocalPos.y <= mpText->GetSize().y) return false;
		if(mpSlider->IsEnabled() && vLocalPos.x >= mvSize.x - 20) return false;

		float fToTextStart = 2 + mpText->GetSize().y + mvGfxCorners[0]->GetActiveSize().y;
		int lSelection = (int)(( vLocalPos.y - fToTextStart) / (mvDefaultFontSize.y+2));
		if(lSelection <0) lSelection =0;

		lSelection = lSelection + mlFirstItem;

		if(lSelection >= (int)mvItems.size()) lSelection = (int)mvItems.size()-1;

		mlMouseOverSelection = lSelection;

		return true;
	}