|
1 /* |
|
2 * Copyright (c) 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: CMnrpMapControl class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MNRP_MAPCONTROL_H |
|
20 #define MNRP_MAPCONTROL_H |
|
21 |
|
22 #include <coecntrl.h> |
|
23 #include "mnrpmapmodel.h" |
|
24 |
|
25 class CMnrpEngine; |
|
26 class CMnrpMapView; |
|
27 |
|
28 /** Map view. Draws map on screen using information from |
|
29 CMnrpMapModel. |
|
30 */ |
|
31 class CMnrpMapControl : public CCoeControl, public MMapModelObserver |
|
32 { |
|
33 public: |
|
34 |
|
35 static CMnrpMapControl* NewL( CMnrpMapView& aView, const TRect& aRect, CMnrpEngine& aEngine ); |
|
36 virtual ~CMnrpMapControl(); |
|
37 |
|
38 void UpdateModelL( CMnrpMapViewService& aService ); |
|
39 void SetSelectionModeL( TBool aSelectionMode ); |
|
40 |
|
41 /** Returns current cursor location in selection mode */ |
|
42 TCoordinate CurrentLocation(); |
|
43 |
|
44 void ToggleFullScreen(); |
|
45 |
|
46 public: // from CCoeControl |
|
47 |
|
48 void Draw( const TRect& aRect ) const; |
|
49 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
50 void SizeChanged(); |
|
51 void HandleResourceChange( TInt aType ); |
|
52 |
|
53 public: // from MMapModelObserver |
|
54 |
|
55 /** Redraws itself when model is updated */ |
|
56 void HandleModelUpdateL(); |
|
57 |
|
58 private: |
|
59 |
|
60 CMnrpMapControl( CMnrpMapView& aView ); |
|
61 void ConstructL( const TRect& aRect, CMnrpEngine& aEngine ); |
|
62 |
|
63 void DrawCursor( CWindowGc& aGc ) const; |
|
64 |
|
65 /** Draws text around map |
|
66 * Top area - left longitude, cell size, right longitude |
|
67 * Left area - top latitude, bottom latitude |
|
68 * Bottom area - center coordinates |
|
69 */ |
|
70 void DrawGridText( |
|
71 CWindowGc& aGc, |
|
72 const TRect& aInnerBox, |
|
73 const TRect& aOuterBox, |
|
74 const CFont* aFont, |
|
75 CMnrpMapModel::TGrid& aGrid ) const; |
|
76 |
|
77 /** Helper to find out border size based on font dimensions */ |
|
78 TSize BorderSize() const; |
|
79 |
|
80 /** Returns specifications of used font */ |
|
81 TFontSpec SmallFontSpec( TInt aFontHeightInTwips ) const; |
|
82 |
|
83 void MoveCursor( TInt aXmove, TInt aYmove ); |
|
84 TRect CursorMargin(); |
|
85 |
|
86 void Zoom( TReal aRate ); |
|
87 |
|
88 void SetFullScreen( TBool aFullScreen ); |
|
89 |
|
90 void CreateFonts(); |
|
91 void DestroyFonts(); |
|
92 |
|
93 void CreateScreenBufferL( const TSize& aSize ); |
|
94 void RenderL(); |
|
95 |
|
96 private: |
|
97 /** Parent view */ |
|
98 CMnrpMapView& iView; |
|
99 |
|
100 /** Model */ |
|
101 CMnrpMapModel* iModel; |
|
102 TSize iViewSize; |
|
103 |
|
104 TBool iSelectionMode; |
|
105 TPoint iCursor; |
|
106 TCoordinate iAbsoluteCursor; |
|
107 |
|
108 /** Whether fullscreen mode on or off*/ |
|
109 TBool iIsFullScreen; |
|
110 |
|
111 mutable CFbsBitmap* iOffScreenBitmap; |
|
112 CFont* iTextFont; |
|
113 CFont* iItemFont; |
|
114 }; |
|
115 |
|
116 #endif // MNRP_MAPVIEW_H |
|
117 |