/// <summary> /// Adds a column to the multiline column scheme. /// </summary> /// <param name="column">The column to add.</param> /// <param name="startRow">The row in which the column rectangle starts.</param> /// <param name="endRow">The row in which the column rectangle ends.</param> /// <param name="startX">The X position where the column data starts.</param> /// <param name="width">The width of the column in pixels.</param> /// <param name="anchor">The anchoring of the columnn to the edges of the view area.</param> /// <param name="textColor">The color of the text displayed in the column.</param> public void AddColumn(JetListViewColumn column, int startRow, int endRow, int startX, int width, ColumnAnchor anchor, Color textColor, HorizontalAlignment textAlign) { _columns.Add(column); _columnSettings.Add(new MultiLineColumnSetting(column, startRow, endRow, startX, width, anchor, textColor, textAlign)); }
public MultiLineColumnSetting(MultiLineColumnSetting rhs) { _column = rhs._column; _startRow = rhs._startRow; _endRow = rhs._endRow; _startX = rhs._startX; _width = rhs._width; _anchor = rhs._anchor; _textColor = rhs._textColor; _textAlign = rhs._textAlign; }
public MultiLineColumnSetting(JetListViewColumn column, int startRow, int endRow, int startX, int width, ColumnAnchor anchor, Color textColor, HorizontalAlignment textAlign) { _column = column; _startRow = startRow; _endRow = endRow; _startX = startX; _width = width; _anchor = anchor; _textColor = textColor; _textAlign = textAlign; }
private ColumnAnchor AnchorFromFlags(MultiLineColumnFlags flags) { ColumnAnchor anchor = 0; if ((flags & MultiLineColumnFlags.AnchorLeft) != 0) { anchor |= ColumnAnchor.Left; } if ((flags & MultiLineColumnFlags.AnchorRight) != 0) { anchor |= ColumnAnchor.Right; } return(anchor); }
//Rearranges the columns with sorting rules applied. private void SortColumns(bool _byCountry) { m_xVelocity = m_xAcceleration = 0.0f; //Stop things moving. if (m_TextPanels.Count > 0) //Get rid of any existing panels { foreach (TextPanel tp in m_TextPanels) { DestroyObject(tp.gameObject); } m_TextPanels.Clear(); } if (_byCountry) { SortCountries(); } else { SortDates(); } float x = xSpacing; float y = ySpacing * 2 - 0.1f; float yPadding = 0.3f; int row = 0; int column = 0; List <ThumbTile> temp = new List <ThumbTile>(); List <ColumnAnchor> tempAnchs = new List <ColumnAnchor>(); if (_byCountry) { foreach (string str in m_Countries) { TextPanel tempTx = Instantiate(m_TextPanelPrefab) as TextPanel; //First a title panel is made to denote the country Vector3 pos = new Vector3(x * column, y, -0.1f); tempTx.transform.parent = m_ThumbAnchor.transform; tempTx.SetPos(pos); tempTx.SetText(str == "" ? "Unknown" : str); m_TextPanels.Add(tempTx); ColumnAnchor anchor = Instantiate(m_ColumnAnchorPrefab) as ColumnAnchor; anchor.transform.parent = m_ThumbAnchor.transform; anchor.LocalPos = new Vector3(x * column, -(row * ySpacing) + ySpacing, 0.0f); if (_byCountry) { for (int i = 0; i < m_Thumbs.Count; ++i) { if (m_Thumbs[i].Image.Country == str) { ThumbTile tempTile = Instantiate(m_TilePrefab) as ThumbTile; tempTile.transform.parent = anchor.transform; tempTile.SetThumb(m_Thumbs[i].Image); Vector3 tPos = new Vector3(0.0f, -(row * ySpacing) - yPadding, 0.0f); tempTile.Pointer = m_Pointer; tempTile.SetPos(tPos); tempTile.CarouselPos = i; temp.Add(tempTile); row++; } } } anchor.Tiles = row; anchor.BottomPoint = -(row * ySpacing) + ySpacing; tempAnchs.Add(anchor); column++; row = 0; } } else { foreach (DateTime str in m_Dates) { TextPanel tempTx = Instantiate(m_TextPanelPrefab) as TextPanel; //First a title panel is made to denote the country Vector3 pos = new Vector3(x * column, y, -0.1f); tempTx.transform.parent = m_ThumbAnchor.transform; tempTx.SetPos(pos); tempTx.SetText(str == new DateTime(1970, 1, 1) ? "Unknown" : DateFormat.WrittenDate(str)); m_TextPanels.Add(tempTx); ColumnAnchor anchor = Instantiate(m_ColumnAnchorPrefab) as ColumnAnchor; anchor.transform.parent = m_ThumbAnchor.transform; anchor.LocalPos = new Vector3(x * column, -(row * ySpacing) + ySpacing, 0.0f); for (int i = 0; i < m_Thumbs.Count; ++i) { if (m_Thumbs[i].Image.Date == str) { ThumbTile tempTile = Instantiate(m_TilePrefab) as ThumbTile; tempTile.transform.parent = anchor.transform; tempTile.SetThumb(m_Thumbs[i].Image); Vector3 tPos = new Vector3(0.0f, -(row * ySpacing) - yPadding, 0.0f); tempTile.Pointer = m_Pointer; tempTile.SetPos(tPos); tempTile.CarouselPos = i; temp.Add(tempTile); row++; } } anchor.Tiles = row; anchor.BottomPoint = -(row * ySpacing) + ySpacing; tempAnchs.Add(anchor); column++; row = 0; } } m_NumColumns = column + 1; foreach (ThumbTile thumb in m_Thumbs) { DestroyObject(thumb.gameObject); } m_Thumbs.Clear(); m_Thumbs = temp; if (m_ColumnAnchors.Count > 0) { foreach (ColumnAnchor an in m_ColumnAnchors) { DestroyObject(an.gameObject); } } m_ColumnAnchors.Clear(); m_ColumnAnchors = tempAnchs; }