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

📄 wg_message.cpp

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 CPP
字号:
// wg_message.cpp//// CMessage class implementation////// Copyright (c) 2002 Rob Wiskow// rob-dev@boxedchaos.com//// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//#include "wgui_include_config.h"#include "wg_message.h"namespace wGui{CMessage::CMessage(const EMessageType MessageType, const CMessageClient* pDestination, const CMessageClient* pSource) :	m_MessageType(MessageType),	m_pDestination(pDestination),	m_pSource(pSource){}CKeyboardMessage::CKeyboardMessage(const EMessageType MessageType, const CMessageClient* pDestination, const CMessageClient* pSource,		unsigned char ScanCode, SDLMod Modifiers, SDLKey Key, Uint16 Unicode) :	CMessage(MessageType, pDestination, pSource),	ScanCode(ScanCode),	Modifiers(Modifiers),	Key(Key),	Unicode(Unicode){}CMouseMessage::CMouseMessage(const EMessageType MessageType, const CMessageClient* pDestination, const CMessageClient* pSource,		CPoint Point, CPoint Relative, unsigned int Button) :	CMessage(MessageType, pDestination, pSource),	Point(Point),	Relative(Relative),	Button(Button){}unsigned int CMouseMessage::TranslateSDLButton(Uint8 SDLButton){	unsigned int Button = 0;	switch (SDLButton)	{	case SDL_BUTTON_LEFT:		Button = LEFT;		break;	case SDL_BUTTON_RIGHT:		Button = RIGHT;		break;	case SDL_BUTTON_MIDDLE:		Button = MIDDLE;		break;	case SDL_BUTTON_WHEELUP:		Button = WHEELUP;		break;	case SDL_BUTTON_WHEELDOWN:		Button = WHEELDOWN;		break;	}	return Button;}unsigned int CMouseMessage::TranslateSDLButtonState(Uint8 SDLButtonState){	unsigned int Button = 0;	if (SDLButtonState & SDL_BUTTON(1))	{		Button &= LEFT;	}	if (SDLButtonState & SDL_BUTTON(2))	{		Button &= RIGHT;	}	if (SDLButtonState & SDL_BUTTON(3))	{		Button &= MIDDLE;	}	if (SDLButtonState & SDL_BUTTON(4))	{		Button &= WHEELUP;	}	if (SDLButtonState & SDL_BUTTON(5))	{		Button &= WHEELDOWN;	}	return Button;}}

⌨️ 快捷键说明

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