当前位置: 首页>>代码示例>>C++>>正文


C++ UIControl类代码示例

本文整理汇总了C++中UIControl的典型用法代码示例。如果您正苦于以下问题:C++ UIControl类的具体用法?C++ UIControl怎么用?C++ UIControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UIControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetCurrentMouseControl

// 处理窗口的鼠标消息
void UIWindow::HandleMouseMessage(UINT message, WPARAM wParam, LPARAM lParam) {
	if (WM_MOUSELEAVE == message) { // 鼠标离开
		SetCurrentMouseControl(NULL);
		mb_mouse_in = FALSE;
		return;
	}

	if (WM_MOUSEMOVE == message) { // 鼠标移动
		if (! mb_mouse_in) {
			TRACKMOUSEEVENT track_mouse_event;
			track_mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
			track_mouse_event.dwFlags = TME_LEAVE;
			track_mouse_event.hwndTrack = GetHWND();
			mb_mouse_in = ::TrackMouseEvent(&track_mouse_event);
		}
	}

	if (WM_LBUTTONDOWN == message) { ::SetFocus(hwnd_); } // 如果鼠标左键按下,设置此窗口活动

	// 关键之处,如果根控件存在,则由根控件来寻找目前鼠标在哪个控件上,在由找到的控件处理此消息
	if (mp_root_control) {
		UIPoint pt((short)LOWORD(lParam), (short)HIWORD(lParam));
		UIControl *pMouseControl = mp_root_control->LookupMouseFocusedControl(pt);
		if (WM_MOUSEMOVE == message) { SetCurrentMouseControl(pMouseControl); }
		pMouseControl->DispatchMouseMessage(message, wParam, lParam);
	}
}
开发者ID:ksdjfdf,项目名称:HUI,代码行数:28,代码来源:window.cpp

示例2: UIControl

UIControl * ControlsFactory::CreateLine(const Rect & rect, Color color)
{
    UIControl * lineControl = new UIControl(rect); 
    lineControl->GetBackground()->color = color;
    lineControl->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
    return lineControl;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: FillCell

void DataGraph::FillCell(UIHierarchyCell *cell, void *node)
{
    //Temporary fix for loading of UI Interface to avoid reloading of texrures to different formates.
    // 1. Reset default format before loading of UI
    // 2. Restore default format after loading of UI from stored settings.
    Texture::SetDefaultGPU(GPU_UNKNOWN);

    DataNode *n = (DataNode *)node;
    UIStaticText *text =  (UIStaticText *)cell->FindByName("_Text_");
    text->SetText(StringToWString(n->GetName()));
    
    UIControl *icon = cell->FindByName("_Icon_");
    icon->SetSprite("~res:/Gfx/UI/SceneNode/datanode", 0);

    UIControl *marker = cell->FindByName("_Marker_");
    marker->SetVisible(false);
    
    if(n == workingNode)
    {
        cell->SetSelected(true, false);
    }
    else
    {
        cell->SetSelected(false, false);
    }
    
    Texture::SetDefaultGPU(EditorSettings::Instance()->GetTextureViewGPU());
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例4: GetCurrentAggregatorControl

	void EditorListDelegate::UpdateCellSize(UIList *forList)
	{		
		if (isElementsCountNeedUpdate && forList)
		{
			isElementsCountNeedUpdate = false;
			// Change cell size only if aggregator control is available
			UIControl *aggregatorControl = GetCurrentAggregatorControl();
			if (aggregatorControl)
			{
				Vector2 aggregatorSize = aggregatorControl->GetSize();
				SetCellSize(aggregatorSize);
			}
			
			Vector2 listSize = forList->GetSize();
			if(forList->GetOrientation() == UIList::ORIENTATION_HORIZONTAL)
			{
				DVASSERT(cellSize.x > 0);
				cellsCount =  ceilf( listSize.x / cellSize.x );
			}
			else
			{
				DVASSERT(cellSize.y > 0);
				cellsCount =  ceilf( listSize.y / cellSize.y );
			}
		}
	}
开发者ID:galek,项目名称:dava.framework,代码行数:26,代码来源:EditorListDelegate.cpp

示例5: UIControlTabPage

bool UIControlTab::SetParameter(const wstring& _key, const ParamValue& _value)
{
    if (L"addpage" == _key)
    {
        const ParamUIHandle& param = dynamic_cast<const ParamUIHandle&>(_value);
        UIControl* page = new UIControlTabPage(this->m_ui, this->m_ui.NewHandle(), NULL);
        if (false != this->SetParameter(L"addchild", ParamControlPtr(page)))
        {
            if (UIControl* control = this->m_ui.GetControl(param.Get()))
            {
                wstring name;
                ParamWString nameparam(name);
                if ((false != (control->GetParameter(L"name", nameparam)))
                        && (false != (page->SetParameter(L"name", nameparam)))
                        && (false != page->SetParameter(L"addchild", ParamControlPtr(control)))
                        && (false != control->SetParameter(L"parent", ParamControlPtr(page))))
                {
                    this->m_pages.push_back(page);
                    return true;
                }
            }
        }
        delete page;
        return false;
    }
    else if (L"headerlocation" == _key)
    {
        const ParamWString& param = dynamic_cast<const ParamWString&>(_value);
        const wstring headerlocation = param.Get();
        if (L"left" == headerlocation)
        {
            this->m_headerlocation = HL_LEFT;
            return true;
        }
        else if (L"right" == headerlocation)
        {
            this->m_headerlocation = HL_RIGHT;
            return true;
        }
        else if (L"top" == headerlocation)
        {
            this->m_headerlocation = HL_TOP;
            return true;
        }
        else if (L"bottom" == headerlocation)
        {
            this->m_headerlocation = HL_BOTTOM;
            return true;
        }
        return false;
    }

    return UIControl::SetParameter(_key, _value);
}
开发者ID:haust,项目名称:TrafficObserver,代码行数:54,代码来源:UIControlTab.cpp

示例6: InitializeControl

void UIAggregatorMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
    int paramsCount = this->GetParamsCount();
    for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
    {
        UIControl* control = this->treeNodeParams[i].GetUIControl();
		
        control->SetName(controlName);
        control->SetPosition(position);
        
        control->GetBackground()->SetDrawType(UIControlBackground::DRAW_ALIGNED);
    }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例7: InitializeControl

// Initialize the control(s) attached.
void BaseMetadata::InitializeControl(const String& controlName, const Vector2& position)
{
    int paramsCount = this->GetParamsCount();
    for (BaseMetadataParams::METADATAPARAMID i = 0; i < paramsCount; i ++)
    {
        UIControl* control = this->treeNodeParams[i].GetUIControl();

        control->SetName(controlName);
        control->SetSize(INITIAL_CONTROL_SIZE);
        control->SetPosition(position);
        
        control->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
    }
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:15,代码来源:BaseMetadata.cpp

示例8: AlignRightBottom

ControlsPositionData BaseAlignHandler::AlignRightBottom(const List<UIControl*>& controlsList, bool isRight)
{
	ControlsPositionData resultData;

	// Find the bottom/right position. All the alignment is to be done in absolute coords.
	float32 referencePos = FLT_MIN;
	for (List<UIControl*>::const_iterator iter = controlsList.begin(); iter != controlsList.end(); iter ++)
	{
		UIControl* uiControl = *iter;
		if (!uiControl)
		{
			continue;
		}

		resultData.AddControl(uiControl);
		Rect absoluteRect = uiControl->GetRect(true);
		float32 controlSize = isRight ? (absoluteRect.x + absoluteRect.dx) : (absoluteRect.y + absoluteRect.dy);
		if (controlSize > referencePos)
		{
			referencePos = controlSize;
		}
	}

	// Second pass - update.
	for (List<UIControl*>::const_iterator iter = controlsList.begin(); iter != controlsList.end(); iter ++)
	{
		UIControl* uiControl = *iter;
		if (!uiControl)
		{
			continue;
		}

		Rect absoluteRect = uiControl->GetRect(true);

		if (isRight)
		{
			float32 offsetX = referencePos - (absoluteRect.x + absoluteRect.dx);
			absoluteRect.x += offsetX;
		}
		else
		{
			float32 offsetY = referencePos - (absoluteRect.y + absoluteRect.dy);
			absoluteRect.y += offsetY;
		}

		uiControl->SetRect(absoluteRect, true);
	}

	return resultData;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:50,代码来源:AlignHandlers.cpp

示例9: AlignLeftTop

ControlsPositionData BaseAlignHandler::AlignLeftTop(const List<UIControl*>& controlsList, bool isLeft)
{
	ControlsPositionData resultData;

	// Find the reference position. All the alignment is to be done in absolute coords.
	float32 referencePos = FLT_MAX;
	for (List<UIControl*>::const_iterator iter = controlsList.begin(); iter != controlsList.end(); iter ++)
	{
		UIControl* uiControl = *iter;
		if (!uiControl)
		{
			continue;
		}

		resultData.AddControl(uiControl);
		Rect absoluteRect = uiControl->GetRect(true);
		float32 currentPos = isLeft ? absoluteRect.x : absoluteRect.y;

		if (currentPos < referencePos)
		{
			referencePos = currentPos;
		}
	}

	// Second pass - update.
	for (List<UIControl*>::const_iterator iter = controlsList.begin(); iter != controlsList.end(); iter ++)
	{
		UIControl* uiControl = *iter;
		if (!uiControl)
		{
			continue;
		}

		Rect absoluteRect = uiControl->GetRect(true);
		if (isLeft)
		{
			float32 offsetX = absoluteRect.x - referencePos;
			absoluteRect.x -= offsetX;
		}
		else
		{
			float32 offsetY = absoluteRect.y - referencePos;
			absoluteRect.y -= offsetY;
		}

		uiControl->SetRect(absoluteRect, true);
	}

	return resultData;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:50,代码来源:AlignHandlers.cpp

示例10: UndoAdjustedSize

void ControlsAdjustSizeCommand::UndoAdjustedSize(const ControlsPositionData& sizeData)
{
	for (Map<UIControl*, Rect>::const_iterator iter = sizeData.GetControlPositions().begin();
		 iter != sizeData.GetControlPositions().end(); iter ++)
	{
		UIControl* control = iter->first;
		Rect rect = iter->second;

		if (control)
		{
			control->SetRect(rect);
		}
	}
}
开发者ID:galek,项目名称:dava.framework,代码行数:14,代码来源:ControlCommands.cpp

示例11: Update

void UIControlTab::Update()
{
    if (false != this->m_visible)
    {
        this->UpdateDirty();
        this->UpdateHeaders();
        if (this->m_currentpageindex < this->m_pages.size())
        {
            UIControl* page = this->m_pages[this->m_currentpageindex];
            page->SetParameter(L"position", ParamPoint(D2D1::Point2F(this->m_startingpagepos.m_x, this->m_startingpagepos.m_y)));
            page->SetParameter(L"size", ParamSize(D2D1::SizeF(this->m_pagesize.m_width, this->m_pagesize.m_height)));
            page->Update();
        }
    }
}
开发者ID:haust,项目名称:TrafficObserver,代码行数:15,代码来源:UIControlTab.cpp

示例12: Render

void UIControlTab::Render()
{
    if (false != this->m_visible)
    {
        if (false == this->RenderUserDraw())
        {
            this->RenderHeaders();
            if (this->m_currentpageindex < this->m_pages.size())
            {
                UIControl* page = this->m_pages[this->m_currentpageindex];
                page->Render();
            }
        }
    }
}
开发者ID:haust,项目名称:TrafficObserver,代码行数:15,代码来源:UIControlTab.cpp

示例13: Cleanup

HierarchyTreeControlNode::~HierarchyTreeControlNode()
{
	Cleanup();
	
	UIControl* parent = uiObject->GetParent();
	if (parent)
		parent->RemoveControl(uiObject);
	else
		SafeRelease(uiObject);

	if (needReleaseUIObjects)
	{
		SafeRelease(uiObject);
		SafeRelease(parentUIObject);
	}
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:16,代码来源:HierarchyTreeControlNode.cpp

示例14: DVASSERT

void HierarchyTreeControlNode::SetParent(HierarchyTreeNode* node, HierarchyTreeNode* insertAfter)
{
	if (this == insertAfter)
		return;
	
	if (parent)
		parent->RemoveTreeNode(this, false, false);
	
	HierarchyTreeControlNode* newParentControl = dynamic_cast<HierarchyTreeControlNode* >(node);
	HierarchyTreeScreenNode* newParentScreen = dynamic_cast<HierarchyTreeScreenNode* >(node);
	DVASSERT(newParentControl || newParentScreen);
	if (!newParentControl && !newParentScreen)
		return;

	UIControl* afterControl = NULL;
	HierarchyTreeControlNode* insertAfterControl = dynamic_cast<HierarchyTreeControlNode* >(insertAfter);
	if (insertAfterControl)
		afterControl = insertAfterControl->GetUIObject();
	
	UIControl* newParentUI = NULL;
	if (newParentControl)
		newParentUI = newParentControl->GetUIObject();
	else if (newParentScreen)
		newParentUI = newParentScreen->GetScreen();
	
	node->AddTreeNode(this, insertAfter);
	if (newParentUI && uiObject)
	{
		if (insertAfter != node)
		{
			newParentUI->InsertChildAbove(uiObject, afterControl);
		}
		else
		{
			UIControl* belowControl = NULL;
			const List<UIControl*> & controls = newParentUI->GetChildren();
			if (controls.size())
			{
				belowControl = *controls.begin();
			}
			newParentUI->InsertChildBelow(uiObject, belowControl);
		}
	}
	
	parent = node;
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:46,代码来源:HierarchyTreeControlNode.cpp

示例15: IsDeleteNodeAllowed

bool HierarchyTreeWidget::IsDeleteNodeAllowed(HierarchyTreeControlNode* selectedControlNode)
{
	if (!selectedControlNode)
	{
		return true;
	}
		
	// Check whether selected control is Subcontrol of its parent.
	UIControl* uiControl = selectedControlNode->GetUIObject();
	if (!uiControl)
	{
		return true;
	}

	// Subcontrols cannot be deleted.
	return !uiControl->IsSubcontrol();
}
开发者ID:,项目名称:,代码行数:17,代码来源:


注:本文中的UIControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。