Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

WTL Helper

, 27 Aug 2007
Add-in for Microsoft VC++.NET 2003 that helps to insert message handlers for WTL.
wtlhelper.zip
wtlhelper_exe.zip
wtlhelper_src.zip
source
AddIn.def
Dialog
vssver.scc
Options
res
a1.ico
AddIn.rgs
addin8.rgs
closefld.ico
Clsdfold.ico
DDX.bmp
dialog.bmp
functoolbar.bmp
icons.bmp
message.ico
msg.bmp
mysmall4.bmp
openfld.ico
Openfold.ico
option.bmp
vartoolbar.bmp
vssver.scc
wizard.bmp
Wizard.ico
WtlHelper.dll.manifest
resources
Setup.nsi
WtlHelperRes
res
DDX.bmp
dialog.bmp
msg.bmp
option.bmp
reflect.bmp
wizard.bmp
WtlHelperRes.aps
WtlHelperRes8.vcproj.MINSK.solozhentsev.user
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Sergey Solozhentsev
// Author: 	Sergey Solozhentsev e-mail: salos@mail.ru
// Product:	WTL Helper
// File:      	SizeListCtrl.h
// Created:	13.01.2005 14:32
// 
//   Using this software in commercial applications requires an author
// permission. The permission will be granted to everyone excluding the cases
// when someone simply tries to resell the code.
//   This file may be redistributed by any means PROVIDING it is not sold for
// profit without the authors written consent, and providing that this notice
// and the authors name is included.
//   This file is provided "as is" with no expressed or implied warranty. The
// author accepts no liability if it causes any damage to you or your computer
// whatsoever.
//
////////////////////////////////////////////////////////////////////////////////

// This file was generated by WTL subclass control wizard 
// SizeListCtrl.h : Declaration of the CSizeListCtrl

#pragma once
#include <atlframe.h>
// CSizeListCtrl

#define MCDS_TEXTCOLOR	1
#define MCDS_BACKCOLOR	2
#define MCDS_STYLE		4

#define SLC_STYLE_ITALIC	1
#define SLC_STYLE_BOLD		2
#define SLC_STYLE_STRIKEOUT	4
#define SLC_STYLE_UNDERLINE	8

struct MyCustomDrawStruct
{
	DWORD dwMask;
	COLORREF TextColor;
	COLORREF BackColor;
	DWORD dwStyle;
};

struct LPARAMSTRUCT
{
	LPARAM lOldParam;
	MyCustomDrawStruct DrawStruct;
};

#define SLC_POSTSIZE	(WM_USER + 200)

typedef CWinTraitsOR<LVS_REPORT | 
LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_TABSTOP, WS_EX_CLIENTEDGE> CSizeListTraits;

class CSizeListCtrl :
	public CWindowImpl<CSizeListCtrl, CListViewCtrl, CSizeListTraits>, 
	public CCustomDraw<CSizeListCtrl>
{
	CFont m_NewFont;
	CFontHandle m_OldFont;
protected:
	LPARAM _GetItemData(int nItem);
	int m_PrevWidth;
public:
	CSizeListCtrl();
	~CSizeListCtrl();

	DECLARE_WND_SUPERCLASS(_T("CSizeListCtrl"), CListViewCtrl::GetWndClassName())
	
    BEGIN_MSG_MAP(CSizeListCtrl)
		MESSAGE_HANDLER(WM_SIZE, OnSize)
		MESSAGE_HANDLER(LVM_SETITEMA, OnSetItem)
		MESSAGE_HANDLER(LVM_SETITEMW, OnSetItem)
		MESSAGE_HANDLER(LVM_INSERTITEMA, OnInsertItem)
		MESSAGE_HANDLER(LVM_INSERTITEMW, OnInsertItem)
		MESSAGE_HANDLER(LVM_GETITEMA, OnGetItem)
		MESSAGE_HANDLER(LVM_GETITEMW, OnGetItem)
		MESSAGE_HANDLER(SLC_POSTSIZE, OnPostSize)

		REFLECTED_NOTIFY_CODE_HANDLER(LVN_DELETEITEM, OnDeleteItem)

		CHAIN_MSG_MAP_ALT(CCustomDraw<CSizeListCtrl>, 1)
    END_MSG_MAP()

	DWORD OnPrePaint(int idCtrl, LPNMCUSTOMDRAW lpNMCustomDraw);
	DWORD OnItemPrePaint(int idCtrl, LPNMCUSTOMDRAW lpNMCustomDraw);
	DWORD OnSubItemPrePaint(int idCtrl, LPNMCUSTOMDRAW lpNMCustomDraw);

	void DeleteHelperItemData(LPARAM lParam);
	BOOL SetDrawStruct(int nItem, const MyCustomDrawStruct* pDrawStruct);
	BOOL GetDrawStruct(int nItem, MyCustomDrawStruct* pDrawStruct);
    // Handler prototypes:
    //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
    //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
    //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSetItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnInsertItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnGetItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDeleteItem(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnPostSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};


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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Sergey Solozhentsev
Web Developer
Belarus Belarus
I am a software developer for 3 years.

| Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 27 Aug 2007
Article Copyright 2004 by Sergey Solozhentsev
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid