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