コード例 #1
0
ファイル: P2PFrame.cpp プロジェクト: sigurdle/FirstProject2
P2PFrame::P2PFrame()
{
//	std::string filename = DownloadFile("http://www.lerstad.com/");

	put_Width(new Length(400, Length::UnitAbsolute));
	put_Height(new Length(300, Length::UnitAbsolute));

	DockPanel* p = new DockPanel;
	{

		{
			CUIDockBar* pDockbar = new CUIDockBar;
			{
				pDockbar->put_BackgroundBrush(new SolidColorBrush(new Color(236, 233, 216)));
				{
					//Gripper* pGripper = new Gripper;
				//	pGripper->put_BackgroundBrush(new CLSolidColorBrush(new CLColor(255, 0, 0)));
					{
						Toolbar* pToolbar = new Toolbar;
					//	pToolbar->put_BackgroundBrush(new CLSolidColorBrush(new CLColor(0, 255, 0)));

						{

							CLXUIMenuElement* pMenu = new CLXUIMenuElement(new TextString(OLESTR("File")));
							{
								pMenu->AddItem(new TextString(OLESTR("Open")), ID_FILE_OPEN);
								pMenu->AddItem(new TextString(OLESTR("Save")));
								pMenu->AddItem(new TextString(OLESTR("Open Program")), ID_FILE_OPENPROGRAM);
								{
									CLXUIMenuElement* pMenu2 = new CLXUIMenuElement(new TextString(OLESTR("Debug")));
									pMenu2->AddItem(new TextString(OLESTR("Go")), ID_DEBUG_GO);
									pMenu2->AddItem(new TextString(OLESTR("Step Into")), ID_DEBUG_STEPINTO);
									pMenu->AddMenuItem(pMenu2);
								}
								{
									CLXUIMenuElement* pMenu2 = new CLXUIMenuElement(new TextString(OLESTR("Edit")));
									pMenu2->AddItem(new TextString(OLESTR("Cut")), ID_EDIT_CUT);
									pMenu2->AddItem(new TextString(OLESTR("Copy")), ID_EDIT_COPY);
									pMenu2->AddItem(new TextString(OLESTR("Paste")), ID_EDIT_PASTE);
									pMenu->AddMenuItem(pMenu2);
								}
								/*
								{
									CLXUIMenuElement* pMenu2 = new CLXUIMenuElement(new TextString(OLESTR("Prefs2")));
									pMenu2->AddItem(new TextString(OLESTR("Local")));
									pMenu2->AddItem(new TextString(OLESTR("Global")));
									pMenu2->AddItem(new TextString(OLESTR("Something")));
									{
										CLXUIMenuElement* pMenu3 = new CLXUIMenuElement(new TextString(OLESTR("Prefs3")));
										pMenu3->AddItem(new TextString(OLESTR("Local")));
										pMenu3->AddItem(new TextString(OLESTR("Global")));
										pMenu3->AddItem(new TextString(OLESTR("Something")));
										pMenu2->AddMenuItem(pMenu3);
									}

									pMenu->AddMenuItem(pMenu2);
								}
								*/
								pMenu->AddSeparator();
								pMenu->AddItem(new TextString(OLESTR("Exit")), ID_APP_EXIT);
							}
							pToolbar->AddRChild(pMenu);

						}

						{
							Button* pButton = new Button;
							pButton->set_Content(new TextString(OLESTR("Save")));
							pToolbar->AddRChild(pButton);
						}

						{
							Button* pButton = new Button;
							pButton->set_Content(new TextString(OLESTR("Exit")));
							pToolbar->AddRChild(pButton);
						}

						/*
						{
							TextString* pText = new TextString(OLESTR("Button0"), font);
							pToolbar->AddRChild(pText);
						}

						{
							TextString* pText = new TextString(OLESTR("Button1"), font);
							pToolbar->AddRChild(pText);
						}

						{
							TextString* pText = new TextString(OLESTR("Button2"), font);
							pToolbar->AddRChild(pText);
						}
						*/

						//pGripper->put_Content(pToolbar);
						pDockbar->DockControlBar(pToolbar);
					}
					//pDockbar->DockControlBar(pGripper);
				}

				{
				//	Gripper* pGripper = new Gripper;
				//	pGripper->put_BackgroundBrush(new CLSolidColorBrush(new CLColor(255, 0, 0)));
					{
						Toolbar* pToolbar = new Toolbar;
					//	pToolbar->put_BackgroundBrush(new CLSolidColorBrush(new CLColor(0, 255, 0)));

						{
							Button* pButton = new Button;
							pButton->set_Content(new TextString(OLESTR("Cut")));
							pToolbar->AddRChild(pButton);
						}

						{
							Button* pButton = new Button;
							pButton->set_Content(new TextString(OLESTR("Copy")));
							pToolbar->AddRChild(pButton);
						}

						{
							Button* pButton = new Button;
							pButton->set_Content(new TextString(OLESTR("Paste")));
							pToolbar->AddRChild(pButton);
						}


				//		pGripper->put_Content(pToolbar);
						pDockbar->DockControlBar(pToolbar);
					}
				//	pDockbar->DockControlBar(pGripper);
				}

			}
			p->set_Dock(pDockbar, DockPanel::Top);
			p->AddRChild(pDockbar);
		}

		{
			CUIDockBar* pDockbar = new CUIDockBar;
			{
				pDockbar->set_BackgroundBrush(new SolidColorBrush(new Color(236, 233, 216)));
			}
			p->set_Dock(pDockbar, DockPanel::Bottom);
			p->AddRChild(pDockbar);
		}


		pCanvas = new ChildWindowContainer;
		{
			Border* outerBorder = new Border(new Thickness(new Length(4, Length::UnitAbsolute), new Length(4, Length::UnitAbsolute), new Length(4, Length::UnitAbsolute), new Length(4, Length::UnitAbsolute)));
			outerBorder->put_BackgroundBrush(new SolidColorBrush(new Color(255, 255, 255)));
			{
				DockPanel* panel2 = new DockPanel;
				{
					DockPanel* panel = new DockPanel;
					{
						Button* pSearchButton = new Button(new TextString(OLESTR("Search")));
						DockPanel::set_Dock(pSearchButton, DockPanel::Right);
						panel->AddRChild(pSearchButton);
					}

					{
						Border* pBorder = new Border(new Thickness(new Length(1, Length::UnitAbsolute), new Length(1, Length::UnitAbsolute), new Length(1, Length::UnitAbsolute), new Length(1, Length::UnitAbsolute)));
						pBorder->m_LeftBrush = new SolidColorBrush(new Color(0, 0, 0));
						pBorder->m_TopBrush = new SolidColorBrush(new Color(0, 0, 0));
						pBorder->m_RightBrush = new SolidColorBrush(new Color(160, 160, 160));
						pBorder->m_BottomBrush = new SolidColorBrush(new Color(160, 160, 160));
						{
							m_searchEdit = new TextEdit;
						//	m_searchEdit->m_tdp = new TextDocument;
						//	m_searchEdit->SetText(OLESTR(""));
							pBorder->set_Content(m_searchEdit);
						}
						DockPanel::set_Dock(pBorder, DockPanel::Fill);
						panel->AddRChild(pBorder);
					}
					DockPanel::put_Dock(panel, DockPanel::Top);
					panel2->AddRChild(panel);
				}
				{
					Border* pSpacer = new Border;
					DockPanel::set_Dock(pSpacer, DockPanel::Fill);
					panel2->AddRChild(pSpacer);
				}
				outerBorder->put_Content(panel2);
			}
			Border* ctl = outerBorder;


			{
				ChildWindow* pWindow = new ChildWindow;
				pWindow->m_computedLeft = 80;//put_Left(pWindow, new Length(100, UnitAbsolute));
				pWindow->m_computedTop = 80;//put_Top(new Length(100, UnitAbsolute));
				pWindow->set_Width(new Length(240, Length::UnitAbsolute));
				pWindow->set_Height(new Length(210, Length::UnitAbsolute));

				if (true)
				{
					pWindow->set_Content(ctl);
				}
				else
				{
					ScrollViewer* pScroller = new ScrollViewer;
					{
						pScroller->put_Content(ctl/*m_watchWnd*/);
					}
					pWindow->set_Content(pScroller);
				}

				pWindow->set_TitleText(OLESTR("Search"));

			//	pWindow->SetOwnerWindow(pCanvas->get_OwnerWindow());	// TODO, not here
				pCanvas->AddChild(pWindow);
			}
			if (true)
			{
				ConnectionsCtl = new TreeControlContainer;
			//	ConnectionsCtl->m_treeHeader->AddColumn(new TextString(OLESTR("IP-Address")));
			//	ConnectionsCtl->m_treeHeader->AddColumn(new TextString(OLESTR("Status")));

				ConnectionsCtl->AddField(L"Address");

				ChildWindow* pWindow = new ChildWindow;
				pWindow->m_computedLeft = 80;//put_Left(pWindow, new Length(100, UnitAbsolute));
				pWindow->m_computedTop = 80;//put_Top(new Length(100, UnitAbsolute));
				pWindow->set_Width(new Length(240, Length::UnitAbsolute));
				pWindow->set_Height(new Length(210, Length::UnitAbsolute));

				pWindow->set_Content(dynamic_cast<Control*>(ConnectionsCtl));

				pWindow->set_TitleText(OLESTR("Connections"));

				pCanvas->AddChild(pWindow);
			}

			if (true)
			{
				m_Downloads = new Downloads;
				ChildWindow* pWindow = new ChildWindow;
				pWindow->m_computedLeft = 80;//put_Left(pWindow, new Length(100, UnitAbsolute));
				pWindow->m_computedTop = 80;//put_Top(new Length(100, UnitAbsolute));
				pWindow->set_Width(new Length(240, Length::UnitAbsolute));
				pWindow->set_Height(new Length(210, Length::UnitAbsolute));

				pWindow->set_Content(dynamic_cast<Control*>(m_Downloads->m_itemContainer));

				pWindow->set_TitleText(OLESTR("Downloads"));

				pCanvas->AddChild(pWindow);
			}

			if (true)
			{
				m_Networks = new Networks;

				if (false)
				{
					Network* pNetwork = new Network;

					{
						pNetwork->pP2P = new GnutellaNetwork(pNetwork);
						pNetwork->pP2P->Connect();
					}

					m_Networks->m_itemContainer->AddItem(pNetwork);
				}

				if (false)
				{
					Network* pNetwork = new Network;

					{
						pNetwork->pP2P = new Gnutella2Network(pNetwork);
						pNetwork->pP2P->Connect();
					}

					m_Networks->m_itemContainer->AddItem(pNetwork);
				}

				{
					Network* pNetwork = new Network;

					{
						pNetwork->pP2P = new EDonkeyNetwork(pNetwork);
						pNetwork->pP2P->Connect();
					}

					m_Networks->m_itemContainer->AddItem(pNetwork);
				}

				ChildWindow* pWindow = new ChildWindow;
				pWindow->m_computedLeft = 80;//put_Left(pWindow, new Length(100, UnitAbsolute));
				pWindow->m_computedTop = 80;//put_Top(new Length(100, UnitAbsolute));
				pWindow->set_Width(new Length(240, Length::UnitAbsolute));
				pWindow->set_Height(new Length(210, Length::UnitAbsolute));

				pWindow->set_Content(dynamic_cast<Control*>(m_Networks->m_itemContainer));

				pWindow->set_TitleText(OLESTR("Networks"));

				pCanvas->AddChild(pWindow);
			}
		}
		p->set_Dock(pCanvas, DockPanel::Fill);
		p->AddRChild(pCanvas);
	}
	set_Content(p);
	set_TitleText(WSTR("LP2P"));
}
コード例 #2
0
TreeItem::TreeItem(TreeControl* ownerTree)
{
	ASSERT(0);
#if 0
	m_itemData = NULL;
//	m_iIndex = -1;
	m_cChildren = -1;

	m_userdata = NULL;
	//m_expanded = false;

	m_Span = new Border;

//	m_Content = NULL;

//	DockPanel* pPanel = new DockPanel;

	m_ownerCtl = ownerTree;

	if (ownerTree)
		m_pos = ownerTree->m_treeItems.insert(ownerTree->m_treeItems.end(), this);

	m_Children = NULL;
#if 0
	m_Children = new TreeItemChildren(ownerTree);
	m_Children->put_Visibility(Collapsed);
#endif
	//m_Button = new Canvas;
	{
		m_ExpandButton = new Border(new Thickness(new Length(1)));
	//	m_ExpandButton->put_Width(Length(22));
	//	m_ExpandButton->put_Height(Length(22));

		/*
			m_ExpandButton->m_LeftBrush = new SolidColorBrush(Color(0,0,0));
			m_ExpandButton->m_TopBrush = new SolidColorBrush(Color(0,0,0));
			m_ExpandButton->m_RightBrush = new SolidColorBrush(Color(0,0,0));
			m_ExpandButton->m_BottomBrush = new SolidColorBrush(Color(0,0,0));
			*/

		//Border* pRect = new Border(Thickness(Length(1), Length(1), Length(1), Length(1)));
	//	m_ExpandButton->put_Visibility(Hidden);
		{
			Border* pRect = new Border(new Thickness(new Length(1)));
			pRect->set_Width(new Length(14));
			pRect->set_Height(new Length(14));
			pRect->set_BorderBrush(new SolidColorBrush(new Color(90,90,90)));

			/*
			pRect->put_Fill(new SolidColorBrush(new Color(0, 0, 0)));
			pRect->put_RectangleWidth(new Length(14, Length::UnitAbsolute));
			pRect->put_RectangleHeight(new Length(14, Length::UnitAbsolute));
			*/
			{
				pRect->set_Content(new TextString(WSTR("-")));
			}
			m_ExpandButton->set_Content(pRect);
		}

		m_ExpandButton->set_Visibility(Hidden);

		//DockPanel::put_Dock(m_ExpandButton, DockPanel::Left);
		/*m_Button->*/AddRChild(m_ExpandButton);
	}

	AddRChild(m_Span);
	/*
	{
		m_ContentBorder = new CLXUICanvas;
	//	m_ContentBorder->put_Content(m_Content);
		DockPanel::put_Dock(m_ContentBorder, DockPanel::Fill);
		m_Button->AddRChild(m_ContentBorder);
	}
	*/
	//AddRChild(m_Button);
#if 0
	AddRChild(m_Children);
#endif
/*
	pPanel->AddRChild(m_Button);
	pPanel->AddRChild(m_Children);

	put_VisualTree(pPanel);
*/

//	m_pFont = m_ownerCtl->m_pFont;

//	m_ownerCtl->m_items.push_back(this);
#endif
}