Click here to Skip to main content
15,886,689 members
Articles / Containers / Virtual Machine

An extendable report editor

Rate me:
Please Sign up or sign in to vote.
5.00/5 (11 votes)
3 Sep 2008CPOL3 min read 41K   2K   35  
An extendable report editor. You can simply add your own controls without recompiling the program or writing annoying plug-ins.
// ToolBarMain.cpp: implementation of the CToolBarMain class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ToolBarMain.h"
#include "mem_tool.h"
#include "resource.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CToolBarMain::CToolBarMain()
{
    this->InitBasic();
}
CToolBarMain::~CToolBarMain()
{
    this->Destroy();
}
int CToolBarMain::InitBasic()
{
	this->tool_bar = NULL;
	this->tbb_new = NULL;
	this->tbb_open = NULL;
	this->tbb_save = NULL;
	this->tbb_code = NULL;
	this->tbb_about = NULL;

    return OK;
}
int CToolBarMain::Init(HWND hparent)
{
    this->InitBasic();
    
	NEW(this->tool_bar,CToolBar);
	this->tool_bar->Init();
	this->tool_bar->SetParent(hparent);
	this->tool_bar->wnd_create->ex_style = WS_EX_CLIENTEDGE;
	this->tool_bar->Create();
	this->tool_bar->CreateImageList(IDB_BITMAP_TOOLBAR_MAIN,16,15,4,9,RGB(192,192,192));
	this->tool_bar->SetAutoSize();

	NEW(this->tbb_new,CTBButton);
	this->tbb_new->Init();
	this->tbb_new->SetImgIndex(0);
	this->tbb_new->SetToolTip("New");

	NEW(this->tbb_open,CTBButton);
	this->tbb_open->Init();
	this->tbb_open->SetImgIndex(1);
	this->tbb_open->SetToolTip("Open");

	NEW(this->tbb_save,CTBButton);
	this->tbb_save->Init();
	this->tbb_save->SetImgIndex(2);
	this->tbb_save->SetToolTip("Save");
	
	NEW(this->tbb_code,CTBButton);
	this->tbb_code->Init();
	this->tbb_code->SetImgIndex(8);
	this->tbb_code->SetToolTip("Code");

	
	NEW(this->tbb_about,CTBButton);
	this->tbb_about->Init();
	this->tbb_about->SetImgIndex(7);
	this->tbb_about->SetToolTip("About");

	this->tool_bar->AddButton(this->tbb_new);
	this->tool_bar->AddButton(this->tbb_open);
	this->tool_bar->AddButton(this->tbb_save);
	this->tool_bar->AddSeparator();
	this->tool_bar->AddButton(this->tbb_code);
	this->tool_bar->AddSeparator();
	this->tool_bar->AddButton(this->tbb_about);

    return OK;
}
int  CToolBarMain::Destroy()
{
	DEL(this->tbb_about);
	DEL(this->tbb_code);
    DEL(this->tbb_new);
	DEL(this->tbb_open);
	DEL(this->tbb_save);
	DEL(this->tool_bar);	

    this->InitBasic();
    return OK;
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
China China
26 years old, 2 years work experience.

Comments and Discussions