protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var layoutStyle = (LinearLayoutStyle)style; Spacing = layoutStyle.Spacing; }
public void ApplyWidgetStyle(WidgetStyle style) { Width = style.Width; Height = style.Height; Background = style.Background; OverBackground = style.OverBackground; DisabledBackground = style.DisabledBackground; FocusedBackground = style.FocusedBackground; Border = style.Border; OverBorder = style.OverBorder; DisabledBorder = style.DisabledBorder; FocusedBorder = style.FocusedBorder; if (style.PaddingLeft != null) { PaddingLeft = style.PaddingLeft.Value; } if (style.PaddingRight != null) { PaddingRight = style.PaddingRight.Value; } if (style.PaddingTop != null) { PaddingTop = style.PaddingTop.Value; } if (style.PaddingBottom != null) { PaddingBottom = style.PaddingBottom.Value; } }
internal static BaseWidget RequestCreateDDContainer(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { DDContainer widget = new DDContainer(); widget.CreateWidget(_parent, _style, _skin, _coord, _align, _layer, _name); return(widget); }
internal static BaseWidget RequestCreateMenuItem(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { MenuItem widget = new MenuItem(); widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); return(widget); }
internal static BaseWidget RequestCreateProgressBar(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { ProgressBar widget = new ProgressBar(); widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); return(widget); }
internal static BaseWidget RequestCreateItemBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { ItemBox widget = new ItemBox(); widget.CreateWidget(_parent, _style, _skin, _coord, _align, _layer, _name); return(widget); }
private RunTime.Question Process(Question question) { var QLQuestion = Questions[question.Name]; var stackCopy = (Stack)Styles.Clone(); while (stackCopy.Count > 0) { var style = (DefaultStyle)stackCopy.Pop(); if (style.Type.GetType() == QLQuestion.GetValue().GetType()) { QLQuestion.SetWidget(style.Widget); var properties = new WidgetStyle(); foreach (var property in style.Properties) { switch (property.Key) { case "width": properties.Width = int.Parse(property.Value); break; case "font": properties.Font = property.Value.Replace('"', ' ').Trim(); break; case "fontsize": properties.FontSize = int.Parse(property.Value); break; case "color": properties.Color = property.Value; break; } } QLQuestion.SetStyle(properties); break; } } return(QLQuestion); }
public WidgetStyle(WidgetStyle style) { Width = style.Width; Height = style.Height; MinWidth = style.MinWidth; MinHeight = style.MinHeight; MaxWidth = style.MaxWidth; MaxHeight = style.MaxHeight; Background = style.Background; OverBackground = style.OverBackground; DisabledBackground = style.DisabledBackground; FocusedBackground = style.FocusedBackground; Border = style.Border; OverBorder = style.OverBorder; DisabledBorder = style.DisabledBorder; FocusedBorder = style.FocusedBorder; Margin = style.Margin; BorderThickness = style.BorderThickness; Padding = style.Padding; HorizontalAlignment = style.HorizontalAlignment; VerticalAlignment = style.VerticalAlignment; }
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var selectboxStyle = (SelectboxStyle)style; button.StyleName = selectboxStyle.ButtonStyle; }
public void SetStyle(WidgetStyle style) { Label.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(style.Color)); Label.FontFamily = new FontFamily(style.Font); Label.FontSize = style.FontSize; Control.Width = style.Width; }
public TabControlStyle(TabControlStyle style) : base(style) { TabItemStyle = new ButtonStyle(style.TabItemStyle); ContentStyle = new WidgetStyle(style.ContentStyle); ButtonSpacing = style.ButtonSpacing; HeaderSpacing = style.HeaderSpacing; }
public void addWidgetStype(WidgetStyleID widgetId, int comId, WidgetStyle style) { if (!m_style2Dic.ContainsKey(widgetId)) { m_style2Dic[widgetId] = new Dictionary <int, WidgetStyle>(); } m_style2Dic[widgetId][comId] = style; }
public void SetWidgetStyle( WidgetStyle _style, string _layer) { ExportWidget_SetWidgetStyle_style_layer(mNative, _style, _layer); }
public T CreateWidget <T>(WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) where T : class { T type = System.Activator.CreateInstance <T>(); BaseWidget widget = type as BaseWidget; widget.CreateWidget(this, _style, _skin, _coord, _align, _layer, _name); return(type); }
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var progressBarStyle = (ProgressBarStyle)style; bar = progressBarStyle.Bar; preferredHeight = progressBarStyle.Height; }
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var textboxStyle = (TextboxStyle)style; label.StyleName = textboxStyle.LabelStyle; content.StyleName = textboxStyle.ContentStyle; }
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var imageStyle = (ImageStyle)style; sprite.Color = imageStyle.Color; sprite.ScaleMode = imageStyle.ScaleMode; }
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var pathSelectorStyle = (PathSelectorStyle)style; layout.StyleName = pathSelectorStyle.LinearLayoutStyle; textbox.StyleName = pathSelectorStyle.TextboxStyle; button.StyleName = pathSelectorStyle.ButtonStyle; }
private static extern IntPtr ExportGui_CreateWidget( IntPtr _parent, WidgetStyle _style, [MarshalAs(UnmanagedType.LPStr)] string _type, [MarshalAs(UnmanagedType.LPStr)] string _skin, [In] ref IntCoord _coord, Align _align, [MarshalAs(UnmanagedType.LPStr)] string _layer, [MarshalAs(UnmanagedType.LPStr)] string _name);
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var buttonStyle = (ButtonStyle)style; Padding = buttonStyle.Padding; label.StyleName = buttonStyle.LabelStyle; label.Offset = buttonStyle.LabelOffset; }
internal static WidgetStyle ReadSelectionNode(XmlReader reader) { WidgetStyle ret = null; string fgColor = string.Empty; string bgColor = string.Empty; string borderColor = string.Empty; reader.ReadToNextSibling(ReadWidgetStyle.XMLName_Selection); while (reader.MoveToNextAttribute()) { switch (reader.Name) { case ReadWidgetStyle.attr_fgColor: fgColor = (reader.Value == null ? string.Empty : reader.Value); break; case ReadWidgetStyle.attr_bgColor: bgColor = (reader.Value == null ? string.Empty : reader.Value); break; case ReadWidgetStyle.attr_borderColor: borderColor = (reader.Value == null ? string.Empty : reader.Value); break; case XMLNameSpace: break; default: if (reader.Name.Trim().Length > 0 && reader.Name != XMLComment) { logger.Warn("Parsing the XML child:'" + reader.Name + "' of '" + ReadLexerType.XMLName + "' is not implemented."); } break; } } ret = new WidgetStyle(ReadWidgetStyle.XMLName_Selection); if (fgColor != string.Empty) { ret.fgColor = ReadWidgetStyle.SetColorFromString(ReadWidgetStyle.attr_fgColor, fgColor); } if (bgColor != string.Empty) { ret.bgColor = ReadWidgetStyle.SetColorFromString(ReadWidgetStyle.attr_bgColor, bgColor); } if (borderColor != string.Empty) { ret.borderColor = ReadWidgetStyle.SetColorFromString(ReadWidgetStyle.attr_borderColor, borderColor); } return(ret); }
private static extern IntPtr ExportGui_CreateWidget( [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(InterfaceMarshaler))] BaseWidget _wrapper, IntPtr _parent, WidgetStyle _style, [MarshalAs(UnmanagedType.LPStr)] string _type, [MarshalAs(UnmanagedType.LPStr)] string _skin, [InAttribute] ref IntCoord _coord, Align _align, [MarshalAs(UnmanagedType.LPStr)] string _layer, [MarshalAs(UnmanagedType.LPStr)] string _name);
public void AttachToWidget( Widget _parent, WidgetStyle _style, string _layer) { ExportWidget_AttachToWidget_parent_style_layer(mNative, _parent, _style, _layer); }
protected override void ApplyStyle(WidgetStyle style) { base.ApplyStyle(style); var labelStyle = (LabelStyle)style; textDrawable.FontName = labelStyle.FontName; textDrawable.FontSize = labelStyle.FontSize; textDrawable.Alignment = labelStyle.TextAlignment; textDrawable.Trimming = labelStyle.Trimming; textDrawable.Color = labelStyle.Color; }
public Widget Visit(QuestionStatement statement, GuiEnvironment environment) { var style = new WidgetStyle { Color = Colors.Black, Width = 200, }; var questionWidget = this.CreateWidgetForQuestion(statement, environment, style); return(questionWidget); }
protected void CreateControls(Control input, QuestionStatement statement, WidgetStyle style) { var label = new Label { Content = statement.Label }; style.Apply(label); style.Apply(input); this.Controls.Add(statement.Identifier + "Label", label); this.Controls.Add(statement.Identifier, input); }
internal void CreateWidget(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { mParent = _parent; IntPtr parent = _parent != null?_parent.GetNative() : IntPtr.Zero; mNative = ExportGui_CreateWidget(this, parent, _style, GetWidgetType(), _skin, ref _coord, _align, _layer, _name); mIsWrap = false; if (mParent != null) { mParent.mChilds.Add(this); } else { mRoots.Add(this); } }
public WidgetStyle(WidgetStyle style) { Width = style.Width; Height = style.Height; Background = style.Background; OverBackground = style.OverBackground; DisabledBackground = style.DisabledBackground; FocusedBackground = style.FocusedBackground; Border = style.Border; OverBorder = style.OverBorder; DisabledBorder = style.DisabledBorder; FocusedBorder = style.FocusedBorder; PaddingLeft = style.PaddingLeft; PaddingRight = style.PaddingRight; PaddingTop = style.PaddingTop; PaddingBottom = style.PaddingBottom; }
public WidgetStyle(WidgetStyle style) { Width = style.Width; Height = style.Height; MinWidth = style.MinWidth; MinHeight = style.MinHeight; MaxWidth = style.MaxWidth; MaxHeight = style.MaxHeight; Background = style.Background; OverBackground = style.OverBackground; DisabledBackground = style.DisabledBackground; FocusedBackground = style.FocusedBackground; PaddingLeft = style.PaddingLeft; PaddingRight = style.PaddingRight; PaddingTop = style.PaddingTop; PaddingBottom = style.PaddingBottom; }
/// <summary> /// Applies a widget style to a dynamic resource in the WPF Resource Dictionary. /// The intention is to be more flexible and allow users to configure other editor /// theme colors than thoses that are pre-defined. /// </summary> /// <param name="w"></param> /// <param name="backupDynResources"></param> private void ApplyWidgetStyle(WidgetStyle w, List <string> backupDynResources) { if (w == null) { return; } switch (w.Name) { case "DefaultStyle": ApplyToDynamicResource("EditorBackground", w.bgColor, backupDynResources); ApplyToDynamicResource("EditorForeground", w.fgColor, backupDynResources); break; case "CurrentLineBackground": ApplyToDynamicResource("EditorCurrentLineBackgroundColor", w.bgColor, backupDynResources); break; case "LineNumbersForeground": ApplyToDynamicResource("EditorLineNumbersForeground", w.fgColor, backupDynResources); break; case "Selection": ApplyToDynamicResource("EditorSelectionBrush", w.bgColor, backupDynResources); ApplyToDynamicResource("EditorSelectionBorder", w.borderColor, backupDynResources); ApplyToDynamicResource("EditorSelectionForeground", w.fgColor, backupDynResources); break; case "Hyperlink": ApplyToDynamicResource("LinkTextBackgroundBrush", w.bgColor, backupDynResources); ApplyToDynamicResource("LinkTextForegroundBrush", w.fgColor, backupDynResources); break; case "NonPrintableCharacter": ApplyToDynamicResource("NonPrintableCharacterBrush", w.fgColor, backupDynResources); break; default: logger.WarnFormat("WidgetStyle named '{0}' is not supported.", w.Name); break; } }
internal static BaseWidget RequestCreateMenuBar(IntPtr _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { return new MenuBar(_parent, _style, _skin, _coord, _align, _layer, _name); }
internal MenuBar(IntPtr _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) : base(_parent, _style, _skin, _coord, _align, _layer, _name) { }
internal static BaseWidget RequestCreatePopupMenu(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { PopupMenu widget = new PopupMenu(); widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); return widget; }
internal static BaseWidget RequestCreateScrollView(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { ScrollView widget = new ScrollView(); widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); return widget; }
internal static BaseWidget RequestCreateMultiListBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { MultiListBox widget = new MultiListBox(); widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); return widget; }
public void AttachToWidget( Widget _parent , WidgetStyle _style , string _layer) { ExportWidget_AttachToWidget_parent_style_layer( mNative , _parent , _style , _layer ); }
public void SetWidgetStyle( WidgetStyle _style , string _layer) { ExportWidget_SetWidgetStyle_style_layer( mNative , _style , _layer ); }
internal static BaseWidget RequestCreateDDContainer(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { DDContainer widget = new DDContainer(); widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); return widget; }
internal static BaseWidget RequestCreateTabBar(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) { TabBar widget = new TabBar(); widget.CreateWidget(_parent, _style, _skin, _coord, _align, _layer, _name); return widget; }