Exemplo n.º 1
0
void CMainFrame::OnUpdateRangeOfIds_Radio(UINT nID)
{
	UINT adjId = nID - ID_RADIO_A;
	UINT curRadio = GetDoc()->GetRadio();
	BOOL bCheck = (curRadio == adjId);
	int nFileItem = GetMenuItemPos(GetFrameMenu(), _T("Select"));
	CMenu* pRadioMenu = GetFrameMenu()->GetSubMenu(nFileItem);
	if (bCheck)  
		pRadioMenu->CheckMenuRadioItem(ID_RADIO_A, ID_RADIO_C, nID, 0);
}
Exemplo n.º 2
0
void CMainFrame::DoPopupMenu()
{
	// Creates the popup menu for the "View Menu" toolbar button

	// Position the popup menu
	CToolBar& TB = GetToolBar();
	CRect rc = TB.GetItemRect(TB.CommandToIndex(IDM_VIEWMENU));
	TB.MapWindowPoints(NULL, (LPPOINT)&rc, 2);

	TPMPARAMS tpm;
	tpm.cbSize = sizeof(TPMPARAMS);
	tpm.rcExclude = rc;

	// Load the popup menu
	CMenu TopMenu(IDM_VIEWMENU);
	CMenu PopupMenu = TopMenu.GetSubMenu(0);

	// Put a radio check in the currently checked item
	MENUITEMINFO mii;
	ZeroMemory(&mii, sizeof(MENUITEMINFO));
	for (int i = 3 ; i < 7 ; i++)
	{
		ZeroMemory(&mii, GetSizeofMenuItemInfo());
		mii.cbSize = GetSizeofMenuItemInfo();

		mii.fMask  = MIIM_STATE | MIIM_ID;
		CMenu SubMenu = GetFrameMenu().GetSubMenu(1);
		SubMenu.GetMenuItemInfo(i, mii, TRUE);
		if (mii.fState & MFS_CHECKED)
			TopMenu.CheckMenuRadioItem(IDM_VIEW_SMALLICON, IDM_VIEW_REPORT, mii.wID, 0);
	}

	// Start the popup menu
	PopupMenu.TrackPopupMenuEx(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL, rc.left, rc.bottom, *this, &tpm);
}
Exemplo n.º 3
0
BOOL CMainFrame::OnViewList()
{
	DWORD dwStyle = DS_NO_UNDOCK | DS_NO_CAPTION | DS_CLIENTEDGE;
	if (m_pDockList->IsDocked())
	{
		m_pDockList->Hide();
		GetFrameMenu().CheckMenuItem(IDM_VIEW_LIST, MF_UNCHECKED);
	}
	else
	{
		m_pDockTree->Dock(m_pDockList, dwStyle | DS_DOCKED_RIGHT);
		GetFrameMenu().CheckMenuItem(IDM_VIEW_LIST, MF_CHECKED);
	}

	return TRUE;
}
Exemplo n.º 4
0
void CMainFrame::OnMenuUpdate(UINT nID)
{
	switch(nID)
	{
	case IDM_PROP_RESIZE:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_UseProportionalResize ? MF_CHECKED : MF_UNCHECKED));
		break;
	case IDM_3DBORDER:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_Use3DBorder ? MF_CHECKED : MF_UNCHECKED));
		break;
	case IDM_NO_UNDOCK:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_DisableUndocking ? MF_CHECKED : MF_UNCHECKED));
		break;
	case IDM_NO_RESIZE:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_DisableResize ? MF_CHECKED : MF_UNCHECKED));
		break;
	case IDM_NO_DOCK_LR:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_DisableDockLR ? MF_CHECKED : MF_UNCHECKED));
		break;
	case IDM_NO_DOCK_CLOSE:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_DisableDockClose ? MF_CHECKED : MF_UNCHECKED));
		break;
	case IDM_DYNAMIC_RESIZE:
		GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (m_UseDynamicResize ? MF_CHECKED : MF_UNCHECKED));
		break;
	}

	CFrame::OnMenuUpdate(nID);
}
Exemplo n.º 5
0
BOOL CMainFrame::OnViewSmallIcon()
{
	// Handle the the View submenu
	CMenu ViewMenu = GetFrameMenu().GetSubMenu(1);

	GetListView().ViewSmallIcons();
	ViewMenu.CheckMenuRadioItem(IDM_VIEW_SMALLICON, IDM_VIEW_REPORT, IDM_VIEW_SMALLICON, 0);
	return TRUE;
}
Exemplo n.º 6
0
void CMainFrame::OnMDITabsAtTop()
// Reposition TabbedMDI's tabs
{
    CTabbedMDI* pTabbedMDI = m_DockTabbedMDI.GetTabbedMDI();
    BOOL bTop = pTabbedMDI->GetTab().GetTabsAtTop();
    pTabbedMDI->GetTab().SetTabsAtTop(!bTop);
    // Set the menu checkmark
    UINT uCheck = (bTop) ? MF_UNCHECKED : MF_CHECKED;
    ::CheckMenuItem(GetFrameMenu(), IDM_TABBEDMDI_TOP, uCheck);
}
Exemplo n.º 7
0
void CMainFrame::OnInitialUpdate()
{
	// Add the right window pane
	int Width = (int) (GetWindowRect().Width() * 0.3);
	DWORD dwDockStyle = DS_DOCKED_LEFT  | DS_NO_UNDOCK | DS_NO_CAPTION;
	m_pLeftPane = static_cast<CLeftPane*>(m_RightPane.AddDockedChild(new CLeftPane, dwDockStyle, Width));

	// All windows are now created, so populate the treeview
	GetTreeView().GetRootItems();

	// Uncheck the hidden menu item
	GetFrameMenu().CheckMenuItem(IDM_SHOW_HIDDEN, MF_UNCHECKED);

	// Place Radio button in view menu
	CMenu ViewMenu = GetFrameMenu().GetSubMenu(1);
	ViewMenu.CheckMenuRadioItem(IDM_VIEW_SMALLICON, IDM_VIEW_REPORT, IDM_VIEW_REPORT, 0);

	// Uncomment the following to use a hash bar and disable of auto resizing 
	// m_RightPane.SetDragAutoResize(FALSE);
}
Exemplo n.º 8
0
BOOL CMainFrame::OnShowHidden()
{
	// Handle the the View submenu
	CMenu ViewMenu = GetFrameMenu().GetSubMenu(1);

	m_ShowHidden = !m_ShowHidden;
	ViewMenu.CheckMenuItem(IDM_SHOW_HIDDEN, (TRUE == m_ShowHidden)? MF_CHECKED : MF_UNCHECKED);

	// Refresh the Listview display
	GetListView().DoDisplay();
	return TRUE;
}
Exemplo n.º 9
0
void CMainFrame::OnContainerTabsAtTop()
// Reposition the tabs in the containers
{
    BOOL bTop = FALSE;
    std::vector<DockPtr>::iterator iter;

    // Set the Tab position for each container
    for (iter = m_DockTabbedMDI.GetAllDockers().begin(); iter < m_DockTabbedMDI.GetAllDockers().end(); ++iter) {
        CDockContainer* pContainer = (*iter)->GetContainer();

        if (pContainer) {
            bTop = pContainer->GetTabsAtTop();
            pContainer->SetTabsAtTop(!bTop);
        }
    }

    // Set the menu checkmark
    UINT uCheck = (bTop) ? MF_UNCHECKED : MF_CHECKED;
    ::CheckMenuItem(GetFrameMenu(), IDM_CONTAINER_TOP, uCheck);
}
Exemplo n.º 10
0
void CMainFrame::OnTBBigIcons()
// Toggle the Image size for the ToolBar by changing Image Lists.
{
	m_UseBigIcons = !m_UseBigIcons;

	GetFrameMenu()->CheckMenuItem(IDM_TOOLBAR_BIGICONS, MF_BYCOMMAND | (m_UseBigIcons ? MF_CHECKED : MF_UNCHECKED));

	if (m_UseBigIcons)
	{
		// Set Large Images. 3 Imagelists - Normal, Hot and Disabled
		SetToolBarImages(RGB(192,192,192), IDB_NORMAL, IDB_HOT, IDB_DISABLED);
	}
	else
	{
		// Set Small icons
		SetToolBarImages(RGB(192,192,192), IDW_MAIN, 0, 0);
	}

	RecalcLayout();
	GetToolBar()->Invalidate();
}
Exemplo n.º 11
0
void CMainFrame::SetupToolBar()
{
    // Set the Resource IDs for the toolbar buttons
    AddToolBarButton(IDM_FILE_NEW);
    AddToolBarButton(IDM_FILE_OPEN,  FALSE);
    AddToolBarButton(IDM_FILE_SAVE,  FALSE);
    AddToolBarButton(0);     // Separator
    AddToolBarButton(IDM_EDIT_CUT,   FALSE);
    AddToolBarButton(IDM_EDIT_COPY,  FALSE);
    AddToolBarButton(IDM_EDIT_PASTE, FALSE);
    AddToolBarButton(0);     // Separator
    AddToolBarButton(IDM_FILE_PRINT, FALSE);
    AddToolBarButton(0);     // Separator
    AddToolBarButton(IDM_HELP_ABOUT);
    // Remove the checkmark for container tabs at top
    ::CheckMenuItem(GetFrameMenu(), IDM_CONTAINER_TOP, MF_UNCHECKED);
    // Add some extra icons for menu items
    AddMenuIcon(IDM_FILE_NEWSIMPLE, (HICON)LoadImage(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(IDI_SIMPLE), IMAGE_ICON, 0, 0, LR_SHARED));
    AddMenuIcon(IDM_FILE_NEWRECT, (HICON)LoadImage(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(IDI_RECT), IMAGE_ICON, 0, 0, LR_SHARED));
    AddMenuIcon(IDM_FILE_NEWTEXT, (HICON)LoadImage(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(IDI_TEXT), IMAGE_ICON, 0, 0, LR_SHARED));
    AddMenuIcon(IDM_FILE_NEWLIST, (HICON)LoadImage(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(IDI_FILEVIEW), IMAGE_ICON, 0, 0, LR_SHARED));
    AddMenuIcon(IDM_FILE_NEWTREE, (HICON)LoadImage(GetApp()->GetResourceHandle(), MAKEINTRESOURCE(IDI_CLASSVIEW), IMAGE_ICON, 0, 0, LR_SHARED));
}
Exemplo n.º 12
0
void CMainFrame::OnMenuUpdate(UINT nID)
// Called when menu items are about to be displayed
{
    // Only for the Menu IDs we wish to modify
    if (nID >= IDM_EDIT_UNDO && nID <= IDM_EDIT_DELETE) {
        CWnd* pWnd = 0;
        CMenu Menu;
        Menu.Attach(GetFrameMenu());
        CMenu* pEditMenu = Menu.GetSubMenu(1);

        if (m_pLastActiveDocker) {
            if (m_pLastActiveDocker == &m_DockTabbedMDI)
                pWnd = m_DockTabbedMDI.GetTabbedMDI()->GetActiveMDIChild();
            else if (m_pLastActiveDocker->IsDocked())
                pWnd = m_pLastActiveDocker->GetContainer()->GetActiveView();
        }

        // Enable the Edit menu items for CViewText windows, disable them otherwise
        UINT Flags = (dynamic_cast<CViewText*>(pWnd)) ? MF_ENABLED : MF_GRAYED;
        pEditMenu->EnableMenuItem(nID, MF_BYCOMMAND | Flags);
        Menu.Detach();
    }
}
Exemplo n.º 13
0
int CMainFrame::OnCreate(LPCREATESTRUCT pcs)
{
	// OnCreate controls the way the frame is created.
	// Overriding CFrame::Oncreate is optional.
	// The default for the following variables is TRUE

	// m_UseIndicatorStatus = FALSE;	// Don't show keyboard indicators in the StatusBar
	// m_UseMenuStatus = FALSE;			// Don't show menu descriptions in the StatusBar
	// m_UseReBar = FALSE;				// Don't use a ReBar
	// m_UseThemes = FALSE;				// Don't use themes

	// call the base class function
	CFrame::OnCreate(pcs);

	// Add the CCS_ADJUSTABLE style to the ToolBar
	DWORD dwStyle = GetToolBar()->GetWindowLongPtr(GWL_STYLE);
	GetToolBar()->SetWindowLongPtr(GWL_STYLE, CCS_ADJUSTABLE|dwStyle);

	// Untick the Large Icons menu item
	GetFrameMenu()->CheckMenuItem(IDM_TOOLBAR_BIGICONS, MF_BYCOMMAND | MF_UNCHECKED);

	return 0;
}
Exemplo n.º 14
0
void CMainFrame::ChooseColor(UINT nColor)
{
	m_nColor = nColor;

	switch (nColor)
	{
	case IDM_MODERN:
		{
			SetReBarColors( RGB(225, 230, 255), RGB(240, 242, 250), RGB(248, 248, 248), RGB(180, 200, 230) );

			StatusBarTheme sbt = {TRUE, RGB(225, 230, 255), RGB(240, 242, 250)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(180, 250, 255), RGB(140, 190, 255), RGB(150, 220, 255), RGB(80, 100, 255), RGB(127, 127, 255)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(180, 250, 255), RGB(140, 190, 255), RGB(240, 250, 255), RGB(120, 170, 220), RGB(127, 127, 255)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_BLUE:	// ICY_BLUE Theme
		{
			SetReBarColors( RGB(150,190,245), RGB(196,215,250), RGB(220,230,250), RGB( 70,130,220) );

			StatusBarTheme sbt = {TRUE, RGB(150,190,245), RGB(196,215,250)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(255, 230, 190), RGB(255, 190, 100), RGB(255, 140, 40), RGB(255, 180, 80), RGB(128, 128, 255)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(255, 230, 190), RGB(255, 190, 100), RGB(150,190,245), RGB(220,230,250), RGB(128, 128, 200)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_GREY:	// Grey Theme
		{
			SetReBarColors( RGB(210, 210, 200), RGB(238, 236, 224), RGB(248, 247, 243), RGB(195, 195, 172) );

			StatusBarTheme sbt = {TRUE, RGB(210, 210, 200), RGB(238, 236, 224)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(192, 210, 238), RGB(192, 210, 238), RGB(152, 181, 226), RGB(152, 181, 226), RGB(49, 106, 197)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(196, 215, 250), RGB( 120, 180, 220), RGB(210, 210, 200), RGB(248, 247, 243), RGB(128, 128, 200)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_OLIVE:
		{
			SetReBarColors( RGB(160, 180, 80), RGB(180, 200, 100), RGB(200, 220, 120), RGB(80, 159, 78) );

			StatusBarTheme sbt = {TRUE, RGB(160, 180, 80), RGB(180, 200, 100)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(255, 230, 190), RGB(255, 190, 100), RGB(255, 140, 40), RGB(255, 180, 80), RGB(128, 128, 255)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(255, 200, 190), RGB(255, 210, 90), RGB(255, 230, 190), RGB(230, 160, 190), RGB(128, 128, 128)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_GOLD:
		{
			SetReBarColors( RGB(230, 180, 0), RGB(240, 210, 90), RGB(255, 240, 150), RGB(180, 140, 50) );

			StatusBarTheme sbt = {TRUE, RGB(230, 180, 0), RGB(240, 210, 90)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(192, 210, 238), RGB(192, 210, 238), RGB(152, 181, 226), RGB(152, 181, 226), RGB(49, 106, 197)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(196, 215, 250), RGB( 120, 180, 220), RGB(240, 210, 90), RGB(255, 240, 150), RGB(128, 128, 128)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_OCHRE:
		{
			SetReBarColors( RGB(248, 132, 12), RGB(248, 198, 10), RGB(248, 210, 20), RGB(248, 141, 6) );

			StatusBarTheme sbt = {TRUE, RGB(248, 132, 12), RGB(248, 198, 10)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(192, 210, 238), RGB(192, 210, 238), RGB(152, 181, 226), RGB(152, 181, 226), RGB(49, 106, 197)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(196, 215, 250), RGB( 120, 180, 220), RGB(150,190,245), RGB(220,230,250), RGB(128, 128, 128)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_PINK:
		{
			SetReBarColors( RGB(255, 130, 190), RGB(250, 205, 235), RGB(250, 205, 235), RGB(255, 120, 170) );

			StatusBarTheme sbt = {TRUE, RGB(255, 130, 190), RGB(250, 205, 235)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(192, 210, 238), RGB(192, 210, 238), RGB(248, 147, 220), RGB(248, 153, 179), RGB(49, 106, 197)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(196, 215, 250), RGB( 120, 180, 220), RGB(255, 130, 190), RGB(250, 205, 235), RGB(128, 128, 128)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_MAUVE:
		{
			SetReBarColors( RGB(210, 128, 155), RGB(230, 160, 190), RGB(230, 158, 188), RGB(110, 100, 125) );

			StatusBarTheme sbt = {TRUE, RGB(210, 128, 155), RGB(230, 160, 190)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(192, 210, 238), RGB(192, 210, 238), RGB(152, 181, 226), RGB(152, 181, 226), RGB(49, 106, 197)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(196, 215, 250), RGB( 120, 180, 220), RGB(150,190,245), RGB(220,230,250), RGB(128, 128, 128)};
			SetMenuTheme(&mt);
		}
		break;
	case IDM_BLACK:
		{
			SetReBarColors( RGB(128, 138 ,176), RGB(98, 108 ,136), RGB(77, 87, 97), RGB(7, 17, 27) );

			StatusBarTheme sbt = {TRUE, RGB(128, 138 ,176), RGB(98, 108 ,136)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(49, 106, 197), RGB(64,177,230), RGB(27,65, 160), RGB(64,177,230), RGB(49, 106, 197)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(84,197,240), RGB(89, 136, 217), RGB(59, 126, 197), RGB(94,187,230), RGB(128, 128, 128)};
			SetMenuTheme(&mt);
		}
		break;
	default:
		{
			m_nColor = IDM_MODERN;
			SetReBarColors( RGB(225, 230, 255), RGB(240, 242, 250), RGB(248, 248, 248), RGB(180, 200, 230) );

			StatusBarTheme sbt = {TRUE, RGB(225, 230, 255), RGB(240, 242, 250)};
			SetStatusBarTheme (&sbt);

			ToolBarTheme tbt = {TRUE, RGB(180, 250, 255), RGB(140, 190, 255), RGB(150, 220, 255), RGB(80, 100, 255), RGB(127, 127, 255)};
			SetToolBarTheme(&tbt);

			MenuTheme mt = {TRUE, RGB(180, 250, 255), RGB(140, 190, 255), RGB(240, 250, 255), RGB(120, 170, 220), RGB(127, 127, 255)};
			SetMenuTheme(&mt);
		}
		break;
	}

	// Check the appropriate menu item
	int nFileItem = GetMenuItemPos(GetFrameMenu(), _T("Theme"));
	if (nFileItem >= 0)
	{
		CMenu* pThemeMenu = GetFrameMenu()->GetSubMenu(nFileItem);
		pThemeMenu->CheckMenuRadioItem(IDM_BLUE, IDM_MODERN, nColor, 0);
	}

	RecalcLayout();
}
Exemplo n.º 15
0
void CMainFrame::OnMenuUpdate(UINT nID)
// Called just before the menu is displayed
{
	// Update the check buttons before displaying the menu
	switch(nID)
	{
	case IDM_USE_THEMES:
		GetFrameMenu()->CheckMenuItem(nID, m_UseThemes? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_BAND_COLORS:
		GetFrameMenu()->CheckMenuItem(nID, m_UseBandColors? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_FLAT_STYLE:
		GetFrameMenu()->CheckMenuItem(nID, m_UseFlatStyle? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_LEFT_BANDS:
		GetFrameMenu()->CheckMenuItem(nID, m_KeepBandsLeft? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_LOCK_MENUBAR:
		GetFrameMenu()->CheckMenuItem(nID, m_LockMenuBand? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_ROUND_BORDERS:
		GetFrameMenu()->CheckMenuItem(nID, m_UseRoundBorders? MF_CHECKED : MF_UNCHECKED);
		break;	
	case IDM_SHORT_BANDS:
		GetFrameMenu()->CheckMenuItem(nID, m_UseShortBands? MF_CHECKED : MF_UNCHECKED);
		break;	
	case IDM_USE_LINES:
		GetFrameMenu()->CheckMenuItem(nID, m_UseLines? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_VIEW_ARROWS:
		GetFrameMenu()->CheckMenuItem(nID, m_ShowArrows? MF_CHECKED : MF_UNCHECKED);
		break;
	case IDM_VIEW_CARDS:
		GetFrameMenu()->CheckMenuItem(nID, m_ShowCards? MF_CHECKED : MF_UNCHECKED);
		break;
	}

	if ((nID >= IDM_BLUE) && (nID <= IDM_MODERN))
		GetFrameMenu()->CheckMenuItem(nID, (nID == m_nColor)? MF_CHECKED : MF_UNCHECKED);

	// Call the base class member function
	CFrame::OnMenuUpdate(nID);
}
Exemplo n.º 16
0
void CMainFrame::OnUpdateCheckC(UINT nID)
{
	BOOL bCheck = GetDoc()->GetCheckC();
	GetFrameMenu()->CheckMenuItem(nID, MF_BYCOMMAND | (bCheck ? MF_CHECKED : MF_UNCHECKED));
}