📄 resorgmaintoolbar.cpp
字号:
/************************************************************************
*
* Resource ID Organiser Core Library
*
* (c) Copyright 2000-2003 by Anna-Jayne Metcalfe (resorg@annasplace.me.uk)
* All rights reserved.
*
************************************************************************
*
* Filename : ResOrgMainToolbar.cpp
*
* Description : CResOrgMainToolbar - main toolbar class
*
* Compiler : Microsoft Visual C++ 6.0, Service Pack 3 or later
* Microsoft Visual C++ .NET 2002
*
* Target
* Environment : Windows 98/NT/2000/XP
*
* NOTE:
*
* This software is provided "as is" free for personal use. All
* title and copyrights in and to the software, including but not
* limited to any images, text, etc. incorporated into it, are
* owned by Anna-Jayne Metcalfe, except where acknowledged otherwise.
*
* Your may freely to use this code in your own products, PROVIDED
* this notice is not removed or modified.
*
*
* Visit http://www.annasplace.me.uk/resorg for latest updates
*
************************************************************************
*
* MODIFICATION HISTORY:
*
* This is a controlled document. See project configuration
* control tool for latest version and full version history.
*
* $Archive: /Projects/AddIns/ResOrg/ResOrgCore/ResOrgMainToolbar.cpp $
* $Revision: 7 $
* $Date: 15/04/03 20:37 $
* $Author: Anna $
*
* $History: ResOrgMainToolbar.cpp $
*
* ***************** Version 7 *****************
* User: Anna Date: 15/04/03 Time: 20:37
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* 1. Removed unnecessary file guards (#pragma once works well enough)
* 2. Updated file banners
*
* ***************** Version 6 *****************
* User: Anna Date: 1/03/03 Time: 18:09
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Added "Display Report" to the main toolbar
*
* ***************** Version 5 *****************
* User: Anna Date: 2/01/03 Time: 0:08
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Mods for compatibility with WinXP visual themes
*
* ***************** Version 4 *****************
* User: Anna Date: 25/11/02 Time: 15:13
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Changed website address in banner
*
* ***************** Version 3 *****************
* User: Anna Date: 22/10/02 Time: 13:24
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Changed name/mail address (at last!)
*
* ***************** Version 2 *****************
* User: Andy Date: 7/06/02 Time: 17:04
* Updated in $/Projects/AddIns/ResOrg/ResOrgCore
* Renamed the ResOrgUtils module to ResOrgCore. Updated file banners
* accordingly
*
* ***************** Version 1 *****************
* User: Andy Date: 12/28/01 Time: 1:08a
* Created in $/Projects/AddIns/ResOrg/ResOrgUtils
*
* $Nokeywords: $
*
************************************************************************/
#include "stdafx.h"
#include "ResOrgCore_Priv.h"
#include "ResOrgMainToolbar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CResOrgMainToolbar
CResOrgMainToolbar::CResOrgMainToolbar(void)
{
m_rectSmallButton.SetRectEmpty();
m_rectLargeButton.SetRectEmpty();
}
CResOrgMainToolbar::~CResOrgMainToolbar(void)
{
}
BEGIN_MESSAGE_MAP(CResOrgMainToolbar, CResOrgMainToolbar_BASE)
//{{AFX_MSG_MAP(CResOrgMainToolbar)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResOrgMainToolbar operations
BOOL CResOrgMainToolbar::Create(CWnd* pParentWnd, BOOL bShowText /*= TRUE*/)
{
#if 1
if (CResOrgMainToolbar_BASE::Create(pParentWnd) && LoadToolBar(IDR_MAINFRAME) )
{
SetBarStyle( GetBarStyle() |
CBRS_TOP |
CBRS_GRIPPER |
CBRS_BORDER_3D |
CBRS_TOOLTIPS |
CBRS_FLYBY |
CBRS_SIZE_DYNAMIC);
ModifyStyle(0, GetStyle() | TBSTYLE_FLAT);
SetLabels();
ShowLabels(bShowText);
return TRUE;
}
#else
if (CreateEx( pParentWnd,
TBSTYLE_FLAT,
WS_CHILD |
WS_VISIBLE |
CBRS_TOP |
CBRS_GRIPPER |
CBRS_TOOLTIPS |
CBRS_FLYBY |
CBRS_SIZE_DYNAMIC) &&
LoadToolBar(IDR_MAINFRAME) )
{
SetLabels();
ShowLabels(bShowText);
return TRUE;
}
#endif
return FALSE;
}
BOOL CResOrgMainToolbar::ShowLabels(BOOL bShow /*= TRUE*/)
{
// Remember that if the toolbar had the TBSTYLE_LIST set
// the first time ShowLabels() was called.
static BOOL bIsList = GetStyle() & TBSTYLE_LIST;
// Set the toolbar button sizes.
if (bShow)
{
if (bIsList)
{
ModifyStyle(0, TBSTYLE_LIST);
}
SetSizes(m_rectLargeButton.Size(), m_sizeImage);
}
else
{
if (bIsList)
{
ModifyStyle(TBSTYLE_LIST, 0);
}
SetSizes(m_rectSmallButton.Size(), m_sizeImage);
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CResOrgMainToolbar implementation
void CResOrgMainToolbar::SetLabels(void)
{
if (CSize(0, 0) == m_rectLargeButton.Size() )
{
// Get the first button size before adding the labels.
GetItemRect(0, &m_rectSmallButton);
SetButtonText(CommandToIndex(ID_FILE_NEW), _T("New"));
SetButtonText(CommandToIndex(ID_FILE_OPEN), _T("Open"));
SetButtonText(CommandToIndex(ID_FILE_SAVE), _T("Save"));
SetButtonText(CommandToIndex(ID_VIEW_WORKSPACE), _T("Workspace"));
SetButtonText(CommandToIndex(ID_SYM_ADD), _T("Add"));
SetButtonText(CommandToIndex(ID_SYM_PROPERTIES), _T("Properties"));
SetButtonText(CommandToIndex(ID_EDIT_CLEAR), _T("Delete"));
SetButtonText(CommandToIndex(ID_TOOLS_RENUMBER), _T("Renumber"));
SetButtonText(CommandToIndex(ID_TOOLS_REPORT), _T("Report"));
SetButtonText(CommandToIndex(ID_RESORG_OPTIONS), _T("Options"));
SetButtonText(CommandToIndex(ID_APP_ABOUT), _T("About"));
// Get the first button size after adding the labels.
GetItemRect(0, &m_rectLargeButton);
}
}
/////////////////////////////////////////////////////////////////////////////
// CResOrgMainToolbar message handlers
// (none)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -