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

📄 gameobjectscrollbar.h

📁 游戏框架
💻 H
字号:
// ***************************************************************
//  GameObjectScrollBar   version:  1.0
//  -------------------------------------------------------------
//	File Name:	GameObjectScrollBar.h
//	Created:	2007/08/15
//	Modified:	2007/08/15   14:19
//	Author:		Randy
//  Msn:		Spark0803@hotmail.com
//  Email:		Spark0803@hotmail.com
//	Description:
//
//	Purpose:	
//  -------------------------------------------------------------
//  license:
//
//  The contents of this file are subject to the Mozilla Public
//  License Version 1.1 (the "License"); you may not use this file
//  except in compliance with the License. You may obtain a copy
//  of the License at  http://www.mozilla.org/MPL/ Software dis-
//  tributed under the License is distributed on an "AS IS" 
//  basis, WITHOUT WARRANTY OF ANY KIND, either express or im-
//  plied. See the License for the specific language governing
//  rights and limitations under the License.
//
//  The Initial Developer of the Original Code is William.Liang .
//  Copyright (C) 2007 - All Rights Reserved.
// ***************************************************************
#ifndef GAME_OBJECT_SCROLLBAR_HEAD_FILE
#define GAME_OBJECT_SCROLLBAR_HEAD_FILE

#pragma once

#include "ObjectCom.h"
#include "GameGroup.h"
#include "GameObjectButton.h"
#include "GameObjectGraph.h"

typedef enum enScrollbarType{
	Scrollbar_VScroll,
	Scrollbar_HScroll,
};

//***************************************************************
//	滑动条对象。提供简单的滑动条质性功能。
//***************************************************************
class OBJECT_COM_CLASS CGameObjectScrollBar :
	  public IGameObjectScrollBar ,public CGameGroup 
{
private:
	_SIZE				m_siInterval;				//间距
protected:
	CResource*			m_pResource;				//图片资源
	CResource*			m_pLuResource;				//分离图片资源左上
	CResource*			m_pRDResource;				//分离图片资源右下
	CResource*			m_pSResource;				//分离图片资源拖动 
	_SIZE				m_siSize;					//大小
	WORD				m_wLength;					//长度
	WORD				m_wCurrent;					//当前值
	WORD				m_wMax;						//最大值
	WORD				m_wMin;						//最小值
	WORD				m_wScrollType;				//滑动类型
	WORD				m_wStep;					//步长值
	CGameObjectButton   m_obgLeftUp;				//左上按钮
	CGameObjectButton   m_obgRightDown;				//右下按钮
	CGameObjectButton   m_obgScroll;				//滑动按钮
	CGameObjectGraph	m_GOGraph;					//内置底纹对象
	bool				m_bDropping;				//是否拖动中

private:
	//计算间隔
	void CalcInterval();

	//调整当前值
	bool Increase(_POINT pPoint);
public:
	CGameObjectScrollBar(void);
	virtual ~CGameObjectScrollBar(void);

	//公共相关方法
public:
	//对象创建
	virtual bool __cdecl Create(LPCTSTR lpName, _SIZE siSize, CResource* pResource, _RECT rcLURes,_RECT rcRDRes,_RECT rcSRes, WORD wScrollType=Scrollbar_VScroll,WORD wMax=1, WORD wMin=0, WORD wStep=1);
	//对象创建
	virtual bool __cdecl Create(LPCTSTR lpName, _SIZE siSize, CResource* pLUResource, _SIZE siLURes,CResource* pRDResource,_SIZE siRDRes,CResource* pSResource,_SIZE siSRes, WORD wScrollType=Scrollbar_VScroll,WORD wMax=1, WORD wMin=0, WORD wStep=1);
	//重获焦点
	virtual void __cdecl FocusGain();
	//渲染对象
	virtual void __cdecl Render(WPARAM wParam=NULL);
public:
	//返回当前值
	virtual WORD __cdecl GetCurrent();
	//返回最大值
	virtual WORD __cdecl GetMax();
	//返回最小值
	virtual WORD __cdecl GetMin();
	//返回滑动类型
	virtual WORD __cdecl GetSliderType();
	//返回步长值
	virtual WORD __cdecl GetStep();
	//设置当前值
	virtual void __cdecl SetCurrent(WORD wCurrent);
	//设置最大值
	virtual void __cdecl SetMax(WORD wMax);
	//设置最小值
	virtual void __cdecl SetMin(WORD wMin);
	//设置滑动类型
	virtual void __cdecl SetScrollBarType(WORD wType);
	//设置步长值
	virtual void __cdecl SetStep(WORD wStep);
	//设置ScrollBar的区域
	virtual void __cdecl SetScrollBarRect(_SIZE siSize);

	//模板方法
public:
	//是否有效
	virtual bool __cdecl IsValid() { return AfxIsValidAddress(this,sizeof(CGameObjectScrollBar))?true:false;};
	//释放对象
	virtual bool __cdecl Release() { if (IsValid()) delete this; return true; };
	//接口查询
	virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer);

public:
	//操作重载
	CGameObjectScrollBar& operator=(CGameObjectScrollBar& GameObject);

	//事件处理
public:
	//鼠标移动
	virtual bool __cdecl OnMouseMove(float x, float y, UINT nComboKey);
	//鼠标点击
	virtual bool __cdecl OnMouseClick(float x, float y, int nType, UINT nMessage, UINT nComboKey);
	//鼠标移出
	virtual bool __cdecl OnMouseOut(float x, float y, int nType, UINT nMessage, UINT nComboKey);
	//键盘事件
	virtual bool __cdecl OnKeyDown(TCHAR nKey, UINT nFlag);
};
#endif

⌨️ 快捷键说明

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