1 | /*
|
---|
2 | * Copyright (C) 2009-2010 Oracle Corporation
|
---|
3 | *
|
---|
4 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | * available from http://www.virtualbox.org. This file is free software;
|
---|
6 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | * General Public License (GPL) as published by the Free Software
|
---|
8 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef ____H_VIRTUALBOXCALLBACKIMPL
|
---|
14 | #define ____H_VIRTUALBOXCALLBACKIMPL
|
---|
15 |
|
---|
16 | #include "VirtualBoxBase.h"
|
---|
17 | #ifdef RT_OS_WINDOWS
|
---|
18 | # include "win/resource.h"
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | class ATL_NO_VTABLE CallbackWrapper :
|
---|
22 | public VirtualBoxBase,
|
---|
23 | public VirtualBoxSupportErrorInfoImpl<CallbackWrapper, IVirtualBoxCallback>,
|
---|
24 | public VirtualBoxSupportTranslation<CallbackWrapper>,
|
---|
25 | VBOX_SCRIPTABLE_IMPL(ILocalOwner),
|
---|
26 | VBOX_SCRIPTABLE_IMPL(IConsoleCallback),
|
---|
27 | VBOX_SCRIPTABLE_IMPL(IVirtualBoxCallback)
|
---|
28 | #ifdef RT_OS_WINDOWS
|
---|
29 | , public CComCoClass<CallbackWrapper, &CLSID_CallbackWrapper>
|
---|
30 | #endif
|
---|
31 | {
|
---|
32 | public:
|
---|
33 |
|
---|
34 | DECLARE_CLASSFACTORY()
|
---|
35 |
|
---|
36 | DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
|
---|
37 | DECLARE_NOT_AGGREGATABLE(CallbackWrapper)
|
---|
38 |
|
---|
39 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
40 |
|
---|
41 | BEGIN_COM_MAP(CallbackWrapper)
|
---|
42 | COM_INTERFACE_ENTRY2(IDispatch, ILocalOwner)
|
---|
43 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
44 | COM_INTERFACE_ENTRY(ILocalOwner)
|
---|
45 | COM_INTERFACE_ENTRY(IVirtualBoxCallback)
|
---|
46 | COM_INTERFACE_ENTRY(IConsoleCallback)
|
---|
47 | END_COM_MAP()
|
---|
48 |
|
---|
49 | HRESULT FinalConstruct();
|
---|
50 | void FinalRelease();
|
---|
51 |
|
---|
52 | // public initializers/uninitializers only for internal purposes
|
---|
53 | HRESULT init();
|
---|
54 | void uninit(bool aFinalRelease);
|
---|
55 |
|
---|
56 | // ILocalOwner methods
|
---|
57 | STDMETHOD(SetLocalObject)(IUnknown *aLocalObject);
|
---|
58 |
|
---|
59 | // IVirtualBoxCallback methods
|
---|
60 | STDMETHOD(OnMachineStateChange)(IN_BSTR machineId, MachineState_T state);
|
---|
61 | STDMETHOD(OnMachineDataChange)(IN_BSTR machineId);
|
---|
62 | STDMETHOD(OnExtraDataCanChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value,
|
---|
63 | BSTR *error, BOOL *changeAllowed);
|
---|
64 | STDMETHOD(OnExtraDataChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value);
|
---|
65 | STDMETHOD(OnMediumRegistered)(IN_BSTR mediaId, DeviceType_T mediaType,
|
---|
66 | BOOL registered);
|
---|
67 | STDMETHOD(OnMachineRegistered)(IN_BSTR machineId, BOOL registered);
|
---|
68 | STDMETHOD(OnSessionStateChange)(IN_BSTR machineId, SessionState_T state);
|
---|
69 | STDMETHOD(OnSnapshotTaken)(IN_BSTR aMachineId, IN_BSTR aSnapshotId);
|
---|
70 | STDMETHOD(OnSnapshotDeleted)(IN_BSTR aMachineId, IN_BSTR aSnapshotId);
|
---|
71 | STDMETHOD(OnSnapshotChange)(IN_BSTR aMachineId, IN_BSTR aSnapshotId);
|
---|
72 | STDMETHOD(OnGuestPropertyChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags);
|
---|
73 |
|
---|
74 | // IConsoleCallback
|
---|
75 | STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
|
---|
76 | ULONG width, ULONG height, ComSafeArrayIn(BYTE, shape));
|
---|
77 | STDMETHOD(OnMouseCapabilityChange)(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor);
|
---|
78 | STDMETHOD(OnKeyboardLedsChange)(BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock);
|
---|
79 | STDMETHOD(OnStateChange)(MachineState_T machineState);
|
---|
80 | STDMETHOD(OnAdditionsStateChange)();
|
---|
81 | STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *aNetworkAdapter);
|
---|
82 | STDMETHOD(OnSerialPortChange)(ISerialPort *aSerialPort);
|
---|
83 | STDMETHOD(OnParallelPortChange)(IParallelPort *aParallelPort);
|
---|
84 | STDMETHOD(OnVRDPServerChange)();
|
---|
85 | STDMETHOD(OnRemoteDisplayInfoChange)();
|
---|
86 | STDMETHOD(OnUSBControllerChange)();
|
---|
87 | STDMETHOD(OnUSBDeviceStateChange)(IUSBDevice *aDevice, BOOL aAttached,
|
---|
88 | IVirtualBoxErrorInfo *aError);
|
---|
89 | STDMETHOD(OnSharedFolderChange)(Scope_T aScope);
|
---|
90 | STDMETHOD(OnStorageControllerChange)();
|
---|
91 | STDMETHOD(OnMediumChange)(IMediumAttachment *iMediumAttachment);
|
---|
92 | STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
|
---|
93 | STDMETHOD(OnRuntimeError)(BOOL fFatal, IN_BSTR id, IN_BSTR message);
|
---|
94 | STDMETHOD(OnCanShowWindow)(BOOL *canShow);
|
---|
95 | STDMETHOD(OnShowWindow)(ULONG64 *winId);
|
---|
96 |
|
---|
97 | // for VirtualBoxSupportErrorInfoImpl
|
---|
98 | static const wchar_t *getComponentName() { return L"CallbackWrapper"; }
|
---|
99 |
|
---|
100 | private:
|
---|
101 | ComPtr<IVirtualBoxCallback> mVBoxCallback;
|
---|
102 | ComPtr<IConsoleCallback> mConsoleCallback;
|
---|
103 | };
|
---|
104 | #endif // ____H_VIRTUALBOXCALLBACKIMPL
|
---|