Example #1
0
	bool ModalLayer::removeWidget( const Widget_p& pWidget )
	{
		if( !pWidget || pWidget->parent() != this )
			return false;
	
		if( pWidget == m_baseHook._widget() )
			return removeBaseWidget();
		else
		{
			ModalHook * pHook = (ModalHook *) pWidget->_hook();
			pHook->_requestRender();
			delete pHook;
			_updateKeyboardFocus();
			return true;
		}
	
	}
Example #2
0
void cbDragWidget( const Msg_p& _pMsg, const Object_p& pObject )
{
	Widget_p pWidget = Widget::cast(pObject);
	
	if( _pMsg->type() != WG_MSG_MOUSE_DRAG || !pWidget->parent() )
		return;

	const MouseDragMsg_p pMsg = MouseDragMsg::cast(_pMsg);



	Coord	dragDistance = pMsg->draggedTotal();

	Coord	ofs = dragStartPos + dragDistance;

//	printf( "AccDistance: %d, %d\n", dragDistance.x, dragDistance.y );
	printf( "ofs: %d, %d   start: %d %d   distance: %d, %d\n", ofs.x, ofs.y, dragStartPos.x, dragStartPos.y, dragDistance.x, dragDistance.y );

	FlexHook_p pHook = FlexHook::cast(pWidget->hook());
	pHook->setOfs(dragStartPos+dragDistance);
}