// DDVertScrollBar.h : Declaration of the CDDVertScrollBar
//
// Author : David Shepherd
// Copyright (c) 2003, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include "resource.h" // main symbols
#include <atlctl.h>
/////////////////////////////////////////////////////////////////////////////
// IDDVertScrollBar
[
object,
uuid("07247DE4-8365-4491-87DF-798E57F618B1"),
dual,
helpstring("IDDVertScrollBar Interface"),
pointer_default(unique)
]
__interface IDDVertScrollBar : public IDispatch
{
////////////////////////////////////////
// enabled
[propget, requestedit, bindable,
id(DISPID_ENABLED),
helpstring("")]
HRESULT Enabled([out, retval] VARIANT_BOOL* pVal);
[propput, requestedit, bindable,
id(DISPID_ENABLED),
helpstring("")]
HRESULT Enabled([in] VARIANT_BOOL newVal);
////////////////////////////////////////
// minimum value
[propget, requestedit, bindable,
id(DISPID_MINVALUE),
helpstring("")]
HRESULT Min([out, retval] LONG* pVal);
[propput, requestedit, bindable,
id(DISPID_MINVALUE),
helpstring("")]
HRESULT Min([in] LONG newVal);
////////////////////////////////////////
// maximum value
[propget, requestedit, bindable,
id(DISPID_MAXVALUE),
helpstring("")]
HRESULT Max([out, retval] LONG* pVal);
[propput, requestedit, bindable,
id(DISPID_MAXVALUE),
helpstring("")]
HRESULT Max([in] LONG newVal);
////////////////////////////////////////
// small step
[propget, requestedit, bindable,
id(DISPID_SMALLSTEP),
helpstring("")]
HRESULT SmallStep([out, retval] LONG* pVal);
[propput, requestedit, bindable,
id(DISPID_SMALLSTEP),
helpstring("")]
HRESULT SmallStep([in] LONG newVal);
////////////////////////////////////////
// large step
[propget, requestedit, bindable,
id(DISPID_LARGESTEP),
helpstring("")]
HRESULT LargeStep([out, retval] LONG* pVal);
[propput, requestedit, bindable,
id(DISPID_LARGESTEP),
helpstring("")]
HRESULT LargeStep([in] LONG newVal);
////////////////////////////////////////
// value
[propget, requestedit, bindable,
id(DISPID_VALUE_NOTDEFAULT),
helpstring("")]
HRESULT Value([out, retval] LONG* pVal);
[propput, requestedit, bindable,
id(DISPID_VALUE_NOTDEFAULT),
helpstring("")]
HRESULT Value([in] LONG newVal);
////////////////////////////////////////
// default property
[propget, nonbrowsable,
id(DISPID_VALUE),
helpstring("")]
HRESULT _Default([out, retval] LONG* pVal);
[propput, nonbrowsable,
id(DISPID_VALUE),
helpstring("")]
HRESULT _Default([in] LONG newVal);
};
/////////////////////////////////////////////////////////////////////////////
// _IDDVertScrollBarEvents
[
uuid("B4948B79-CE4B-4B34-A2ED-02E89CB14B43"),
dispinterface,
helpstring("_IDDVertScrollBarEvents Interface")
]
__interface _IDDVertScrollBarEvents
{
[id(1), helpstring("")] HRESULT Change();
[id(2), helpstring("")] HRESULT Scroll();
};
/////////////////////////////////////////////////////////////////////////////
// CDDVertScrollBar
[
coclass,
threading("apartment"),
vi_progid("DDControlPack.DDVertScrollBar"),
progid("DDControlPack.DDVertScrollBar.1"),
version(1.0),
uuid("639DB38D-88AF-40E3-A374-2F21327825D6"),
helpstring("DDVertScrollBar Class"),
event_source("com"),
support_error_info(IDDVertScrollBar),
registration_script("control.rgs")
]
class ATL_NO_VTABLE CDDVertScrollBar :
public IDispatchImpl<IDDVertScrollBar>,
public IPersistStreamInitImpl<CDDVertScrollBar>,
public IOleControlImpl<CDDVertScrollBar>,
public IOleObjectImpl<CDDVertScrollBar>,
public IOleInPlaceActiveObjectImpl<CDDVertScrollBar>,
public IViewObjectExImpl<CDDVertScrollBar>,
public IOleInPlaceObjectWindowlessImpl<CDDVertScrollBar>,
public IPersistStorageImpl<CDDVertScrollBar>,
public ISpecifyPropertyPagesImpl<CDDVertScrollBar>,
public IQuickActivateImpl<CDDVertScrollBar>,
public IDataObjectImpl<CDDVertScrollBar>,
public CComControl<CDDVertScrollBar>
{
private:
CContainedWindow m_ctlScrollBar;
__event __interface _IDDVertScrollBarEvents;
/////////////////////////////////////////////////////////////////////////////
// properties
LONG m_Reserved0; // reserved
LONG m_Reserved1; // reserved
VARIANT_BOOL m_Enabled; // enabled
LONG m_MinValue; // minimum value
LONG m_MaxValue; // maximum value
LONG m_SmallStep; // small step
LONG m_LargeStep; // large step
LONG m_Value; // value
/////////////////////////////////////////////////////////////////////////////
// property change validators
HRESULT OnSmallStepChanging(LONG newVal);
HRESULT OnLargeStepChanging(LONG newVal);
HRESULT OnValueChanging(LONG newVal);
/////////////////////////////////////////////////////////////////////////////
// property change handlers
void OnEnabledChanged();
void OnValueChanged();
/////////////////////////////////////////////////////////////////////////////
// returns the value for the passed scroll position
LONG ValueFromScrollPos(LONG Pos);
// returns the scroll position for the passed value
LONG ScrollPosFromValue(LONG Value);
// returns the normalised minimum value
LONG NormalisedMinValue();
// returns the normalised maximum value
LONG NormalisedMaxValue();
public:
CDDVertScrollBar();
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct();
void FinalRelease();
static const TCHAR* GetObjectFriendlyName();
DECLARE_OLEMISC_STATUS(
OLEMISC_RECOMPOSEONRESIZE |
OLEMISC_CANTLINKINSIDE |
OLEMISC_INSIDEOUT |
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST)
BEGIN_PROP_MAP(CDDVertScrollBar)
PROP_DATA_ENTRY("_reserved0", m_Reserved0, VT_I4)
PROP_DATA_ENTRY("_reserved1", m_Reserved1, VT_I4)
PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
PROP_ENTRY("Enabled", DISPID_ENABLED, CLSID_NULL)
PROP_ENTRY("MinValue", DISPID_MINVALUE, CLSID_NULL)
PROP_ENTRY("MaxValue", DISPID_MAXVALUE, CLSID_NULL)
PROP_ENTRY("SmallStep", DISPID_SMALLSTEP, CLSID_NULL)
PROP_ENTRY("LargeStep", DISPID_LARGESTEP, CLSID_NULL)
PROP_ENTRY("Value", DISPID_VALUE_NOTDEFAULT, CLSID_NULL)
// Example entries
// PROP_ENTRY("Property Description", dispid, clsid)
// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()
BEGIN_MSG_MAP(CDDVertScrollBar)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
MESSAGE_HANDLER(WM_VSCROLL, OnVScroll)
CHAIN_MSG_MAP(CComControl<CDDVertScrollBar>)
ALT_MSG_MAP(1)
// Replace this with message map entries for superclassed ScrollBar
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
BOOL PreTranslateAccelerator(LPMSG pMsg, HRESULT& hRet);
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// IOleInPlaceObjectWindowless
STDMETHOD(SetObjectRects)(LPCRECT prcPos,LPCRECT prcClip);
// IViewObjectEx
DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
// IDDVertScrollBar
IMPLEMENT_CUSTOM_BOOL_PROPERTY(Enabled,m_Enabled,DISPID_ENABLED);
STDMETHOD(get_Min)(LONG *pVal);
STDMETHOD(put_Min)(LONG newVal);
STDMETHOD(get_Max)(LONG *pVal);
STDMETHOD(put_Max)(LONG newVal);
IMPLEMENT_CUSTOM_PROPERTY(LONG,SmallStep,m_SmallStep,DISPID_SMALLSTEP);
IMPLEMENT_CUSTOM_PROPERTY(LONG,LargeStep,m_LargeStep,DISPID_LARGESTEP);
IMPLEMENT_CUSTOM_PROPERTY(LONG,Value,m_Value,DISPID_VALUE_NOTDEFAULT);
STDMETHOD(get__Default)(LONG* pVal);
STDMETHOD(put__Default)(LONG newVal);
};