1 | /*
|
---|
2 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
13 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
14 | * additional information or have any questions.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef ____H_VIRTUALBOXCALLBACKIMPL
|
---|
18 | #define ____H_VIRTUALBOXCALLBACKIMPL
|
---|
19 |
|
---|
20 | #include "VirtualBoxBase.h"
|
---|
21 | #ifdef RT_OS_WINDOWS
|
---|
22 | # include "win/resource.h"
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | class ATL_NO_VTABLE CallbackWrapper :
|
---|
26 | public VirtualBoxBase,
|
---|
27 | public VirtualBoxSupportErrorInfoImpl<CallbackWrapper, IVirtualBoxCallback>,
|
---|
28 | public VirtualBoxSupportTranslation<CallbackWrapper>,
|
---|
29 | VBOX_SCRIPTABLE_IMPL(ILocalOwner),
|
---|
30 | VBOX_SCRIPTABLE_IMPL(IConsoleCallback),
|
---|
31 | VBOX_SCRIPTABLE_IMPL(IVirtualBoxCallback)
|
---|
32 | #ifdef RT_OS_WINDOWS
|
---|
33 | , public CComCoClass<CallbackWrapper, &CLSID_CallbackWrapper>
|
---|
34 | #endif
|
---|
35 | {
|
---|
36 | public:
|
---|
37 |
|
---|
38 | DECLARE_CLASSFACTORY()
|
---|
39 |
|
---|
40 | DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
|
---|
41 | DECLARE_NOT_AGGREGATABLE(CallbackWrapper)
|
---|
42 |
|
---|
43 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
44 |
|
---|
45 | BEGIN_COM_MAP(CallbackWrapper)
|
---|
46 | COM_INTERFACE_ENTRY2(IDispatch, ILocalOwner)
|
---|
47 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
48 | COM_INTERFACE_ENTRY(ILocalOwner)
|
---|
49 | COM_INTERFACE_ENTRY(IVirtualBoxCallback)
|
---|
50 | COM_INTERFACE_ENTRY(IConsoleCallback)
|
---|
51 | END_COM_MAP()
|
---|
52 |
|
---|
53 | HRESULT FinalConstruct();
|
---|
54 | void FinalRelease();
|
---|
55 |
|
---|
56 | // public initializers/uninitializers only for internal purposes
|
---|
57 | HRESULT init();
|
---|
58 | void uninit (bool aFinalRelease);
|
---|
59 |
|
---|
60 | // ILocalOwner methods
|
---|
61 | STDMETHOD(SetLocalObject)(IUnknown *aLocalObject);
|
---|
62 |
|
---|
63 | // IVirtualBoxCallback methods
|
---|
64 | STDMETHOD(OnMachineStateChange)(IN_BSTR machineId, MachineState_T state);
|
---|
65 | STDMETHOD(OnMachineDataChange)(IN_BSTR machineId);
|
---|
66 | STDMETHOD(OnExtraDataCanChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value,
|
---|
67 | BSTR *error, BOOL *changeAllowed);
|
---|
68 | STDMETHOD(OnExtraDataChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value);
|
---|
69 | STDMETHOD(OnMediumRegistered) (IN_BSTR mediaId, DeviceType_T mediaType,
|
---|
70 | BOOL registered);
|
---|
71 | STDMETHOD(OnMachineRegistered)(IN_BSTR machineId, BOOL registered);
|
---|
72 | STDMETHOD(OnSessionStateChange)(IN_BSTR machineId, SessionState_T state);
|
---|
73 | STDMETHOD(OnSnapshotTaken) (IN_BSTR aMachineId, IN_BSTR aSnapshotId);
|
---|
74 | STDMETHOD(OnSnapshotDiscarded) (IN_BSTR aMachineId, IN_BSTR aSnapshotId);
|
---|
75 | STDMETHOD(OnSnapshotChange) (IN_BSTR aMachineId, IN_BSTR aSnapshotId);
|
---|
76 | STDMETHOD(OnGuestPropertyChange)(IN_BSTR machineId, IN_BSTR key, IN_BSTR value, IN_BSTR flags);
|
---|
77 |
|
---|
78 | // IConsoleCallback
|
---|
79 | STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
|
---|
80 | ULONG width, ULONG height, BYTE *shape);
|
---|
81 | STDMETHOD(OnMouseCapabilityChange)(BOOL supportsAbsolute, BOOL needsHostCursor);
|
---|
82 | STDMETHOD(OnKeyboardLedsChange)(BOOL fNumLock, BOOL fCapsLock, BOOL fScrollLock);
|
---|
83 | STDMETHOD(OnStateChange)(MachineState_T machineState);
|
---|
84 | STDMETHOD(OnAdditionsStateChange)();
|
---|
85 | STDMETHOD(OnNetworkAdapterChange) (INetworkAdapter *aNetworkAdapter);
|
---|
86 | STDMETHOD(OnSerialPortChange) (ISerialPort *aSerialPort);
|
---|
87 | STDMETHOD(OnParallelPortChange) (IParallelPort *aParallelPort);
|
---|
88 | STDMETHOD(OnVRDPServerChange)();
|
---|
89 | STDMETHOD(OnRemoteDisplayInfoChange)();
|
---|
90 | STDMETHOD(OnUSBControllerChange)();
|
---|
91 | STDMETHOD(OnUSBDeviceStateChange) (IUSBDevice *aDevice, BOOL aAttached,
|
---|
92 | IVirtualBoxErrorInfo *aError);
|
---|
93 | STDMETHOD(OnSharedFolderChange) (Scope_T aScope);
|
---|
94 | STDMETHOD(OnStorageControllerChange) ();
|
---|
95 | STDMETHOD(OnMediumChange)(IMediumAttachment *iMediumAttachment);
|
---|
96 | STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
|
---|
97 | STDMETHOD(OnRuntimeError)(BOOL fFatal, IN_BSTR id, IN_BSTR message);
|
---|
98 | STDMETHOD(OnCanShowWindow)(BOOL *canShow);
|
---|
99 | STDMETHOD(OnShowWindow) (ULONG64 *winId);
|
---|
100 |
|
---|
101 | // for VirtualBoxSupportErrorInfoImpl
|
---|
102 | static const wchar_t *getComponentName() { return L"CallbackWrapper"; }
|
---|
103 |
|
---|
104 | private:
|
---|
105 | ComPtr<IVirtualBoxCallback> mVBoxCallback;
|
---|
106 | ComPtr<IConsoleCallback> mConsoleCallback;
|
---|
107 | };
|
---|
108 | #endif // ____H_VIRTUALBOXCALLBACKIMPL
|
---|