Пример #1
0
void CControlResizer::HideControls(int id, bool bHide, bool bLeft, bool bHorizontally)
{
	const ResizeProp *rszBaseControl(GetControl(id));
	if (rszBaseControl == NULL)
		return;
	if (bHide) {
		if (m_iHiddenLen) { // already hidden
			if (m_iHiddenLen < 0 && bLeft) // already hidden in left/top
				return;
			// First show - then hide
			HideControls(id, !bHide, bLeft, bHorizontally);
		}
	}
	if (bHide) {
		m_iHiddenLen = 0;
		// first hide all controls left
		m_ControlsHidden.RemoveAll();
		INT_PTR arrayCount  = m_ResizePropArray.GetCount();
		for (INT_PTR i = 0; i < arrayCount; i++) {
			const ResizeProp &rszProp(m_ResizePropArray.GetAt(i));
			int leftLen = IsLeft(rszBaseControl->controlID, rszProp.controlID, bLeft, bHorizontally);
			if (leftLen) {
				m_pDialog->GetDlgItem(rszProp.controlID)->ShowWindow(SW_HIDE);
				m_ControlsHidden.Add(rszProp.controlID);
				if (leftLen < 0) {
					if (leftLen < m_iHiddenLen)
						m_iHiddenLen = leftLen;
				}
				else {
					if (leftLen > m_iHiddenLen)
						m_iHiddenLen = leftLen;
				}
			}
		}
		int cx(0), cy(0);
		if (bHorizontally)
			cy = m_iHiddenLen;
		else
			cx = m_iHiddenLen;
		DoReSize(cx, cy);
	}
	else { // show the control
		// first resize
		int cx(0), cy(0);
		m_iHiddenLen = -m_iHiddenLen;
		if (bHorizontally)
			cy = m_iHiddenLen;
		else
			cx = m_iHiddenLen;
		m_iHiddenLen = 0;
		DoReSize(cx, cy);
		// then show all hidden control
		INT_PTR arrayCount  = m_ControlsHidden.GetCount();
		for (INT_PTR i = 0; i < arrayCount; i++) {
			m_pDialog->GetDlgItem(m_ControlsHidden[i])->ShowWindow(SW_SHOW);
		}
		m_ControlsHidden.RemoveAll();
	}
}
Пример #2
0
void IControlGroup::HideControlsWithSubgroups()
{
	HideControls();

	for (int i = 0; i < controlSubgroups.size(); i++)
	{
		controlSubgroups[i]->HideControlsWithSubgroups();
	}
}
Пример #3
0
// order = 0 sorted (not supported yet)
// order = 1 add to top
// order = 2 add to bottom
int wxPropertyList::AddPropItem(wxPropertyItem* pItem, int order)
{
    m_PropertyItems.Add(pItem);
    if(pItem->GetAdvanced() && ! m_ShowAdvanced)
        return 0;

    // disable in progress editing
    HideControls();
        
    return AddPropertyToGrid(pItem, order);
}
Пример #4
0
void wxPropertyList::BrowseSelectedItem()
{
    HideControls();
  
    for(size_t i = 0; i < (size_t)GetNumberRows(); i++)
    {
        if(IsInSelection(i, 0))
        {
            // browse for file or directory
            wxPropertyItem *pItem = GetPropertyItemFromRow(i);      
            if(pItem)
            {
                wxString title;
                wxString str = pItem->GetPropName() + _("-NOTFOUND");       
                if(pItem->GetCurValue().IsSameAs(str, true))
                    str.Empty();
                else
                    str = pItem->GetCurValue();

                // browse the directory path
                
                if(pItem->IsDirPath())
                {
                    title = _("Select path for ") + pItem->GetPropName();
                    str = ::wxDirSelector(title, str, 0, wxDefaultPosition, this);
                }
                else if(pItem->IsFilePath())
                {
                    title = _("Select file for ") + pItem->GetPropName();
                    str = ::wxFileSelector(title, str, _(""), _(""), _(MC_DEFAULT_WILDCARD), wxFILE_MUST_EXIST, this);
                }
                else
                    str.Empty();
                
                if(!str.IsEmpty())
                {
                    pItem->SetCurValue(str.c_str());
                    UpdatePropertyItem(pItem, i);
                }
            }
            
            // only allow one item to browse
            break;
        }
    }
}
Пример #5
0
void wxPropertyList::OnIgnoreCache( wxCommandEvent& event )
{
    HideControls();
  
    // ignore all selected items
    for(size_t i = 0; i < (size_t)GetNumberRows(); i++)
    {
        if(IsInSelection(i, 0))
        {
            wxPropertyItem *pItem = GetPropertyItemFromRow(i);      
            if(pItem)
            {
                pItem->SetCurValue("IGNORE");
                UpdatePropertyItem(pItem, i);
            }
        }
    }
}
Пример #6
0
void wxPropertyList::OnDeleteCache( wxCommandEvent& event )
{
    HideControls();
  
    // convert selections to prop items
    wxArrayPtrVoid items;
    for(size_t i = 0; i < (size_t)GetNumberRows(); i++)
    {
        // if selected, query for removal
        if(IsInSelection(i, 0))
        {
            wxPropertyItem *pItem = GetPropertyItemFromRow(i);      
            if(pItem)
                items.Add((void *)pItem);
        }
    }

    // now delete all prop items in cells
    for(size_t i = 0; i < items.Count(); i++)
        RemoveProperty((wxPropertyItem *)items[i]);
}
Пример #7
0
	void PropertyPanelControl::setCurrentData(DataPtr _data)
	{
		mCurrentData = _data;

		HideControls();

		if (mCurrentData != nullptr)
		{
			mContentHeight = 0;
			const DataType::VectorProperty& properties = mCurrentData->getType()->getProperties();
			for (DataType::VectorProperty::const_iterator property = properties.begin(); property != properties.end(); property ++)
			{
				if ((*property)->getVisible())
				{
					PropertyPtr pr = mCurrentData->getProperty((*property)->getName());
						InitialiseProperty(pr, mContentHeight);
				}
			}

			updateView();
		}
	}
Пример #8
0
void wxPropertyList::RemoveProperty(wxPropertyItem *pItem)
{
    HideControls();
  
    // look for property in grid, delete it when present        
    for(size_t j = 0; j < (size_t)GetNumberRows(); j++)
    {
        if(pItem->GetPropName().IsSameAs(GetCellValue(j, 0), false))
        {
            DeleteRows(j, 1);                   
            
#ifdef __LINUX__
            // fix to make sure scrollbars are drawn properly
            wxGrid::AdjustScrollbars();
#endif
             break;
        }
    }

    // delete the item from the list
    m_PropertyItems.Remove(pItem);
    delete pItem;
}