21
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0""
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Implementation for Floating window
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "peninputfloatctrl.h"
|
|
20 |
|
|
21 |
const TInt KDefaultRoundSize = 2;
|
|
22 |
const TInt KDefaultOrdinalPosition = 0;
|
|
23 |
const TInt KDefaultOrdinalPriority = ECoeWinPriorityAlwaysAtFront + 100;
|
|
24 |
// ---------------------------------------------------------------------------
|
|
25 |
// C++ destructor
|
|
26 |
// ---------------------------------------------------------------------------
|
|
27 |
//
|
|
28 |
CPeninputFloatingCtrl::~CPeninputFloatingCtrl()
|
|
29 |
{
|
|
30 |
}
|
|
31 |
|
|
32 |
// ---------------------------------------------------------------------------
|
|
33 |
// Draw this control
|
|
34 |
// ---------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
void CPeninputFloatingCtrl::Draw( const TRect& aRect ) const
|
|
37 |
{
|
|
38 |
CWindowGc& gc = SystemGc();
|
|
39 |
TRect rect = Rect();
|
|
40 |
gc.Clear( rect );
|
|
41 |
|
|
42 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
43 |
gc.SetBrushColor( KRgbGray );
|
|
44 |
gc.SetPenStyle( CGraphicsContext::ESolidPen );
|
|
45 |
gc.SetPenColor( KRgbBlack );
|
|
46 |
gc.DrawRoundRect( rect, TSize( KDefaultRoundSize, KDefaultRoundSize ) );
|
|
47 |
}
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
// Show this floating control
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
void CPeninputFloatingCtrl::Show( const TRect& aRect )
|
|
54 |
{
|
|
55 |
Show( aRect, KDefaultOrdinalPosition, KDefaultOrdinalPriority );
|
|
56 |
}
|
|
57 |
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
// Show this floating control
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
void CPeninputFloatingCtrl::Show( const TRect& aRect, TInt aOrdinalPos,
|
|
63 |
TInt aOrdinalPriority )
|
|
64 |
{
|
|
65 |
SetRect( aRect );
|
|
66 |
DrawableWindow()->SetOrdinalPosition( aOrdinalPos, aOrdinalPriority );
|
|
67 |
MakeVisible( ETrue );
|
|
68 |
}
|
|
69 |
// ---------------------------------------------------------------------------
|
|
70 |
// Hide this floating control
|
|
71 |
// ---------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
void CPeninputFloatingCtrl::Hide()
|
|
74 |
{
|
|
75 |
MakeVisible( EFalse );
|
|
76 |
}
|
|
77 |
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
// Test if transparency is supported by this control
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
TBool CPeninputFloatingCtrl::SupportTransparent() const
|
|
83 |
{
|
|
84 |
return iSupportTransparent;
|
|
85 |
}
|
|
86 |
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
// Symbian constructor
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
void CPeninputFloatingCtrl::BaseConstructL()
|
|
92 |
{
|
|
93 |
RWindowGroup& wg = CCoeEnv::Static()->RootWin();
|
|
94 |
CreateWindowL( wg );
|
|
95 |
SetComponentsToInheritVisibility();
|
|
96 |
Window().SetRequiredDisplayMode( EColor16MA );
|
|
97 |
TInt err = Window().SetTransparencyAlphaChannel();
|
|
98 |
iSupportTransparent = ( KErrNone == err );
|
|
99 |
MakeVisible( EFalse );
|
|
100 |
ActivateL();
|
|
101 |
}
|
|
102 |
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
// C++ constructor
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
CPeninputFloatingCtrl::CPeninputFloatingCtrl()
|
|
108 |
{
|
|
109 |
// No implementation required
|
|
110 |
}
|
|
111 |
|