コード例 #1
0
ファイル: TextureManager.cpp プロジェクト: ACefalu/tzod
size_t ThemeManager::FindTheme(const string_t &name)
{
	for( size_t i = 0; i < _themes.size(); i++ )
	{
		if( GetThemeName(i+1) == name )
		{
			return i+1;
		}
	}
	return 0;
}
コード例 #2
0
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);
		}
	}
}
コード例 #3
0
JSONElement LexerConf::ToJSON() const
{
    JSONElement json = JSONElement::createObject(GetName());
    json.addProperty("Name", GetName());
    json.addProperty("Theme", GetThemeName());
    json.addProperty("Flags", m_flags);
    json.addProperty("Id", GetLexerId());
    json.addProperty("KeyWords0", GetKeyWords(0));
    json.addProperty("KeyWords1", GetKeyWords(1));
    json.addProperty("KeyWords2", GetKeyWords(2));
    json.addProperty("KeyWords3", GetKeyWords(3));
    json.addProperty("KeyWords4", GetKeyWords(4));
    json.addProperty("Extensions", GetFileSpec());

    JSONElement properties = JSONElement::createArray("Properties");
    json.append(properties);

    StyleProperty::Map_t::const_iterator iter = m_properties.begin();
    for(; iter != m_properties.end(); ++iter) {
        properties.arrayAppend(iter->second.ToJSON());
    }
    return json;
}
コード例 #4
0
MkFloat2 MkWindowThemedNode::CalculateWindowSize(void) const
{
	return ConvertClientToWindowSize(GetThemeName(), GetComponentType(), GetCustomForm(), GetClientSize());
}
コード例 #5
0
void MkBodyFrameControlNode::SetClientSize(const MkFloat2& clientSize)
{
	MkWindowBaseNode::SetClientSize(clientSize);

	if ((m_ParentNodePtr != NULL) && (m_ParentNodePtr->IsDerivedFrom(ePA_SNT_TitleBarControlNode)))
	{
		MkTitleBarControlNode* parentNode = dynamic_cast<MkTitleBarControlNode*>(m_ParentNodePtr);
		if (parentNode != NULL)
		{
			// 부모의 크기(length)를 변경
			float sizeOffset = 0.f;
			if ((m_HangingType == eHT_IncludeParentAtTop) || (m_HangingType == eHT_IncludeParentAtBottom))
			{
				const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(GetThemeName(), GetComponentType(), GetCustomForm());
				if (formData != NULL)
				{
					sizeOffset += formData->GetLeftMargin();
					sizeOffset += formData->GetRightMargin();
				}
			}

			float frameSize = MK_STATIC_RES.GetWindowThemeSet().GetFrameSize(parentNode->GetThemeName(), parentNode->GetFrameType());
			float titleLength = GetMax<float>(m_ClientRect.size.x - sizeOffset, 0.f);
			parentNode->SetClientSize(MkFloat2(titleLength, frameSize));
		}
	}
}
コード例 #6
0
void MkBodyFrameControlNode::_ApplyHangingType(void)
{
	bool pivotIsWindowRect = false;
	bool targetIsWindowRect = true;
	eRectAlignmentPosition alignPos = eRAP_NonePosition;

	if (m_HangingType != eHT_None)
	{
		switch (m_HangingType)
		{
		case eHT_OverParentWindow:
			pivotIsWindowRect = true;
			alignPos = eRAP_LeftOver;
			break;

		case eHT_UnderParentWindow:
			pivotIsWindowRect = true;
			alignPos = eRAP_LeftUnder;
			break;

		case eHT_IncludeParentAtTop:
		case eHT_IncludeParentAtBottom:
			{
				const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(GetThemeName(), GetComponentType(), GetCustomForm());
				if (formData != NULL)
				{
					switch (m_HangingType)
					{
					case eHT_IncludeParentAtTop:
						pivotIsWindowRect = true;
						targetIsWindowRect = false;
						alignPos = eRAP_LeftTop;
						break;

					case eHT_IncludeParentAtBottom:
						pivotIsWindowRect = true;
						targetIsWindowRect = false;
						alignPos = eRAP_LeftBottom;
						break;
					}
				}
			}
			break;
		}
	}

	SetAlignmentPivotIsWindowRect(pivotIsWindowRect);
	SetAlignmentTargetIsWindowRect(targetIsWindowRect);
	SetAlignmentPosition(alignPos);
}
コード例 #7
0
wxXmlNode* LexerConf::ToXml() const
{
    // convert the lexer back xml node
    wxXmlNode* node = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Lexer"));
    // set the lexer name
    node->AddProperty(wxT("Name"), GetName());
    node->AddProperty("Theme", GetThemeName());
    node->AddProperty("IsActive", IsActive() ? "Yes" : "No");
    node->AddAttribute("UseCustomTextSelFgColour", IsUseCustomTextSelectionFgColour() ? "Yes" : "No");
    node->AddProperty(wxT("StylingWithinPreProcessor"), BoolToString(GetStyleWithinPreProcessor()));
    wxString strId;
    strId << GetLexerId();
    node->AddProperty(wxT("Id"), strId);

    // set the keywords node
    wxXmlNode* keyWords0 = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("KeyWords0"));
    XmlUtils::SetNodeContent(keyWords0, GetKeyWords(0));
    node->AddChild(keyWords0);

    wxXmlNode* keyWords1 = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("KeyWords1"));
    XmlUtils::SetNodeContent(keyWords1, GetKeyWords(1));
    node->AddChild(keyWords1);

    wxXmlNode* keyWords2 = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("KeyWords2"));
    XmlUtils::SetNodeContent(keyWords2, GetKeyWords(2));
    node->AddChild(keyWords2);

    wxXmlNode* keyWords3 = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("KeyWords3"));
    XmlUtils::SetNodeContent(keyWords3, GetKeyWords(3));
    node->AddChild(keyWords3);

    wxXmlNode* keyWords4 = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("KeyWords4"));
    XmlUtils::SetNodeContent(keyWords4, GetKeyWords(4));
    node->AddChild(keyWords4);

    // set the extensions node
    wxXmlNode* extesions = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Extensions"));
    XmlUtils::SetNodeContent(extesions, GetFileSpec());
    node->AddChild(extesions);

    // set the properties
    wxXmlNode* properties = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Properties"));
    std::map<long, StyleProperty>::const_iterator iter = m_properties.begin();
    for(; iter != m_properties.end(); ++iter) {
        StyleProperty p = iter->second;
        wxXmlNode* property = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Property"));

        strId.Clear();
        strId << p.GetId();
        property->AddProperty(wxT("Id"), strId);
        property->AddProperty(wxT("Name"), p.GetName());
        property->AddProperty(wxT("Bold"), BoolToString(p.IsBold()));
        property->AddProperty(wxT("Face"), p.GetFaceName());
        property->AddProperty(wxT("Colour"), p.GetFgColour());
        property->AddProperty(wxT("BgColour"), p.GetBgColour());
        property->AddProperty(wxT("Italic"), BoolToString(p.GetItalic()));
        property->AddProperty(wxT("Underline"), BoolToString(p.GetUnderlined()));
        property->AddProperty(wxT("EolFilled"), BoolToString(p.GetEolFilled()));

        strId.Clear();
        strId << p.GetAlpha();
        property->AddProperty(wxT("Alpha"), strId);

        wxString strSize;
        strSize << p.GetFontSize();
        property->AddProperty(wxT("Size"), strSize);
        properties->AddChild(property);
    }
    node->AddChild(properties);
    return node;
}