|
/************************************************************************
*
* 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)
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I haven't always written software for a living. When I graduated from Surrey University in 1989, it was with an Electronic Engineering degree, but unfortunately that never really gave me the opportunity to do anything particularly interesting (with the possible exception of designing
Darth Vader's Codpiece * for the UK Army in 1990).
* Also known as the Standard Army Bootswitch. But that's another story...
Since the opportunity arose to lead a software team developing C++ software for
Avionic Test Systems in 1996, I've not looked back. More recently I've been involved in the development of subsea acoustic navigation systems, digital TV broadcast systems, port security/tracking systems, and most recently software development tools with my own company,
Riverblade Ltd.
One of my personal specialities is IDE plug-in development.
ResOrg was my first attempt at a plug-in, but my day to day work is with
Visual Lint, an interactive code analysis tool environment with works within the Visual Studio and Eclipse IDEs or on build servers.
I love lots of things, but particularly music, photography and anything connected with history or engineering. I
despise ignorant, intolerant and obstructive people - and it shows...I can be a bolshy cow if you wind me up the wrong way...
I'm currently based 15 minutes walk from the beach in Bournemouth on the south coast of England. Since I moved here I've grown to love the place - even if it is full of grockles in Summer!