SIL.FieldWorks.SharpViews.AssembledStyles.WithWs C# (CSharp) Method

WithWs() public method

public WithWs ( int ws ) : AssembledStyles
ws int
return AssembledStyles
		public AssembledStyles WithWs(int ws)
		{
			// Todo JohnT: to handle the case of a paragraph style that sets ws-specific overrides
			// which can't be applied until we know the WS of a run within the paragraph,
			// we will have to have WithNamedStyle record the style name, and this routine must
			// check whether a named style is recorded, and if so, apply also any overrides
			// specified for this WS.
			return m_styleCache.GetDerivedStyle(this, (int)FwTextPropType.ktptWs, ws,
												(newStyles, w) => newStyles.Ws = ws);
		}

Usage Example

Example #1
0
		// Add to the root a text paragraph which reflects the SimpleText property.
		private void AddSimpleTextPara(AssembledStyles styles, int ws, RootBox root)
		{
			var items = new List<IClientRun>();
			var run = new StringClientRun("This is the day that the Lord has made. We will rejoice and be glad in it",
										  styles.WithWs(ws));
			items.Add(run);
			var source = new TextSource(items);
			var para = new ParaBox(styles, source);
			var hookup = new StringHookup(this, () => this.SimpleText,
										  hook => SimpleTextChanged += hook.StringPropChanged,
										  hook => SimpleTextChanged -= hook.StringPropChanged, para);
			hookup.Writer = newVal => SimpleText = newVal;
			run.Hookup = hookup;
			root.AddBox(para);
		}