void CXTPDockingPaneTabbedContainer::InvalidatePane(BOOL bSelectionChanged)
{
	if (!GetSafeHwnd())
		return;

	if (m_pParentContainer == 0)
		return;

	if (m_nLockReposition)
		return;

	m_nLockReposition += 1;
	OnTabsChanged();
	m_nLockReposition -= 1;

	CRect rect = m_rcWindow;
	CXTPDockingPaneBase::GetPaintManager()->AdjustClientRect(this, rect, TRUE);

	if (bSelectionChanged)
	{
		POSITION pos = GetHeadPosition();
		while (pos)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)GetNext(pos);
			CRect rcPane = m_pSelectedPane == pPane ? rect : CRect(0, 0, 0, 0);
			pPane->OnSizeParent(m_pDockingSite, rcPane, 0);
		}
	}
	Invalidate(FALSE);

	m_pParentContainer->InvalidatePane(bSelectionChanged);
}
LRESULT CMainFrame::_AttachDockPane( WPARAM wParam, LPARAM lParam )
{
	if (wParam == XTP_DPN_SHOWWINDOW)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

		if (!pPane->IsValid())
		{
			switch (pPane->GetID())
			{
			case IDR_Pane_ObjectProperty:
				pPane->Attach(m_propertyObject);
				break;

			case IDR_Pane_EffectProperty:
				pPane->Attach(m_propertyEffect);
				break;

			default: assert(0);
			}
		}
		return 1;
	}

	return 0;
}
Exemple #3
0
CXTPDockingPane* CMainFrame::CreatePane(int x, int y, CRuntimeClass* pNewViewClass, CString strFormat, XTPDockingPaneDirection direction, CXTPDockingPane* pNeighbour)
{
	//做个标记
	int nID = ++m_nCount;
	
	CXTPDockingPane* pwndPane = m_paneManager.CreatePane(nID, CRect(0, 0,x, y), direction, pNeighbour);
	
	CString strTitle;
	strTitle.Format(strFormat, nID);
	pwndPane->SetTitle(strTitle);
	pwndPane->SetIconID(nID % 6 + 1);
	
	CFrameWnd* pFrame = new CFrameWnd;
	
	CCreateContext context;
	context.m_pNewViewClass = pNewViewClass;
	context.m_pCurrentDoc = GetActiveView()->GetDocument();
	
	pFrame->Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, NULL, 0, &context);
	pFrame->ModifyStyleEx(WS_EX_CLIENTEDGE, 0);
	
	m_mapPanes.SetAt(nID, pFrame);
	
	return pwndPane;
}
LRESULT CXTPDockingPaneTabbedContainer::OnHelpHitTest(WPARAM, LPARAM lParam)
{
	CXTPDockingPane* pPane = GetSelected();
	CPoint point((DWORD)lParam);

	int nHit = HitTest(point);

	if (nHit >= 0)
	{
		pPane = GetItemPane(nHit);
	}

	if (!pPane)
		return 0;

	int nIDHelp = pPane->m_nIDHelp;

	if (nIDHelp == 0)
	{
		pPane->m_hwndChild ? (int)::GetDlgCtrlID(pPane->m_hwndChild): 0;
	}

	if (nIDHelp == 0)
	{
		nIDHelp = pPane->GetID();
	}

	return HID_BASE_RESOURCE + nIDHelp;
}
void CXTPDockingPaneTabbedContainer::OnLButtonDblClk(UINT /*nFlags*/, CPoint point)
{
	if (PerformClick(m_hWnd, point, TRUE))
		return;

	if (HitTestCaptionButton(point))
		return;

	int nHit = HitTest(point);
	if (nHit == DOCKINGPANE_HITCAPTION)
	{
		CXTPDockingPane* pSelected = GetSelected();

		if (IsHidden() && pSelected && ((pSelected->GetOptions() & xtpPaneNoHideable) != 0))
			return;

		if (!IsHidden() && pSelected && ((pSelected->GetOptions() & xtpPaneNoFloatableByCaptionDoubleClick) != 0))
			return;

		GetDockingPaneManager()->ToggleDocking(this);
	}
	else if (nHit >= 0)
	{
		CXTPDockingPane* pPane = GetItemPane(nHit);

		if ((pPane->GetOptions() & xtpPaneNoFloatableByTabDoubleClick) == 0)
		{
			GetDockingPaneManager()->ToggleDocking(pPane);
		}
	}

}
void CXTPDockingPaneTabbedContainer::OnCaptionButtonClick(CXTPDockingPaneCaptionButton* pButton)
{
	CXTPDockingPane* pSelectedPane = m_pSelectedPane;

	CXTPDockingPaneManager* pManager = GetDockingPaneManager();

	switch (pButton->GetID())
	{
	case XTP_IDS_DOCKINGPANE_CLOSE:

		if (pManager->m_bCloseGroupOnButtonClick)
		{
			POSITION pos = m_lstPanes.GetTailPosition();
			while (pos)
			{
				CXTPDockingPane* pPane = (CXTPDockingPane*)m_lstPanes.GetPrev(pos);

				ClosePane(pPane);
			}

		}
		else if (pSelectedPane)
		{
			ClosePane(pSelectedPane);
		}
		break;


	case XTP_IDS_DOCKINGPANE_AUTOHIDE:

		if (!IsHidden())
		{
			if (!pManager->NotifyAction(xtpPaneActionUnpinning, pSelectedPane))
			{
				GetDockingSite()->SetFocus();
				NormalizeDockingSize();
				pSelectedPane->Hide();
				pManager->NotifyAction(xtpPaneActionUnpinned, pSelectedPane);
			}

		}
		else
		{
			GetDockingPaneManager()->ToggleDocking(pManager->m_bHideGroupOnButtonClick ?
				(CXTPDockingPaneBase*)this : (CXTPDockingPaneBase*)pSelectedPane);
		}

		break;

	case XTP_IDS_DOCKINGPANE_MAXIMIZE:
		Maximize();
		break;

	case XTP_IDS_DOCKINGPANE_RESTORE:
		Restore();
		break;

	}
}
void CXTPDockingPaneTabbedContainer::Copy(CXTPDockingPaneBase* pCloneBase, CXTPPaneToPaneMap* pMap, DWORD dwIgnoredOptions)
{
	CXTPDockingPaneTabbedContainer* pClone = (CXTPDockingPaneTabbedContainer*)pCloneBase;
	ASSERT(pClone);
	if (!pClone)
		return;

	m_bActive = FALSE;
	m_pDockingSite = GetDockingPaneManager()->GetSite();
	m_pSelectedPane = m_pTrackingPane = NULL;

	m_rcWindow = pClone->m_rcWindow;
	m_szDocking = pClone->m_szDocking;
	m_bTitleVisible = TRUE;
	m_nLockReposition = 0;

	if (pClone->m_pLayout != m_pLayout)
	{
		m_bMaximized = pClone->m_bMaximized;
	}

	CXTPDockingPane* pSelected = NULL;
	if (pMap)
	{
		POSITION pos = pClone->GetHeadPosition();
		while (pos)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)pClone->GetNext(pos);
			CXTPDockingPane* pNewPane = (CXTPDockingPane*)pPane->Clone(m_pLayout, pMap);
			if (pClone->GetSelected() == pPane) pSelected = pNewPane;
			_InsertPane(pNewPane);
		}
	}
	else
	{

		POSITION pos = pClone->m_lstPanes.GetHeadPosition();
		while (pos)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)pClone->GetNext(pos);

			ASSERT(pPane->GetType() == xtpPaneTypeDockingPane);

			if ((((CXTPDockingPane*)pPane)->GetOptions() & dwIgnoredOptions) == 0)
			{
				if (pClone->GetSelected() == pPane && pSelected == NULL) pSelected = pPane;

				pPane->m_pParentContainer->RemovePane(pPane);
				_InsertPane(pPane);
			}
		}
	}
	if (pSelected) SelectPane(pSelected, FALSE);


}
void CXTPDockingPaneTabbedContainer::OnSizeParent(CWnd* pParent, CRect rect, LPVOID lParam)
{
	AFX_SIZEPARENTPARAMS* lpLayout = (AFX_SIZEPARENTPARAMS*)lParam;

	ASSERT(!IsEmpty());

	SetDockingSite(pParent);
	m_rcWindow = rect;

	if (lpLayout == 0 || lpLayout->hDWP != NULL)
	{
		CRect rectOld;
		::GetWindowRect(m_hWnd, rectOld);
		HWND hWndParent = ::GetParent(m_hWnd);
		::ScreenToClient(hWndParent, &rectOld.TopLeft());
		::ScreenToClient(hWndParent, &rectOld.BottomRight());
		if (rectOld != rect || m_bDelayRedraw)
		{
			SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, rect.Width(), rect.Height(), 0);
			Invalidate(FALSE);
			m_bDelayRedraw = FALSE;
		}
		else
		{
			SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOACTIVATE);
		}

		m_nLockReposition += 1;
		OnTabsChanged();
		m_nLockReposition -= 1;

		GetPinButton()->SetState(IsHidden() ? xtpPanePinVisible | xtpPanePinPushed: DYNAMIC_DOWNCAST(CXTPDockingPaneMiniWnd, pParent) == 0 ? xtpPanePinVisible : 0);

		CXTPDockingPaneBase::GetPaintManager()->AdjustClientRect(this, rect, TRUE);

		POSITION pos = GetHeadPosition();
		while (pos)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)GetNext(pos);

			CRect rcPane = m_pSelectedPane == pPane ? rect : CRect(0, 0, 0, 0);
			pPane->OnSizeParent(pParent, rcPane, lParam);
		}

		if (m_bEnsureSelectedTab)
		{
			m_bEnsureSelectedTab = FALSE;
			EnsureSelectedTabVisible();
		}
	}
}
BOOL CXTPDockingPaneSidePanel::IsCaptionButtonVisible(CXTPDockingPaneCaptionButton* pButton)
{
	CXTPDockingPane* pSelectedPane = GetSelectedPane();

	if (pButton->GetID() == XTP_IDS_DOCKINGPANE_CLOSE)
		return pSelectedPane && ((pSelectedPane->GetOptions() & xtpPaneNoCloseable) == 0);

	if (pButton->GetID() == XTP_IDS_DOCKINGPANE_AUTOHIDE)
	{
		pButton->SetState(m_bCollapsed ? xtpPanePinPushed : 0);
		return pSelectedPane && ((pSelectedPane->GetOptions() & xtpPaneNoHideable) == 0);
	}

	return TRUE;
}
void gkToolBarPaneBase::RegisterPane( CWnd* pCtrl, const TCHAR* name, XTPDockingPaneDirection dockdir, CSize constrain, int dockoption )
{
 	NameIDMap::iterator it = m_paneMap.find(name);
 	if (it == m_paneMap.end())
 	{
 		CXTPDockingPane* pane = m_paneManager.CreatePane( ++m_paneIDCounter, CRect(0, 0, 100, 120), dockdir );
 		pane->SetTitle(name);
 		pane->SetOptions(dockoption);
 		pane->Attach( pCtrl );
 		m_paneManager.ShowPane(pane);

		//pane->SetMinTrackSize(constrain);
		pane->SetMaxTrackSize(constrain);
 
 		m_paneMap[name] = m_paneIDCounter;
 	}
}
BOOL CXTPDockingPaneSidePanel::Init(CXTPDockingPaneBase* pBasePane, XTPDockingPaneDirection direction, CRect rc)
{
	CXTPDockingPaneBaseList lstPanes;
	pBasePane->FindPane(xtpPaneTypeDockingPane, &lstPanes);
	if (lstPanes.GetCount() == 0)
		return FALSE;

	m_direction = direction;
	m_rcWindow = rc;
	CreateContainer();

	CXTPDockingPaneTabbedContainer* pContainer = (CXTPDockingPaneTabbedContainer*)GetDockingPaneManager()->
		OnCreatePane(xtpPaneTypeTabbedContainer, m_pLayout);

	BOOL bInit = FALSE;

	POSITION pos = lstPanes.GetHeadPosition();
	while (pos)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)lstPanes.GetNext(pos);

		if (pPane->GetContainer())
		{
			pPane->GetContainer()->RemovePane(pPane);
		}

		if (!bInit)
		{
			pContainer->Init((CXTPDockingPane*)pPane, this);
		}
		else
		{
			pContainer->_InsertPane(pPane, FALSE);
		}
		bInit = TRUE;
	}

	_InsertPane(pContainer);

	OnFocusChanged();

	m_nIdleFlags = 0;

	return TRUE;
}
Exemple #12
0
LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
	if (wParam == XTP_DPN_SHOWWINDOW)
	{
		// get a pointer to the docking pane being shown.
		CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
		if (!pPane->IsValid())
		{
			CWnd* pWnd = NULL;
			if (m_mapPanes.Lookup(pPane->GetID(), pWnd))
			{
				pPane->Attach(pWnd);
			}
		}
		
		return TRUE; // handled
	}
	return FALSE;
}
LRESULT DialogBehaviorTreeEditor::_AttachDockPane( WPARAM wParam, LPARAM lParam )
{
	if (wParam == XTP_DPN_SHOWWINDOW)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

		if (!pPane->IsValid())
		{
			switch (pPane->GetID())
			{
			case IDR_Pane_BT_Explorer: pPane->Attach(m_pExplorer); break;
			case IDR_Pane_BT_Property: pPane->Attach(m_property); break;
			default: assert(0);
			}
		}
		return 1;
	}

	return 0;
}
void CXTPDockingPaneTabbedContainer::OnTabsChanged()
{
	if (!m_hWnd)
		return;

	m_nLockReposition += 1;

	DeleteAllItems();

	m_bCloseItemButton = GetDockingPaneManager()->m_bShowCloseTabButton;

	POSITION pos = GetHeadPosition();
	while (pos)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)GetNext(pos);

		CXTPTabManagerItem* pItem = AddItem(GetItemCount());
		if (m_pSelectedPane == pPane) SetSelectedItem(pItem);

		pItem->SetCaption(pPane->GetTabCaption());
		pItem->SetColor(pPane->GetItemColor());
		pItem->SetTooltip(pPane->GetTitle());
		pItem->SetEnabled(pPane->GetEnabled() & xtpPaneEnableClient);
		pItem->SetClosable((pPane->GetOptions() & xtpPaneNoCloseable) == 0);

		pItem->SetData((DWORD_PTR)pPane);
	}
	//////////////////////////////////////////////////////////////////////////

	m_pCaptionButtons->CheckForMouseOver(CPoint(-1, -1));

	m_nLockReposition -= 1;
}
void CXTPDockingPaneTabbedContainer::SetDockingSite(CWnd* pFrame)
{
	m_pDockingSite = pFrame;

	if (m_hWnd && !pFrame->GetSafeHwnd())
	{
		pFrame = GetDockingPaneManager()->GetSite();
	}

	if (m_hWnd)
	{
		if (GetParent() != pFrame) CWnd::SetParent(pFrame);
	}

	POSITION pos = GetHeadPosition();
	while (pos)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)GetNext(pos);
		pPane->SetDockingSite(m_pDockingSite);
	}

}
Exemple #16
0
LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
	if (wParam == XTP_DPN_SHOWWINDOW)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

		if (!pPane->IsValid())
		{
			switch (pPane->GetID())
			{
			case IDR_PANE_PROPERTIES:
				{
					if (m_wndProperties.GetSafeHwnd() == 0)
					{
						m_wndProperties.Create(WS_CHILD|
							ES_AUTOVSCROLL|ES_MULTILINE,
							CRect(0, 0, 0, 0), this, 0);
					}
					pPane->Attach(&m_wndProperties);
					break;
				}
			case IDR_PANE_OPTIONS:
				{
					if (m_wndOptions.GetSafeHwnd() == 0)
					{
						m_wndOptions.Create(_T("\n\nOptions"),
							WS_CHILD|WS_CLIPCHILDREN|
							WS_CLIPSIBLINGS|SS_CENTER,
							CRect(0, 0, 0, 0), this, 0);
					}
					pPane->Attach(&m_wndOptions);
					break;
				}
			}
		}
		return TRUE;
	}
	return FALSE;
}
Exemple #17
0
LRESULT CMainFrame::_AttachDockPane( WPARAM wParam, LPARAM lParam )
{
	if (wParam == XTP_DPN_SHOWWINDOW)
	{
		CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

		if (!pPane->IsValid())
		{
			switch (pPane->GetID())
			{
			case IDR_Pane_ResourceSelector:
				pPane->Attach(&m_resourceSelector);
				break;

			case IDR_Pane_TerrainProperty:
				pPane->Attach(m_propertyTerrain);
				break;

			case IDR_Pane_ObjectProperty:
				pPane->Attach(m_propertyObject);
				break;

			case IDR_Pane_EffectProperty:
				pPane->Attach(m_propertyEffect);
				break;

			case IDR_Pane_Attachment:
				pPane->Detach();
				break;

			case IDR_Pane_BTEditor:
				pPane->Attach(m_dlgBTEditor);
				break;

			default: assert(0);
			}
		}
		return 1;
	}

	return 0;
}
void CXTPDockingPaneSidePanel::OnCaptionButtonClick(CXTPDockingPaneCaptionButton* pButton)
{
	CXTPDockingPaneManager* pManager = GetDockingPaneManager();

	switch (pButton->GetID())
	{
		case XTP_IDS_DOCKINGPANE_CLOSE:
			{
				CXTPDockingPaneBaseList lstPanes;
				FindPane(xtpPaneTypeDockingPane, &lstPanes);

				POSITION pos = lstPanes.GetTailPosition();
				while (pos)
				{
					CXTPDockingPane* pPane = (CXTPDockingPane*)lstPanes.GetPrev(pos);

					if ((pPane->GetOptions() & xtpPaneNoCloseable) != 0)
						continue;

					pPane->InternalAddRef();

					if (!pManager->NotifyAction(xtpPaneActionClosing, pPane))
					{
						pPane->Close();
						pManager->NotifyAction(xtpPaneActionClosed, pPane);
					}

					pPane->InternalRelease();
				}
			}
			break;

		case XTP_IDS_DOCKINGPANE_AUTOHIDE:
			OnPinButtonClick();
			break;
	}
}
	// 浮动窗口通知
	LRESULT TerrainEditorPlugin::onDockingPaneNotify(WPARAM wParam, LPARAM lParam)
	{
		if (wParam == XTP_DPN_SHOWWINDOW)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

			if (!pPane->IsValid())
			{
				switch (pPane->GetID())
				{
				case DlgTerrainBrush::IDD:
					{
						if (m_DlgTerrainBrush.GetSafeHwnd() == 0)
						{
							m_DlgTerrainBrush.Create(DlgTerrainBrush::IDD, m_worldEditor->getMainFrame()->getWnd());
						}
						pPane->Attach(&m_DlgTerrainBrush);
					}
					break;
				case DlgTerrainHeight::IDD:
					{
						if (m_DlgTerrainHeight.GetSafeHwnd() == 0)
						{
							m_DlgTerrainHeight.Create(DlgTerrainHeight::IDD, m_worldEditor->getMainFrame()->getWnd());
						}
						pPane->Attach(&m_DlgTerrainHeight);
					}
					break;
				case DlgTerrainPaint::IDD:
					{
						if (m_DlgTerrainPaint.GetSafeHwnd() == 0)
						{
							m_DlgTerrainPaint.Create(DlgTerrainPaint::IDD, m_worldEditor->getMainFrame()->getWnd());
						}
						pPane->Attach(&m_DlgTerrainPaint);
					}
					break;
				default:
					return FALSE;
					break;
				}
			}
			return TRUE;
		}
		return FALSE;
	}
Exemple #20
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	AfxGetApp()->m_nCmdShow = SW_HIDE;
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	//界面居中显示
   this ->CenterWindow(CWnd::GetDesktopWindow());

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
    
	m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, NULL);
	m_wndStatusBar.SetPaneInfo(1, m_wndStatusBar.GetItemID(1), SBPS_NORMAL, 485);
	m_wndStatusBar.SetPaneInfo(2, m_wndStatusBar.GetItemID(2), SBPS_NORMAL, 100);
	m_wndStatusBar.SetPaneInfo(3, m_wndStatusBar.GetItemID(3), SBPS_NORMAL, NULL);
	m_wndStatusBar.SetPaneInfo(4, m_wndStatusBar.GetItemID(4), SBPS_NORMAL, NULL);
	m_wndStatusBar.SetPaneInfo(5, m_wndStatusBar.GetItemID(5), SBPS_NORMAL, NULL);

	XTPColorManager()->DisableLunaColors(TRUE);

	if (!m_TrayIcon.Create(_T("Online: 0"), // Toolktip text
		this,                       // Parent window
		IDR_MAINFRAME,               // Icon resource ID
		IDR_MINIMIZE,             // Resource ID of popup menu
		IDM_SHOW,                // Default menu item for popup menu
		false))                     // True if default menu item is located by position
	{
		TRACE0("Failed to create tray icon\n");
		return -1;
	}	

/*	if (!InitCommandBars())
	{
		return -1;
	}
	
	CXTPCommandBars* pCommandBars = GetCommandBars();
	
	CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
	pMenuBar->SetFlags(xtpFlagAddMDISysPopup);

	// Create ToolBar
	CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
	if (!pCommandBar ||
		!pCommandBar->LoadToolBar(IDR_TOOLBAR4))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;
	}*/
// 	CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions();
// 	pOptions->bShowExpandButtonAlways= FALSE;
// 	pOptions->bShowTextBelowIcons = true;
// 	pOptions->bLargeIcons = TRUE;
//	pCommandBar->GetImageManager()->SetIcons(IDR_TOOLBAR4,IDB_BARNEW);
//	RedrawWindow(0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);   
//	GetCommandBars()->GetPaintManager()->RefreshMetrics(); 
// 	ModifyStyle(WS_THICKFRAME, 0);
// 	ModifyStyle(0, WS_THICKFRAME);

//	pCommandBars->GetCommandBarsOptions()->bShowTextBelowIcons = TRUE;
//	pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);
	XTPColorManager()->DisableLunaColors(TRUE);
//	pCommandBars->SetTheme(xtpThemeOfficeXP);

	CXTPPaintManager::SetTheme(xtpThemeVisualStudio2008);
	/*
	xtpThemeOffice2000,     // Office 2000 theme.
	xtpThemeOfficeXP,       // Office XP theme.
	xtpThemeOffice2003,     // Office 2003 theme.
	xtpThemeNativeWinXP,    // Windows XP themes support.
	xtpThemeWhidbey,        // Visual Studio 2005 theme.
	xtpThemeVisualStudio2008, // Visual Studio 2008 theme
	xtpThemeVisualStudio6,    // Visual Studio 6 theme
	xtpThemeVisualStudio2010, // Visual Studio 2010 theme
	xtpThemeCustom          // Custom theme.
	*/
	m_paneManager.InstallDockingPanes(this);
	m_paneManager.SetTheme(xtpPaneThemeVisualStudio2005Beta2); // 设置主题
	// 		xtpPaneThemeOffice2003,            // Office 2003 Style Theme
	// 		xtpPaneThemeWinNative,             // Windows Native Style Theme
	// 		xtpPaneThemeVisualStudio2005Beta2, // Visual Studio 2005 Whidbey Beta 2 Style Theme
	// 		xtpPaneThemeVisualStudio2008,      // Visual Studio 2008 Style Theme
	// 		xtpPaneThemeVisualStudio2010,      // Visual Studio 2010 Beta 1 Style Theme
	CXTPDockingPane* pwndPaneLog = CreatePane(20, 141, RUNTIME_CLASS(CLogView), _T(" 日志信息 "), xtpPaneDockBottom);
// 	CXTPDockingPane* pwndPaneTool = CreatePane(20, 141, RUNTIME_CLASS(CTools), _T(" Batch "), xtpPaneDockBottom);
//	CXTPDockingPane* pwndPaneDDOSFlood = CreatePane(20, 141, RUNTIME_CLASS(CDDOSFlood), _T(" 常规测试1 "), xtpPaneDockBottom);
//	CXTPDockingPane* pwndPaneDDOSFlood1 = CreatePane(20, 141, RUNTIME_CLASS(CDDOSFlood1), _T(" 常规测试2 "), xtpPaneDockBottom);
//	CXTPDockingPane* pwndPaneDDOSWeb = CreatePane(20, 141, RUNTIME_CLASS(CDDOSWeb), _T(" Web测试1 "), xtpPaneDockBottom);
//	CXTPDockingPane* pwndPaneDDOSWeb1 = CreatePane(20, 141, RUNTIME_CLASS(CDDOSWeb1), _T(" Web测试2 "), xtpPaneDockBottom);
//	CXTPDockingPane* pwndPaneDDOSDNS = CreatePane(20, 141, RUNTIME_CLASS(CDDOSDrDos), _T(" DNS "), xtpPaneDockBottom);
	
//	m_paneManager.AttachPane( pwndPaneDDOSFlood, pwndPaneLog );
// 	m_paneManager.AttachPane( pwndPaneDDOSFlood, pwndPaneTool );
//	m_paneManager.AttachPane( pwndPaneDDOSFlood1, pwndPaneDDOSFlood );
//	m_paneManager.AttachPane( pwndPaneDDOSWeb, pwndPaneDDOSFlood1 );
//	m_paneManager.AttachPane( pwndPaneDDOSWeb1, pwndPaneDDOSWeb );
//	m_paneManager.AttachPane( pwndPaneDDOSDNS, pwndPaneDDOSWeb1 );
 	pwndPaneLog->Select();
	pwndPaneLog->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);
//	pwndPaneTool->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);
// 	pwndPaneDDOSFlood->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);
//	pwndPaneDDOSFlood1->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);
//	pwndPaneDDOSWeb->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);
 //	pwndPaneDDOSWeb1->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);
//	pwndPaneDDOSDNS->SetOptions(xtpPaneNoCloseable|xtpPaneNoHideable|xtpPaneNoFloatable|xtpPaneNoCaption|xtpPaneNoDockable|xtpPaneNoFloatableByTabDoubleClick|xtpPaneNoFloatableByCaptionDoubleClick|xtpPaneNoHoverShow);

	
//	XTPColorManager()->DisableLunaColors(TRUE);
//	CXTPPaintManager::SetTheme(xtpThemeOfficeXP);
	
//	LoadCommandBars(_T("CommandBars"));
	
//	SetTimer(1,1000,NULL); 
	
	return 0;
}
Exemple #21
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	AfxGetApp()->m_nCmdShow = SW_HIDE;
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	//界面居中显示
   this ->CenterWindow(CWnd::GetDesktopWindow());

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, NULL);
	m_wndStatusBar.SetPaneInfo(1, m_wndStatusBar.GetItemID(1), SBPS_NORMAL, 180);
	m_wndStatusBar.SetPaneInfo(2, m_wndStatusBar.GetItemID(2), SBPS_NORMAL, 100);
	m_wndStatusBar.SetPaneInfo(3, m_wndStatusBar.GetItemID(3), SBPS_NORMAL, 100);
	m_wndStatusBar.SetPaneInfo(4, m_wndStatusBar.GetItemID(4), SBPS_NORMAL, NULL);
	m_wndStatusBar.SetPaneInfo(5, m_wndStatusBar.GetItemID(5), SBPS_NORMAL, NULL);
	m_wndStatusBar.SetPaneInfo(6, m_wndStatusBar.GetItemID(6), SBPS_NORMAL, NULL);
	
	///////////////////////////////////////////////////////////////////////////////////////

	m_wndStatusBar.EnableCustomization();
	
	if (!m_TrayIcon.Create(_T(""), // Toolktip text
		this,                       // Parent window
		IDR_MAINFRAME,               // Icon resource ID
		IDR_MINIMIZE,             // Resource ID of popup menu
		IDM_SHOW,                // Default menu item for popup menu
		false))                     // True if default menu item is located by position
	{
		TRACE0("Failed to create tray icon\n");
		return -1;
	}	
	
	if (!InitCommandBars())
	{
		return -1;
	}
	

	CXTPCommandBars* pCommandBars = GetCommandBars();
	
	CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
	pMenuBar->SetFlags(xtpFlagAddMDISysPopup);
	
	CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
	if (!pCommandBar ||
		!pCommandBar->LoadToolBar(IDR_TOOLBAR3))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;
	};
	
	pCommandBars->GetCommandBarsOptions()->bShowTextBelowIcons = TRUE;
	pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);

	
	m_paneManager.InstallDockingPanes(this);
	m_paneManager.SetTheme(xtpPaneThemeWinExplorer);
	CXTPDockingPane* pwndPaneLog = CreatePane(300, 141, RUNTIME_CLASS(CLogView), _T("日志信息"), xtpPaneDockBottom);
	CXTPDockingPane* pwndPaneShortcuts = CreatePane(200, 145, RUNTIME_CLASS(CShortcuts), _T("快捷功能"), xtpPaneDockRight,pwndPaneLog);
	CXTPDockingPane* pwndPaneIPUP = CreatePane(200, 145, RUNTIME_CLASS(CIPUpdate), _T("域名更新"), xtpPaneDockRight,pwndPaneLog);
	
	pwndPaneIPUP->Select();
	m_paneManager.AttachPane( pwndPaneIPUP ,pwndPaneShortcuts );

	pwndPaneShortcuts->SetOptions(xtpPaneNoCaption);
	pwndPaneIPUP->SetOptions(xtpPaneNoCaption);
	
	XTPColorManager()->DisableLunaColors(TRUE);
	CXTPPaintManager::SetTheme(xtpThemeOffice2003);
	LoadCommandBars(_T("CommandBars"));
	
	SetTimer(1,1000,NULL); 
	
	return 0;
}
Exemple #22
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    AfxGetApp()->m_nCmdShow = SW_HIDE;
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;
    this->CenterWindow(CWnd::GetDesktopWindow());

    if (!m_wndStatusBar.Create(this) ||
            !m_wndStatusBar.SetIndicators(indicators,
                                          sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }

    if (!InitCommandBars())
        return -1;

    CXTPCommandBars* pCommandBars = GetCommandBars();
    if(pCommandBars == NULL)
    {
        TRACE0("Failed to create command bars object.\n");
        return -1;      // fail to create
    }

    //设置下面状态栏
    m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, NULL);
    m_wndStatusBar.SetPaneInfo(1, m_wndStatusBar.GetItemID(1), SBPS_NORMAL, 250);
    m_wndStatusBar.SetPaneInfo(2, m_wndStatusBar.GetItemID(2), SBPS_NORMAL, 120);
    m_wndStatusBar.SetPaneInfo(3, m_wndStatusBar.GetItemID(3), SBPS_NORMAL, 120);
    /*
    	m_wndStatusBar.EnableCustomization();

    	if (!m_TrayIcon.Create(_T(""), // Toolktip text
    		this,                       // Parent window
    		IDR_MAINFRAME,               // Icon resource ID
    		IDR_MINIMIZE,             // Resource ID of popup menu
    		IDM_SHOW,                // Default menu item for popup menu
    		false))                     // True if default menu item is located by position
    	{
    		TRACE0("Failed to create tray icon\n");
    		return -1;
    	}
    	*/

    if (!InitCommandBars())
    {
        return -1;
    }

//	CXTPCommandBars* pCommandBars = GetCommandBars();

    CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
    pMenuBar->SetFlags(xtpFlagAddMDISysPopup);
    /*
    	CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
    	if (!pCommandBar ||
    		!pCommandBar->LoadToolBar(IDR_TOOLBAR3))
    	{
    		TRACE0("Failed to create toolbar\n");
    		return -1;
    	};
    	*/
    CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("工具栏(T)"), xtpBarTop);
    if (!pCommandBar ||
            !pCommandBar->LoadToolBar(IDR_TOOLBAR3)) //
    {
        TRACE0("Failed to create toolbar\n");
        return -1;
    }



    pCommandBars->GetCommandBarsOptions()->bShowTextBelowIcons = TRUE;
    pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);




    /*

    	// Create ToolBar
    	CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T("工具栏(T)"), xtpBarTop);
    	if (!pCommandBar ||
    		!pCommandBar->LoadToolBar(IDR_TOOLBAR3)) //
    	{
    		TRACE0("Failed to create toolbar\n");
    		return -1;
    	}


    //    LoadIcons();

    	CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions();


    	pOptions->bShowExpandButtonAlways= FALSE;

    	pOptions->bShowTextBelowIcons = true;
    	pOptions->bLargeIcons = TRUE;
    	pCommandBar->GetImageManager()->SetIcons(IDR_TOOLBAR3,IDB_BITMAP1);

    	RedrawWindow(0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);
    	GetCommandBars()->GetPaintManager()->RefreshMetrics();

    	ModifyStyle(WS_THICKFRAME, 0);
    	ModifyStyle(0, WS_THICKFRAME);
    	pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowNever);

    */



    m_paneManager.InstallDockingPanes(this);
    m_paneManager.SetTheme(xtpPaneThemeVisualStudio2010); // 设置主题

    CXTPDockingPane* pwndPaneLog = CreatePane(235, 150, RUNTIME_CLASS(CLogView), _T("日志信息"), xtpPaneDockBottom);
    CXTPDockingPane* pwndPaneNum = CreatePane(58, 150, RUNTIME_CLASS(CShowNum), _T("主机统计"), xtpPaneDockRight, pwndPaneLog);
//	CXTPDockingPane* pwndPaneChoose = CreatePane(235, 150, RUNTIME_CLASS(CMoreChoose), _T("筛选主机"), xtpPaneDockBottom);
    CXTPDockingPane* pwndPaneUPDATEIP = CreatePane(235, 150, RUNTIME_CLASS(CUPDATEIP), _T("域名更新"), xtpPaneDockBottom);
//    CXTPDockingPane* pwndPaneBatch = CreatePane(235, 150, RUNTIME_CLASS(CBatch), _T("批量命令"), xtpPaneDockBottom);
//	CXTPDockingPane* pwndPaneplay = CreatePane(260, 145, RUNTIME_CLASS(CBuildServer), _T("整蛊娱乐"), xtpPaneDockBottom);
    CXTPDockingPane* pwndPaneproxy = CreatePane(235, 150, RUNTIME_CLASS(CProxy), _T("远程连接"), xtpPaneDockBottom);

//	m_paneManager.AttachPane( pwndPaneChoose, pwndPaneLog );
    m_paneManager.AttachPane( pwndPaneUPDATEIP, pwndPaneLog);
//	m_paneManager.AttachPane( pwndPaneBatch, pwndPaneChoose);
    m_paneManager.AttachPane( pwndPaneproxy, pwndPaneUPDATEIP );

    pwndPaneLog->Select();
    pwndPaneLog->SetOptions(xtpPaneNoCaption);
    pwndPaneNum->SetOptions(xtpPaneNoCaption);
//	pwndPaneChoose->SetOptions(xtpPaneNoCaption);
    pwndPaneUPDATEIP->SetOptions(xtpPaneNoCaption);
//	pwndPaneBatch->SetOptions(xtpPaneNoCaption);
//	pwndPaneplay->SetOptions(xtpPaneNoCaption);
    pwndPaneproxy->SetOptions(xtpPaneNoCaption);
    /*
    	XTPColorManager()->DisableLunaColors(TRUE);
    	CXTPPaintManager::SetTheme(xtpThemeOffice2003);
    	LoadCommandBars(_T("CommandBars"));

    	SetTimer(1,1000,NULL);
    */
    m_hDrawIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
    m_hEmptyIcon = AfxGetApp()->LoadIcon(IDI_SYSTRAY1);
    m_NotifyIcon.cbSize = sizeof(NOTIFYICONDATA);
    m_NotifyIcon.hWnd = this->GetSafeHwnd();

    CString Lineips = Onlinetips();
    CString Lineips1 = OnVoicepromptsm();
    wsprintf(m_NotifyIcon.szTip,"主机数量: %d台\n语音: %s\n消息提示: %s",Zjshulian,Lineips1,Lineips);
    m_NotifyIcon.uCallbackMessage = WM_ICONMESSAGE;
    m_NotifyIcon.uFlags = NIF_MESSAGE|NIF_TIP|NIF_ICON;
    m_NotifyIcon.hIcon = m_hDrawIcon;
    m_NotifyIcon.uID = IDR_MAINFRAME;
    Shell_NotifyIcon(NIM_ADD, &m_NotifyIcon);

    //初始化记录值
//     m_nCurrent = 0;
//	SetTimer(1, 500, NULL);  //开启定时器 1


    return 0;
}