// The main work is done here. // Find out if smart folder mode is being used // If false, return active image based on aspectValue. // If true, calculate correct icon to show depending on aspectValue and all parent values. // If a parent is true, the icon will be active and based on aspectValue. // If a parent is false, the icon will be inactive and based on aspectValue. public override void Render(Graphics g, Rectangle r) { this.DrawBackground(g, r); r = this.ApplyCellPadding(r); Image image = null; bool? aspectValue = this.Aspect as bool?; // Is the listItem enabled? If so, we need to calculate the correct active/inactive icon. if (ListItem.Enabled) { NlmTreeListView ListView = this.ListView as NlmTreeListView; if (ListView.SmartFolderMode) { BaseTreeNode baseTreeNode = this.RowObject as BaseTreeNode; bool parentValue = true; while (baseTreeNode.Parent != null) { INLMColumn nlmColumn = this.Column as INLMColumn; if ((Boolean?)nlmColumn.AspectEngine.GetAspect(baseTreeNode.Parent) == false) { parentValue = false; break; } baseTreeNode = baseTreeNode.Parent; } if (parentValue) { image = GetActiveImage(aspectValue); } else { image = GetInactiveImage(aspectValue); } } // Dumb folder mode is a lot simpler :) else { image = GetActiveImage(aspectValue); } } // If the item is disabled we want it to have 50% opacity, so we always use the inactive image. else { image = GetInactiveImage(aspectValue); } // Finally, after all that work, let's draw the image. if (image != null) { this.DrawAlignedImage(g, r, image); } }
public Boolean Click(OlvListViewHitTestInfo hti) { if (hti.ColumnIndex > 0) { if (hti.Column == ListView.NlmColumns.ColorColumn) { // Should the check states be changed on the selection, or on an item outside of selection. // If inside selection, suppress change in selection by returning true. // If outside selection, change the single item and return false. if (hti.Item.Selected) { NlmMaxColorPicker colorPicker = new NlmMaxColorPicker(hti, true, ListView); colorPicker.ShowModeless(); return(true); } else { NlmMaxColorPicker colorPicker = new NlmMaxColorPicker(hti, false, ListView); colorPicker.ShowModeless(); // Returning false annoyingly pushes the window to the back. // TODO: Somehow make this dialog modal, or at least parented to 3ds Max, and sort out the focus issue. return(true); } } if (hti.Column == ListView.NlmColumns.CurrentColumn) { BaseTreeNode treeNode = hti.RowObject as BaseTreeNode; if (treeNode is LayerTreeNode) { ListView.BeginUpdate(); hti.Column.PutValue(treeNode, true); ListView.EndUpdate(); } return(hti.Item.Selected); } else { Boolean htiItemSelected = hti.Item.Selected; INLMColumn column = hti.Column as INLMColumn; // Should the check states be changed on the selection, or on an item outside of selection. // If inside selection, suppress change in selection by returning true. // If outside selection, change the single item and return false. if (htiItemSelected) { column.AspectEngine.ToggleCheckStates(hti.RowObject); ListView.RefreshObjects(ListView.SelectedObjects); } else { column.AspectEngine.ToggleCheckState(hti.RowObject); ListView.RefreshObject(hti.RowObject); } MaxUI.RedrawViewportsNow(); return(htiItemSelected); } } return(false); // Returning true means selection does not change, returning false means it does. }