void MkWindowThemedNode::Save(MkDataNode& node) const { // component panel 제외 static MkArray<MkHashStr> panelExceptions(10); if (panelExceptions.Empty()) { panelExceptions.PushBack(MkWindowThemeUnitData::ImagePositionName); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_LT]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_MT]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_RT]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_LC]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_MC]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_RC]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_LB]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_MB]); panelExceptions.PushBack(MkWindowThemeUnitData::EdgeAndTablePositionName[MkWindowThemeUnitData::eP_RB]); } _AddExceptionList(node, SystemKey_PanelExceptions, panelExceptions); // shadow node 제외 static MkArray<MkHashStr> nodeExceptions; if (nodeExceptions.Empty()) { nodeExceptions.PushBack(ShadowNodeName); } _AddExceptionList(node, SystemKey_NodeExceptions, nodeExceptions); // run MkVisualPatternNode::Save(node); }
bool MkCheatMessage::ExcuteMsg(const MkStr& command, const MkArray<MkStr>& argument, MkStr& resultMsg) const { MkStr cmd = command; cmd.ToLower(); if ((cmd == L"q") && argument.Empty()) { MK_DEV_PANEL.__QuitApplication(); return true; } if ((cmd == L"cls") && argument.Empty()) { MK_DEV_PANEL.ClearLogWindow(); return true; } return false; }
void MkCheckBoxControlNode::SendNodeReportTypeEvent(ePA_SceneNodeEvent eventType, MkArray<MkHashStr>& path, MkDataNode* argument) { // left cursor click이고 해당 window가 자신이면 toggle if ((eventType == ePA_SNE_CursorLBtnReleased) && path.Empty()) { _SetCheck(!GetCheck(), true); } else { MkWindowBaseNode::SendNodeReportTypeEvent(eventType, path, argument); } }
void MkCheckBoxControlNode::Save(MkDataNode& node) const { // caption, on icon 제외 static MkArray<MkHashStr> exceptions(2); if (exceptions.Empty()) { exceptions.PushBack(CaptionNodeName); exceptions.PushBack(CheckIconName); } _AddExceptionList(node, SystemKey_NodeExceptions, exceptions); // run MkWindowBaseNode::Save(node); }
void MkDataPack::GetValidUnitList(const MkDataPack& source, MkArray<MkHashStr>& keyList) const { keyList.Clear(); MkArray<MkHashStr> myOwn; GetUnitKeyList(myOwn); if (!myOwn.Empty()) { keyList.Reserve(myOwn.GetSize()); MK_INDEXING_LOOP(myOwn, i) { const MkHashStr& currKey = myOwn[i]; if (!(source.IsValidKey(currKey) && source.Equals(currKey, *m_UnitTable[currKey]))) { keyList.PushBack(currKey); // 자신에게만 속하거나 값이 다른 key } } }
void MkCheckBoxControlNode::LoadObject(const MkDataNode& node) { MkWindowBaseNode::LoadObject(node); // caption MkArray<MkHashStr> textName; if (node.GetDataEx(ObjKey_CaptionTextName, textName) && (!textName.Empty())) { MkStr caption; node.GetData(ObjKey_CaptionString, caption, 0); _SetCaption(textName, caption); } // check bool onCheck; if (node.GetData(ObjKey_OnCheck, onCheck, 0)) { SetCheck(onCheck); } }
void MkCheckBoxControlNode::_SetCaption(const MkArray<MkHashStr>& textNode, const MkStr& caption) { if (textNode.Empty() || (!MK_STATIC_RES.TextNodeExist(textNode))) { RemoveChildNode(CaptionNodeName); m_CaptionString.Clear(); return; } // MkWindowTagNode 사용 MkWindowTagNode* node = NULL; if (ChildExist(CaptionNodeName)) { node = dynamic_cast<MkWindowTagNode*>(GetChildNode(CaptionNodeName)); } else { node = MkWindowTagNode::CreateChildNode(this, CaptionNodeName); if (node != NULL) { node->SetAlignmentPivotIsWindowRect(true); node->SetAlignmentPosition(eRAP_RMostCenter); node->SetAlignmentOffset(MkFloat2(node->GetLengthOfBetweenIconAndText(), 0.f)); } } if (node != NULL) { m_CaptionString = caption; if (caption.Empty()) { node->SetTextName(textNode); } else { node->SetTextName(textNode, caption); } } }
void MkImageInfo::SetUp(const MkInt2& imageSize, const MkDataNode* node) { Clear(); // ready to uv converting MkFloat2 fImageSize(static_cast<float>(imageSize.x), static_cast<float>(imageSize.y)); // empty subset Subset& emptySubset = m_Subsets.Create(MkHashStr::EMPTY); emptySubset.rectSize = fImageSize; emptySubset.uv[MkFloatRect::eLeftTop] = MkFloat2::Zero; emptySubset.uv[MkFloatRect::eRightTop] = MkFloat2(1.f, 0.f); emptySubset.uv[MkFloatRect::eLeftBottom] = MkFloat2(0.f, 1.f); emptySubset.uv[MkFloatRect::eRightBottom] = MkFloat2(1.f, 1.f); if (node == NULL) return; // group node->GetDataEx(GROUP_KEY, m_Group, 0); // parse nodes MkArray<MkHashStr> keyList; node->GetChildNodeList(keyList); MK_INDEXING_LOOP(keyList, i) { const MkHashStr& childName = keyList[i]; const MkDataNode& childNode = *node->GetChildNode(childName); do { // 필수 key로 subset/sequence 종류 판단 if (childNode.IsValidKey(SIZE_KEY)) // subset { MkInt2 position; childNode.GetData(POSITION_KEY, position, 0); MkInt2 size; childNode.GetData(SIZE_KEY, size, 0); MK_CHECK(size.IsPositive(), childName.GetString() + L" 노드의 " + SIZE_KEY.GetString() + L" 값 오류") break; MkInt2 table(1, 1); childNode.GetData(TABLE_KEY, table, 0); MK_CHECK(table.IsPositive(), childName.GetString() + L" 노드의 " + TABLE_KEY.GetString() + L" 값 오류") break; MkFloat2 fSubsetSize(static_cast<float>(size.x), static_cast<float>(size.y)); MkFloat2 fUVSize(fSubsetSize.x / fImageSize.x, fSubsetSize.y / fImageSize.y); // single subset if ((table.x == 1) && (table.y == 1)) { _RegisterSubset(childName, fSubsetSize, position, fImageSize, fUVSize); } // multi subset else { MkInt2 offset = size; childNode.GetData(OFFSET_KEY, offset, 0); MkInt2 currPivot = position; for (int y = 0; y < table.y; ++y) { for (int x = 0; x < table.x; ++x) { _RegisterSubset(childName.GetString() + MkStr(y * table.x + x), fSubsetSize, currPivot, fImageSize, fUVSize); currPivot.x += offset.x; } currPivot.x = position.x; currPivot.y += offset.y; } } } else if (childNode.IsValidKey(TOTAL_RANGE_KEY) && childNode.IsValidKey(SUBSET_LIST_KEY)) // sequence { float totalRange = 0.f; childNode.GetData(TOTAL_RANGE_KEY, totalRange, 0); MK_CHECK(totalRange > 0.f, childName.GetString() + L" 노드의 " + TOTAL_RANGE_KEY.GetString() + L" 값 오류") break; MkArray<MkHashStr> subsetList; childNode.GetDataEx(SUBSET_LIST_KEY, subsetList); MK_CHECK(!subsetList.Empty(), childName.GetString() + L" 노드의 " + SUBSET_LIST_KEY.GetString() + L" 값 오류") break; MkArray<float> timeList; childNode.GetData(TIME_LIST_KEY, timeList); bool loop = true; childNode.GetData(LOOP_KEY, loop, 0); // time list 검증 및 자동생성 if (timeList.Empty()) { timeList.Reserve(subsetList.GetSize()); float oneFrameTime = totalRange / static_cast<float>(subsetList.GetSize()); float timeStamp = 0.f; MK_INDEXING_LOOP(subsetList, j) { timeList.PushBack(timeStamp); timeStamp += oneFrameTime; } }
MkTitleBarControlNode* MkWindowFactory::_CreateMessageBox (const MkHashStr& name, const MkStr& titleStr, const MkArray<MkHashStr>& titleTextName, const MkStr& descStr, const MkArray<MkHashStr>& descTextName, MkWindowBaseNode* callBackWindow, eMsgBoxType boxType, eMsgBoxButton btnType) const { // icon type MkWindowThemeData::eIconType iconType = MkWindowThemeData::eIT_None; MkWindowThemeData::eComponentType bodyType = MkWindowThemeData::eCT_None; switch (boxType) { case eMBT_Default: iconType = MkWindowThemeData::eIT_Default; bodyType = MkWindowThemeData::eCT_DefaultBox; break; case eMBT_Notice: iconType = MkWindowThemeData::eIT_Notice; bodyType = MkWindowThemeData::eCT_DefaultBox; break; case eMBT_Information: iconType = MkWindowThemeData::eIT_Information; bodyType = MkWindowThemeData::eCT_DefaultBox; break; case eMBT_Warning: iconType = MkWindowThemeData::eIT_Warning; bodyType = MkWindowThemeData::eCT_NoticeBox; break; case eMBT_EditMode: iconType = MkWindowThemeData::eIT_EditMode; bodyType = MkWindowThemeData::eCT_DefaultBox; break; } if ((iconType == MkWindowThemeData::eIT_None) || (bodyType == MkWindowThemeData::eCT_None)) return NULL; // create title MkTitleBarControlNode* titleNode = MkTitleBarControlNode::CreateChildNode(NULL, name); if (titleNode != NULL) { do { titleNode->SetTitleBar(m_ThemeName, m_FrameType, 10.f, (btnType == eMBB_None)); // length는 의미 없음. 이후 body frame에서 재설정 할 것임 titleNode->SetIcon(iconType); if (titleTextName.Empty()) { titleNode->SetCaption(titleStr); } else { titleNode->SetCaption(titleTextName); } // create body frame MkBodyFrameControlNode* bodyFrame = MkBodyFrameControlNode::CreateChildNode(titleNode, BodyFrameName); if (bodyFrame == NULL) break; // body frame dispositioner MkWindowDispositioner windowDispositioner; windowDispositioner.SetMargin(MkFloat2(8.f, 8.f)); // border windowDispositioner.AddNewLine(); // title에 해당하는 빈 영역 windowDispositioner.AddDummyToCurrentLine(titleNode->CalculateWindowSize()); // create text tag MkFloat2 textRegion; MkWindowTagNode* tagNode = descTextName.Empty() ? CreateTextTagNode(OneAndOnlyTagName, descStr, textRegion) : CreateTextTagNode(OneAndOnlyTagName, descTextName, textRegion); if (tagNode == NULL) break; bodyFrame->AttachChildNode(tagNode); windowDispositioner.AddNewLine(MkWindowDispositioner::eLHA_Center); // text tag는 중앙 정렬 windowDispositioner.AddRectToCurrentLine(OneAndOnlyTagName, textRegion); // call back target path MkArray<MkHashStr> callbackTarget; if (callBackWindow != NULL) { callBackWindow->GetWindowPath(callbackTarget); } MkWindowBaseNode* okBtn = NULL; MkWindowBaseNode* cancelBtn = NULL; if (btnType != eMBB_None) { // create ok btn okBtn = CreateOkButtonNode(); if (okBtn == NULL) break; bodyFrame->AttachChildNode(okBtn); if (!callbackTarget.Empty()) { okBtn->SetCallBackTargetWindowPath(callbackTarget); } windowDispositioner.AddNewLine(MkWindowDispositioner::eLHA_Center); // button set도 중앙 정렬 windowDispositioner.AddRectToCurrentLine(okBtn->GetNodeName(), okBtn->CalculateWindowSize()); // create cancel btn if (btnType == eMBB_OkCancel) { cancelBtn = CreateCancelButtonNode(); if (cancelBtn == NULL) break; bodyFrame->AttachChildNode(cancelBtn); if (!callbackTarget.Empty()) { cancelBtn->SetCallBackTargetWindowPath(callbackTarget); } windowDispositioner.AddRectToCurrentLine(cancelBtn->GetNodeName(), cancelBtn->CalculateWindowSize()); } } // dispositioner 계산 windowDispositioner.Calculate(); // body frame size MkFloat2 clientSize = windowDispositioner.GetRegion(); //clientSize += MkFloat2(10.f, 10.f); // border bodyFrame->SetBodyFrame(m_ThemeName, bodyType, true, MkBodyFrameControlNode::eHT_IncludeParentAtTop, clientSize); // 하위 node 위치 반영 windowDispositioner.ApplyPositionToNode(tagNode); windowDispositioner.ApplyPositionToNode(okBtn); windowDispositioner.ApplyPositionToNode(cancelBtn); return titleNode; } while (false); MK_DELETE(titleNode); } return NULL; }