0
|
1 |
/**
|
|
2 |
* ====================================================================
|
|
3 |
* topwindow.h
|
|
4 |
*
|
|
5 |
* Copyright (c) 2006 Nokia Corporation
|
|
6 |
*
|
|
7 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8 |
* you may not use this file except in compliance with the License.
|
|
9 |
* You may obtain a copy of the License at
|
|
10 |
*
|
|
11 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12 |
*
|
|
13 |
* Unless required by applicable law or agreed to in writing, software
|
|
14 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16 |
* See the License for the specific language governing permissions and
|
|
17 |
* limitations under the License.
|
|
18 |
* ====================================================================
|
|
19 |
*/
|
|
20 |
|
|
21 |
#include "Python.h"
|
|
22 |
#include "symbian_python_ext_util.h"
|
|
23 |
|
|
24 |
#include<coecntrl.h>
|
|
25 |
|
|
26 |
|
|
27 |
// white non-transparent background.
|
|
28 |
#define DEFAULT_BG_COLOR 0xffffffff
|
|
29 |
|
|
30 |
|
|
31 |
/*
|
|
32 |
* Helper class for storing images.
|
|
33 |
*/
|
|
34 |
#ifndef EKA2
|
|
35 |
class CImageData : public CBase
|
|
36 |
#else
|
|
37 |
NONSHARABLE_CLASS(CImageData) : public CBase
|
|
38 |
#endif
|
|
39 |
{
|
|
40 |
private:
|
|
41 |
TRect iRect;
|
|
42 |
PyObject* iImageObj;
|
|
43 |
CFbsBitmap* iBitmap;
|
|
44 |
public:
|
|
45 |
static CImageData* NewL(PyObject* aImageObj, TRect& aRect);
|
|
46 |
CImageData(PyObject* aImageObj, TRect& aRect);
|
|
47 |
virtual ~CImageData();
|
|
48 |
// Draw the image if the drawArea and iRect intersect.
|
|
49 |
void Draw(CWindowGc* aGc, TRect& aDrawArea);
|
|
50 |
TRect Rect();
|
|
51 |
};
|
|
52 |
|
|
53 |
|
|
54 |
#ifndef EKA2
|
|
55 |
class CTopWindow : public CActive
|
|
56 |
#else
|
|
57 |
NONSHARABLE_CLASS(CTopWindow) : public CActive
|
|
58 |
#endif
|
|
59 |
{
|
|
60 |
public:
|
|
61 |
virtual ~CTopWindow();
|
|
62 |
static CTopWindow* NewL();
|
|
63 |
void ShowL();
|
|
64 |
void HideL();
|
|
65 |
void SetSize(TSize& aSize);
|
|
66 |
TSize Size();
|
|
67 |
TSize MaxSize();
|
|
68 |
void SetPosition(TPoint& aPos);
|
|
69 |
TUint PutImageL(PyObject* aBitmapObj, TRect& aRect);
|
|
70 |
TInt RemoveImage(TUint aKey);
|
|
71 |
void SetCornerType(TInt aCornerType);
|
|
72 |
void SetShadow(TInt aShadow);
|
|
73 |
void SetBgColor(TRgb& aRgb);
|
|
74 |
void SetFocus(TBool aFocus);
|
|
75 |
void SetFading(TInt aFading);
|
|
76 |
void RunL();
|
|
77 |
void DoCancel();
|
|
78 |
void Start();
|
|
79 |
void Flush(); // Sends all pending commands in the buffer to the window server.
|
|
80 |
// Normally this is not needed.
|
|
81 |
void DoRedraw(); // Causes the window to get a redraw message.
|
|
82 |
void DoRedraw(TRect& aRect); // Causes the window to get a redraw message
|
|
83 |
// concerning the specified area.
|
|
84 |
|
|
85 |
|
|
86 |
RWindow* RWindowPtr();
|
|
87 |
RWsSession* RWsSessionPtr();
|
|
88 |
RWindowGroup* RWindowGroupPtr();
|
|
89 |
CWsScreenDevice* ScreenDevicePtr();
|
|
90 |
private:
|
|
91 |
void Redraw(TWsRedrawEvent* aRedrawEvent=NULL);
|
|
92 |
void ConstructL();
|
|
93 |
CTopWindow();
|
|
94 |
RWsSession* iSession;
|
|
95 |
RWindowGroup* iWinGroup;
|
|
96 |
RWindow* iWindow;
|
|
97 |
CWsScreenDevice* iScrDevice;
|
|
98 |
CWindowGc* iGc;
|
|
99 |
TWsRedrawEvent iRedrawEvent;
|
|
100 |
RPointerArray<CImageData> iImages;
|
|
101 |
};
|
|
102 |
|