1 | /* $Id: AbstractDockIconPreview.h 24377 2009-11-05 11:18:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
5 | * Abstract class for the dock icon preview
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | *
|
---|
19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
20 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
21 | * additional information or have any questions.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef ___AbstractVBoxDockIconPreview_h___
|
---|
25 | #define ___AbstractVBoxDockIconPreview_h___
|
---|
26 |
|
---|
27 | /* System includes */
|
---|
28 | #include <ApplicationServices/ApplicationServices.h>
|
---|
29 |
|
---|
30 | /* VBox includes */
|
---|
31 | #include "VBoxUtils-darwin.h"
|
---|
32 |
|
---|
33 | class VBoxConsoleWnd;
|
---|
34 | class VBoxFrameBuffer;
|
---|
35 |
|
---|
36 | class QPixmap;
|
---|
37 |
|
---|
38 | class AbstractDockIconPreview
|
---|
39 | {
|
---|
40 | public:
|
---|
41 | AbstractDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
|
---|
42 | virtual ~AbstractDockIconPreview() {};
|
---|
43 |
|
---|
44 | virtual void updateDockOverlay() = 0;
|
---|
45 | virtual void updateDockPreview (CGImageRef aVMImage) = 0;
|
---|
46 | virtual void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
|
---|
47 |
|
---|
48 | virtual void setOriginalSize (int /* aWidth */, int /* aHeight */) {}
|
---|
49 | };
|
---|
50 |
|
---|
51 | class AbstractDockIconPreviewHelper
|
---|
52 | {
|
---|
53 | public:
|
---|
54 | AbstractDockIconPreviewHelper (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);
|
---|
55 | virtual ~AbstractDockIconPreviewHelper();
|
---|
56 | void initPreviewImages();
|
---|
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 { return ::darwinFlipCGRect (aRect, mDockIconRect); }
|
---|
62 | inline CGRect centerRect (CGRect aRect) const { return ::darwinCenterRectTo (aRect, mDockIconRect); }
|
---|
63 | inline CGRect centerRectTo (CGRect aRect, const CGRect& aToRect) const { return ::darwinCenterRectTo (aRect, aToRect); }
|
---|
64 |
|
---|
65 | /* Private member vars */
|
---|
66 | VBoxConsoleWnd *mMainWnd;
|
---|
67 | const CGRect mDockIconRect;
|
---|
68 |
|
---|
69 | CGImageRef mOverlayImage;
|
---|
70 | CGImageRef mDockMonitor;
|
---|
71 | CGImageRef mDockMonitorGlossy;
|
---|
72 |
|
---|
73 | CGImageRef mStatePaused;
|
---|
74 | CGImageRef mStateSaving;
|
---|
75 | CGImageRef mStateRestoring;
|
---|
76 |
|
---|
77 | CGRect mUpdateRect;
|
---|
78 | CGRect mMonitorRect;
|
---|
79 | };
|
---|
80 |
|
---|
81 | #endif /* ___AbstractVBoxDockIconPreview_h___ */
|
---|
82 |
|
---|