当前位置: 首页>>代码示例>>C++>>正文


C++ CInterfaceManager::getCapturePointerLeft方法代码示例

本文整理汇总了C++中CInterfaceManager::getCapturePointerLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ CInterfaceManager::getCapturePointerLeft方法的具体用法?C++ CInterfaceManager::getCapturePointerLeft怎么用?C++ CInterfaceManager::getCapturePointerLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CInterfaceManager的用法示例。


在下文中一共展示了CInterfaceManager::getCapturePointerLeft方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleEvent

// ***************************************************************************
bool CCtrlBase::handleEvent(const CEventDescriptor &event)
{
	if (event.getType() == CEventDescriptor::system)
	{
		CEventDescriptorSystem &eds = (CEventDescriptorSystem&)event;
		if (eds.getEventTypeExtended() == CEventDescriptorSystem::activecalledonparent)
		{
			if (!((CEventDescriptorActiveCalledOnParent &) eds).getActive())
			{
				// the mouse capture should be lost when the ctrl is hidden
				CInterfaceManager *manager = CInterfaceManager::getInstance();
				if (manager->getCapturePointerLeft() == this)
				{
					manager->setCapturePointerLeft(NULL);
				}
				if (manager->getCapturePointerRight() == this)
				{
					manager->setCapturePointerRight(NULL);
				}
				// NB : don't call return here because derived class may be interested
				// in handling event more speciffically
			}
		}
	}
	return false;
}
开发者ID:AzyxWare,项目名称:ryzom,代码行数:27,代码来源:ctrl_base.cpp

示例2: release

	void release()
	{
		CInterfaceManager	*im = CInterfaceManager::getInstance();
		if (im->getCapturePointerLeft() == this)
		{
			_Moving = false;
			im->setCapturePointerLeft(NULL);
		}
	}
开发者ID:mixxit,项目名称:solinia,代码行数:9,代码来源:group_header.cpp

示例3: draw

// ***************************************************************************
void CDBGroupListSheet::draw ()
{
    // Drag'N'Drop : display the selected slot bitmap if this slot accept the currently dragged element
    CInterfaceManager *pIM = CInterfaceManager::getInstance();

    if (_CanDrop)
    {
        CGroupContainer *pGC = getContainer();
        if (pGC != NULL) pGC->setHighLighted(false);
    }

    _CanDrop = false;
    if (_CtrlInfo._AHOnCanDrop != NULL)
        if (pIM->getCapturePointerLeft())
        {
            CGroupContainer *pGC = getContainer();
            if (pIM->getCurrentWindowUnder() == pGC)
            {
                if ((pIM->getPointer()->getX() >= _XReal) &&
                        (pIM->getPointer()->getX() < (_XReal + _WReal))&&
                        (pIM->getPointer()->getY() > _YReal) &&
                        (pIM->getPointer()->getY() <= (_YReal+ _HReal)))
                {
                    CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pIM->getCapturePointerLeft());
                    if ((pCSSrc != NULL) && pCSSrc->isDraging())
                    {
                        string params = string("src=") + pCSSrc->getId();
                        if (!_CtrlInfo._AHCanDropParams.empty())
                        {
                            string sTmp = _CtrlInfo._AHCanDropParams;
                            params = sTmp + "|" + params;
                        }
                        pIM->runActionHandler (_CtrlInfo._AHOnCanDrop, this, params);
                    }
                }
            }

            // Set the container highlighted
            if (pGC != NULL) pGC->setHighLighted(_CanDrop);
        }

    CInterfaceGroup::draw();
}
开发者ID:mixxit,项目名称:solinia,代码行数:44,代码来源:dbgroup_list_sheet.cpp

示例4: handleEvent

	bool handleEvent (const CEventDescriptor &event)
	{
		CInterfaceManager	*im = CInterfaceManager::getInstance();
		if (_Parent)
		{
			if (event.getType() == CEventDescriptor::system)
			{
				const CEventDescriptorSystem &eds = (const CEventDescriptorSystem &) event;
				if (eds.getEventTypeExtended() == CEventDescriptorSystem::setfocus)
				{
					const CEventDescriptorSetFocus &edsf = (const CEventDescriptorSetFocus &) eds;
					if (edsf.hasFocus() == false)
					{
						release();
						return CCtrlBase::handleEvent(event);
					}
				}
			}
			if (event.getType() == CEventDescriptor::mouse)
			{
				const CEventDescriptorMouse &eventDesc = (const CEventDescriptorMouse &)event;
				if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown)
				{
					if (!this->isIn(eventDesc.getX(), eventDesc.getY())) return false;
					_TargetGroup = getTargetGroup();
					if (!_TargetGroup) return false;
					im->setCapturePointerLeft(this);
					_Moving = true;
					_OffsetX = _TargetGroup->getW() - eventDesc.getX();
					return true;
				}
				if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup)
				{
					release();
				}
				if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mousemove)
				{
					if (_Moving && im->getCapturePointerLeft() == this)
					{
						if (!_TargetGroup)
						{
							release();
							return false;
						}
						sint32 newW = eventDesc.getX() + _OffsetX;
						// compute width of all header entries but this one
						CGroupHeader *header = dynamic_cast<CGroupHeader *>(getParent()->getParent());
						if (header)
						{
							sint32 w = 0;
							for (uint k = 0; k < header->getNumChildren(); ++k)
							{
								if (header->getChild(k) != _TargetGroup)
								{
									w += header->getChild(k)->getW();
								}
							}
							sint32 excess = w + newW - header->getHeaderMaxSize();
							if (excess)
							{
								// try to diminish the size of all headers starting from the last
								for (sint k = header->getNumChildren() - 1; k >= 0 && excess > 0; --k)
								{
									if (header->getChild(k) == _TargetGroup) break;
									CGroupHeaderEntry *ghe = dynamic_cast<CGroupHeaderEntry *>(header->getChild(k));
									sint32 wGain = std::min(excess, std::max((sint32) 0, ghe->getW() - ghe->getMinSize()));
									if (wGain > 0)
									{
										ghe->setW(ghe->getW() - wGain);
										ghe->invalidateCoords();
										excess -= wGain;
									}
								}
							}
							newW -= std::max((sint32) 0, excess);
						}
						_TargetGroup->setW(std::max(_WMin, newW));
						_TargetGroup->invalidateCoords();
						CGroupHeaderEntry *ghe = dynamic_cast<CGroupHeaderEntry *>((CInterfaceGroup *) _TargetGroup);
						if (ghe)
						{
							ghe->setW(_TargetGroup->getW());
							ghe->invalidateCoords();
							im->runActionHandler(ghe->getAHOnResize(), ghe, ghe->getAHOnResizeParams());
						}
						return true;
					}
					_Moving = false;
				}
			}
		}
		return CCtrlBase::handleEvent(event);
	}
开发者ID:mixxit,项目名称:solinia,代码行数:93,代码来源:group_header.cpp

示例5: draw

// --------------------------------------------------------------------------------------------------------------------
void CViewPointer::draw ()
{
	// Do not display the pointer if not visible.
	if(!_PointerVisible)
		return;

	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = pIM->getViewRenderer();

	if (pIM->isInGame())
	if (!_StringCursor)
	{
		// Create the string cursor instance
		std::vector<std::pair<std::string,std::string> > templateParams;
		templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor"));

		_StringCursor = pIM->createGroupInstance("string_cursor", "", templateParams);
		if (_StringCursor)
			_StringCursor->setParentPos(pIM->getElementFromId("ui:interface"));

		templateParams.clear();
		templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor_hardware"));
		_StringCursorHardware = pIM->createGroupInstance("string_cursor_hardware", "", templateParams);
		if (_StringCursorHardware)
			_StringCursorHardware->setParentPos(pIM->getElementFromId("ui:interface"));
	}

	CRGBA col;
	if(getModulateGlobalColor())
		col.modulateFromColor (_Color, pIM->getGlobalColor());
	else
		col= _Color;

	//col.A = (uint8)(((sint32)col.A*((sint32)pIM->getGlobalColor().A+1))>>8);
	col.A = _Color.A;

	if (_LastHightLight != NULL)
	{
		_LastHightLight->setHighLighted(false,0);
		_LastHightLight = NULL;
	}

	if (pIM->getCapturePointerLeft() != NULL && pIM->isMouseHandlingEnabled())
	{
		CCtrlMover *pCM = dynamic_cast<CCtrlMover*>(pIM->getCapturePointerLeft());
		if ((pCM != NULL) && (pCM->canMove() == true))
		{
			CGroupContainer *pGC = dynamic_cast<CGroupContainer *>(pCM->getParent());
			if (pGC != NULL && !pGC->isLocked())
			{
				pGC->setHighLighted(true, 255);
				_LastHightLight = pGC;
			}
		}
	}

	if (_TxIdDefault == -2)
	{
		_TxIdDefault	= rVR.getTextureIdFromName (_TxDefault);
		_TxIdMoveWindow = rVR.getTextureIdFromName (_TxMoveWindow);
		_TxIdResizeBRTL = rVR.getTextureIdFromName (_TxResizeBRTL);
		_TxIdResizeBLTR = rVR.getTextureIdFromName (_TxResizeBLTR);
		_TxIdResizeTB	= rVR.getTextureIdFromName (_TxResizeTB);
		_TxIdResizeLR	= rVR.getTextureIdFromName (_TxResizeLR);
		_TxIdRotate		= rVR.getTextureIdFromName (_TxRotate);
		_TxIdScale		= rVR.getTextureIdFromName (_TxScale);
		_TxIdColPick	= rVR.getTextureIdFromName (_TxColPick);
		_TxIdPan		= rVR.getTextureIdFromName (_TxPan);
		_TxIdCanPan		= rVR.getTextureIdFromName (_TxCanPan);
		if (ClientCfg.R2EDEnabled)
		{
			_TxIdPanR2		= rVR.getTextureIdFromName (_TxPanR2);
			_TxIdCanPanR2	= rVR.getTextureIdFromName (_TxCanPanR2);
		}
	}

	const vector<CCtrlBase *> &rICL = pIM->getCtrlsUnderPointer ();


	// Draw the captured cursor
	CCtrlBase *pCB = pIM->getCapturePointerLeft();
	if (pCB != NULL)
	{
		if (drawResizer(pCB,col)) return;
		//if (drawMover(pCB,col)) return;
		if (drawColorPicker(pCB,col)) return;
		if (drawRotate(pCB,col)) return;
		if (drawPan(pCB,col)) return;
		if (drawCustom(pCB)) return;
		drawCursor(_TxIdDefault, col, 0);
		return;
	}

	const vector<CViewBase *> &vUP = pIM->getViewsUnderPointer ();

	for(uint i=0;i<vUP.size();i++)
	{
		CViewLink *vLink = dynamic_cast<CViewLink*>(vUP[i]);
		if (vLink != NULL)
//.........这里部分代码省略.........
开发者ID:AzyxWare,项目名称:ryzom,代码行数:101,代码来源:view_pointer.cpp

示例6: operator

// ***************************************************************************
void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
{
	HandleSystemCursorCapture(event);

	if (event == EventDisplayChangeId)
	{
	}

	// Process message to InterfaceManager
	CInterfaceManager *pIM = CInterfaceManager::getInstance();

	if (event==EventSetFocusId)
	{
		CEventSetFocus *pEvent=(CEventSetFocus *)&event;
		if (!pEvent->Get)
		{
			// Deactivate all keys
			_MouseButtonsDown = noButton;
			_MouseButtonsReleased = noButton;
			_MouseButtonsState = noButton;
			_Focus = false;

			if (!_SkipInterfaceManager)
			{
				// if there was some control capturing the mouse, warn them that they lost the focus
				if (pIM->getCapturePointerLeft())
				{
					pIM->getCapturePointerLeft()->handleEvent(CEventDescriptorSetFocus(pEvent->Get));
				}
				pIM->setCapturePointerLeft(NULL);
				if (pIM->getCapturePointerRight())
				{
					pIM->getCapturePointerRight()->handleEvent(CEventDescriptorSetFocus(pEvent->Get));
				}
				pIM->setCapturePointerRight(NULL);
				UserControls.stopFreeLook();
			}
			// be nice with other app : let the mouse reappear (useful in direct 3D mode with no hardware cursor)
			Driver->showCursor(true);
//			Driver->setSystemArrow();
		}
		else
		{
			_RecoverFocusLost = true; // force to update mouse pos on next click or move
			Driver->showCursor(IsMouseCursorHardware());
			_Focus = true;
		}

		if(!_SkipInterfaceManager)
		{
			//
			if (R2::getEditor().isInitialized()
					&& (ClientCfg.R2EDEnabled || R2::getEditor().getCurrentTool())
				   )
			{
				R2::getEditor().handleEvent(CEventDescriptorSetFocus(pEvent->Get));
			}
		}

		// re-post
		FilteredEventServer.postEvent( event.clone() );
	}

	// If want to skip the interface Manager
	if(_SkipInterfaceManager)
	{
		// redirect to FilteredEventServer
		FilteredEventServer.postEvent( event.clone() );
		/*	Invalidate Actions managers by simulate keyUp on all. Else can have this scenario:
			- keyDown ("forward" action valide) before teleporting
			- keyUp while teleporting (=> _SkipInterfaceManager==true)
			- action still valide when teleported
		*/
		EditActions.releaseAllKeyNoRunning();
		Actions.releaseAllKeyNoRunning();
		return;
	}


	// **** Event Focus

	// **** Event Keyboard
	if( event == EventKeyDownId ||
			 event == EventKeyUpId ||
			 event == EventCharId ||
			 event == EventStringId)
	{
		// if not handled, post to Action Manager
		if( !pIM->handleEvent( CEventDescriptorKey((const CEventKey &) event) ) )
		{
			// See if handled by editor
			bool handled = false;
			if (R2::getEditor().isInitialized()
			    && (ClientCfg.R2EDEnabled || R2::getEditor().getCurrentTool())
			   )
			{
				handled = R2::getEditor().handleEvent(CEventDescriptorKey((const CEventKey &) event) );
			}
			if (!handled)
//.........这里部分代码省略.........
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:101,代码来源:input_handler_manager.cpp


注:本文中的CInterfaceManager::getCapturePointerLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。