Ejemplo n.º 1
0
void Slider::OnValueChanged(double oldValue, double newValue)
{
    InvalidateArrange();
    InvalidateVisual();

    __super::OnValueChanged(oldValue, newValue);
}
Ejemplo n.º 2
0
Archivo: media.cpp Proyecto: snorp/moon
void
Image::ImageFailed (ImageErrorEventArgs *args)
{
	BitmapSource *source = (BitmapSource*) GetSource ();

	if (source->Is (Type::BITMAPIMAGE)) {
		source->RemoveHandler (BitmapImage::DownloadProgressEvent, download_progress, this);
		source->RemoveHandler (BitmapImage::ImageOpenedEvent, image_opened, this);
		source->RemoveHandler (BitmapImage::ImageFailedEvent, image_failed, this);
	}
	source->RemoveHandler (BitmapSource::PixelDataChangedEvent, source_pixel_data_changed, this);


	InvalidateArrange ();
	InvalidateMeasure ();
	UpdateBounds ();
	Invalidate ();

	args = new ImageErrorEventArgs (this, *(MoonError*)args->GetMoonError ());
	if (HasHandlers (ImageFailedEvent)) {
		Emit (ImageFailedEvent, args);
	} else {
		GetDeployment ()->GetSurface ()->EmitError (args);
	}
}
Ejemplo n.º 3
0
void ItemsControl::RemoveAt(int iIndex)
{
    if (iIndex < GetItems()->GetCount() && iIndex >= 0)
    {        
        GetItems()->RemoveAt(iIndex);
        InvalidateArrange();
    }
}
Ejemplo n.º 4
0
void TabControl::OnItemSelected(suic::ObjectPtr item, ItemSelectionEventArg& e)
{
    __super::OnItemSelected(item, e);

    //
    // 设置测量大小脏区域标志,使布局管理器重新元素测量大小
    //
    RaisedMeasureDirty();

    //
    // 刷新布局和显示
    //
    InvalidateMeasure();
    InvalidateArrange();
    InvalidateVisual();
}
Ejemplo n.º 5
0
void
Canvas::OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error)
{
	if (args->GetProperty ()->GetOwnerType() != Type::CANVAS) {
		Panel::OnPropertyChanged (args, error);
		return;
	}

	if (args->GetId () == Canvas::TopProperty 
	    || args->GetId () == Canvas::LeftProperty) {
		if (GetVisualParent () == NULL) {
			UpdateTransform ();
			InvalidateArrange ();
		}
	}
	NotifyListenersOfPropertyChange (args, error);
}
Ejemplo n.º 6
0
Archivo: media.cpp Proyecto: snorp/moon
void
Image::ImageOpened (RoutedEventArgs *args)
{
	BitmapSource *source = (BitmapSource*)GetSource ();

	if (source->Is (Type::BITMAPIMAGE)) {
		source->RemoveHandler (BitmapImage::DownloadProgressEvent, download_progress, this);
		source->RemoveHandler (BitmapImage::ImageOpenedEvent, image_opened, this);
		source->RemoveHandler (BitmapImage::ImageFailedEvent, image_failed, this);
	}

	InvalidateArrange ();
	InvalidateMeasure ();
	UpdateBounds ();
	Invalidate ();

	if (HasHandlers (ImageOpenedEvent)) {
		args->ref (); // to counter the unref in Emit
		Emit (ImageOpenedEvent, args);
	}
}
Ejemplo n.º 7
0
void
Control::OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error)
{
    if (args->GetProperty ()->GetOwnerType() != Type::CONTROL) {
        FrameworkElement::OnPropertyChanged (args, error);
        return;
    }

    if (args->GetId () == Control::TemplateProperty) {
        if (GetSubtreeObject ())
            ElementRemoved ((UIElement *) GetSubtreeObject ());
        InvalidateMeasure ();
    }
    else if (args->GetId () == Control::PaddingProperty
             || args->GetId () == Control::BorderThicknessProperty) {
        InvalidateMeasure ();
    } else if (args->GetId () == Control::IsEnabledProperty) {
        if (!args->GetNewValue ()->AsBool ()) {
            Surface *surface = Deployment::GetCurrent ()->GetSurface ();
            if (surface && surface->GetFocusedElement () == this) {
                // Ensure this element loses focus, then try to focus the next suitable element
                surface->FocusElement (NULL);
                TabNavigationWalker::Focus (this, true);
            }
            ReleaseMouseCapture ();
        }
        PropertyChangedEventArgs *pargs = new PropertyChangedEventArgs (args->GetProperty(),
                args->GetId (),
                args->GetOldValue(),
                args->GetNewValue());
        EmitAsync (IsEnabledChangedEvent, pargs);
    } else if (args->GetId () == Control::HorizontalContentAlignmentProperty
               || args->GetId () == Control::VerticalContentAlignmentProperty) {
        InvalidateArrange ();
    }
    NotifyListenersOfPropertyChange (args, error);
}
Ejemplo n.º 8
0
void ScrollBar::ScrollTo(int nNewPos, bool bRepaint)
{
    int iMin = 0;
    int iMaxPos = max(0, (_scroInfo.iMax - iMin + 1 - _scroInfo.iPage));

    if (nNewPos < iMin)
    {
        nNewPos = iMin;
    }

    int iOldPos = _scroInfo.iVisualPos;

    _scroInfo.iVisualPos = min(iMaxPos, nNewPos);

    if (iOldPos != _scroInfo.iVisualPos)
    {
        InvalidateArrange();
    }

    if (bRepaint)
    {
        InvalidateVisual();
    }
}
Ejemplo n.º 9
0
void ScrollBar::ShowSecondScrollButton(bool bShow)
{
    _increaseBtn.SetVisible(bShow);
    InvalidateArrange();
    InvalidateVisual();
}
Ejemplo n.º 10
0
void ScrollBar::ShowFirstScrollButton(bool bShow)
{
    _decreaseBtn.SetVisible(bShow);
    InvalidateArrange();
    InvalidateVisual();
}
Ejemplo n.º 11
0
void ScrollBar::UpdateScrollBar()
{
    InvalidateArrange();
}
Ejemplo n.º 12
0
void ItemsControl::ClearChildren()
{
    GetItems()->Clear();

    InvalidateArrange();
}
Ejemplo n.º 13
0
void ItemsControl::RemoveChild(suic::ObjectPtr ePtr)
{
    GetItems()->Remove(ePtr);
    InvalidateArrange();
}