本文整理汇总了C++中UIElement::set_Parent方法的典型用法代码示例。如果您正苦于以下问题:C++ UIElement::set_Parent方法的具体用法?C++ UIElement::set_Parent怎么用?C++ UIElement::set_Parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement::set_Parent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnComputedPropertyValueChanging
void UIElement::OnComputedPropertyValueChanging(PropertyValue* pPropertyVal, const Variant& oldValue, const Variant& newValue, bool handled)
{
if (pPropertyVal->m_dp == get_ShadowTreeProperty())
{
// remove old
UIElement* uielement = get_ShadowTree();
if (uielement)
{
uielement->SetRoot(nullptr);
uielement->set_Parent(nullptr);
uielement->set_ParentWindow(nullptr);
}
handled = true;
}
if (m_elementProvider)
{
PROPERTYID propertyId = 0;
if (pPropertyVal->m_dp == Window::get_TitleTextProperty())
{
propertyId = UIA_NamePropertyId;
}
HRESULT hr;
if (propertyId)
{
hr = UiaRaiseAutomationPropertyChangedEvent(m_elementProvider, propertyId, oldValue, newValue);
}
}
baseClass::OnComputedPropertyValueChanging(pPropertyVal, oldValue, newValue, handled);
}
示例2: OnComputedPropertyValueChanged
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())
{
//.........这里部分代码省略.........
示例3: OnComputedPropertyValueChanged
//.........这里部分代码省略.........
}
}
}
else if (pPropertyVal->m_dp == get_ActualWidthProperty() ||
pPropertyVal->m_dp == get_ActualHeightProperty())
{
if (m_platformWindow)
{
int x = int(get_Left());
int y = int(get_Top());
int cx = int(get_ActualWidth()); // ceil??
int cy = int(get_ActualHeight()); // ceil??
if (!get_InSizeMove() && !m_inSizeMove)
{
::SetWindowPos(m_platformWindow->get_Handle(), nullptr, x, y, cx, cy,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE/* |
SWP_ASYNCWINDOWPOS // ??*/
);
}
}
}
else if (pPropertyVal->m_dp == get_RTProperty())
{
if (m_platformWindow)
{
m_platformWindow->ChangeTech();
}
}
#if 0
else if (pPropertyVal->m_dp == get_ChildProperty())
{
/*
MessageBeep(-1);
if (m_platformWindow)
{
}
*/
InvalidateVisual();
}
#endif
else if (pPropertyVal->m_dp == get_ShadowTreeProperty())
{
UIElement* uielement = get_ShadowTree();
if (uielement)
{
uielement->SetRoot(this); // This is different from default UIElement implementation
uielement->set_ParentWindow(this); // This is different from default UIElement implementation
uielement->set_Parent(this);
uielement->set_TemplatedOwner(this); // ??
InvalidateMeasure();
// // ??
// uielement->ArrangeCore(gm::SizeF(get_ActualWidth(), get_ActualHeight()));
}
handled = true;
}
else if (pPropertyVal->m_dp == get_OwnerProperty())
{
Window* owner = get_Owner();
if (m_platformWindow && m_platformWindow->get_Handle())
{
if (owner)
{
if (owner->m_platformWindow && owner->m_platformWindow->get_Handle())
{
::SetParent(m_platformWindow->get_Handle(), owner->m_platformWindow->get_Handle());
}
}
else
{
::SetParent(m_platformWindow->get_Handle(), nullptr);
}
}
}
else if (pPropertyVal->m_dp == get_TaskbarItemInfoProperty())
{
MS::Windows::Shell::TaskbarItemInfo* info = get_TaskbarItemInfo();
if (m_platformWindow)
{
HWND hWnd = m_platformWindow->get_Handle();
if (hWnd)
{
double progress = info->get_ProgressValue();
const ULONGLONG totalProgress = 1000000ULL;
// TBPFLAG tbFlags;
// MS::Windows::Shell::Private::pTaskbarList3->SetProgressState(hWnd, tbpFlags);
MS::Windows::Shell::Private::pTaskbarList3->SetProgressValue(hWnd, progress*totalProgress, totalProgress);
}
}
}
baseClass::OnComputedPropertyValueChanged(pPropertyVal, handled);
}