void TitleBar::TitleBar_OnMouseMove( void* sender, MouseEventArgs* e ) { if (moving_) { Point loc = get_Parent()->get_Location(); loc.X += e->Location.X - down_loc_.X; loc.Y += e->Location.Y - down_loc_.Y; get_Parent()->set_Location(loc); } }
STDMETHODIMP CGaugeOverlay::CumulativeTransform(/*[out, retval]*/ long size, long offset, REAL *elements) { if (elements == NULL) return E_POINTER; Matrix m; ISimpleOverlay2 *parent = NULL; get_Parent(&parent); if (parent) { REAL el[6]; parent->CumulativeTransform(el); Matrix cm(el[0], el[1], el[2], el[3], el[4], el[5]); m.Multiply(&cm); } PointF center((float)centerX, (float)centerY); m.Translate((float)(x-centerX), (float)(y-centerY)); m.RotateAt((float)span * offset / size + rotation, center); m.Scale((float)hScale, (float)vScale); m.GetElements(elements); return S_OK; }
void UIElement::OnComputedPropertyValueChanged(PropertyValue* pPropertyVal, bool handled) { if (pPropertyVal->m_dp == get_CursorProperty()) { IRootVisual* root = GetRoot(); if (root) { root->ElementSetMouseCursor(this); } } else if (pPropertyVal->m_dp == get_ShadowTreeProperty()) { if (!handled) { UIElement* shadowTree = get_ShadowTree(); if (shadowTree) { shadowTree->SetRoot(GetRoot()); shadowTree->set_ParentWindow(get_ParentWindow()); shadowTree->set_Parent(this); shadowTree->set_TemplatedOwner(this); InvalidateMeasure(); } } } else if (pPropertyVal->m_dp == get_ParentProperty()) { UIElement* parent = get_Parent(); if (parent) { SetTreeLevel(parent->get_TreeLevel()+1); parent->InvalidateArrange(); } else { set_TreeLevel(0); } } else if (pPropertyVal->m_dp == get_ParentWindowProperty()) { Window* parentwindow = get_ParentWindow(); UIElement* shadowTree = get_ShadowTree(); if (shadowTree) { shadowTree->set_ParentWindow(parentwindow); } size_t nchildren = GetChildrenCount(); for (size_t i = 0; i < nchildren; ++i) { Visual* child = GetChild(i); ASSERT(child); child->set_ParentWindow(parentwindow); } } else if (pPropertyVal->m_dp == get_TemplatedOwnerProperty()) { UIElement* owner = get_TemplatedOwner(); size_t nchildren = GetChildrenCount(); for (size_t i = 0; i < nchildren; ++i) { Visual* child = GetChild(i); ASSERT(child); child->set_TemplatedOwner(owner); } } else if (pPropertyVal->m_dp == get_WidthProperty()) { InvalidateMeasure(); /* float minWidth = get_MinWidth(); float width = get_Width(); if (width < minWidth) width = minWidth; set_ActualWidth(width); */ } else if (pPropertyVal->m_dp == get_HeightProperty()) { InvalidateMeasure(); /* float minHeight = get_MinHeight(); float height = get_Height(); if (height < minHeight) height = minHeight; set_ActualHeight(height); */ } else if (pPropertyVal->m_dp == get_ActualWidthProperty() || pPropertyVal->m_dp == get_ActualHeightProperty()) { #if 0 m_visibleGeometryValid = false; get_Parent(); m_measureValid = false; WindowVisual* w = dynamic_cast<WindowVisual*>(GetRoot()); if (w) { w->AddArrange(this, get_TreeLevel()); // w->m_arrangeList.push_back(this); } /* // Not here for (size_t i = 0; i < GetChildrenCount(); ++i) { Visual* child = GetChild(i); child->DoLayoutSize(); } */ #endif } baseClass::OnComputedPropertyValueChanged(pPropertyVal, handled); }