Click here to Skip to main content
15,891,906 members
Articles / Desktop Programming / WTL

WTL Helper

Rate me:
Please Sign up or sign in to vote.
4.92/5 (116 votes)
27 Aug 200713 min read 712.9K   8.8K   190  
Add-in for Microsoft VC++.NET 2003 that helps to insert message handlers for WTL.
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2005 Sergey Solozhentsev
// Author: 	Sergey Solozhentsev e-mail: salos@mail.ru
// Product:	WTL Helper
// File:      	ColorSetupDlg.h
// Created:	08.09.2005 16:59
// 
//   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 Dialog wizard 
// dialog\ColorSetupDlg.h : Declaration of the CColorSetupDlg

#pragma once

#include "../resource.h"       // main symbols
#include <atlddx.h>
#include <atldlgs.h>
#include "ColorButton.h"
// CColorSetupDlg

class CColorSetupDlg : 
	public CDialogImpl<CColorSetupDlg>,
	public CSettings<CColorSetupDlg>
{
	CColorButton m_WindowsText;
	CColorButton m_WindowsBack;
	CColorButton m_CommandText;
	CColorButton m_CommandBack;
	CColorButton m_NotifyText;
	CColorButton m_NotifyBack;
	CColorButton m_ReflectText;
	CColorButton m_ReflectBack;

	COLORREF m_clDefTextColor;
	COLORREF m_clDefBackColor;

	CBrush m_WindowsBrush;
	CBrush m_CommandBrush;
	CBrush m_NotifyBrush;
	CBrush m_ReflectBrush;
public:
	CColorSetupDlg();
	~CColorSetupDlg();
	enum { IDD = IDD_COLORSETUPDLG };

	COLORREF m_clWindowsText;
	COLORREF m_clWindowsBack;
	COLORREF m_clCommandText;
	COLORREF m_clCommandBack;
	COLORREF m_clNotifyText;
	COLORREF m_clNotifyBack;
	COLORREF m_clReflectText;
	COLORREF m_clReflectBack;

    BEGIN_MSG_MAP(CColorSetupDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtrlColor)
        COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK)
        COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel)
		COMMAND_HANDLER(IDC_BUTTON_RESET, BN_CLICKED, OnButtonReset)
		COMMAND_HANDLER(IDC_BUTTON_IMPORT, BN_CLICKED, OnImport)
		COMMAND_HANDLER(IDC_BUTTON_EXPORT, BN_CLICKED, OnExport)
		NOTIFY_RANGE_CODE_HANDLER(IDC_BUTTON_WINDOWS_TEXT_COLOR, IDC_BUTTON_WINDOWS_BACK_COLOR, CPN_SELCHANGE, OnWindowColorChange)
		NOTIFY_RANGE_CODE_HANDLER(IDC_BUTTON_COMMAND_TEXT_COLOR, IDC_BUTTON_COMMAND_BACK_COLOR, CPN_SELCHANGE, OnCommandColorChange)
		NOTIFY_RANGE_CODE_HANDLER(IDC_BUTTON_NOTIFY_TEXT_COLOR, IDC_BUTTON_NOTIFY_BACK_COLOR, CPN_SELCHANGE, OnNotifyColorChange)
		NOTIFY_RANGE_CODE_HANDLER(IDC_BUTTON_REFLECT_TEXT_COLOR, IDC_BUTTON_REFLECT_BACK_COLOR, CPN_SELCHANGE, OnReflectColorChange)
		REFLECT_NOTIFICATIONS()
    END_MSG_MAP()

	BEGIN_SETTINGS_MAP()
		SETTINGS_VARIABLE_OPT(m_clWindowsText)
		SETTINGS_VARIABLE_OPT(m_clWindowsBack)
		SETTINGS_VARIABLE_OPT(m_clCommandText)
		SETTINGS_VARIABLE_OPT(m_clCommandBack)
		SETTINGS_VARIABLE_OPT(m_clNotifyText)
		SETTINGS_VARIABLE_OPT(m_clNotifyBack)
		SETTINGS_VARIABLE_OPT(m_clReflectText)
		SETTINGS_VARIABLE_OPT(m_clReflectBack)
	END_SETTINGS_MAP()
    // 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 OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnCtrlColor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnWindowColorChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnCommandColorChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnNotifyColorChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnReflectColorChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnButtonReset(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnImport(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnExport(WORD wNotifyCode, WORD wID, HWND hWndCtl, 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


Written By
Web Developer
Belarus Belarus
I am a software developer for 3 years.

Comments and Discussions