MkWindowBaseNode* MkWindowFactory::CreateButtonTypeNode(const MkHashStr& name, MkWindowThemeData::eComponentType componentType, const MkStr& message) const { MkWindowBaseNode* node = NULL; const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(m_ThemeName, componentType, MkHashStr::EMPTY); if ((formData != NULL) && formData->IsButtonFormType()) { // btn node node = CreateComponentNode(name, componentType); if (node != NULL) { // tag MkFloat2 textRegion; MkWindowTagNode* tagNode = CreateTextTagNode(OneAndOnlyTagName, message, textRegion); if (tagNode != NULL) { node->AttachChildNode(tagNode); tagNode->SetAlignmentPosition(eRAP_MiddleCenter); } // client size MkFloat2 clientSize = m_MinClientSizeForButton; clientSize.CompareAndKeepMax(textRegion); // btn 크기가 text 영역을 포괄하도록 갱신 node->SetClientSize(clientSize); } } return node; }
void MkWindowThemedNode::SetClientSize(const MkFloat2& clientSize) { MkFloat2 cs = clientSize; cs.CompareAndKeepMax(MkFloat2::Zero); // ignore negative side if (cs != m_ClientRect.size) { m_ClientRect.size = cs; m_UpdateCommand.Set(eUC_Region); } }