Click here to Skip to main content
15,886,873 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 704.2K   8.8K   190  
Add-in for Microsoft VC++.NET 2003 that helps to insert message handlers for WTL.
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Sergey Solozhentsev
// Author: 	Sergey Solozhentsev e-mail: salos@mail.ru
// Product:	WTL Helper
// File:      	WtlHelperDlg.h
// Created:	12.01.2005 13:54
// 
//   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 
// WtlHelperDlg.h : Declaration of the CWtlHelperDlg

#pragma once
#pragma warning (disable: 4267)
#include "../atlgdix.h"
#include "../CustomTabCtrl.h"
#include "../DotNetTabCtrl.h"
#include <atlframe.h>
#include "../TabbedFrame.h"
#pragma warning (default: 4267)

#include "VariablePage.h"
#include "FunctionPage.h"

struct WtlDlgWindowSettings : public CSettings<WtlDlgWindowSettings>
{
	CRect m_WindowRect;
	int m_ActiveTab;

	BEGIN_SETTINGS_MAP()
		SETTINGS_VARIABLE_OPT(m_ActiveTab)
		SETTINGS_BINARY_OPT(&m_WindowRect, sizeof(CRect))
	END_SETTINGS_MAP()
	WtlDlgWindowSettings() : m_ActiveTab(0), m_WindowRect(0, 0, 450, 300)
	{
	}
};

// CWtlHelperDlg
#define IDC_PAGESTAB	1023

class CWtlHelperDlg : 
	public CDialogImpl<CWtlHelperDlg>,
	public CDialogResize<CWtlHelperDlg>,
	public CSettings<CWtlHelperDlg>
{
	CToolBarCtrl m_ToolBar;
	CTabbedChildWindow< CDotNetTabCtrl<CTabViewTabItem> > m_tabbedChildWindow;
	CFunctionPage m_FunctionPage;
	CVariablePage m_VariablePage;
	WtlDlgWindowSettings m_DlgSettings;
	bool m_bSavePreviousPane;

	void SetCommonPointers();

	void LoadSettings();
	void SaveSettings();
public:
	CWtlHelperDlg();
	~CWtlHelperDlg();
	enum { IDD = IDD_WTLHELPERDLG };

	int* m_piCurrentClass;
	ClassVector* m_pClassVector;
	CSmartAtlArray<InsDelPoints>* m_pModifications;
	CResourceManager* m_pResManager;
	int m_iActivePage;

    BEGIN_MSG_MAP(CWtlHelperDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_SIZE, OnSize)
		MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
		MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)

        COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK)
        COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel)
		COMMAND_HANDLER(IDC_BUTTON_APPLY, BN_CLICKED, OnApply)

		NOTIFY_CODE_HANDLER(CTCN_SELCHANGE, OnTabSelectChange)

		MESSAGE_HANDLER(WTLH_SETMODIFIED, OnSetModified)
		NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, OnTtnGetDispInfo)
		if (uMsg == WM_COMMAND)
		{
			if (lParam == (LPARAM)m_ToolBar.m_hWnd)
			{
				::SendMessage(m_tabbedChildWindow.GetActiveView(), uMsg, wParam, lParam);
			}
		}
		if (uMsg == WM_NOTIFY)
		{
			if (((LPNMHDR)lParam)->hwndFrom == m_ToolBar.m_hWnd)
			{
				::SendMessage(m_tabbedChildWindow.GetActiveView(), uMsg, wParam, lParam);
			}
		}
		CHAIN_MSG_MAP(CDialogResize<CWtlHelperDlg>)
    END_MSG_MAP()

	BEGIN_DLGRESIZE_MAP(CWtlHelperDlg)
		DLGRESIZE_CONTROL(IDOK, DLSZ_MOVE_X | DLSZ_MOVE_Y)
		DLGRESIZE_CONTROL(IDCANCEL, DLSZ_MOVE_X | DLSZ_MOVE_Y)
		DLGRESIZE_CONTROL(IDC_BUTTON_APPLY, DLSZ_MOVE_X | DLSZ_MOVE_Y)

		DLGRESIZE_CONTROL(IDC_PAGESTAB, DLSZ_SIZE_X | DLSZ_SIZE_Y)
	END_DLGRESIZE_MAP()

	BEGIN_SETTINGS_MAP()
		SETTINGS_VARIABLE_OPT_RO(m_bSavePreviousPane)
		SETTINGS_CHILD_OPT_USE_PARENT(m_DlgSettings)
	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 OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnGetMinMaxInfo(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 OnApply(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

	LRESULT OnTabSelectChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnTtnGetDispInfo(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnSetModified(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


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

Comments and Discussions