Click here to Skip to main content
13,898,354 members
Click here to Skip to main content

Stats

296.9K views
78.8K downloads
226 bookmarked
Posted 30 Dec 2005
Licenced CPOL

Form Designer

, 1 Aug 2009
Component for adding scriptable forms capabilities to an application.
MFCDemo.exe
CSDemo
App.ico
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
CSDemo.suo
DaeDoe.bmp
MFCDemo
MFCDemo.dsp
MFCDemo.odl
MFCDemo.reg
res
DaeDoe.bmp
MFCDemo.ico
MFCDemoDoc.ico
Toolbar1.bmp
Toolbar2.bmp
Toolbar3.bmp
Wand.bmp
VBDemo
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
DaeDoe.bmp
VBDemo.vbp
DDForms.chm
DDForms
Archive
FormEditorItems.rgs
vssver.scc
Constants.scr
DaeDoe.bmp
DDForms.def
DDForms.vcproj
DDForms.vcproj.vspscc
EventSinkPassThrough.rgs
FormEditor.bmp
FormEditor.rgs
FormEditorItemCollection.rgs
FormEditorItemDetails.rgs
FormViewer.bmp
FormViewer.rgs
FormViewerItemCollection.rgs
FormViewerItemDetails.rgs
mssccprj.scc
PropPageExtended.rgs
PropPageFormEditor.rgs
PropPageFormViewer.rgs
PropPageSimpleScriptEditor.rgs
SimpleScriptEditor.bmp
SimpleScriptEditor.rgs
vssver.scc
DDFormsTools
CodeMaxDriver
CodeMaxDriver.rgs
CodeMaxDriver.vcproj
CodeMaxDriver.vcproj.vspscc
CodeMaxDriverps.def
CodeMaxDriverPS.vcproj
CodeMaxDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
CodeSenseDriver
CodeSenseDriver.rgs
CodeSenseDriver.vcproj
CodeSenseDriver.vcproj.vspscc
CodeSenseDriverps.def
CodeSenseDriverPS.vcproj
CodeSenseDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
DDPropPageAll
DDPropPageAll.def
DDPropPageAll.vcproj
DDPropPageAll.vcproj.vspscc
mssccprj.scc
PropPageAll.rgs
vssver.scc
DDUnlock
DDUnlock.vcproj
DDUnlock.vcproj.vspscc
mssccprj.scc
vssver.scc
DDControlPack
DDButton.bmp
DDCheckBox.bmp
DDComboBox.bmp
DDControlPack.rgs
DDControlPack.vcproj
DDControlPack.vcproj.vspscc
DDHorzScrollBar.bmp
DDLabel.bmp
DDListBox.bmp
DDPicture.bmp
DDRadioButton.bmp
DDTextBox.bmp
DDVertScrollBar.bmp
mssccprj.scc
vssver.scc
Redistributables
Ansi
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
Unicode
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
// PropPageAll.h : Declaration of the CPropPageAll
//
// Author : David Shepherd
//			Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#ifndef __PROPPAGEALL_H_
#define __PROPPAGEALL_H_

#include "resource.h"       // main symbols

#include "ColorPicker.h"
#include "ValueEditor.h"
#include "ValuePicker.h"

#include "PropertyInfo.h"

// list box message map id
#define MSG_MAP_LIST		IDC_LIST

EXTERN_C const CLSID CLSID_PropPageAll;

/////////////////////////////////////////////////////////////////////////////
// type definitions

// maps a property dispatch id to a CPropertyInfo
typedef std::map<DISPID,CPropertyInfo> CDispatchIdToPropertyInfoMap;

/////////////////////////////////////////////////////////////////////////////
// CPropPageAll
class ATL_NO_VTABLE CPropPageAll :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CPropPageAll, &CLSID_PropPageAll>,
	public IPropertyPageImpl<CPropPageAll>,
	public CDialogImpl<CPropPageAll>,
	public IPropertyNotifySink
{
private:
	// list box
	CContainedWindowT<CListBox> m_ListBox;

	// value editor
	CValueEditor m_ValueEditor;
	// value picker
	CValuePicker m_ValuePicker;
	// color picker
	CColorPicker m_ColorPicker;
	// todo : the color picker constructor can throw

	// property map
	CDispatchIdToPropertyInfoMap m_PropertyMap;

	// property notification sink connection cookie
	DWORD m_ConnectionCookie;

	// returns the property page font
	CFontHandle GetFont();

	// loads the property map
	void LoadPropertyMap();

	// handles property changes
	void PropertyChanged(DISPID DispatchId);

	// returns an item rectangle
	CRect GetItemRect(DISPID DispatchId);
	// returns an item name rectangle
	CRect GetItemNameRect(const CRect &ItemRect);
	// returns an item value rectangle
	CRect GetItemValueRect(const CRect &ItemRect);
	// returns an item button rectangle
	CRect GetItemButtonRect(const CRect &ItemRect);

	// draws a string value
	void DrawValueAsString(CDCHandle &hDC,
		const CPropertyInfo &PropertyInfo,const CRect &ValueRect);
	// draws a color value
	void DrawValueAsColor(CDCHandle &hDC,
		const CPropertyInfo &PropertyInfo,const CRect &ValueRect);
	// draws a font value
	void DrawValueAsFont(CDCHandle &hDC,
		const CPropertyInfo &PropertyInfo,const CRect &ValueRect);
	// draws a picture value
	void DrawValueAsPicture(CDCHandle &hDC,
		const CPropertyInfo &PropertyInfo,const CRect &ValueRect);

	// draws an item grid
	void DrawItemGrid(CDCHandle &hDC,const CPropertyInfo &PropertyInfo,
		const CRect &ItemRect,BOOL IsSelected);
	// draws an item name
	void DrawItemName(CDCHandle &hDC,const CPropertyInfo &PropertyInfo,
		const CRect &ItemRect,BOOL IsSelected);
	// draws an item value
	void DrawItemValue(CDCHandle &hDC,const CPropertyInfo &PropertyInfo,
		const CRect &ItemRect,BOOL IsSelected);
	// draws an item button
	void DrawItemButton(CDCHandle &hDC,const CPropertyInfo &PropertyInfo,
		const CRect &ItemRect,BOOL IsSelected);

	// clears a picture property
	void ClearPicture(const CPropertyInfo &PropertyInfo);
	// sets a picture property using a bitmap
	void SetPictureOnBitmap(
		const CPropertyInfo &PropertyInfo,const std::wstring &FileName);
	// sets a picture property using an icon
	void SetPictureOnIcon(
		const CPropertyInfo &PropertyInfo,const std::wstring &FileName);
	// sets a picture property using a metafile
	void SetPictureOnMetafile(
		const CPropertyInfo &PropertyInfo,const std::wstring &FileName);

	// shows the value editor
	void EditValue(const CPropertyInfo &PropertyInfo);
	// shows the value picker
	void PickValue(const CPropertyInfo &PropertyInfo);
	// shows the color picker
	void PickColor(const CPropertyInfo &PropertyInfo);
	// shows the font picker
	void PickFont(const CPropertyInfo &PropertyInfo);
	// shows the picture picker
	void PickPicture(const CPropertyInfo &PropertyInfo);

public:
	CPropPageAll();

	enum {IDD = IDD_PROPPAGEALL};

DECLARE_REGISTRY_RESOURCEID(IDR_PROPPAGEALL)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CPropPageAll)
	COM_INTERFACE_ENTRY(IPropertyPage)
	COM_INTERFACE_ENTRY(IPropertyNotifySink)
END_COM_MAP()

BEGIN_MSG_MAP(CPropPageAll)
	CHAIN_MSG_MAP(IPropertyPageImpl<CPropPageAll>)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
	MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
	MESSAGE_HANDLER(WM_SIZE, OnSize)
	MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem)
	MESSAGE_HANDLER(WM_COMPAREITEM, OnCompareItem)
	MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem)
	COMMAND_HANDLER(IDC_LIST, LBN_SELCHANGE, OnSelchangeList)
// list box message map
ALT_MSG_MAP(MSG_MAP_LIST)
	MESSAGE_HANDLER(WM_KEYDOWN, OnListKeyDown)
	MESSAGE_HANDLER(WM_LBUTTONDOWN, OnListLButtonDown)
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);

// IPropertyPage
	STDMETHOD(Apply)();

// IPropertyNotifySink
	STDMETHOD(OnChanged)(DISPID dispID);
	STDMETHOD(OnRequestEdit)(DISPID dispID);

// message handlers
	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnCompareItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSelchangeList(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

// message handlers (list box)
	LRESULT OnListKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnListLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};

#endif //__PROPPAGEALL_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)

Share

About the Author

DaveShep
Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190306.1 | Last Updated 1 Aug 2009
Article Copyright 2005 by DaveShep
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid