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 );
			}
		}
	}
示例#2
0
void OpSpeedDialView::SetCellsSizes()
{
	for(unsigned i = 0; i < m_thumbnail_flow->GetWidgetCount(); ++i)
	{
		SetCellSize(i);
	}
}
示例#3
0
void CGridLabThresholds::_SetColCount(int nCols)
{
  int nOldCount = m_bCreated ? GetNumberCols() : 0;
  int nCol;
  int nRow;
  _CreateGrid(m_nRows,nCols);
  if(nOldCount <= 1)
  {
    nOldCount = 0;
  }
  else
  {
    // ummerge all cells in first row
    for(nCol = 0; nCol < nOldCount; nCol++)
    {
      SetCellSize(0,nCol,1,1);
    }
  }

  // set Renderer and Editor
  for(nRow = 1; nRow < m_nRows; nRow++)
  {
    for(nCol = nOldCount; nCol < nCols; nCol++)
    {
      SetCellEditor(nRow,nCol,new wxGridCellFloatEditor(-1,4));
      SetReadOnly(nRow,nCol,m_bReadOnly);
    }
  }
}
示例#4
0
OP_STATUS OpSpeedDialView::CreateThumbnail(const DesktopSpeedDial& entry, bool animate)
{
	typedef QuickAnimatedWidget<SpeedDialThumbnail> QuickSpeedDialThumbnail;
	OpAutoPtr<QuickSpeedDialThumbnail> quick_thumbnail(OP_NEW(QuickSpeedDialThumbnail, ()));
	RETURN_OOM_IF_NULL(quick_thumbnail.get());
	RETURN_IF_ERROR(quick_thumbnail->Init());

	SpeedDialThumbnail* thumbnail = quick_thumbnail->GetOpWidget();
	RETURN_IF_ERROR(thumbnail->SetEntry(&entry));
	thumbnail->SetLocked(IsReadOnly());

	const int pos = g_speeddial_manager->FindSpeedDial(&entry);
	if (pos < 0 || pos > (int)m_thumbnails.GetCount())
	{
		OP_ASSERT(!"Out of sync with SpeedDialManager");
		return OpStatus::ERR;
	}
	RETURN_IF_ERROR(m_thumbnails.Insert(pos, thumbnail));

	quick_thumbnail->SetListener(m_thumbnail_flow);
	RETURN_IF_ERROR(m_thumbnail_flow->InsertWidget(quick_thumbnail.release(), pos));

	SetCellSize(pos);

	if (animate)
	{
		DoLayout(); // must do the layout explicitly first, before we do the following animation
		m_thumbnails.Get(pos)->AnimateThumbnailIn();
	}

	return OpStatus::OK;
}
int GLIDebugVariableGrid::AddRowType(RowType addType, uint typeIndex)
{
  //Add the row and get the index
  AppendRows(1);

  //Add to the type array
  rowTypeDataArray.push_back(RowTypeData(addType, typeIndex));

  //Check that the array sizes match
  wxASSERT(rowTypeDataArray.size() == GetNumberRows());

  //Set the default properties for the different types
  int addIndex = GetNumberRows() - 1;
  switch(addType)
  {
    case(RT_Header):
      SetCellSize(addIndex, NAME_COLUMN_INDEX, 1, 3);
      SetReadOnly(addIndex, NAME_COLUMN_INDEX);
      SetCellBackgroundColour(addIndex, NAME_COLUMN_INDEX, gridGrey);
      SetCellFont(addIndex, NAME_COLUMN_INDEX, GetLabelFont());
      break;

    case(RT_WatchValue):
      SetCellRenderer(addIndex, NAME_COLUMN_INDEX, new OffsetStringGridCellRenderer(CELL_RENDER_OFFSET));  
      SetReadOnly(addIndex, VALUE_COLUMN_INDEX);
      break;

    case(RT_Uniform):
      SetReadOnly(addIndex, NAME_COLUMN_INDEX);
      SetReadOnly(addIndex, VALUE_COLUMN_INDEX);
      SetReadOnly(addIndex, TYPE_COLUMN_INDEX);

      SetCellRenderer(addIndex, NAME_COLUMN_INDEX, new OffsetStringGridCellRenderer(CELL_RENDER_OFFSET));  
      break;

    case(RT_UniformArray):
      SetReadOnly(addIndex, NAME_COLUMN_INDEX);
      SetReadOnly(addIndex, VALUE_COLUMN_INDEX);
      SetReadOnly(addIndex, TYPE_COLUMN_INDEX);

      SetCellRenderer(addIndex, NAME_COLUMN_INDEX, new OffsetStringGridCellRenderer(CELL_RENDER_OFFSET*2));  
      break;

  };


  //Return the index
  return addIndex;
}