Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24662/com/win32comext/shell/src
Modified Files:
shell.cpp
Added Files:
PyIDeskBand.cpp PyIDeskBand.h PyIDockingWindow.cpp
PyIDockingWindow.h
Log Message:
Add support for IDeskBand and IDockingWindow.
--- NEW FILE: PyIDockingWindow.h ---
// This file declares the IDockingWindow Gateway for Python.
// ---------------------------------------------------------
//
// Gateway Declaration
class PyGDockingWindow: public PyGOleWindow, public IDockingWindow
{
protected:
PyGDockingWindow(PyObject *instance) : PyGOleWindow(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGDockingWindow, IDockingWindow, IID_IDockingWindow, PyGOleWindow)
// IOleWindow
STDMETHOD(GetWindow)(
HWND __RPC_FAR * phwnd);
STDMETHOD(ContextSensitiveHelp)(
BOOL fEnterMode);
// IDockingWindow
STDMETHOD(ShowDW)(
BOOL fShow);
STDMETHOD(CloseDW)(
DWORD dwReserved);
STDMETHOD(ResizeBorderDW)(
LPCRECT prcBorder,
IUnknown *punkToolbarSite,
BOOL fReserved);
};
--- NEW FILE: PyIDockingWindow.cpp ---
// This file implements the IDockingWindow Interface and Gateway for Python.
#include "shell_pch.h"
#include "PyIOleWindow.h"
#include "PyIDockingWindow.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGDockingWindow::GetWindow(HWND __RPC_FAR * phwnd) {return PyGOleWindow::GetWindow(phwnd);}
STDMETHODIMP PyGDockingWindow::ContextSensitiveHelp(BOOL fEnterMode) {return PyGOleWindow::ContextSensitiveHelp(fEnterMode);}
STDMETHODIMP PyGDockingWindow::ShowDW(BOOL fShow)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("ShowDW", NULL, "i", fShow);
}
STDMETHODIMP PyGDockingWindow::CloseDW(DWORD dwReserved)
{
PY_GATEWAY_METHOD;
return InvokeViaPolicy("CloseDW", NULL, "i", dwReserved);
}
STDMETHODIMP PyGDockingWindow::ResizeBorderDW(
/* [in] */ LPCRECT prcBorder,
/* [in] */ IUnknown *punkToolbarSite,
/* [in] */ BOOL fReserved)
{
PY_GATEWAY_METHOD;
PyObject *obSite = PyCom_PyObjectFromIUnknown(punkToolbarSite, IID_IUnknown, TRUE);
if (!obSite)
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("ResizeBorderDW");
return InvokeViaPolicy("ResizeWindowDW", NULL, "(iiii)Ni",
prcBorder->left, prcBorder->top,
prcBorder->right, prcBorder->bottom,
obSite, fReserved);
}
--- NEW FILE: PyIDeskBand.cpp ---
// This file implements the IDeskBand Interface and Gateway for Python.
#include "shell_pch.h"
#include "PyIOleWindow.h"
#include "PyIDockingWindow.h"
#include "PyIDeskBand.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Gateway Implementation
// IOleWindow
STDMETHODIMP PyGDeskBand::GetWindow(HWND __RPC_FAR * phwnd) {return PyGDockingWindow::GetWindow(phwnd);}
STDMETHODIMP PyGDeskBand::ContextSensitiveHelp(BOOL fEnterMode) {return PyGDockingWindow::ContextSensitiveHelp(fEnterMode);}
// IDockingWindow
STDMETHODIMP PyGDeskBand::ShowDW(BOOL fShow) {
return PyGDockingWindow::ShowDW(fShow);
}
STDMETHODIMP PyGDeskBand::CloseDW(DWORD dwReserved) {
return PyGDockingWindow::CloseDW(dwReserved);
}
STDMETHODIMP PyGDeskBand::ResizeBorderDW(
LPCRECT prcBorder,
IUnknown *punkToolbarSite,
BOOL fReserved) {
return PyGDockingWindow::ResizeBorderDW(prcBorder, punkToolbarSite,
fReserved);
}
STDMETHODIMP PyGDeskBand::GetBandInfo(
DWORD dwBandID,
DWORD dwViewMode,
DESKBANDINFO* pdbi)
{
PY_GATEWAY_METHOD;
PyObject *ret;
HRESULT hr=InvokeViaPolicy("GetBandInfo", &ret, "ikk", dwBandID,
dwViewMode, pdbi->dwMask);
if (FAILED(hr)) return hr;
// I'm slack here - all values must be returned from Python (eg, even
// if the mask doesn't want a value, you must provide one (usually 0)
PyObject *obtitle;
if (!PyArg_ParseTuple(ret, "(ii)(ii)(ii)(ii)Oii",
&pdbi->ptMinSize.x,
&pdbi->ptMinSize.y,
&pdbi->ptMaxSize.x,
&pdbi->ptMaxSize.y,
&pdbi->ptIntegral.x,
&pdbi->ptIntegral.y,
&pdbi->ptActual.x,
&pdbi->ptActual.y,
&obtitle,
&pdbi->dwModeFlags,
&pdbi->crBkgnd))
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetBandInfo");
else {
WCHAR *title = NULL;
if (!PyWinObject_AsWCHAR(obtitle, &title)) {
hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetBandInfo");
} else {
wcsncpy(pdbi->wszTitle, title,
sizeof(pdbi->wszTitle)/sizeof(pdbi->wszTitle[0]));
PyWinObject_FreeWCHAR(title);
}
}
Py_DECREF(ret);
return hr;
}
Index: shell.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** shell.cpp 20 Oct 2005 22:30:58 -0000 1.40
--- shell.cpp 29 Nov 2005 02:24:16 -0000 1.41
***************
*** 35,38 ****
--- 35,40 ----
#include "PyIAsyncOperation.h"
#include "PyIQueryAssociations.h"
+ #include "PyIDockingWindow.h"
+ #include "PyIDeskBand.h"
#include "PythonCOMRegister.h" // For simpler registration of IIDs etc.
***************
*** 2165,2168 ****
--- 2167,2172 ----
PYCOM_INTERFACE_FULL(DropTargetHelper),
PYCOM_INTERFACE_CLIENT_ONLY(QueryAssociations),
+ PYCOM_INTERFACE_SERVER_ONLY(DeskBand),
+ PYCOM_INTERFACE_SERVER_ONLY(DockingWindow),
// IID_ICopyHook doesn't exist - hack it up
{ &IID_IShellCopyHook, "IShellCopyHook", "IID_IShellCopyHook", &PyICopyHook::type, GET_PYGATEWAY_CTOR(PyGCopyHook) },
--- NEW FILE: PyIDeskBand.h ---
// This file declares the IDeskBand Gateway for Python.
// ---------------------------------------------------
// ---------------------------------------------------
//
// Gateway Declaration
class PyGDeskBand: public PyGDockingWindow, public IDeskBand
{
protected:
PyGDeskBand(PyObject *instance) : PyGDockingWindow(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGDeskBand, IDeskBand, IID_IDeskBand, PyGDockingWindow)
// IOleWindow
STDMETHOD(GetWindow)(
HWND __RPC_FAR * phwnd);
STDMETHOD(ContextSensitiveHelp)(
BOOL fEnterMode);
// IDockingWindow
STDMETHOD(ShowDW)(
BOOL fShow);
STDMETHOD(CloseDW)(
DWORD dwReserved);
STDMETHOD(ResizeBorderDW)(
LPCRECT prcBorder,
IUnknown *punkToolbarSite,
BOOL fReserved);
// IDeskBand
STDMETHOD(GetBandInfo)(
DWORD dwBandID,
DWORD dwViewMode,
DESKBANDINFO* pdbi);
};
|