////////////////////////////////////////////////////////////////////////////////
//
// 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);
};