Beispiel #1
0
SlaveControl::~SlaveControl() 
   {  
   int ct = blockID.Count();
   for (int i = 0; i < ct; i++)
      RemoveControl(0);

   if (scratchControl)
      {
      scratchControl->MaybeAutoDelete();
      }
   scratchControl = NULL;
   } 
// Remove a control
void CListCtrl::RemoveControl ( CLTGUICtrl *pControl )
{
	unsigned int i;
	for ( i = 0; i < m_controlArray.GetSize(); i++ )
	{
		if ( m_controlArray[i] == pControl )
		{
			RemoveControl(i);
			return;
		}
	}
}
Beispiel #3
0
void ModificationsPanel::OnModificationPopUpPressed(BaseObject *, void *, void *)
{
	if(modificationPopUp->GetParent())
	{
		RemoveControl(modificationPopUp);
		modificationPopUp->SetSelection(0);
	}
	else
	{
		modificationPopUp->SetSelection(workingScene->GetProxy());
		AddControl(modificationPopUp);
	}
}
Beispiel #4
0
	void UIButton::SetSelected(bool isSelected, bool hierarchic)
	{
		if(selectedText)
		{
			RemoveControl(selectedText);
		}
		UIControl::SetSelected(isSelected, hierarchic);
		if(selectedText)
		{
			AddControl(selectedText);
            BringChildBack(selectedText);
		}
	}
Beispiel #5
0
	void UIButton::SetMultiInput(bool isMultiInput, bool hierarchic)
	{
		if(selectedText)
		{
			RemoveControl(selectedText);
		}
		UIControl::SetMultiInput(isMultiInput, hierarchic);
		if(selectedText)
		{
			AddControl(selectedText);
            BringChildBack(selectedText);
		}
	}
Beispiel #6
0
void SceneEditorScreenMain::SetViewport(ResourceEditor::eViewportType viewportType)
{
    BodyItem *iBody = FindCurrentBody();
    
    if(libraryControl->GetParent())
    {
        RemoveControl(libraryControl);
    }
    
    iBody->bodyControl->UpdateLibraryState(libraryControl->GetParent(), libraryControl->GetRect().dx);
    
    iBody->bodyControl->SetViewportSize(viewportType);
}
Beispiel #7
0
//------------------------------------------------------------------------------
// CControlPos::RemoveControl
// 
//	If a client ever wants to remove a control programmatically, this 
//    function will do it. 
// 
//	Access: public
// 
//	Args:
//		const UINT& unId  =  ID of the control that should be removed from the
//                         internal control list [ie: will not be repositioned]
// 
//	Return:
//		BOOL 	=	TRUE if the control was found [and deleted], FALSE otherwise
// 
BOOL CControlPos::RemoveControl(const UINT& unId)
{
	CWnd* pControl;

	if (m_pParent)
	{
		pControl = m_pParent->GetDlgItem(unId);
		return (RemoveControl(pControl));
	}
	else
	{
		return (FALSE);
	}
}
Beispiel #8
0
void CGUIDialogContextMenu::OnDeinitWindow(int nextWindowID)
{
  //we can't be sure that controls are removed on window unload
  //we have to remove them to be sure that they won't stay for next use of context menu
  for (unsigned int i = 0; i < m_buttons.size(); i++)
  {
    const CGUIControl *control = GetControl(BUTTON_START + i);
    if (control)
      RemoveControl(control);
  }

  m_buttons.clear();
  CGUIDialog::OnDeinitWindow(nextWindowID);
}
Beispiel #9
0
void UISlider::CopyBackgroundAndRemoveControl(UIControl* from, UIControlBackground*& to)
{
    if (!from)
    {
        return;
    }

    if (to)
    {
        SafeRelease(to);
    }

    to = from->GetBackground()->Clone();
    RemoveControl(from);
}
Beispiel #10
0
void SceneEditorScreenMain::OnPropertiesPressed(DAVA::BaseObject *obj, void *, void *)
{
    BodyItem *iBody = FindCurrentBody();
    bool areShown = iBody->bodyControl->PropertiesAreShown();
    iBody->bodyControl->ShowProperties(!areShown);
    
    if(!areShown)
    {
        if(libraryControl->GetParent())
        {
            RemoveControl(libraryControl);
            iBody->bodyControl->UpdateLibraryState(false, libraryControl->GetRect().dx);
        }
    }
}
void EditorBodyControl::LandscapeEditorFinished()
{
    landscapeToolsSelection->Close();

    UIControl *toolsPanel = currentLandscapeEditor->GetToolPanel();
    RemoveControl(toolsPanel);

    modificationPanel->IsModificationMode(savedModificatioMode);
    AddControl(modificationPanel);
    
    scene->SetSelection(NULL);
    SelectNodeAtTree(NULL);
    
    currentLandscapeEditor = NULL;
}
Beispiel #12
0
void LodDistanceControl::ReleaseControls()
{
    for(int32 iZone = 0; iZone < count; ++iZone)
    {
        RemoveControl(zones[iZone]);
        SafeRelease(zones[iZone]);
    }
    SafeDeleteArray(zones);
    
    for(int32 iSlider = 0; iSlider < count - 1; ++iSlider)
    {
        RemoveControl(sliders[iSlider]);
        SafeRelease(sliders[iSlider]);
    }
    SafeDeleteArray(sliders);
    
    count = 0;
    
    activeSlider = NULL;
    leftZone = NULL;
    rightZone = NULL;
    
    activeLodIndex = -1;
}
void UIScrollBar::CopyDataFrom(UIControl *srcControl)
{
    //release default buttons - they have to be copied from srcControl
    RemoveControl(slider);
 	SafeRelease(slider);

    UIControl::CopyDataFrom(srcControl);
	
	UIScrollBar* t = (UIScrollBar*) srcControl;
	this->orientation = t->orientation;
	this->resizeSliderProportionally = t->resizeSliderProportionally;
	this->slider = t->slider->Clone();

	AddControl(slider);
}
Beispiel #14
0
void UISlider::SetThumb(UIControl *newThumb)
{
    RemoveControl(thumbButton);
    SafeRelease(thumbButton);
    
    thumbButton = SafeRetain(newThumb);

	thumbButton->SetInputEnabled(false);
	
	thumbButton->relativePosition.y = size.y * 0.5f;
    thumbButton->pivotPoint = thumbButton->size*0.5f;
	
	AddControl(thumbButton);
	
	SetValue(currentValue);
}
Beispiel #15
0
	void UIButton::SetStateTextControl(int32 state, UIStaticText *textControl)
	{
		for(int i = 0; i < DRAW_STATE_COUNT; i++)
		{
			if(state & 0x01)
			{
				if(stateTexts[i])
				{
					RemoveControl(stateTexts[i]);
					SafeRelease(stateTexts[i]);
				}
				stateTexts[i] = textControl->CloneStaticText();
			}
			state >>= 1;
		}
		oldState = 0;
	}
Beispiel #16
0
void SceneEditorScreenMain::MaterialsTriggered()
{
    BodyItem *iBody = FindCurrentBody();
    if (!materialEditor->GetParent())
    {
        materialEditor->SetWorkingScene(iBody->bodyControl->GetScene(), iBody->bodyControl->GetSelectedSGNode());
        
        AddControl(materialEditor);
    }
    else 
    {
        RemoveControl(materialEditor);
        
        iBody->bodyControl->RefreshProperties();
        SceneValidator::Instance()->EnumerateSceneTextures();
    }
}
Beispiel #17
0
void SceneEditorScreenMain::MenuSelected(int32 menuID, int32 itemID)
{
    RemoveControl(menuPopup);
    
    switch (menuID) 
    {
        case MENUID_OPEN:
        {
            if(EOMID_OPEN == itemID)
            {
                ShowOpenFileDialog();
            }
            else
            {
                int32 lastIndex = itemID - EOMID_OPENLAST_STARTINDEX;
                String path = EditorSettings::Instance()->GetLastOpenedFile(lastIndex);
                OpenFileAtScene(path);
            }

            break;
        }
            
            
        case MENUID_CREATENODE:
        {
            CreateNode((ResourceEditor::eNodeType)itemID);
            break;
        }
                        
        case MENUID_VIEWPORT:
        {
            SetViewport((ResourceEditor::eViewportType)itemID);
            break;
        }
            
        case MENUID_EXPORTTOGAME:
        {
            ExportAs((ResourceEditor::eExportFormat)itemID);
            break;
        }
            
        default:
            break;
    }
}
Beispiel #18
0
void SceneEditorScreenMain::OnLibraryPressed(DAVA::BaseObject *obj, void *, void *)
{
    BodyItem *iBody = FindCurrentBody();
    if(!iBody->bodyControl->ControlsAreLocked())
    {
        if(libraryControl->GetParent())
        {
            RemoveControl(libraryControl);
        }
        else
        {
            AddControl(libraryControl);
        }
        
        iBody->bodyControl->ShowProperties(false);
        iBody->bodyControl->UpdateLibraryState(libraryControl->GetParent(), libraryControl->GetRect().dx);
    }
}
Beispiel #19
0
void CWindow::Deactivate()
{
	//保证只有激活过才能冻结
	if(iIsActivated)
	{
		iIsActivated = EFalse;
		delete iBackgroundBmp;
		iBackgroundBmp = NULL;
		delete iControlPaneBmp;
		iControlPaneBmp = NULL;
		if(iShowControlText)
		{
			RemoveControl(iControlText);
			delete iControlText;
			iControlText = NULL;
		}
		DeactivateAllControl();
		DoDeactivate();
	}
}
Beispiel #20
0
	void UIButton::SetVisible(bool isVisible, bool hierarchic)
	{
		if(selectedText)
		{
			RemoveControl(selectedText);
		}
		UIControl::SetVisible(isVisible, hierarchic);
		for(int i = 0; i < DRAW_STATE_COUNT; i++)
		{
			if(stateTexts[i])
			{
				stateTexts[i]->SetVisible(isVisible);
			}
		}
		if(selectedText)
		{
			AddControl(selectedText);
            BringChildBack(selectedText);
		}
	}
Beispiel #21
0
// 删除指定tab页(按照名字)
void CDuiTabCtrl::DeleteItem(CString strTabName)
{
	vector<TabItemInfo>::iterator it;
	for(it=m_vecItemInfo.begin();it!=m_vecItemInfo.end();++it)
	{
		TabItemInfo &itemInfo = *it;
		if(itemInfo.strName == strTabName)
		{
			if(itemInfo.pControl != NULL)
			{
				RemoveControl(itemInfo.pControl);
			}
			m_vecItemInfo.erase(it);
			break;
		}
	}

	// 重新计算每个tab页的位置,并刷新界面
	RefreshItems();
}
void UIScrollBar::LoadFromYamlNode(const YamlNode * node, UIYamlLoader * loader)
{
	RemoveControl(slider);
	SafeRelease(slider);

	UIControl::LoadFromYamlNode(node, loader);
		
	const YamlNode * orientNode = node->Get("orientation");
	if (orientNode)
	{
		if (orientNode->AsString() == "ORIENTATION_VERTICAL")
			orientation = ORIENTATION_VERTICAL;
		else if (orientNode->AsString() == "ORIENTATION_HORIZONTAL")
			orientation = ORIENTATION_HORIZONTAL;
		else 
		{
			DVASSERT(0 && "Orientation constant is wrong");
		}
	}
}
Beispiel #23
0
void UISlider::SetThumb(UIControl *newThumb)
{
    if (thumbButton == newThumb)
    {
        return;
    }

    RemoveControl(thumbButton);
    SafeRelease(thumbButton);

    thumbButton = SafeRetain(newThumb);
    thumbButton->SetName(UISLIDER_THUMB_SPRITE_CONTROL_NAME);
    thumbButton->SetInputEnabled(false);

    thumbButton->relativePosition.y = size.y * 0.5f;
    thumbButton->pivotPoint = thumbButton->size*0.5f;

    UIControl::AddControl(thumbButton);

    SetValue(currentValue);
}
void SceneEditorScreenMain::OnSelectBody(BaseObject * owner, void *, void *)
{
    UIButton *btn = (UIButton *)owner;
    
    for(int32 i = 0; i < (int32)bodies.size(); ++i)
    {
        if(bodies[i]->bodyControl->GetParent())
        {
            if(btn == bodies[i]->headerButton)
            {
                // click on selected body - nothing to do
                return;
            }
            
            RemoveControl(bodies[i]->bodyControl);
            bodies[i]->headerButton->SetSelected(false, false);
        }
    }

	ActivateBodyItem(bodies[btn->GetTag()], false);
}
void MaterialEditor::SetSize(const Vector2 &newSize)
{
    DraggableDialog::SetSize(newSize);
    
    btnSetupFog->SetPosition(Vector2(newSize.x - ControlsFactory::BUTTON_WIDTH, ControlsFactory::BUTTON_HEIGHT));
	btnSetupColor->SetPosition(Vector2(newSize.x - ControlsFactory::BUTTON_WIDTH*2, ControlsFactory::BUTTON_HEIGHT));
    line->SetPosition(Vector2(newSize.x - ControlsFactory::BUTTON_WIDTH*3, ControlsFactory::BUTTON_HEIGHT * 3));
    

    Rect setupFogRect(newSize.x - ControlsFactory::BUTTON_WIDTH, ControlsFactory::BUTTON_HEIGHT, ControlsFactory::BUTTON_WIDTH, ControlsFactory::BUTTON_HEIGHT);
    Rect fogRect(setupFogRect.x - ControlsFactory::BUTTON_WIDTH, setupFogRect.dy + setupFogRect.y, ControlsFactory::BUTTON_WIDTH * 2, ControlsFactory::BUTTON_HEIGHT * 5);
    fogControl->SetRect(fogRect);

	Rect setupColorRect(setupFogRect);
	setupColorRect.x -= ControlsFactory::BUTTON_WIDTH;
	Rect colorRect(setupColorRect.x - ControlsFactory::BUTTON_WIDTH, setupColorRect.dy + setupColorRect.y, ControlsFactory::BUTTON_WIDTH * 3, ControlsFactory::BUTTON_HEIGHT * 5);
	colorControl->SetRect(colorRect);
    
    
    float32 materialListWidth = materialsList->GetSize().x;
    Rect noMaterialsRect = noMaterials->GetRect();
    noMaterials->SetRect(Rect(materialListWidth, noMaterialsRect.y, newSize.x - materialListWidth, noMaterialsRect.dy));

    
    Rect propsRect = materialProps->GetRect();

    RemoveControl(materialProps);
    SafeRelease(materialProps);
    
    materialProps = new MaterialPropertyControl(Rect(materialListWidth,
                                                     propsRect.y,
                                                     newSize.x - materialListWidth,
                                                     propsRect.dy),
                                                false);
    materialProps->SetDelegate(this);
    AddControl(materialProps);

    
    SelectMaterial(selectedMaterial);
}
// 删除行
BOOL CDuiGridCtrl::DeleteRow(int nRow)
{
	if((nRow < 0) || (nRow >= (int)m_vecRowInfo.size()))
	{
		return FALSE;
	}

	// 查找行的所有单元格,删除对应的子控件对象
	GridRowInfo &rowInfo = m_vecRowInfo.at(nRow);
	for(size_t j = 0; j < rowInfo.vecItemInfo.size(); j++)
	{
		GridItemInfo &itemInfo = rowInfo.vecItemInfo.at(j);
		vector<CControlBase*>::iterator it;
		for(it=itemInfo.vecControl.begin(); it!=itemInfo.vecControl.end(); ++it)
		{
			CControlBase* _pControl = *it;
			// 删除单元格包含的子控件
			RemoveControl(_pControl);
		}
	}

	// 删除行信息
	int nIndex = 0;
	vector<GridRowInfo>::iterator it;
	for(it=m_vecRowInfo.begin();it!=m_vecRowInfo.end();++it)
	{
		if(nIndex == nRow)
		{
			m_vecRowInfo.erase(it);
			break;
		}
		nIndex++;
	}

	// 计算所有表格行的位置
	CalcRowsPos();

	UpdateControl(true);
	return true;
}
// 清空列表
void CDuiGridCtrl::ClearItems()
{
	// 删除所有子控件
	for(size_t i = 0; i < m_vecRowInfo.size(); i++)
	{
		GridRowInfo &rowInfo = m_vecRowInfo.at(i);
		for(size_t j = 0; j < rowInfo.vecItemInfo.size(); j++)
		{
			GridItemInfo &itemInfo = rowInfo.vecItemInfo.at(j);
			vector<CControlBase*>::iterator it;
			for(it=itemInfo.vecControl.begin(); it!=itemInfo.vecControl.end(); ++it)
			{
				CControlBase* pControl = *it;
				RemoveControl(pControl);
			}
		}
	}

	m_vecRowInfo.clear();
	m_pControScrollV->SetVisible(FALSE);
	UpdateControl(true);
}
Beispiel #28
0
	void UIButton::SystemUpdate(float32 timeElapsed)
	{
		UIControl::SystemUpdate(timeElapsed);

		if(oldState != controlState)
		{
			if(selectedText)
			{
				RemoveControl(selectedText);
				SafeRelease(selectedText);
			}
			selectedText = SafeRetain(GetActualText(controlState));
			if(selectedText)
			{
				AddControl(selectedText);
                BringChildBack(selectedText);
			}
			
			selectedBackground = GetActualBackground(controlState);
			
			oldState = controlState;
		}
	}
Beispiel #29
0
void ModificationsPanel::Update(float32 timeElapsed)
{
    if(workingScene)
    {
        Entity * selection = workingScene->GetProxy();
        modificationPopUp->SetSelection(selection);
        if (isModeModification && selection && modificationPanel->GetParent() == 0)
        {
            AddControl(modificationPanel);
        }
        else if ((selection == 0 && modificationPanel->GetParent() != 0) || !isModeModification)
        {
            RemoveControl(modificationPanel);
            modificationPopUp->SetSelection(0);
            if (modificationPopUp->GetParent())
            {
                modificationPopUp->GetParent()->RemoveControl(modificationPopUp);
            }
        }
    }
    
	
    UIControl::Update(timeElapsed);
}
void EditorBodyControl::LandscapeEditorStarted()
{
    RemoveControl(modificationPanel);
    savedModificatioMode = modificationPanel->IsModificationMode();
    
    UIControl *toolsPanel = currentLandscapeEditor->GetToolPanel();
    if(!toolsPanel->GetParent())
    {
        AddControl(toolsPanel);
    }
    
	Entity* sceneNode = FindLandscapeEntity(scene);
	if (sceneNode)
	{
		scene->SetSelection(sceneNode);
		SelectNodeAtTree(NULL);
		SelectNodeAtTree(sceneNode);
	}
    landscapeToolsSelection->Show();

	ArrowsNode* arrowsNode = GetArrowsNode(false);
	if (arrowsNode)
		arrowsNode->SetVisible(false);
}