12
|
1 |
/*
|
|
2 |
============================================================================
|
|
3 |
Name : CImageLabel.h
|
|
4 |
Author :
|
|
5 |
Version : 1.0
|
|
6 |
Copyright : Your copyright notice
|
|
7 |
Description : CImageLabel declaration
|
|
8 |
============================================================================
|
|
9 |
*/
|
|
10 |
|
|
11 |
#ifndef IMAGELABEL_H
|
|
12 |
#define IMAGELABEL_H
|
|
13 |
|
|
14 |
// INCLUDES
|
|
15 |
#include <e32std.h>
|
|
16 |
#include <e32base.h>
|
|
17 |
#include <COECNTRL.H>
|
|
18 |
#include "MCountTime.h"
|
|
19 |
|
|
20 |
class CFbsBitmap;
|
|
21 |
class CTimeAO;
|
|
22 |
|
|
23 |
|
|
24 |
class MHandlePointerObserver
|
|
25 |
{
|
|
26 |
public:
|
|
27 |
virtual void HandlePointerNotify(CCoeControl* aComponent) = 0;
|
|
28 |
virtual ~MHandlePointerObserver() {}
|
|
29 |
protected:
|
|
30 |
MHandlePointerObserver(){}
|
|
31 |
};
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
// CLASS DECLARATION
|
|
36 |
|
|
37 |
/**
|
|
38 |
* CCImageLabel
|
|
39 |
*
|
|
40 |
*/
|
|
41 |
class CImageLabel : public CCoeControl, MCountTime
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
enum LABEL_STATE
|
|
45 |
{
|
|
46 |
ENone, ESelected, ESelectedWithTooltip,EMoving
|
|
47 |
};
|
|
48 |
enum TOOLTIP_LAYOUT
|
|
49 |
{
|
|
50 |
ELabelHorizontal, ELabelVertical
|
|
51 |
};
|
|
52 |
public:
|
|
53 |
// Constructors and destructor
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Destructor.
|
|
57 |
*/
|
|
58 |
~CImageLabel();
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Two-phased constructor.
|
|
62 |
*/
|
|
63 |
static CImageLabel* NewL(CCoeControl *aParent, const TRect& aRect, TOOLTIP_LAYOUT aLabelLayout);
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Two-phased constructor.
|
|
67 |
*/
|
|
68 |
static CImageLabel* NewLC(CCoeControl *aParent, const TRect& aRect, TOOLTIP_LAYOUT aLabelLayout);
|
|
69 |
|
|
70 |
public:
|
|
71 |
/**
|
|
72 |
* From CCoeControl
|
|
73 |
*/
|
|
74 |
virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
|
75 |
|
|
76 |
/**
|
|
77 |
* From CCoeControl
|
|
78 |
*/
|
|
79 |
virtual void SizeChanged();
|
|
80 |
|
|
81 |
/**
|
|
82 |
* From CCoeControl
|
|
83 |
*/
|
|
84 |
virtual void Draw(const TRect& aRect) const;
|
|
85 |
|
|
86 |
virtual void Notify();
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Self-define
|
|
90 |
*/
|
|
91 |
void SetImage(const TDesC& aMbmPackage, TInt aIndex);
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Self-define
|
|
95 |
*/
|
|
96 |
void SetTooltip(const TDesC& aTooltip);
|
|
97 |
|
|
98 |
void ResetControl();
|
|
99 |
|
|
100 |
void LabelIsMoving();
|
|
101 |
|
|
102 |
void SetHandlePointerObserver(MHandlePointerObserver* aHandlePointerObserver);
|
|
103 |
|
|
104 |
private:
|
|
105 |
/**
|
|
106 |
* Constructor for performing 1st stage construction
|
|
107 |
*/
|
|
108 |
CImageLabel();
|
|
109 |
|
|
110 |
/**
|
|
111 |
* EPOC default constructor for performing 2nd stage construction
|
|
112 |
*/
|
|
113 |
void ConstructL(CCoeControl *aParent, const TRect& aRect, TOOLTIP_LAYOUT aLabelLayout);
|
|
114 |
|
|
115 |
void CalculateImagePoint();
|
|
116 |
void CalculateBoundingRectStartPoint();
|
|
117 |
void CalculateTooltipPoint();
|
|
118 |
void CalculateZones();
|
|
119 |
|
|
120 |
private:
|
|
121 |
LABEL_STATE iState;
|
|
122 |
TOOLTIP_LAYOUT iLabelLayout;
|
|
123 |
|
|
124 |
TBuf<20> iTooltip;
|
|
125 |
TPoint iTooltipStartPoint;
|
|
126 |
TPoint iImageStartPoint;
|
|
127 |
TPoint iBoundingRectStartPoint;
|
|
128 |
|
|
129 |
TSize iImageSize;
|
|
130 |
TSize iBoundingSize;
|
|
131 |
|
|
132 |
CFbsBitmap* iBitmap;
|
|
133 |
CFbsBitmap* iBitmapMask;
|
|
134 |
|
|
135 |
CTimeAO* iTimeAO;
|
|
136 |
MHandlePointerObserver* iHandlePointerObserver;
|
|
137 |
TBool iIsHandlePointerNotifyProcessing;
|
|
138 |
};
|
|
139 |
|
|
140 |
#endif // CIMAGELABEL_H
|