VirtualBox

source: vbox/trunk/src/VBox/Main/include/VirtualBoxCallbackImpl.h@ 22305

Last change on this file since 22305 was 22305, checked in by vboxsync, 15 years ago

Main: generic callback wrappers mechanism

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
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
22class ATL_NO_VTABLE VirtualBoxCallback :
23 public VirtualBoxBase,
24 public VirtualBoxSupportErrorInfoImpl<VirtualBoxCallback, IVirtualBoxCallback>,
25 public VirtualBoxSupportTranslation<VirtualBoxCallback>,
26 VBOX_SCRIPTABLE_IMPL(ILocalOwner),
27 VBOX_SCRIPTABLE_IMPL(IConsoleCallback),
28 VBOX_SCRIPTABLE_IMPL(IVirtualBoxCallback)
29#ifdef RT_OS_WINDOWS
30 , public CComCoClass<VirtualBoxCallback, &CLSID_VirtualBoxCallback>
31#endif
32{
33public:
34
35 DECLARE_CLASSFACTORY()
36
37 DECLARE_NOT_AGGREGATABLE(VirtualBoxCallback)
38
39 DECLARE_PROTECT_FINAL_CONSTRUCT()
40
41 BEGIN_COM_MAP(VirtualBoxCallback)
42 COM_INTERFACE_ENTRY2(IDispatch, IVirtualBoxCallback)
43 COM_INTERFACE_ENTRY2(IDispatch, IConsoleCallback)
44 COM_INTERFACE_ENTRY2(IDispatch, ILocalOwner)
45 COM_INTERFACE_ENTRY(ISupportErrorInfo)
46 COM_INTERFACE_ENTRY(ILocalOwner)
47 COM_INTERFACE_ENTRY(IVirtualBoxCallback)
48 COM_INTERFACE_ENTRY(IConsoleCallback)
49 END_COM_MAP()
50
51 NS_DECL_ISUPPORTS
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(OnMediaRegistered) (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(OnDVDDriveChange)();
86 STDMETHOD(OnFloppyDriveChange)();
87 STDMETHOD(OnNetworkAdapterChange) (INetworkAdapter *aNetworkAdapter);
88 STDMETHOD(OnSerialPortChange) (ISerialPort *aSerialPort);
89 STDMETHOD(OnParallelPortChange) (IParallelPort *aParallelPort);
90 STDMETHOD(OnVRDPServerChange)();
91 STDMETHOD(OnUSBControllerChange)();
92 STDMETHOD(OnUSBDeviceStateChange) (IUSBDevice *aDevice, BOOL aAttached,
93 IVirtualBoxErrorInfo *aError);
94 STDMETHOD(OnSharedFolderChange) (Scope_T aScope);
95 STDMETHOD(OnStorageControllerChange) ();
96 STDMETHOD(OnRuntimeError)(BOOL fFatal, IN_BSTR id, IN_BSTR message);
97 STDMETHOD(OnCanShowWindow)(BOOL *canShow);
98 STDMETHOD(OnShowWindow) (ULONG64 *winId);
99
100 // for VirtualBoxSupportErrorInfoImpl
101 static const wchar_t *getComponentName() { return L"VirtualBoxCallback"; }
102
103private:
104 ComPtr<IVirtualBoxCallback> mVBoxCallback;
105 ComPtr<IConsoleCallback> mConsoleCallback;
106};
107#endif // ____H_VIRTUALBOXCALLBACKIMPL
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette