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 <QObject> /* drag in QT_MAC_USE_COCOA */
|
---|
27 |
|
---|
28 | #ifdef QT_MAC_USE_COCOA
|
---|
29 | /** @todo include chocolatey headers... */
|
---|
30 | #else
|
---|
31 | # include <Carbon/Carbon.h>
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | class VBoxConsoleWnd;
|
---|
35 | class VBoxFrameBuffer;
|
---|
36 |
|
---|
37 | class QPixmap;
|
---|
38 |
|
---|
39 | class VBoxDockIconPreview
|
---|
40 | {
|
---|
41 | public:
|
---|
42 | VBoxDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
|
---|
43 | ~VBoxDockIconPreview();
|
---|
44 |
|
---|
45 | void updateDockOverlay();
|
---|
46 | #ifndef QT_MAC_USE_COCOA
|
---|
47 | void updateDockPreview (CGImageRef aVMImage);
|
---|
48 | #endif
|
---|
49 | void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
|
---|
50 |
|
---|
51 | private:
|
---|
52 | #ifdef QT_MAC_USE_COCOA
|
---|
53 | /** @todo Carbon -> Cocoa */
|
---|
54 | #else
|
---|
55 | inline void initPreviewImages();
|
---|
56 | inline void initOverlayData (int aBitmapByteCount);
|
---|
57 | inline CGImageRef stateImage() const;
|
---|
58 | void drawOverlayIcons (CGContextRef aContext);
|
---|
59 |
|
---|
60 | /* Flipping is necessary cause the drawing context in Carbon is flipped by 180 degree */
|
---|
61 | inline CGRect flipRect (CGRect aRect) const { aRect.origin.y = mDockIconRect.size.height - aRect.origin.y - aRect.size.height; return aRect; }
|
---|
62 | inline CGRect centerRect (CGRect aRect) const { return centerRectTo (aRect, mDockIconRect); }
|
---|
63 | inline CGRect centerRectTo (CGRect aRect, const CGRect& aToRect) const
|
---|
64 | {
|
---|
65 | aRect.origin.x = aToRect.origin.x + (aToRect.size.width - aRect.size.width) / 2.0;
|
---|
66 | aRect.origin.y = aToRect.origin.y + (aToRect.size.height - aRect.size.height) / 2.0;
|
---|
67 | return aRect;
|
---|
68 | }
|
---|
69 | #endif /* !QT_MAC_USE_COCOA */
|
---|
70 |
|
---|
71 | /* Private member vars */
|
---|
72 | VBoxConsoleWnd *mMainWnd;
|
---|
73 | #ifdef QT_MAC_USE_COCOA
|
---|
74 | /** @todo Carbon -> Cocoa */
|
---|
75 | #else
|
---|
76 | const CGRect mDockIconRect;
|
---|
77 |
|
---|
78 | CGImageRef mOverlayImage;
|
---|
79 | CGImageRef mDockMonitor;
|
---|
80 | CGImageRef mDockMonitorGlossy;
|
---|
81 |
|
---|
82 | void *mBitmapData;
|
---|
83 |
|
---|
84 | CGImageRef mStatePaused;
|
---|
85 | CGImageRef mStateSaving;
|
---|
86 | CGImageRef mStateRestoring;
|
---|
87 |
|
---|
88 | CGRect mUpdateRect;
|
---|
89 | CGRect mMonitorRect;
|
---|
90 | #endif
|
---|
91 | };
|
---|
92 |
|
---|
93 | #endif /* !___VBoxDockIconPreview_h___ */
|
---|
94 |
|
---|