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

📄 gridcontainer.h

📁 symbian中讲述的一个有关grid的简单例子
💻 H
字号:
/*
* ============================================================================
*  Name     : CGridContainer from CCoeControl, MCoeControlObserver
*  Part of  : MyHello
*  Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/

#ifndef GRIDCONTAINER_H
#define GRIDCONTAINER_H

// INCLUDES
#include <aknview.h>
#include "common.h"
#include <AknGridView.h>	//for CAknGridView

// CLASS DECLARATION
class CAknGrid;
class CAknGridView;


enum TContentType
{
	EContainText = 0x0001,         // contain only text
	EContainGraphic = 0x0002,      // contain only graphic
	EContainBoth = 0x0004          // contain both text and graphic
};

enum TAknExGridGridType
{
	EAknExGridSelectionGrid = 0,    // Show grid as "Selection Grid"
	EAknExGridMarkableGrid         // Show grid as "Markable Grid"
};

/**
*  CGridContainer  container control class.
*  
*/
class CGridContainer : public CCoeControl, MCoeControlObserver
{
public: // Constructors and destructor
	void	AddInfoToList(TInt aIndex, const TDesC& aText);
	/**
	* C++ default constructor.
	*/
	CGridContainer();
	
	/**
	* EPOC default constructor.
	* @param aRect Frame rectangle for container.
	*/
	void ConstructL(const TRect& aRect);
	
	/**
	* Destructor.
	*/
	virtual ~CGridContainer();
	
public: // New functions
        /**
        * Change focussed control using specified command.
        * @param aCommand Command to be used.
	*/
	void FocusTo(TInt aCommand);
	
private: // Functions from base classes
	
		 /**
		 * From CoeControl,SizeChanged.
	*/
	void SizeChanged();
	
	/**
	* From CoeControl,CountComponentControls.
	*/
	TInt CountComponentControls() const;
	
	/**
	* From CCoeControl,ComponentControl.
	* @param aIndex of control
	*/
	CCoeControl* ComponentControl(TInt aIndex) const;
	
	/**
	* From CCoeControl, Draw client rect.
	* @param aRect Frame rectangle for container.
	*/
	void Draw(const TRect& aRect) const;
	
	/**
	* From CCoeControl, Handles key event.
	* @param aKeyEvent The key event.
	* @param aType The type of the event.
	* @return Indicates whether or not the key event was
	*           used by this control.
	*/
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
		TEventCode aType);
	
private:
/**
* From MCoeControlObserver, Handles an event of type aEventType
* @param aControl Pointer to component control
* @param aEventType Event Code
	*/
	void HandleControlEventL(CCoeControl* /*aControl*/,
		TCoeEvent /*aEventType*/);
	
private: //data
	CAknGrid* m_pGrid;

	TBool			iVerticalOrientation;	// params used by SetGridLayoutL()
	TBool			iLeftToRight;
	TBool			iTopToBottom;
	TInt			iNumOfColumns;
	TInt			iNumOfRows;
	TInt			iContentType;
	TSize			iSizeOfItems;
	TInt			iNumOfItems;
	TBool			iInstantsCreated;      // indicate wether the Select or menu grid is using
	
	CAknGridView::TScrollingType iVerticalScrollingType; // Scrolling type
	CAknGridView::TScrollingType iHorizontalScrollingType; 
	
	TAknExGridGridType          m_pGridType;
	TInt						m_nFontWidth;

private:
	void LoadGraphicsL();
	void AddDataL();
	void ApplySelGridGraphicStyleL();
};

#endif // GRIDCONTAINER_H

// End of File

⌨️ 快捷键说明

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