|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * MsgEditor Frame control |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MSGFRAMECONTROL_H |
|
22 #define MSGFRAMECONTROL_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <coecntrl.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 // ========================================================== |
|
40 |
|
41 /** |
|
42 * CMsgFrameControl is a class for drawing a frame |
|
43 * around the bitmap of CMsgMediaControl |
|
44 */ |
|
45 NONSHARABLE_CLASS( CMsgFrameControl ) : public CCoeControl |
|
46 { |
|
47 public: // Constructor and destructor |
|
48 |
|
49 /** |
|
50 * Symbian constructor |
|
51 * @param aParent parent control |
|
52 */ |
|
53 static CMsgFrameControl* NewL( const CCoeControl& aParent ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CMsgFrameControl(); |
|
59 |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Called when size is changed. |
|
64 * @param aSize New size of the "image" (e.g. icon). |
|
65 */ |
|
66 void SetImageSize( const TSize& aSize ); |
|
67 |
|
68 /** |
|
69 * Size of the frame |
|
70 * @return size |
|
71 */ |
|
72 TSize FrameSize() const; |
|
73 |
|
74 /** |
|
75 * Size of the frame borders i.e. thickness of frame. |
|
76 * The size includes both borders. |
|
77 * @return size |
|
78 */ |
|
79 inline TSize FrameBorderSize() const; |
|
80 |
|
81 /** |
|
82 * To support media control reloading without creating new control |
|
83 */ |
|
84 inline void ResetFrameSize(); |
|
85 |
|
86 protected: // from CCoeControl |
|
87 |
|
88 /** |
|
89 * Draw Control |
|
90 * From CCoeControl |
|
91 */ |
|
92 void Draw( const TRect& aRect ) const; |
|
93 |
|
94 /** |
|
95 * Handles resource change events. |
|
96 * From CCoeControl |
|
97 */ |
|
98 void HandleResourceChange( TInt aType ); |
|
99 |
|
100 private: // Constructors |
|
101 |
|
102 /** |
|
103 * Hidden C++ default constructor. |
|
104 */ |
|
105 CMsgFrameControl(); |
|
106 |
|
107 /** |
|
108 * By default Symbian constructor is private. |
|
109 * @param aParent parent control |
|
110 */ |
|
111 void ConstructL( const CCoeControl& aParent ); |
|
112 |
|
113 /** |
|
114 * Set correct frame size |
|
115 */ |
|
116 void SetFrameSize(); |
|
117 |
|
118 private: //Data |
|
119 |
|
120 TSize iFrameBorderSize; |
|
121 TSize iFrameSize; |
|
122 TBool iImageSizeSet; |
|
123 }; |
|
124 |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // FrameBorderSize |
|
128 // |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 inline TSize CMsgFrameControl::FrameBorderSize() const |
|
132 { |
|
133 return iFrameBorderSize; |
|
134 } |
|
135 |
|
136 |
|
137 // --------------------------------------------------------- |
|
138 // ResetFrameSize |
|
139 // |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 inline void CMsgFrameControl::ResetFrameSize() |
|
143 { |
|
144 iFrameSize.iWidth = 0; |
|
145 iFrameSize.iHeight = 0; |
|
146 } |
|
147 |
|
148 #endif // MSGFRAMECONTROL_H |