Exemplo n.º 1
0
void DataBase::print_Attribute_Item_List(string name)
{
	Attribute* temp_a;
	temp_a = get_Attribute(name);
	temp_a->print_items();
	delete temp_a;
}
Exemplo n.º 2
0
void XmlElement::SetAttribute(stringx nameAttr, stringx value)
{
	ref<XmlAttribute>	attr = get_Attribute(nameAttr);
	if (attr != NULL)
	{
		attr->set_Value(value);
		return;
	}

	attr = gc_new<XmlAttribute>(nameAttr, value);
	AddAttribute(attr);
}
Exemplo n.º 3
0
HWND CTangramNode::CreateView(HWND hParentWnd, CString strTag)
{
	BOOL bWebCtrl = false;
	CString strURL = _T("");
	CString strID = strTag;
	auto hWnd = ::CreateWindowEx(NULL,L"Tangram Window Class", NULL, WS_CHILD | WS_VISIBLE| WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 0, 0, hParentWnd, NULL, AfxGetInstanceHandle(), NULL);
	//if (::IsWindow(this->m_pHostWnd->m_hWnd) == false)
	//	 = m_pHostWnd->SubclassWindow(hWnd);
	CComBSTR bstr2;
	get_Attribute(CComBSTR("Name"), &bstr2);
	CString strName = OLE2T(bstr2);
	switch (m_nViewType)
	{
	case ActiveX:
		{
			strID.MakeLower();
			auto nPos = strID.Find(_T("http:"));
			if (nPos == -1)
				nPos = strID.Find(_T("https:"));
			if (m_pFrame)
			{
				CComBSTR bstr;
				get_Attribute(CComBSTR("InitInfo"), &bstr);
				CString str = _T("");
				str += bstr;
				if (str != _T("") && m_pTangram)
				{
					LRESULT hr = ::SendMessage(m_pTangram->m_hWnd, WM_GETNODEINFO, (WPARAM)OLE2T(bstr), (LPARAM)hParentWnd);
					if (hr)
					{
						CString strInfo = _T("");
						CWindow m_wnd;
						m_wnd.Attach(hParentWnd);
						m_wnd.GetWindowText(strInfo);
						strID += strInfo;
						m_wnd.Detach();
					}
				}
			}

			if (strID.Find(_T("http://")) != -1 || strID.Find(_T("https://")) != -1)
			{
				bWebCtrl = true;
				strURL = strID;
				strID = _T("shell.explorer.2");
			}

			if (strID.Find(_T("res://")) != -1 || ::PathFileExists(strID))
			{
				bWebCtrl = true;
				strURL = strID;
				strID = _T("shell.explorer.2");
			}

			if (strID.CompareNoCase(_T("about:blank")) ==0 )
			{
				bWebCtrl = true;
				strURL = strID;
				strID = _T("shell.explorer.2");
			}

			if (m_pDisp == NULL)
			{
				CComPtr<IDispatch> pDisp;
				HRESULT hr = pDisp.CoCreateInstance(CComBSTR(strID));
				if (hr == S_OK)
				{
					m_pDisp = pDisp.Detach();
					//CAxWindow m_Wnd;
					//m_Wnd.Attach(hWnd);
					//CComPtr<IUnknown> pUnk;
					//m_Wnd.AttachControl(m_pDisp, &pUnk);
					//m_Wnd.Detach();
				}
			}
		}
		break;
	case CLRCtrl:
		{
			if (theApp.m_pTangramCLRProxy)
				m_pDisp = theApp.m_pTangramCLRProxy->TangramCreateObject(strTag.AllocSysString(), (LONGLONG)hParentWnd, this);
		}
		break;
	}
	if (m_pDisp)
	{
		CAxWindow m_Wnd;
		m_Wnd.Attach(hWnd);
		CComPtr<IUnknown> pUnk;
		m_Wnd.AttachControl(m_pDisp, &pUnk);
		if (m_nViewType == ActiveX)
		{
			CComQIPtr<IWebBrowser2> pWebDisp(m_pDisp);
			if (pWebDisp)
			{
				bWebCtrl = true;
				m_strURL = strURL;
				if (m_strURL == _T(""))
					m_strURL = strID;
				if (m_pFrame)
				{
					if (m_pTangram)
						m_pTangram->m_nWebViewCount++;

					m_pTangramNodeWBEvent = new CTangramNodeWBEvent(this);
				}
				CComPtr<IAxWinAmbientDispatch> spHost;
				LRESULT hr = m_Wnd.QueryHost(&spHost);
				if (SUCCEEDED(hr))
				{
					CComBSTR bstr;
					get_Attribute(CComBSTR("scrollbar"), &bstr);
					CString str = OLE2T(bstr);
					if (str == _T("1"))
						spHost->put_DocHostFlags(DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE | DOCHOSTUIFLAG_THEME);//DOCHOSTUIFLAG_DIALOG|
					else
						spHost->put_DocHostFlags(/*DOCHOSTUIFLAG_DIALOG|*/DOCHOSTUIFLAG_SCROLL_NO | DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE | DOCHOSTUIFLAG_THEME);

					if (m_strURL != _T(""))
					{
						pWebDisp->Navigate2(&CComVariant(m_strURL), &CComVariant(navNoReadFromCache | navNoWriteToCache), NULL, NULL, NULL);
						m_bWebInit = true;
					}
				}
			}
		}
		CComQIPtr<IOleInPlaceActiveObject> pIOleInPlaceActiveObject(m_pDisp);
		if (pIOleInPlaceActiveObject)
			((CTangramWnd*)m_pHostWnd)->m_pOleInPlaceActiveObject = pIOleInPlaceActiveObject.Detach();
		m_Wnd.Detach();
	}

	return hWnd;
}