public WidgetStyleCollection() { styles.Add(defaultKey, new WidgetStyle()); activeStyle = styles[defaultKey]; }
/// <summary> /// Constructs a WidgetLayout structure. /// </summary> /// <param name="activeStyle"></param> /// <remarks> /// The dependency on WidgetStyle is something I'm calling a "perfect" dependency. /// WidgetLayout needs a WidgetStyle object to function and avoid the null reference checks everywhere for situations which would be unrecoverable anyway if it was null. /// WidgetLayout interacts with WidgetStyle in a completely read-only manner. Nothing is written to WidgetStyle. /// WidgetLayout caches nothing from WidgetStyle. /// The WidgetStyle can be switched to any other WidgetStyle at-will without any deterimental effect to the behavior of the WidgetLayout. /// Because of these facts, we can freely change the style for a widget at will. /// </remarks> public WidgetRegion(WidgetStyle activeStyle) { this.Style = activeStyle; }