Exemple #1
0
bool Widget::TriggerTextInput(const TextInputEvent &event, bool emit)
{
	HandleTextInput(event);
	if (emit) emit = !onTextInput.emit(event);
	if (GetContainer()) GetContainer()->TriggerTextInput(event, emit);
	return !emit;
}
Exemple #2
0
bool Widget::TriggerKeyUp(const KeyboardEvent &event, bool emit)
{
	HandleKeyUp(event);
	if (emit) emit = !onKeyUp.emit(event);
	if (GetContainer()) GetContainer()->TriggerKeyUp(event, emit);
	return !emit;
}
Exemple #3
0
bool Widget::TriggerTextInput(const TextInputEvent &event, bool handled)
{
	HandleTextInput(event);
	if (!handled) handled = onTextInput.emit(event);
	if (GetContainer()) handled = GetContainer()->TriggerTextInput(event, handled);
	return handled;
}
Exemple #4
0
bool Widget::TriggerJoystickHatMove(const JoystickHatMotionEvent &event, bool handled)
{
	HandleJoystickHatMove(event);
	if (!handled) handled = onJoystickHatMove.emit(event);
	if (GetContainer()) handled = GetContainer()->TriggerJoystickHatMove(event, handled);
	return handled;
}
T* HashMapHolder<T>::Find(ObjectGuid guid)
{
    boost::shared_lock<boost::shared_mutex> lock(*GetLock());

    typename MapType::iterator itr = GetContainer().find(guid);
    return (itr != GetContainer().end()) ? itr->second : NULL;
}
Exemple #6
0
    BOOL SComboBase::CalcPopupRect( int nHeight,CRect & rcPopup )
    {
        CRect rcWnd=GetWindowRect();
        GetContainer()->FrameToHost(rcWnd);
        
        ClientToScreen(GetContainer()->GetHostHwnd(),(LPPOINT)&rcWnd);
        ClientToScreen(GetContainer()->GetHostHwnd(),((LPPOINT)&rcWnd)+1);

        HMONITOR hMonitor = ::MonitorFromWindow(GetContainer()->GetHostHwnd(), MONITOR_DEFAULTTONULL);
        CRect rcMonitor;
        if (hMonitor)
        {
            MONITORINFO mi = {sizeof(MONITORINFO)};
            ::GetMonitorInfo(hMonitor, &mi);
            rcMonitor = mi.rcMonitor;
        }
        else
        {
            rcMonitor.right   =   GetSystemMetrics(   SM_CXSCREEN   );   
            rcMonitor.bottom  =   GetSystemMetrics(   SM_CYSCREEN   );
        }
        if(rcWnd.bottom+nHeight<=rcMonitor.bottom)
        {
            rcPopup = CRect(rcWnd.left,rcWnd.bottom,rcWnd.right,rcWnd.bottom+nHeight);
            return TRUE;
        }else
        {
            rcPopup = CRect(rcWnd.left,rcWnd.top-nHeight,rcWnd.right,rcWnd.top);
            return FALSE;
        }
    }
bool UKUIInterfaceElement::IsMouseOver() const
{
	if ( GetInterface() == NULL )
	{
		KUIErrorUO( "Null interface" );
		return false;
	}

	if ( GetContainer() != NULL )
	{
		if ( !GetContainer()->IsMouseOver() )
			return false;
	}

	const FVector2D v2CursorLocation = GetInterface()->GetCursorLocation();
	const FVector2D v2Size = GetSize();
	const FVector2D v2TopLeftLocation = GetScreenLocation();

	if ( v2CursorLocation.X >= v2TopLeftLocation.X &&
		 v2CursorLocation.Y >= v2TopLeftLocation.Y &&
		 v2CursorLocation.X < ( v2TopLeftLocation.X + v2Size.X ) &&
		 v2CursorLocation.Y < ( v2TopLeftLocation.Y + v2Size.Y ) )
		 return true;

	return false;
}
Exemple #8
0
bool Widget::TriggerKeyUp(const KeyboardEvent &event, bool handled)
{
	HandleKeyUp(event);
	if (!handled) handled = onKeyUp.emit(event);
	if (GetContainer()) handled = GetContainer()->TriggerKeyUp(event, handled);
	return handled;
}
Exemple #9
0
bool Widget::TriggerClick(bool handled)
{
	HandleClick();
	if (!handled) handled = onClick.emit();
	if (GetContainer()) handled = GetContainer()->TriggerClick(handled);
	return handled;
}
Exemple #10
0
bool Widget::TriggerJoystickButtonUp(const JoystickButtonEvent &event, bool handled)
{
	HandleJoystickButtonUp(event);
	if (!handled) handled = onJoystickButtonUp.emit(event);
	if (GetContainer()) handled = GetContainer()->TriggerJoystickButtonUp(event, handled);
	return handled;
}
NS_IMETHODIMP
InsertNodeTransaction::DoTransaction()
{
  if (NS_WARN_IF(!mEditorBase) ||
      NS_WARN_IF(!mContentToInsert) ||
      NS_WARN_IF(!mPointToInsert.IsSet())) {
    return NS_ERROR_NOT_INITIALIZED;
  }

  if (!mPointToInsert.IsSetAndValid()) {
    // It seems that DOM tree has been changed after first DoTransaction()
    // and current RedoTranaction() call.
    if (mPointToInsert.GetChild()) {
      EditorDOMPoint newPointToInsert(mPointToInsert.GetChild());
      if (!newPointToInsert.IsSet()) {
        // The insertion point has been removed from the DOM tree.
        // In this case, we should append the node to the container instead.
        newPointToInsert.SetToEndOf(mPointToInsert.GetContainer());
        if (NS_WARN_IF(!newPointToInsert.IsSet())) {
          return NS_ERROR_FAILURE;
        }
      }
      mPointToInsert = newPointToInsert;
    } else {
      mPointToInsert.SetToEndOf(mPointToInsert.GetContainer());
      if (NS_WARN_IF(!mPointToInsert.IsSet())) {
        return NS_ERROR_FAILURE;
      }
    }
  }

  mEditorBase->MarkNodeDirty(GetAsDOMNode(mContentToInsert));

  ErrorResult error;
  mPointToInsert.GetContainer()->InsertBefore(*mContentToInsert,
                                              mPointToInsert.GetChild(),
                                              error);
  error.WouldReportJSException();
  if (NS_WARN_IF(error.Failed())) {
    return error.StealNSResult();
  }

  // Only set selection to insertion point if editor gives permission
  if (mEditorBase->GetShouldTxnSetSelection()) {
    RefPtr<Selection> selection = mEditorBase->GetSelection();
    if (NS_WARN_IF(!selection)) {
      return NS_ERROR_FAILURE;
    }
    // Place the selection just after the inserted element
    EditorRawDOMPoint afterInsertedNode(mContentToInsert);
    DebugOnly<bool> advanced = afterInsertedNode.AdvanceOffset();
    NS_WARNING_ASSERTION(advanced,
      "Failed to advance offset after the inserted node");
    selection->Collapse(afterInsertedNode, error);
    if (NS_WARN_IF(error.Failed())) {
      error.SuppressException();
    }
  }
  return NS_OK;
}
Exemple #12
0
bool Widget::TriggerClick(bool emit)
{
	HandleClick();
	if (emit) emit = !onClick.emit();
	if (GetContainer()) GetContainer()->TriggerClick(emit);
	return !emit;
}
Exemple #13
0
bool Widget::TriggerJoystickHatMove(const JoystickHatMotionEvent &event, bool emit)
{
	HandleJoystickHatMove(event);
	if (emit) emit = !onJoystickHatMove.emit(event);
	if (GetContainer()) GetContainer()->TriggerJoystickHatMove(event, emit);
	return !emit;
}
Exemple #14
0
bool Widget::TriggerJoystickButtonUp(const JoystickButtonEvent &event, bool emit)
{
	HandleJoystickButtonUp(event);
	if (emit) emit = !onJoystickButtonUp.emit(event);
	if (GetContainer()) GetContainer()->TriggerJoystickButtonUp(event, emit);
	return !emit;
}
Exemple #15
0
bool UKUIInterfaceElement::IsVisibleRecursive() const
{
	if ( !IsVisible() )
		return false;

	if ( GetContainer() == NULL )
		return false;

	return GetContainer()->IsVisibleRecursive();
}
Exemple #16
0
bool UKUIInterfaceElement::IsDisabledRecursive() const
{
	if ( IsDisabled() )
		return true;

	if ( GetContainer() == NULL )
		return false;

	return GetContainer()->IsDisabledRecursive();
}
Exemple #17
0
bool Widget::TriggerMouseWheel(const MouseWheelEvent &event, bool emit)
{
	HandleMouseWheel(event);
	if (emit) emit = !onMouseWheel.emit(event);
	if (GetContainer()) {
		MouseWheelEvent translatedEvent = MouseWheelEvent(event.direction, event.pos+GetPosition());
		GetContainer()->TriggerMouseWheel(translatedEvent, emit);
	}
	return !emit;
}
Exemple #18
0
bool Widget::TriggerMouseMove(const MouseMotionEvent &event, bool emit)
{
	HandleMouseMove(event);
	if (emit) emit = !onMouseMove.emit(event);
	if (GetContainer()) {
		MouseMotionEvent translatedEvent = MouseMotionEvent(event.pos+GetPosition(), event.rel);
		GetContainer()->TriggerMouseMove(translatedEvent, emit);
	}
	return !emit;
}
Exemple #19
0
bool Widget::TriggerMouseUp(const MouseButtonEvent &event, bool emit)
{
	HandleMouseUp(event);
	if (emit) emit = !onMouseUp.emit(event);
	if (GetContainer()) {
		MouseButtonEvent translatedEvent = MouseButtonEvent(event.action, event.button, event.pos+GetPosition());
		GetContainer()->TriggerMouseUp(translatedEvent, emit);
	}
	return !emit;
}
Exemple #20
0
bool Widget::TriggerMouseWheel(const MouseWheelEvent &event, bool handled)
{
	HandleMouseWheel(event);
	if (!handled) handled = onMouseWheel.emit(event);
	if (GetContainer()) {
		MouseWheelEvent translatedEvent = MouseWheelEvent(event.direction, event.pos+GetPosition());
		handled = GetContainer()->TriggerMouseWheel(translatedEvent, handled);
	}
	return handled;
}
Exemple #21
0
bool Widget::TriggerMouseMove(const MouseMotionEvent &event, bool handled)
{
	HandleMouseMove(event);
	if (!handled) handled = onMouseMove.emit(event);
	if (GetContainer()) {
		MouseMotionEvent translatedEvent = MouseMotionEvent(event.pos+GetPosition(), event.rel);
		handled = GetContainer()->TriggerMouseMove(translatedEvent, handled);
	}
	return handled;
}
Exemple #22
0
bool Widget::TriggerMouseUp(const MouseButtonEvent &event, bool handled)
{
	HandleMouseUp(event);
	if (!handled) handled = onMouseUp.emit(event);
	if (GetContainer()) {
		MouseButtonEvent translatedEvent = MouseButtonEvent(event.action, event.button, event.pos+GetPosition());
		handled = GetContainer()->TriggerMouseUp(translatedEvent, handled);
	}
	return handled;
}
Exemple #23
0
void CDuiColorPicker::OnLButtonUp( UINT nFlags,CPoint pt )
{
	__super::OnLButtonUp(nFlags,pt);
	CColourPopup *pCrPopup = new CColourPopup(GetContainer()->GetHostHwnd(),this);
	CRect rcWnd;
	GetRect(rcWnd);
	pt.x=rcWnd.left,pt.y=rcWnd.bottom;
	::ClientToScreen(GetContainer()->GetHostHwnd(),&pt);
	pCrPopup->SetDefColor(m_crDef);
	pCrPopup->Create(pt,m_crCur,_T("д╛хо"),_T("╦Э╤Ю"));
}
Exemple #24
0
void SAnimateImgWnd::OnShowWindow( BOOL bShow, UINT nStatus )
{
    __super::OnShowWindow(bShow,nStatus);
    if(!bShow)
    {
        if(IsPlaying()) GetContainer()->UnregisterTimelineHandler(this);
    }else
    {
        if(IsPlaying()) GetContainer()->RegisterTimelineHandler(this);
        else if(m_bAutoStart) Start();
    }
}
Exemple #25
0
bool Widget::TriggerMouseOut(const Point &pos, bool emit, Widget *stop)
{
	// only send external events on state change
	if (m_mouseOver) {
		HandleMouseOut();
		if (emit) emit = !onMouseOut.emit();
		m_mouseOver = false;
	}
	if (stop == this) return !emit;
	if (GetContainer()) GetContainer()->TriggerMouseOut(pos+GetPosition(), emit, stop);
	return !emit;
}
Exemple #26
0
    int SIECtrl::OnCreate( LPVOID )
    {
        int nRet=__super::OnCreate(NULL);
        if(GetContainer()->IsTranslucent())
        {
            STRACE(_T("warning!!! create iectrl failed bacause of host is translucent!"));
//          SASSERT_FMT(FALSE,_T("iectrl can't used in translucent host"));
            return -1;
        }
        GetContainer()->GetMsgLoop()->AddMessageFilter(this);
        return nRet;
    }
Exemple #27
0
bool Widget::TriggerMouseOut(const Point &pos, bool handled, Widget *stop)
{
	// only send external events on state change
	if (m_mouseOver) {
		HandleMouseOut();
		if (!handled) handled = onMouseOut.emit();
		m_mouseOver = false;
	}
	if (stop == this) return handled;
	if (GetContainer()) handled = GetContainer()->TriggerMouseOut(pos+GetPosition(), handled, stop);
	return handled;
}
Exemple #28
0
void UKUIInterfaceElement::SetSize( float fWidth, float fHeight )
{
	for ( int32 i = 0; i < arAlignedToThis.Num(); ++i )
		if ( arAlignedToThis[ i ].IsValid() )
			arAlignedToThis[ i ]->InvalidateAlignLocation();

	if ( GetContainer() != NULL )
	{
		FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_ChildSizeChange, this );
		GetContainer()->SendEvent( stEventInfo );
	}

	InvalidateRenderCache();
}
Exemple #29
0
void UKUIInterfaceElement::SetVerticalAlignment( TEnumAsByte<EKUIInterfaceVAlign::Type> eVAlign )
{
	if ( this->eVAlign == eVAlign )
		return;

	this->eVAlign = eVAlign;

	InvalidateAlignLocation();

	if ( GetContainer() != NULL )
	{
		FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_ChildLocationChange, this );
		GetContainer()->SendEvent( stEventInfo );
	}
}
Exemple #30
0
void SGifPlayer::OnShowWindow( BOOL bShow, UINT nStatus )
{
	__super::OnShowWindow(bShow,nStatus);
	if(!bShow)
	{
        GetContainer()->UnregisterTimelineHandler(this);
	}else if(m_aniSkin && m_aniSkin->GetStates()>1)
	{
        GetContainer()->RegisterTimelineHandler(this);
        if(m_aniSkin->GetFrameDelay()==0)
            m_nNextInterval = 90;
        else
            m_nNextInterval = m_aniSkin->GetFrameDelay()*10;
	}
}