• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UIControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了UIControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:


示例16: typeid

BaseMetadata* MetadataFactory::GetMetadataForTreeNodesList(const HierarchyTreeController::SELECTEDCONTROLNODES& nodesList) const
{
    if (nodesList.empty())
    {
        Logger::Error("MetadataFactory::GetMetadataForTreeNodesList - Nodes List is empty!");
        return NULL;
    }

    // Simplified logic for now. If all the UI Controls attached to the node have the same type, return it.
    // Otherwise return common UIControlMetadata.
    bool allNodesHaveSameUIObjectType = true;
    const char* firstUIControlType = NULL;
    for (HierarchyTreeController::SELECTEDCONTROLNODES::const_iterator iter = nodesList.begin();
            iter != nodesList.end(); iter ++)
    {
        UIControl* attachedControl = (*iter)->GetUIObject();
        if (firstUIControlType == NULL)
        {
            // Remember the first node type.
            firstUIControlType = typeid(*attachedControl).name();
            continue;
        }

        // Compare the current control type with the first one.
        if (strcmp(firstUIControlType, typeid(*attachedControl).name()) != 0)
        {
            allNodesHaveSameUIObjectType = false;
            break;
        }
    }

    if (allNodesHaveSameUIObjectType)
    {
        // Since all the nodes have the same UI Object type attached, use the first one.
        return GetMetadataForUIControl((*nodesList.begin())->GetUIObject());
    }
    else
    {
        // Return the metadata for common UIControl.
        UIControl* uiControl = new UIControl();
        BaseMetadata* resultMetadata = GetMetadataForUIControl(uiControl);

        uiControl->Release();
        return resultMetadata;
    }
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:46,代码来源:MetadataFactory.cpp


示例17: GetVisibleCells

UIHierarchyCell * UIHierarchy::FindVisibleCellForPoint(Vector2 &point)
{
    UIHierarchyCell *cell = NULL;
    
    List<UIControl*> cellsToFind = GetVisibleCells();
    for(List<UIControl*>::const_iterator it = cellsToFind.begin(); it != cellsToFind.end(); ++it)
    {
        UIControl *c = *it;
        if(c->IsPointInside(point))
        {
            cell = (UIHierarchyCell *)c;
            break;
        }
    }
    
    return cell;
}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例18: SetupTexturePreview

void TextureConverterDialog::OnCellSelected(UIList *forList, UIListCell *selectedCell)
{
    selectedItem = selectedCell->GetIndex();

    SetupTexturePreview();
    
    //set selections
    List<UIControl*> children = forList->GetVisibleCells();
    List<UIControl*>::iterator endIt = children.end();
    for(List<UIControl*>::iterator it = children.begin(); it != endIt; ++it)
    {
        UIControl *ctrl = (*it);
        ctrl->SetSelected(false, false);
    }
    
    selectedCell->SetSelected(true, false);
}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例19: SelectControl

void HierarchyTreeController::SelectControl(HierarchyTreeControlNode* control)
{
	if (activeControlNodes.find(control) != activeControlNodes.end())
		return;
	
	//add selection
	activeControlNodes.insert(control);
	UIControl* uiControl = control->GetUIObject();
	if (uiControl)
	{
		uiControl->SetDebugDraw(true);
		uiControl->SetDebugDrawColor(Color(1.f, 0, 0, 1.f));
	
		//YZ draw parent rect
		UIControl* parentUiControl = uiControl->GetParent();
		if (parentUiControl)
		{
			parentUiControl->SetDebugDrawColor(Color(0.55f, 0.55f, 0.55f, 1.f));
			parentUiControl->SetDebugDraw(true);
		}
	}
	
	emit AddSelectedControl(control);
	emit SelectedControlNodesChanged(activeControlNodes);
	UpdateSelection(control);
}
开发者ID:,项目名称:,代码行数:26,代码来源:


示例20: DVASSERT

void GraphBase::OnCellSelected(UIHierarchy *forHierarchy, UIHierarchyCell *selectedCell)
{
    DVASSERT(delegate);
    if(!delegate->LandscapeEditorActive())
    {
        SelectHierarchyNode(selectedCell->GetNode());
        
        //select 
        List<UIControl*> children = forHierarchy->GetVisibleCells();
        for(List<UIControl*>::iterator it = children.begin(); it != children.end(); ++it)
        {
            UIControl *ctrl = (*it);
            ctrl->SetSelected(false, false);
        }
        
        selectedCell->SetSelected(true, false);
    }
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:18,代码来源:GraphBase.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UIDSet类代码示例发布时间:2022-05-31
下一篇:
C++ UIContext类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap