void MkCheckBoxControlNode::_SetCheck(bool onCheck, bool makeEvent)
{
	if (onCheck != m_OnCheck)
	{
		m_OnCheck = onCheck;

		MkWindowThemedNode* node = NULL;
		if (ChildExist(CheckIconName))
		{
			node = dynamic_cast<MkWindowThemedNode*>(GetChildNode(CheckIconName));
		}
		else
		{
			MkWindowThemeData::eComponentType iconCT = MkWindowThemeData::GetSystemIconComponent(m_FrameType, MkWindowThemeData::eIT_CheckMark);
			if (iconCT != MkWindowThemeData::eCT_None)
			{
				node = MkWindowThemedNode::CreateChildNode(this, CheckIconName);
				if (node != NULL)
				{
					node->SetLocalDepth(-0.1f); // check box와 겹치는 것을 피하기 위해 0.1f만큼 앞에 위치
					node->SetThemeName(GetThemeName());
					node->SetComponentType(iconCT);
					node->SetAlignmentPosition(eRAP_MiddleCenter);
				}
			}
		}

		if (node != NULL)
		{
			node->SetVisible(m_OnCheck);
		}

		if (makeEvent)
		{
			StartNodeReportTypeEvent((m_OnCheck) ? ePA_SNE_CheckOn : ePA_SNE_CheckOff, NULL);
		}
	}
}
Пример #2
0
void MkWindowBaseNode::_StartCursorReport(ePA_SceneNodeEvent evt, const MkInt2& position)
{
	// report
	MkFloat2 worldPos(static_cast<float>(position.x), static_cast<float>(position.y));
	MkFloat2 localPos = worldPos - GetWorldPosition();

	MkDataNode arg;
	arg.CreateUnit(MkWindowBaseNode::ArgKey_CursorLocalPosition, MkVec2(localPos.x, localPos.y));
	arg.CreateUnit(MkWindowBaseNode::ArgKey_CursorWorldPosition, MkVec2(worldPos.x, worldPos.y));
	StartNodeReportTypeEvent(evt, &arg);

	// call back
	if (!m_CallBackTargetWindowPath.Empty())
	{
		do
		{
			MkSceneNode* mgrNode = FindNearestDerivedNode(ePA_SNT_WindowManagerNode); // 소속 window mananger
			if (mgrNode == NULL)
				break;

			MkSceneNode* targetNode = mgrNode->GetChildNode(m_CallBackTargetWindowPath); // call back을 호출 할 node
			if ((targetNode == NULL) || (!targetNode->IsDerivedFrom(ePA_SNT_WindowBaseNode)))
				break;

			MkWindowBaseNode* winBase = dynamic_cast<MkWindowBaseNode*>(targetNode);
			if (winBase == NULL)
				break;

			MkArray<MkHashStr> myPath;
			GetWindowPath(myPath);
			winBase->CallBackOperation(evt, &arg, myPath);
			return;
		}
		while (false);

		m_CallBackTargetWindowPath.Clear(); // 부정 경로. 초기화
	}
}
Пример #3
0
void MkWindowBaseNode::UpdateCursorInput
(const MkInt2& position, const MkInt2& movement, bool cursorInside, eButtonState leftBS, eButtonState middleBS, eButtonState rightBS, int wheelDelta)
{
	if (cursorInside)
	{
		if (IsQuadForm())
		{
			switch (leftBS)
			{
			case eBS_None:
			case eBS_Released:
				SetFormState(MkWindowThemeFormData::eS_Focus);
				break;

			case eBS_Pushing:
			case eBS_Pressed:
			case eBS_DoubleClicked:
				SetFormState(MkWindowThemeFormData::eS_Pushing);
				break;
			}
		}

		if (!m_CursorInside)
		{
			StartNodeReportTypeEvent(ePA_SNE_CursorEntered, NULL);
		}

		switch (leftBS)
		{
		case eBS_Released:
			_StartCursorReport(ePA_SNE_CursorLBtnReleased, position);
			m_HoldingEventType = ePA_SNE_None;
			break;
		case eBS_Pressed:
			_StartCursorReport(ePA_SNE_CursorLBtnPressed, position);
			_StartHoldingCheck(ePA_SNE_CursorLBtnHold, position);
			break;
		case eBS_DoubleClicked:
			_StartCursorReport(ePA_SNE_CursorLBtnDBClicked, position);
			_StartHoldingCheck(ePA_SNE_CursorLBtnHold, position);
			break;
		}

		switch (middleBS)
		{
		case eBS_Released:
			_StartCursorReport(ePA_SNE_CursorMBtnReleased, position);
			m_HoldingEventType = ePA_SNE_None;
			break;
		case eBS_Pressed:
			_StartCursorReport(ePA_SNE_CursorMBtnPressed, position);
			_StartHoldingCheck(ePA_SNE_CursorMBtnHold, position);
			break;
		case eBS_DoubleClicked:
			_StartCursorReport(ePA_SNE_CursorMBtnDBClicked, position);
			_StartHoldingCheck(ePA_SNE_CursorMBtnHold, position);
			break;
		}

		switch (rightBS)
		{
		case eBS_Released:
			_StartCursorReport(ePA_SNE_CursorRBtnReleased, position);
			m_HoldingEventType = ePA_SNE_None;
			break;
		case eBS_Pressed:
			_StartCursorReport(ePA_SNE_CursorRBtnPressed, position);
			_StartHoldingCheck(ePA_SNE_CursorRBtnHold, position);
			break;
		case eBS_DoubleClicked:
			_StartCursorReport(ePA_SNE_CursorRBtnDBClicked, position);
			_StartHoldingCheck(ePA_SNE_CursorRBtnHold, position);
			break;
		}

		// holding check
		if ((m_HoldingEventType == ePA_SNE_CursorLBtnHold) || (m_HoldingEventType == ePA_SNE_CursorMBtnHold) || (m_HoldingEventType == ePA_SNE_CursorRBtnHold))
		{
			MkTimeState ts;
			MK_TIME_MGR.GetCurrentTimeState(ts);

			if (m_HoldingCounter.OnTick(ts))
			{
				_StartCursorReport(m_HoldingEventType, position);

				m_HoldingEventType = ePA_SNE_None;
			}
		}

		if (wheelDelta != 0)
		{
			MkDataNode arg;
			arg.CreateUnit(MkWindowBaseNode::ArgKey_WheelDelta, wheelDelta);
			StartNodeReportTypeEvent(ePA_SNE_WheelMoved, &arg);
		}
	}
	else
	{
		if (IsQuadForm())
		{
			SetFormState(MkWindowThemeFormData::eS_Normal);
		}

		StartNodeReportTypeEvent(ePA_SNE_CursorLeft, NULL);

		m_HoldingEventType = ePA_SNE_None;
	}

	m_CursorInside = cursorInside;
}