1 //=--------------------------------------------------------------------------=
3 //=--------------------------------------------------------------------------=
4 // This contains a set of interfaces through which the Common Language Runtime
5 // form designer architecture and Visual Studio communicate.
9 // in order to limit our exposure to "header bleed"
10 // and not require us to have all the VS headers and
11 // build system, we define URTBUILD, which indicates
12 // we are building within the common language runtime. If URTBUILD is
13 // defined we stub a lot of interfaces to be IUnknown.
17 #define IVsHierarchy IUnknown
18 #define IServiceProvider IUnknown
20 #define READONLYSTATUS
int
23 import
"servprov.idl";
28 #define
VARIANT_BOOL boolean
31 interface IVSMDCodeDomProvider
;
35 VSHPROPID_ProjAspxLanguage
= 5000, // BSTR Value for 'Language' attribute to be written in .aspx file
36 VSHPROPID_ProjAspxCodeBehindExt
= 5001, // BSTR file extension for code-behind file for .aspx file
37 VSHPROPID_ProjAspxAutoEventWireup
= 5002 // BSTR Value for 'AutoEventWireup' attribute to be written in .aspx file
40 //=--------------------------------------------------------------------------=
42 //=--------------------------------------------------------------------------=
46 uuid(74946836-37A0
-11d2
-A273
-00C04F8EF4FF
),
48 custom(0f21f359
-ab84
-41e8
-9a78
-36d110e6d2f9
, "Microsoft.VisualStudio.Designer.Interfaces"),
49 helpstring("Visual Studio Managed Designer Hosting Library")
51 library VSManagedDesigner
53 importlib
("stdole2.tlb");
56 //=----------------------------------------------------------------------=
57 // IVSMDCodeDomCreator
58 //=----------------------------------------------------------------------=
59 // This is an interface that can be used to create a CodeDom provider
60 // based on a hieararchy and itemid. Visual Studio uses this to create
61 // CodeDom providers that are based on the Visual Studio CodeModel.
62 // This may be accessed by querying for the service
63 // SID_SVSMDDesignerService and asking for this interface.
66 uuid(4CC03BF7
-4D89
-4198-8E4D
-17E217CA07B2
)
68 interface IVSMDCodeDomCreator
: IUnknown
70 HRESULT CreateCodeDomProvider
([in] IVsHierarchy
*pHier
, [in]VSITEMID itemid
, [out, retval]IVSMDCodeDomProvider
**ppProvider
);
74 //=----------------------------------------------------------------------=
75 // IVSMDCodeDomProvider
76 //=----------------------------------------------------------------------=
77 // This is an interface that provides access to a CodeDomProvider object
78 // through native code. Designer loaders may use this if their loading
79 // engine relies on the CodeDom. As a service, this may be queried
80 // from the service provider returned from IVsProject::GetItemContext.
84 uuid(73E59688
-C7C4
-4a85
-AF64
-A538754784C5
)
86 interface IVSMDCodeDomProvider
: IUnknown
89 HRESULT CodeDomProvider
([out, retval] IDispatch
**ppProvider
);
91 cpp_quote
("#define SID_SVSMDCodeDomProvider IID_IVSMDCodeDomProvider")
94 //=----------------------------------------------------------------------=
96 //=----------------------------------------------------------------------=
97 // This is an instance of a managed form designer. The view that this instance
98 // provides can be passed in as the view to CreateDocumentWindow.
102 uuid(7494682A
-37A0
-11d2
-A273
-00C04F8EF4FF
)
104 interface IVSMDDesigner
: IUnknown
106 // Returns the command ID guid for the designer.
109 HRESULT CommandGuid
([out, retval] GUID
*pguidCmdId
);
111 // Returns the view for this designer. This is typically an IVsWindowPane or
112 // a doc object. Whatever it is, it can be hosted by the shell.
115 HRESULT View
([out, retval] IUnknown
**pView
);
117 // Returns the selection container the designer is using to propagate
118 // selection information. You may QI this interface for ISelectionContainer.
121 HRESULT SelectionContainer
([out, retval] IUnknown
**ppSelCon
);
123 // This should be called before the designer is destroyed. If you are
124 // using the view returned from GetView, closing the window pane within
125 // the view will also call Dispose(), so you don't have to.
129 // This causes the designer to flush any lazy changes it has made to
130 // the text buffer. If there are no changes to flush this does nothing.
131 // If you are using a standard designer-provided view, our view
132 // implements IVsWindowPaneCommit and calls this on your behalf. If
133 // you are implementing your own view by having your designer specify
134 // the view technology of "PassThrough", you should call this by
135 // implementing IVsWindowPaneCommit yourself.
139 // Returns the HRESULT of the last load error, should one exist.
141 HRESULT GetLoadError
();
145 //=----------------------------------------------------------------------=
146 // IVSMDDesignerLoader
147 //=----------------------------------------------------------------------=
148 // This interface may be implemented on a designer loader to provide a VS
149 // specific way to initialize it. All designer loaders we provide
150 // to VS implement this interface.
154 uuid(74946834-37A0
-11d2
-A273
-00C04F8EF4FF
)
156 interface IVSMDDesignerLoader
: IUnknown
158 // Disposes this loader. The only time you need to call this method is if designer creation
159 // failed. Otherwise, the designer maintains ownership of the loader and is responsible for
164 // Retrieves the editor caption for the design surface. The loader is responsible for everything
165 // related to buffers, so it is in charge of maintaining the editor caption.
167 HRESULT GetEditorCaption
([in] READONLYSTATUS status
, [out, retval] BSTR *pbstrCaption
);
169 // Initializes the loader. This associates it with a doc data and itemid.
171 HRESULT Initialize
([in] IServiceProvider
*pSp
, [in] IVsHierarchy
*pHier
, [in] VSITEMID itemid
, [in] IUnknown
*pDocData
);
173 // Sets the base editor caption. This defaults to [Design], since most views will use
174 // this loader for a design view.
176 HRESULT SetBaseEditorCaption
([in] LPCOLESTR pwszCaption
);
180 //=----------------------------------------------------------------------=
181 // IVSMDDesignerService / SVSMDDesignerService
182 //=----------------------------------------------------------------------=
183 // This service provides VS shell support for managed form designers.
187 uuid(74946829-37A0
-11d2
-A273
-00C04F8EF4FF
)
189 interface IVSMDDesignerService
: IUnknown
191 // Retrieves the name of the metadata attribute we will use to determine if a class supports design
192 // view. Compilers typically call this to tell the project system if a particular file can be shown
193 // in a designer. This is much more efficient than attempting to creat a designer and failing.
196 HRESULT DesignViewAttribute
([out, retval] BSTR *pbstrAttribute
);
198 // Creates a designer based on the contents of the given designer loader.
200 HRESULT CreateDesigner
([in] IServiceProvider
*pSp
, [in] IUnknown
*pDesignerLoader
, [out, retval] IVSMDDesigner
**ppDesigner
);
202 // Creates a designer based on the designer of the given component class. The designer will
203 // will provide a UI only and will not have any persistence mechanism.
205 HRESULT CreateDesignerForClass
([in] IServiceProvider
*pSp
, [in] LPCOLESTR pwszComponentClass
, [out, retval] IVSMDDesigner
**ppDesigner
);
207 // Creates an uninitialized designer loader. The caller must initialize the loader before
208 // it can be used. Loaders are typically initialized by calling Initialize on IVSMDDesignerLoader.
210 HRESULT CreateDesignerLoader
([in] LPCOLESTR pwszCodeStreamClass
, [out, retval] IUnknown
**ppCodeStream
);
212 // Given a filename, this will look into the registry to find a registered designer loader for that file
213 // extension. It will return S_FALSE if it was unable to find a match. The designer loader registry entry
214 // must be under the Languages subkey of the registry and is a REG_SZ value with the name "DesignerLoaderClass".
216 HRESULT GetDesignerLoaderClassForFile
([in] LPCOLESTR pwszFileName
, [out, retval] BSTR* pbstrDesignerLoaderClass
);
218 // Registers the given attribute value for the given file. This value is the result of the compiler
219 // searching the value passed to the constructor of the "DesignerCategoryAttribute". If no such attribute
220 // is found, the compiler will pass NULL into the pwszAttribute value below. The value for dwClass is a
221 // number indicating the index of the class. The only requirement is that it be unique for each class and
222 // be in increasing value for each class declared in the file. Typical implementations of this may
223 // either return the line number on which the class is defined or a "class count" value.
225 HRESULT RegisterDesignViewAttribute
([in] IVsHierarchy
* pHier
, [in] VSITEMID itemid
, [in] int dwClass
, [in] LPOLESTR pwszAttributeValue
);
228 cpp_quote
("#define SID_SVSMDDesignerService IID_IVSMDDesignerService")
231 typedef enum _PROPERTYGRIDSORT
234 PGSORT_ALPHABETICAL
= 1,
235 PGSORT_CATEGORIZED
= 2
239 typedef enum _PROPERTYGRIDOPTION
241 PGOPT_HOTCOMMANDS
= 0, // VARIANT_BOOL
242 PGOPT_HELP
= 1, // VARIANT_BOOL
243 PGOPT_TOOLBAR
= 2 // VARIANT_BOOL
244 } PROPERTYGRIDOPTION
;
247 //=----------------------------------------------------------------------=
249 //=----------------------------------------------------------------------=
250 // This interface defines a "tear off" properties window. Tear off grids
251 // are mini property browsers that can be hosted in dialog boxes or other
252 // windows. To use a tear off grid, just QI for IVsWindowPane to get
253 // the window, and hand the sheet a selection container for it to browse.
254 // You will be responsible for updating the selection container if you
255 // change the contents of the selection without the grid knowing.
258 uuid(74946837-37A0
-11d2
-A273
-00C04F8EF4FF
)
260 interface IVSMDPropertyGrid
: IUnknown
262 // Returns the current visible state of the hotcommands window
265 HRESULT CommandsVisible
([out,retval]VARIANT_BOOL* pfVisible
);
267 // returns the top-level hwnd for the grid window
270 HRESULT Handle([out,retval]HWND
* phwnd
);
272 // the sort order of the properties window
275 HRESULT GridSort
([out, retval]PROPERTYGRIDSORT
*pSort
);
277 // the sort order of the properties window
280 HRESULT GridSort
([in]PROPERTYGRIDSORT sort
);
282 // Returns the name of the currently selected property.
285 HRESULT SelectedPropertyName
([out,retval]BSTR* pbstrName
);
287 // Call this to destroy the properties window.
291 // Returns the value of the given option
293 HRESULT GetOption
([in]PROPERTYGRIDOPTION option
, [out,retval]VARIANT* pvtOption
);
295 // causes the grid to requery it's currently selected objects and refresh
300 // Returns the value of the given option
302 HRESULT SetOption
([in]PROPERTYGRIDOPTION option
, [in]VARIANT vtOption
);
304 // sets objects for the grid to browse
307 HRESULT SetSelectedObjects
(int cObjects
, [in] IntPtr ppUnk
);
309 HRESULT SetSelectedObjects
(int cObjects
, [in, size_is(cObjects
)]IUnknown
** ppUnk
);
314 //=----------------------------------------------------------------------=
315 // IVSMDPropertyBrowser / SVSMDPropertyBrowser
316 //=----------------------------------------------------------------------=
317 // This provides access to the designer properties window service. This
318 // service provides the global shell properties window. In addition, it
319 // also provides a way to create "tear off" property grids that can
320 // be independently manipulated.
322 // The global properties window can be accessed by querying for
323 // SVSMDPropertyBrowser but passing IVsWindowPane as your interface.
327 uuid(74946810-37A0
-11d2
-A273
-00C04F8EF4FF
)
329 interface IVSMDPropertyBrowser
: IUnknown
331 // the resource ID of the glpyh the properties window should use
332 // as its tool window icon.
335 HRESULT WindowGlyphResourceID
([out, retval]DWORD
* pdwResID
);
337 // Creates a tear off properties window. You must populate this
338 // grid with data yourself.
340 HRESULT CreatePropertyGrid
([out, retval] IVSMDPropertyGrid
**ppGrid
);
342 // Refreshes the properties window.
346 cpp_quote
("#define SID_SVSMDPropertyBrowser IID_IVSMDPropertyBrowser")
349 //=----------------------------------------------------------------------=
350 // IVSMDPerPropertyBrowsing
351 //=----------------------------------------------------------------------=
352 // This interface allows native COM objects to specify managed attributes
353 // on values. It can be used to expose the richer functionality of
354 // managed objects as COM objects.
358 uuid(7494683C
-37A0
-11d2
-A273
-00C04F8EF4FF
),
359 pointer_default(unique)
361 interface IVSMDPerPropertyBrowsing
: IUnknown
{
363 // Gets the list of attributes for the object.
364 // dispid - the dispid of the property to retrieve attributes
366 // pceltAttrs - the number of attribute type names in pbstrTypeNames
368 // pbstrTypeName - attribute type names, such as System.ComponentModel.BrowsableAttribute, or
369 // System.ComponentModel.DescriptionAttribute. This can be the name of any type that
370 // derives from System.Attribute. The array is callee allocated
371 // and will be callee freed using CoTaskMemFree. Strings themselves will be freed with SysFreeString
372 // It can also be a static instance name such as System.ComponentModel.BrowsableAttribute.No, which
373 // will cause the initializer value to be ignored.
375 // pVarAttrValues - An array of variants to be used to initialize the given attributes. If the attributes have a
376 // a ctor that takes a parameter, the give attiribute will be used to iniitalize the attribute. If the initializer
377 // is NULL, VT_EMPTY or VT_NULL, the default ctor will be called. Variants will be caller freed individually
378 // using variant clear then CoTaskMemFree on the array itself.
380 [id(1), helpstring("Specifies Common Language Runtime attributes to apply to this property")]
381 HRESULT GetPropertyAttributes
(DISPID dispid
,
382 [out]UINT
* pceltAttrs
,
383 [out, size_is(,*pceltAttrs
)]BSTR** ppbstrTypeNames
,
384 [out,size_is(,*pceltAttrs
)]VARIANT** ppvarAttrValues
);