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

📄 slidercontrol.h

📁 RGA: Biowaste Game Example This C++ application demonstrates how to create a 2D mobile game for S60
💻 H
字号:
/*
* ==============================================================================
*  Name        : SliderControl.h
*  Part of     : RGA Game Example
*  Interface   :
*  Description : slider control to modify settings
*  Version     : 1.0
*
*  Copyright (c) 2007-2008 Nokia Corporation.
*  This material, including documentation and any related
*  computer programs, is protected by copyright controlled by
*  Nokia Corporation.
* ==============================================================================
*/

#ifndef __SLIDERCONTROL_H__
#define __SLIDERCONTROL_H__

// from Symbian
#include <e32base.h>
#include <bitstd.h>

// from RGA
#include <graphicscontext.h>
using namespace ngi;


class CSliderControl : public CBase
	{
	public:
		CSliderControl();
		virtual ~CSliderControl();
		
		/**
		 * Draw
		 * Draw slider to given graphics context
		 * @param aContext graphics context to draw to.
		 * @param aPosition position to draw to
		 * @param aSize size of the slider control in pixels
		 */
		virtual void Draw(	IGraphicsContext& aContext,
							const TPoint& aPosition,
							const TSize& aSize);
		
		/**
		 * SetSliderValueSource
		 * @param pointer to value that slider control modifies
		 */
		void SetSliderValueSource(TInt* aValue);
		
		/**
		 * Increase
		 * increase current value by step size
		 * @return current slider value after increasing it.
		 */
		TInt Increase();

		/**
		 * Decrease
		 * decrease current value by step size
		 * @return current slider value after decreasing it.
		 */
		TInt Decrease();
		
		/**
		 * SetValueRange
		 * set value range of the slider control. Default values are 0 and 100
		 * @param aLow lowest value to use in slider
		 * @param aHigh highest value to use in slider
		 */
		void SetValueRange(const TInt aLow, const TInt aHigh);
		
		/**
		 * SetStepSize
		 * @param amount to add or subtract from current value with
		 * 'Increase' and 'Decrease' functions. Default step size is 1
		 */
		void SetStepSize(const TInt aStepSize);
		
		/**
		 * SetColors
		 * set colors to use when rendering slider control.
		 * Color is interpolated across the slider control.
		 * Default values are 0,255,0 (green) and 255,0,0 (red)
		 * @param aLowColor color to use at low end of the slider
		 * @param aHighColor color to use at high end of the slider
		 */
		void SetColors(const TRgb& aLowColor, const TRgb& aHighColor);
		
		/**
		 * CurrentValue
		 * @return current value of the slider control
		 */
		TInt CurrentValue() const;
		
		/**
		 * StepSize
		 * @return amount to add or subtract from current value with
		 * 'Increase' and 'Decrease' functions
		 */
		TInt StepSize() const;
		
	private:
		TInt			iLowLimit;
		TInt			iHighLimit;
		TInt*			iValue;
		TInt			iStepSize;
		
		TRgb			iLowColor;
		TRgb			iHighColor;
	};

#endif	// __SLIDERCONTROL_H__


⌨️ 快捷键说明

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