1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxDockIconPreview class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef ___VBoxDockIconPreview_h___
|
---|
24 | #define ___VBoxDockIconPreview_h___
|
---|
25 |
|
---|
26 | #include "VBoxUtils-darwin.h"
|
---|
27 |
|
---|
28 | RT_C_DECLS_BEGIN
|
---|
29 | void darwinCreateVBoxDockIconTileView (void);
|
---|
30 | void darwinDestroyVBoxDockIconTileView (void);
|
---|
31 |
|
---|
32 | CGContextRef darwinBeginCGContextForApplicationDockTile (void);
|
---|
33 | void darwinEndCGContextForApplicationDockTile (CGContextRef aContext);
|
---|
34 |
|
---|
35 | void darwinOverlayApplicationDockTileImage (CGImageRef pImage);
|
---|
36 | void darwinRestoreApplicationDockTileImage (void);
|
---|
37 | RT_C_DECLS_END
|
---|
38 |
|
---|
39 | #ifndef __OBJC__
|
---|
40 | class VBoxConsoleWnd;
|
---|
41 | class VBoxFrameBuffer;
|
---|
42 |
|
---|
43 | class QPixmap;
|
---|
44 |
|
---|
45 | class VBoxDockIconPreview
|
---|
46 | {
|
---|
47 | public:
|
---|
48 | VBoxDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
|
---|
49 | ~VBoxDockIconPreview();
|
---|
50 |
|
---|
51 | void updateDockOverlay();
|
---|
52 | void updateDockPreview (CGImageRef aVMImage);
|
---|
53 | void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
|
---|
54 |
|
---|
55 | private:
|
---|
56 | inline void initPreviewImages();
|
---|
57 | inline void initOverlayData (int aBitmapByteCount);
|
---|
58 | inline CGImageRef stateImage() const;
|
---|
59 | void drawOverlayIcons (CGContextRef aContext);
|
---|
60 |
|
---|
61 | /* Flipping is necessary cause the drawing context in Carbon is flipped by 180 degree */
|
---|
62 | inline CGRect flipRect (CGRect aRect) const { return ::darwinFlipCGRect (aRect, mDockIconRect); }
|
---|
63 | inline CGRect centerRect (CGRect aRect) const { return ::darwinCenterRectTo (aRect, mDockIconRect); }
|
---|
64 | inline CGRect centerRectTo (CGRect aRect, const CGRect& aToRect) const { return ::darwinCenterRectTo (aRect, aToRect); }
|
---|
65 |
|
---|
66 | void updateDockPreviewImpl (CGContextRef aContext, CGImageRef aVMImage);
|
---|
67 |
|
---|
68 | /* Private member vars */
|
---|
69 | VBoxConsoleWnd *mMainWnd;
|
---|
70 | const CGRect mDockIconRect;
|
---|
71 |
|
---|
72 | CGImageRef mOverlayImage;
|
---|
73 | CGImageRef mDockMonitor;
|
---|
74 | CGImageRef mDockMonitorGlossy;
|
---|
75 |
|
---|
76 | void *mBitmapData;
|
---|
77 |
|
---|
78 | CGImageRef mStatePaused;
|
---|
79 | CGImageRef mStateSaving;
|
---|
80 | CGImageRef mStateRestoring;
|
---|
81 |
|
---|
82 | CGRect mUpdateRect;
|
---|
83 | CGRect mMonitorRect;
|
---|
84 | };
|
---|
85 | #endif /* !__OBJC__ */
|
---|
86 |
|
---|
87 | #endif /* !___VBoxDockIconPreview_h___ */
|
---|
88 |
|
---|