/*
* Attributes - Attributes that can be attached to properties of models to allow columns to be
* built from them directly
*
* Author: Phillip Piper
* Date: 15/08/2009 22:01
*
* Change log:
* v2.6
* 2012-08-16 JPP - Added [OLVChildren] and [OLVIgnore]
* - OLV attributes can now only be set on properties
* v2.4
* 2010-04-14 JPP - Allow Name property to be set
*
* v2.3
* 2009-08-15 JPP - Initial version
*
* To do:
*
* Copyright (C) 2009-2014 Phillip Piper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* If you wish to use this code in a closed source application, please contact phillip_piper@bigfoot.com.
*/
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace BrightIdeasSoftware
{
///
/// This attribute is used to mark a property of a model
/// class that should be noticed by Generator class.
///
///
/// All the attributes of this class match their equivilent properties on OLVColumn.
///
[AttributeUsage(AttributeTargets.Property)]
public class OLVColumnAttribute : Attribute
{
#region Constructor
// There are several property where we actually want nullable value (bool?, int?),
// but it seems attribute properties can't be nullable types.
// So we explicitly track if those properties have been set.
///
/// Create a new OLVColumnAttribute
///
public OLVColumnAttribute() {
}
///
/// Create a new OLVColumnAttribute with the given title
///
/// The title of the column
public OLVColumnAttribute(string title) {
this.Title = title;
}
#endregion
#region Public properties
///
///
///
public string AspectToStringFormat {
get { return aspectToStringFormat; }
set { aspectToStringFormat = value; }
}
private string aspectToStringFormat;
///
///
///
public bool CheckBoxes {
get { return checkBoxes; }
set {
checkBoxes = value;
this.IsCheckBoxesSet = true;
}
}
private bool checkBoxes;
internal bool IsCheckBoxesSet = false;
///
///
///
public int DisplayIndex {
get { return displayIndex; }
set { displayIndex = value; }
}
private int displayIndex = -1;
///
///
///
public bool FillsFreeSpace {
get { return fillsFreeSpace; }
set { fillsFreeSpace = value; }
}
private bool fillsFreeSpace;
///
///
///
public int FreeSpaceProportion {
get { return freeSpaceProportion; }
set {
freeSpaceProportion = value;
IsFreeSpaceProportionSet = true;
}
}
private int freeSpaceProportion;
internal bool IsFreeSpaceProportionSet = false;
///
/// An array of IComparables that mark the cutoff points for values when
/// grouping on this column.
///
public object[] GroupCutoffs {
get { return groupCutoffs; }
set { groupCutoffs = value; }
}
private object[] groupCutoffs;
///
///
///
public string[] GroupDescriptions {
get { return groupDescriptions; }
set { groupDescriptions = value; }
}
private string[] groupDescriptions;
///
///
///
public string GroupWithItemCountFormat {
get { return groupWithItemCountFormat; }
set { groupWithItemCountFormat = value; }
}
private string groupWithItemCountFormat;
///
///
///
public string GroupWithItemCountSingularFormat {
get { return groupWithItemCountSingularFormat; }
set { groupWithItemCountSingularFormat = value; }
}
private string groupWithItemCountSingularFormat;
///
///
///
public bool Hyperlink {
get { return hyperlink; }
set { hyperlink = value; }
}
private bool hyperlink;
///
///
///
public string ImageAspectName {
get { return imageAspectName; }
set { imageAspectName = value; }
}
private string imageAspectName;
///
///
///
public bool IsEditable {
get { return isEditable; }
set {
isEditable = value;
this.IsEditableSet = true;
}
}
private bool isEditable = true;
internal bool IsEditableSet = false;
///
///
///
public bool IsVisible {
get { return isVisible; }
set { isVisible = value; }
}
private bool isVisible = true;
///
///
///
public bool IsTileViewColumn {
get { return isTileViewColumn; }
set { isTileViewColumn = value; }
}
private bool isTileViewColumn;
///
///
///
public int MaximumWidth {
get { return maximumWidth; }
set { maximumWidth = value; }
}
private int maximumWidth = -1;
///
///
///
public int MinimumWidth {
get { return minimumWidth; }
set { minimumWidth = value; }
}
private int minimumWidth = -1;
///
///
///
public String Name {
get { return name; }
set { name = value; }
}
private String name;
///
///
///
public HorizontalAlignment TextAlign {
get { return this.textAlign; }
set {
this.textAlign = value;
IsTextAlignSet = true;
}
}
private HorizontalAlignment textAlign = HorizontalAlignment.Left;
internal bool IsTextAlignSet = false;
///
///
///
public String Tag {
get { return tag; }
set { tag = value; }
}
private String tag;
///
///
///
public String Title {
get { return title; }
set { title = value; }
}
private String title;
///
///
///
public String ToolTipText {
get { return toolTipText; }
set { toolTipText = value; }
}
private String toolTipText;
///
///
///
public bool TriStateCheckBoxes {
get { return triStateCheckBoxes; }
set {
triStateCheckBoxes = value;
this.IsTriStateCheckBoxesSet = true;
}
}
private bool triStateCheckBoxes;
internal bool IsTriStateCheckBoxesSet = false;
///
///
///
public bool UseInitialLetterForGroup {
get { return useInitialLetterForGroup; }
set { useInitialLetterForGroup = value; }
}
private bool useInitialLetterForGroup;
///
///
///
public int Width {
get { return width; }
set { width = value; }
}
private int width = 150;
#endregion
}
///
/// Properties marked with [OLVChildren] will be used as the children source in a TreeListView.
///
[AttributeUsage(AttributeTargets.Property)]
public class OLVChildrenAttribute : Attribute
{
}
///
/// Properties marked with [OLVIgnore] will not have columns generated for them.
///
[AttributeUsage(AttributeTargets.Property)]
public class OLVIgnoreAttribute : Attribute
{
}
}