Click here to Skip to main content
15,886,199 members
Articles / Desktop Programming / WTL

Form Designer

26 Jul 2021CPOL24 min read 351.2K   82.5K   230  
Component for adding scriptable forms capabilities to an application.
// InsertItemDlg.h : Declaration of the CInsertItemDlg
//
// Author : David Shepherd
//			Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#ifndef __INSERTITEMDLG_H_
#define __INSERTITEMDLG_H_

#include "resource.h"       // main symbols
#include <atlhost.h>

/////////////////////////////////////////////////////////////////////////////
// CInsertableItem
class CInsertableItem
{
public:
	// name
	std::wstring m_Name;
	// class id
	CLSID m_ClassId;
	// prog id
	std::wstring m_ProgId;

	CInsertableItem();
	virtual ~CInsertableItem();
};
// CInsertableItem vector
typedef std::vector<CInsertableItem> CInsertableItemVector;

/////////////////////////////////////////////////////////////////////////////
// CInsertItemDlg
class CInsertItemDlg : public CAxDialogImpl<CInsertItemDlg>
{
private:
// control wrappers
	// item list
	CListBox m_ctrlItemList;

	// insertable items
	CInsertableItemVector m_InsertableItems;

public:
	// prog id of the item to insert
	std::wstring m_ProgId;

	CInsertItemDlg();
	virtual ~CInsertItemDlg();

	enum { IDD = IDD_INSERT_ITEM };

BEGIN_MSG_MAP(CInsertItemDlg)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
	COMMAND_ID_HANDLER(IDOK, OnOK)
	COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
	COMMAND_HANDLER(IDC_ITEM_LIST, LBN_SELCHANGE, OnSelChangeItemList)
	COMMAND_HANDLER(IDC_ITEM_LIST, LBN_DBLCLK, OnDblClkItemList)
END_MSG_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);

// message handlers
	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnSelChangeItemList(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnDblClkItemList(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
};

#endif //__INSERTITEMDLG_H_

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
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions