/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.CorrectEventsBehavior: return(true); } return(null); }
/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.ExpandedImage: case newPropertiesEnum.NormalImage: return(new Dictionary <TreeNode, object>()); } return(null); }
/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.ActiveFontStyle: return(ActiveTabFontStyleEnum.Default); case newPropertiesEnum.UseMnemonic: return(true); } return(null); }
///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////// INSTANCE IMPLEMENTATION FOR EXTRA PROPERTIES ////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////// STATIC IMPLEMENTATION FOR EXTRA PROPERTIES /////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this button. /// </summary> /// <param name="btn">The button.</param> /// <param name="prop">newPropertiesEnum</param> private static bool CheckForProperty(Button btn, newPropertiesEnum prop) { if (btn == null) { return(false); } CheckNewProperties(btn); if (!newProperties[btn].ContainsKey(prop)) { newProperties[btn][prop] = GetDefaultValueForProperty(prop); } return(true); }
/// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this tabcontrol. /// </summary> /// <param name="tabControl">The tab control to test.</param> /// <param name="prop">The property to check.</param> /// <returns>True if property could be checked.</returns> private static bool CheckForProperty(TabControl tabControl, newPropertiesEnum prop) { if (tabControl == null) { return(false); } CheckNewProperties(tabControl); if (!newProperties[tabControl.GetHashCode()].ContainsKey(prop)) { newProperties[tabControl.GetHashCode()][prop] = GetDefaultValueForProperty(prop); } return(true); }
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////// STATIC PROPERTIES DEFINITION //////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this TreeView. /// </summary> /// <param name="tView">The TreeView.</param> /// <param name="prop">The newPropertiesEnum to search.</param> private static bool CheckForProperty(TreeView tView, newPropertiesEnum prop) { if (tView == null) { return(false); } CheckNewProperties(tView); if (!newProperties[tView].ContainsKey(prop)) { newProperties[tView][prop] = GetDefaultValueForProperty(prop); } return(true); }
/// <summary> /// Sets the tabControl to use the custom drawing mode, /// if the mode or the eventhandler have already been set then /// they are not set again. /// </summary> /// <param name="tabControl">The tabControl to set its custom value.</param> /// <param name="property">A custom behaviour value.</param> /// <param name="value">True if the custom drawing mode has to be set.</param> private static void SetCustomDrawingMode(TabControl tabControl, newPropertiesEnum property, bool value) { if (tabControl != null) { int key = tabControl.GetHashCode(); if (value) { if (!ControlOfCustomDrawingMode.ContainsKey(key)) { tabControl.DrawMode = TabDrawMode.OwnerDrawFixed; tabControl.DrawItem += TabControl_DrawItem; ControlOfCustomDrawingMode.Add(key, new List <newPropertiesEnum>()); } if (!ControlOfCustomDrawingMode[key].Contains(property)) { ControlOfCustomDrawingMode[key].Add(property); } } else { if (ControlOfCustomDrawingMode.ContainsKey(key)) { if (ControlOfCustomDrawingMode[key].Contains(property)) { ControlOfCustomDrawingMode[key].Remove(property); } if (ControlOfCustomDrawingMode[key].Count == 0) { tabControl.DrawMode = TabDrawMode.Normal; tabControl.DrawItem -= TabControl_DrawItem; ControlOfCustomDrawingMode.Remove(key); } } } } }
/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.CorrectEventsBehavior: return true; } return null; }
///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////// INSTANCE IMPLEMENTATION FOR EXTRA PROPERTIES ////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////// STATIC IMPLEMENTATION FOR EXTRA PROPERTIES /////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this button. /// </summary> /// <param name="btn">The button.</param> /// <param name="prop">newPropertiesEnum</param> private static bool CheckForProperty(Button btn, newPropertiesEnum prop) { if (btn == null) return false; CheckNewProperties(btn); if (!newProperties[btn].ContainsKey(prop)) newProperties[btn][prop] = GetDefaultValueForProperty(prop); return true; }
/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.ExpandedImage: case newPropertiesEnum.NormalImage: return new Dictionary<TreeNode, object>(); } return null; }
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////// STATIC PROPERTIES DEFINITION //////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this TreeView. /// </summary> /// <param name="tView">The TreeView.</param> /// <param name="prop">The newPropertiesEnum to search.</param> private static bool CheckForProperty(TreeView tView, newPropertiesEnum prop) { if (tView == null) return false; CheckNewProperties(tView); if (!newProperties[tView].ContainsKey(prop)) newProperties[tView][prop] = GetDefaultValueForProperty(prop); return true; }
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////// STATIC PROPERTIES DEFINITION //////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this list view. /// </summary> /// <param name="lView">The list view to test.</param> /// <param name="prop">The new PropertiesEnum.</param> private static bool CheckForProperty(ListView lView, newPropertiesEnum prop) { if (lView == null) return false; CheckNewProperties(lView); if (!newProperties[lView].ContainsKey(prop)) newProperties[lView][prop] = GetDefaultValueForProperty(prop); //Ensures that a custom class has been set to do the ordering if ((prop == newPropertiesEnum.SortedProperty) || (prop == newPropertiesEnum.SortKeyProperty) || (prop == newPropertiesEnum.SortOrderProperty)) { if ((lView.ListViewItemSorter == null) || !(lView.ListViewItemSorter is ListViewItemComparer)) { if (!newProperties[lView].ContainsKey(newPropertiesEnum.CustomSortingClass)) newProperties[lView][newPropertiesEnum.CustomSortingClass] = GetDefaultValueForProperty(newPropertiesEnum.CustomSortingClass); lView.ListViewItemSorter = (System.Collections.IComparer)newProperties[lView][newPropertiesEnum.CustomSortingClass]; } } return true; }
/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.SortedProperty: case newPropertiesEnum.CorrectEventsBehavior: return false; case newPropertiesEnum.SortKeyProperty: return 0; case newPropertiesEnum.SortOrderProperty: return SortOrder.Ascending; case newPropertiesEnum.CustomSortingClass: return new ListViewItemComparer(); case newPropertiesEnum.LargeIcons: case newPropertiesEnum.SmallIcons: case newPropertiesEnum.ColumnHeaderIcons: case newPropertiesEnum.ItemClickMethod: return string.Empty; case newPropertiesEnum.ListItemSmallIcon: case newPropertiesEnum.ListItemIcon: return new Dictionary<ListViewItem, object>(); case newPropertiesEnum.InternalColumnHeaderImageListHelper: return new ImageListHelper(); } return null; }
/// <summary> /// Sets the tabControl to use the custom drawing mode, /// if the mode or the eventhandler have already been set then /// they are not set again. /// </summary> /// <param name="tabControl">The tabControl to set its custom value.</param> /// <param name="property">A custom behaviour value.</param> /// <param name="value">True if the custom drawing mode has to be set.</param> private static void SetCustomDrawingMode(TabControl tabControl, newPropertiesEnum property, bool value) { if (tabControl != null) { int key = tabControl.GetHashCode(); if (value) { if (!ControlOfCustomDrawingMode.ContainsKey(key)) { tabControl.DrawMode = TabDrawMode.OwnerDrawFixed; tabControl.DrawItem += TabControl_DrawItem; ControlOfCustomDrawingMode.Add(key, new List<newPropertiesEnum>()); } if (!ControlOfCustomDrawingMode[key].Contains(property)) ControlOfCustomDrawingMode[key].Add(property); } else { if (ControlOfCustomDrawingMode.ContainsKey(key)) { if (ControlOfCustomDrawingMode[key].Contains(property)) ControlOfCustomDrawingMode[key].Remove(property); if (ControlOfCustomDrawingMode[key].Count == 0) { tabControl.DrawMode = TabDrawMode.Normal; tabControl.DrawItem -= TabControl_DrawItem; ControlOfCustomDrawingMode.Remove(key); } } } } }
/// <summary> /// Returns a default value for the specified property. /// </summary> /// <param name="prop">The property requesting a default value.</param> /// <returns>A default value casted as object.</returns> private static object GetDefaultValueForProperty(newPropertiesEnum prop) { switch (prop) { case newPropertiesEnum.ActiveFontStyle: return ActiveTabFontStyleEnum.Default; case newPropertiesEnum.UseMnemonic: return true; } return null; }
/// <summary> /// Check if the property 'newPropertiesEnum' is already defined for this tabcontrol. /// </summary> /// <param name="tabControl">The tab control to test.</param> /// <param name="prop">The property to check.</param> /// <returns>True if property could be checked.</returns> private static bool CheckForProperty(TabControl tabControl, newPropertiesEnum prop) { if (tabControl == null) return false; CheckNewProperties(tabControl); if (!newProperties[tabControl.GetHashCode()].ContainsKey(prop)) newProperties[tabControl.GetHashCode()][prop] = GetDefaultValueForProperty(prop); return true; }