Exemplo n.º 1
0
STDMETHODIMP CESceneDocument::ShowViews(IEFrame* pFrame)
{
#if 0
	CComPtr<ILXFrameworkFrame> frame;
	static_cast<CLXMLEditorApp*>(m_app.p)->m_spAddinSite->GetFrame(&frame);

	CComPtr<ILXFrameworkApp> app;
	frame->GetApp(&app);

	CComPtr<ILXUIMDIFrameElement> frameelement;
	frame->get_Element(&frameelement);

	CComPtr<ILXUIDocument> appdocument;
	app->get_Document(&appdocument);

//	CComPtr<ILXUIElement> mdiclient;
//	frameelement->getMDIClientElement(&mdiclient);

#if 0
	CComPtr<ILDOMElement> mdiclient = GetElementByTagNameNS(frameelement, L"http://www.lerstad.com/2004/lxui", L"mdiclient", FALSE);

	if (mdiclient)
	{
		CComPtr<ILXUIElement> mdichild;
		appdocument->createElementNS(L"http://www.lerstad.com/2004/lxui", L"mdichild", (ILDOMElement**)&mdichild);

		mdiclient->appendChild(mdichild, NULL);
	}
#endif

	CDocumentWorkspace* pWorkspace = &static_cast<CLXMLEditorApp*>(m_app.p)->m_sceneDocumentWorkspace;

	CComQIPtr<ILXAddin> addin = m_app;
	CComPtr<ILXAddinSite> addinSite;
	addin->GetSite(&addinSite);

	CComPtr<IUIManager> uiManager;
	addinSite->GetUIManager((IUnknown**)&uiManager);

	CComQIPtr<IUIMDIFrame> mdiframe = pFrame;

	/*
	CComObject<CEXMLViewGroup>* viewGroup;
	CComObject<CEXMLViewGroup>::CreateInstance(&viewGroup);
	if (viewGroup)
	{
		viewGroup->AddRef();
		viewGroup->SetDocument(this);
		*/

	// Create all views

	// 3DView(s)
		{
			CComPtr<ILDOMElement> e;
			appdocument->createElementNS(NULL, L"content", &e);

			CComPtr<IUnknown> old;
			e->setUserData(L"n", /*viewGroup->*/GetUnknown(), NULL, &old);

			VARIANT vFactory;
			V_VT(&vFactory) = VT_UNKNOWN;
			V_UNKNOWN(&vFactory) = static_cast<CLXMLEditorApp*>(m_app.p)->m_pElementBehaviorFactory;
			V_UNKNOWN(&vFactory)->AddRef();

			long cookie;
			e->addBehavior(L"#factory#scene_3dview", &vFactory, &cookie);

			m_views.Add(e.Detach());
		}

	// SceneGraphDlg
		{
			CComPtr<ILDOMElement> e;
			appdocument->createElementNS(NULL, L"content", &e);

			CComPtr<IUnknown> old;
			e->setUserData(L"n", /*viewGroup->*/GetUnknown(), NULL, &old);

			VARIANT vFactory;
			V_VT(&vFactory) = VT_UNKNOWN;
			V_UNKNOWN(&vFactory) = static_cast<CLXMLEditorApp*>(m_app.p)->m_pElementBehaviorFactory;
			V_UNKNOWN(&vFactory)->AddRef();

			long cookie;
			e->addBehavior(L"#factory#scene_graph", &vFactory, &cookie);

			m_views.Add(e.Detach());
		}

		pWorkspace->Create(pFrame, static_cast<CLXMLEditorApp*>(m_app.p), this/*viewGroup*/);
	//}

//	UpdateTitles();
#endif

	return S_OK;
}
Exemplo n.º 2
0
void TableView::handleEvent(System::Event* evt)
{
	ASSERT(0);
#if 0
	sysstring type = evt->get_type();

	if (evt->get_eventPhase() != System::CAPTURING_PHASE)
	{
		if (type == OLESTR("command"))
		{
			CommandInvokeEvent* cmdEvt = dynamic_cast<CommandInvokeEvent*>(evt);

			int ncolumn = cmdEvt->get_Command() - 100;
			Visual* column = m_list->m_treeHeader->m_columns[ncolumn];
			column->put_Visibility(column->get_Visibility()==Collapsed? Visible: Collapsed);
		}
		else if (type == OLESTR("contextmenu"))
		{
			evt->stopPropagation();
			MouseEvent* mouseEvt = dynamic_cast<MouseEvent*>(evt);

			OnContextMenu(mouseEvt);
		}
		else if (type == OLESTR("ItemStateChanging"))
		{
			evt->stopPropagation();

			int index = *dynamic_cast<IntObject*>(dynamic_cast<TreeItem*>(evt->get_target())->m_itemData);

			Record pRecord = m_table[index];

			CViewGroup* pMessage = new MailMessage;

			Field Subject = pRecord.get_Fields()[1];
			Field Headers = pRecord.get_Fields()[3];
			Field Content = pRecord.get_Fields()[4];

			ScrollViewer* pScroller = new ScrollViewer;
			{
				TextEdit* textView = new TextEdit;
				textView->put_textDocument(new TextDocument());
				textView->SetText(
					ConvertA2S((char*)Headers.GetData(), Headers.GetSize()) +
					OLESTR("\n") +
					ConvertA2S((char*)Content.GetData(), Content.GetSize()));

				pScroller->put_Content(textView);
			}
			pScroller->SetOwnerWindow(get_OwnerWindow());	// TODO remove

			pMessage->m_views.Add(pScroller);

			m_xmlDocumentWorkspace.Create(m_Canvas, pMessage);

			for (int i = 0; i < pMessage->m_sheets.GetSize(); i++)
			{
				CViewSheet* pViewSheet = pMessage->m_sheets[i];

				sysstring str;
				try
				{
					str = ConvertA2S((char*)Subject.GetData(), Subject.GetSize());
				}
				catch(int)
				{
					str = OLESTR("(Error)");
				}

				pViewSheet->m_tabElement->set_TextContent(str);
			}
		}
	}
#endif
}