All pastes #986566 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-15 21:56 UTC
rendered paste body
... rest of Surface::Attach here ...

	canvas->InvokeMethodWithPost (invoke_canvasOnLoaded, canvas,
				      invoke_postCanvasOnLoaded, this);
}

void
Surface::invoke_canvasOnLoaded (gpointer data, gpointer user_data)
{
	((Canvas*)user_data)->OnLoaded ();
}

void
Surface::invoke_postCanvasOnLoaded (gpointer data, gpointer user_data)
{
	Surface *s = (Surface*)user_data;

	bool change_size = false;
	//
	// If the did not get a size specified
	//
	if (s->normal_width == 0){
		Value *v = s->toplevel->GetValue (FrameworkElement::WidthProperty);

		if (v){
			s->normal_width = (int) v->AsDouble ();
			if (s->normal_width < 0)
				s->normal_width = 0;
			change_size = true;
		}
	}

	if (s->normal_height == 0){
		Value *v = s->toplevel->GetValue (FrameworkElement::HeightProperty);

		if (v){
			s->normal_height = (int) v->AsDouble ();
			if (s->normal_height < 0)
				s->normal_height = 0;
			change_size = true;
		}
	}

	if (!s->full_screen) {
		s->height = s->normal_height;
		s->width = s->normal_width;
	}

	if (change_size) {
		s->Realloc ();
		
		s->Emit (ResizeEvent);
	}

	s->toplevel->UpdateTotalRenderVisibility ();
	s->toplevel->UpdateTotalHitTestVisibility ();
	s->toplevel->FullInvalidate (true);
}