BOOL CXTPMouseManager::PreTranslateMouseEvents(WPARAM wParam, POINT point)
{
	HWND hWndMouse = ::WindowFromPoint(point);
	CTrackArray& arrTracked = m_arrTracked;
	int i;

	for (i = (int)arrTracked.GetSize() - 1; i >= 0; i--)
	{
		CXTPCommandBar* pCommandBar = arrTracked[i];

		if (!pCommandBar->GetSafeHwnd())
			continue;

		int nHtCode = pCommandBar->OnMouseHitTest(point);

		if ((nHtCode != HTERROR) && ((nHtCode == HTCLIENT) || ::IsChild(pCommandBar->GetSafeHwnd(), hWndMouse) || IsRelated(pCommandBar->GetSafeHwnd(), hWndMouse)))
		{
			if (pCommandBar->m_nLockRecurse > 0 && wParam != WM_MOUSEMOVE && wParam != WM_NCMOUSEMOVE && !m_bIgnoreLButtonUp)
			{
				SendTrackLostRecurse();
				ptMouse = 0;
			}
			return FALSE;
		}
	}

	if (arrTracked.GetSize() > 0)
	{
		CTrustedArray& arrTrusted = m_arrTrusted;
		for (i = 0; i < arrTrusted.GetSize(); i++)
		{
			HWND hWnd = arrTrusted[i];
			if (IsWindow(hWnd) && IsWindowVisible(hWnd) && CXTPWindowRect(hWnd).PtInRect(point))
			{
				return FALSE;
			}
		}

	}

	if (hWndMouse && arrTracked.GetSize() > 0)
	{
		if (GetClassLong(hWndMouse, GCL_STYLE) & CS_IME)
			return FALSE;
	}

	for (i = 0; i < arrTracked.GetSize(); i++)
	{
		DeliverMessage(arrTracked.GetAt(i), wParam, point);
	}

	return FALSE;

}
Esempio n. 2
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CXTPFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

    // Enable/Disable XP GUI Mode
//    xtAfxData.bXPMode = TRUE;

    // Enable/Disable Menu Shadows
//    xtAfxData.bMenuShadows = TRUE;

	if (!InitCommandBars())
		return -1;
	CXTPPaintManager::SetTheme(xtpThemeOffice2003);  //xtpThemeVisualStudio2008
	CXTPCommandBars* pCommandBars = GetCommandBars();
	CXTPCommandBar* pMenuBar;
    	pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
	pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage | xtpFlagHideMDIButtons);  //main  IDR_MAINFRAME
/*	if (!m_wndMenuBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndMenuBar.LoadMenuBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create menubar\n");
		return -1;      // fail to create  m_wndMenuBar
	}*/
	
	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_wndMenuBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_SEMIFLAT);
//	m_wndToolBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_SEMIFLAT);
//	EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_SEMIFLAT);
//	DockControlBar(&m_wndMenuBar);
//	DockControlBar(&m_wndToolBar);

//	InstallCoolMenus(IDR_MAINFRAME);
	///////////////装入数据库信息////////////////
//	m_sql.Init();
//	if(m_sql.Connect(_T("masterdefine"),_T("kj86"),_T("kj86")))
	{
//		AfxMessageBox("NetThread:无法连接用户参数数据库,请确定SQL SERVER服务是否运行!");
//		return 0;
	}
//	LoadPointInfo();

	return 0;
}
Esempio n. 3
0
CXTPControlStatic* CControlGalleryUndo::FindInfoControl()
{
	CXTPCommandBar* pCommandBar = GetParent();

	for (int i = 0; i < pCommandBar->GetControls()->GetCount(); i++)
	{
		CXTPControlStatic* pControlStatic = DYNAMIC_DOWNCAST(CXTPControlStatic, pCommandBar->GetControl(i));
		if (pControlStatic && pControlStatic->GetID() == GetID())
		{
			return pControlStatic;
		}

	}
	return NULL;
}
Esempio n. 4
0
CXTPControl* CXTPRibbonGroup::FindControl(XTPControlType type, int nId, BOOL bVisible, BOOL bRecursive) const
{
    for (int nIndex = 0; nIndex < GetCount(); nIndex++)
    {
        CXTPControl* pControl = GetAt(nIndex);
        if ((type == xtpControlError || pControl->GetType() == type) &&
                (!bVisible || pControl->IsVisible()) &&
                (nId == -1 || nId == pControl->GetID()))
            return pControl;

        if (bRecursive)
        {
            CXTPCommandBar* pBar = pControl->GetCommandBar();
            if (pBar)
            {
                pControl = pBar->GetControls()->FindControl(type, nId, bVisible, bRecursive);
                if (pControl != NULL) return pControl;
            }
        }
    }
    return NULL;
}
CXTPCommandBar* CXTPMouseManager::HitTest(POINT point) const
{
	HWND hWndMouse = ::WindowFromPoint(point);
	const CTrackArray& arrTracked = m_arrTracked;
	int i;

	for (i = (int)arrTracked.GetSize() - 1; i >= 0; i--)
	{
		CXTPCommandBar* pCommandBar = arrTracked[i];

		if (!pCommandBar->GetSafeHwnd())
			continue;

		int nHtCode = pCommandBar->OnMouseHitTest(point);

		if ((nHtCode != HTERROR) && ((nHtCode == HTCLIENT) || ::IsChild(pCommandBar->GetSafeHwnd(), hWndMouse)))
		{
			return pCommandBar;
		}
	}

	return NULL;
}
Esempio n. 6
0
void CXTPRibbonTabPopupToolBar::OnKeyboardTip(CXTPCommandBarKeyboardTip* pTip)
{
	CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pTip->m_pOwner);
	if (pControl)
	{

		if (pTip->m_bVisible == FALSE && pControl->GetHideFlags() == xtpHideWrap)
		{
			CXTPRibbonGroup* pGroup = pControl->GetRibbonGroup();
			if (pGroup && pGroup->GetControlGroupPopup())
			{
				EnsureVisible(pGroup->GetControlGroupPopup());
				pGroup->GetControlGroupPopup()->OnUnderlineActivate();

				int nIndex = pGroup->IndexOf(pControl);

				CXTPCommandBar* pPopupToolBar = pGroup->GetControlGroupPopup()->GetCommandBar();
				if (pPopupToolBar && pPopupToolBar->IsTrackingMode() && nIndex >= 0 &&
					nIndex < pPopupToolBar->GetControlCount())
				{
					pPopupToolBar->GetControl(nIndex)->OnUnderlineActivate();

				}
			}

			return;
		}

		if (pControl->IsVisible())
		{
			pControl->OnUnderlineActivate();
		}

		return;
	}
}
// picks the current target
void CXTPCustomizeDropSource::PickTarget(CPoint point)
{
	HWND hWndPoint = WindowFromPoint(point);

	BOOL bFound = FALSE;

	for (int i = (int)m_arrTargets.GetSize() - 1; i >= 0; i--)
	{
		CXTPCommandBar* pCommandBar = m_arrTargets[i];

		if (pCommandBar->IsVisible() && CXTPWindowRect(pCommandBar).PtInRect(point)
			&& (pCommandBar->GetSafeHwnd() == hWndPoint || ::IsChild(pCommandBar->GetSafeHwnd(), hWndPoint)))
		{
			bFound = TRUE;

			if (m_pTarget == pCommandBar)
			{
				m_pTarget->ScreenToClient(&point);
				m_pTarget->OnCustomizeDragOver(m_pControl, point);
			}
			else if (m_pTarget != NULL)
			{
				m_pTarget->OnCustomizeDragLeave();
				m_pTarget = 0;
			}

			if (m_pTarget == 0)
			{
				pCommandBar->ScreenToClient(&point);
				if (pCommandBar->OnCustomizeDragEnter(m_pControl, point) != DROPEFFECT_NONE)
				{
					m_pTarget = pCommandBar;
				}
			}
			break;
		}
	}

	if (!bFound && m_pTarget)
	{
		m_pTarget->OnCustomizeDragLeave();
		m_pTarget = 0;
	}


	// set the cursor as appropriate
	FreshenCursor();
}
Esempio n. 8
0
/////////////////////////////////////////////////////////////////////////////
// 加载扩展菜单
/////////////////////////////////////////////////////////////////////////////
BOOL CPlugIn::AddOwmSubMenu(CString strMainMenu, CString strSubMenu, CString strAction)
{
	CMainFrame* pMainFrame = (CMainFrame*)(theApp.GetMainWnd());
	CXTPCommandBars* pCommandBars = pMainFrame->GetCommandBars();
	if(!pCommandBars)
	{
		return FALSE;		
	}
	CXTPCommandBar* pMenuBar = pCommandBars->GetMenuBar();
	if(!pMenuBar)
	{
		return FALSE;
	}

	CXTPControls* pControls = pMenuBar->GetControls();
	CXTPControl* pControl = pControls->GetFirst();
	CXTPCommandBar* pMenuBarSub = NULL;
	CXTPControl* pControlExtSub = NULL;
	while(pControl)
	{
		if(pControl->GetCaption() == strMainMenu)
		{
			pMenuBarSub = pControl->GetCommandBar();
			CXTPControls* pControlsSub = pMenuBarSub->GetControls();
			pControl = pControlsSub->GetFirst();
			while(pControl)
			{
				if(pControl->GetCaption() == strSubMenu)
				{
					pControlExtSub = pControl;
					break;
				}
				pControlsSub->GetNext(pControl);
			}			
			break;
		}
		pControls->GetNext(pControl);
	}
	if(pMenuBarSub && !pControlExtSub)
	{
		CExtMenuInfo extMenuInfo;
		extMenuInfo.m_strVciId = m_strId;
		extMenuInfo.m_strMainMenu = strMainMenu;
		extMenuInfo.m_strSubMenu = strSubMenu;
		extMenuInfo.pProc = (TYPEOF_ClientMenu*)OnOwmExtMenuProc;
		extMenuInfo.pUpdateProc = NULL;
		extMenuInfo.nProcType = MENU_PROC_TYPE_PARAM_ID;
		
		int nExMenuId = IDM_OWMCMD+g_nIdOwmExMenu;
		extMenuInfo.m_strAction = strAction;
		extMenuInfo.nId = nExMenuId-IDM_OWMCMD;
		pMainFrame->m_arExtMenuInfo.Add(extMenuInfo);

		CXTPControls* pControlsSub = pMenuBarSub->GetControls();
		CMenu* pMenu = new CMenu();
		pMenu->CreatePopupMenu();
		pMenu->AppendMenu(MF_STRING, nExMenuId, strSubMenu);
		pControlsSub->AddMenuItem(pMenu, 0);
		delete pMenu;

		g_nIdOwmExMenu++;
	}

	return TRUE;
}
Esempio n. 9
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;
}
Esempio n. 10
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;
}
BOOL CXTPRibbonBuilder::BuildMainButtonPopupBar(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar)
{
	if (!pRibbonBar->GetSystemButton())
		return FALSE;

	CXTPCommandBar* pPopupBar = pRibbonBar->GetSystemButton()->GetCommandBar();


	CString strElementName;
	PX_String(pPX, _T("ELEMENT_NAME"), strElementName);

	if (strElementName != _T("Category_Main"))
		return FALSE;

	CString strCaption;
	PX_String(pPX, _T("NAME"), strCaption);

	pRibbonBar->GetSystemButton()->SetCaption(strCaption);


	pPopupBar->SetIconSize(CSize(32, 32));

	m_arrImageLarge.RemoveAll();
	m_arrImageSmall.RemoveAll();

	CXTPPropExchangeSection pxElements(pPX->GetSection(_T("ELEMENTS")));

	CXTPPropExchangeEnumeratorPtr pEnumerator(pxElements->GetEnumerator(_T("ELEMENT")));

	BOOL bBeginGroup = FALSE;

	POSITION pos = pEnumerator->GetPosition(0);
	while (pos)
	{
		CXTPPropExchangeSection pxControl(pEnumerator->GetNext(pos));

		CString strElementName;
		PX_String(&pxControl, _T("ELEMENT_NAME"), strElementName);

		if (strElementName == _T("Separator"))
		{
			bBeginGroup = TRUE;
			continue;
		}


		CCmdTarget* pElement = CreateElement(strElementName);
		if (pElement == NULL)
			continue;

		CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pElement);

		if (!pControl)
		{
			delete pElement;
			continue;
		}

		CXTPPropExchangeSection pxElements(pxControl->GetSection(_T("ELEMENTS")));
		BuildControlPopupBar(&pxElements, pControl, RUNTIME_CLASS(CXTPRibbonSystemPopupBarPage));

		BuildControl(&pxControl, pControl);

		pPopupBar->GetControls()->Add(pControl, pControl->GetID());

		pControl->SetBeginGroup(bBeginGroup);
		bBeginGroup = FALSE;

	}

	CXTPPropExchangeSection pxRecentFileList(pPX->GetSection(_T("RECENT_FILE_LIST")));

	CString strEnabled;
	PX_String(&pxRecentFileList, _T("ENABLE"), strEnabled);
	if (strEnabled == _T("TRUE"))
	{
		CXTPControl* pControl = pPopupBar->GetControls()->Add(new CXTPRibbonControlSystemRecentFileList());

		CString strLabel;
		PX_String(&pxRecentFileList, _T("LABEL"), strLabel);
		pControl->SetCaption(strLabel);
	}


	LoadIcons(pPX);


	return TRUE;
}