⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controlbase.h

📁 a Animation control of symbian
💻 H
字号:
#ifndef CONTROLBASE_H_
#define CONTROLBASE_H_

#include <COECNTRL.H>
#include <e32base.h>
#include <GULICON.H>
#include <W32STD.H>
#include <GDI.H>
#include <FBS.H>
#include <BITSTD.H>
#include <BITDEV.H>

/*
class COggControl;
class MOggControlObserver
	{
public:
	virtual void OggPointerEvent(COggControl* c, const TPointerEvent& p) = 0;
	virtual void OggControlEvent(COggControl* c, TInt aEventType, TInt aValue) = 0;
	virtual void AddControlToFocusList(COggControl* c) = 0;
	};
*/

// COggControl:
// Abstract base type for objects displayed on a COggCanvas
class COggControl : public CBase
	{
public:
	COggControl();
	COggControl(TBool aHighFrequency);
	~COggControl();

	virtual void SetPosition(TInt ax, TInt ay, TInt aw, TInt ah);
//	void SetObserver(MOggControlObserver* obs);

	virtual void MakeVisible(TBool isVisible);
	TBool IsVisible();

	void SetDimmed(TBool aDimmed);
	TBool IsDimmed();

	void SetFocus(TBool aFocus);
	TBool Focus();

//	virtual void PointerEvent(const TPointerEvent& p);
//	virtual void ControlEvent(TInt anEventType, TInt aValue);

	virtual void Redraw(TBool doRedraw = ETrue);
	virtual void SetFocusIcon(CGulIcon* anIcon);

	TRect Rect();
	TSize Size();

	virtual void  SetBitmapFile(const TDesC& aBitmapFile);
//	virtual TBool Read(TOggParser& p);

	TBool HighFrequency();

public:
	TInt ix;
	TInt iy;
	TInt iw;
	TInt ih;

	CGulIcon* iFocusIcon;
	TDblQueLink iDlink;

protected:
	// These must be overriden to create specific behaviour
	virtual void Cycle();
	virtual void Draw(CBitmapContext& aBitmapContext) = 0;

	virtual void DrawFocus(CBitmapContext& aBitmapContext);
	void DrawCenteredIcon(CBitmapContext& aBitmapContext, CGulIcon* anIcon);

	// Utility functions
//	virtual TBool ReadArguments(TOggParser& p);

	TBool iRedraw;       // if true: something has changed with the control and the control needs to be redrawn
	TInt iCycle;         // frame nmber of an animation etc. (1 cycle = 10ms)
	TBool iVisible;      // if false the control will not be drawn
	TBool iDimmed;       // if false the control is disabled and rejects pointer and keyboard focus events
	TBool iAcceptsFocus; // if true the control can accept keyboard focus, else it's never focussed.
	TBool iFocus;        // if true, control has focus.

	CFbsBitmap* iOverlayMask;
//	MOggControlObserver* iObserver;
	TFileName iBitmapFile;
	TBool iHighFrequency;

	friend class COggCanvas;
	};
	
	
// COggCanvas
// A canvas that can display and manage several COggControls 
// and which uses an off-screen bitmap for double buffering
class COggCanvas : public CCoeControl
	{
	 public:
	  COggCanvas();
	  ~COggCanvas();
	  void LoadBackgroundBitmapL(const TDesC& aFileName, TInt iIdx);

	  void Refresh();
	  void RefreshList();
	  void Invalidate();

	  void DrawControl();  // redraw the off screen bitmap
	  void IsExit();
	  void NoExit();
	  // Modify/add/clear controls: 
	  COggControl* GetControl(TInt i);
	  void AddControl(COggControl* c);
	  void ClearControls();

	  void CycleHighFrequencyControls();
	  void CycleLowFrequencyControls();

	 protected:
	  // from CCoeControl:
//	  void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	  TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);

	  void DrawControl(CBitmapContext& aBitmapContext, CBitmapDevice& aBitmapDevice) const;

	  void DestroyBitmap();
	  void CreateBitmapL(const TSize& aSize);
	  void Draw(const TRect& aRect) const;

	protected:
	  CFbsBitmap* iBitmap;
	  CFbsBitmapDevice*  iBitmapDevice;
	  CFbsBitGc* iBitmapContext;

	  CFbsBitmap* iOverlayMaskBitmap;
	  CFbsBitmapDevice*  iOverlayMaskDevice;
	  CFbsBitGc* iOverlayMaskContext;

	  CFbsBitmap* iBackground;
	  TBool       iSExit;
	  
	  CArrayPtrFlat<COggControl> iControls;

	  COggControl*       iGrabbed; // a control gets grabbed on a pointer button down event
	  COggControl*       iFocused; // control that has input focus (UIQ does not need this)
	};

#endif /*CONTROLBASE_H_*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -