Inheritance: DivBox, IDisposable
Ejemplo n.º 1
0
		void m_root_SizeChanged(object sender, RootBox.RootSizeChangedEventArgs e)
		{
			if (m_root != null)
				SetScrollRange(m_root.Width, m_root.Height);
		}
Ejemplo n.º 2
0
		public NoInvalidateLayoutCallbacks(RootBox root) : base(root)
		{
		}
Ejemplo n.º 3
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);
		}
Ejemplo n.º 4
0
		private void InitSimpleTextPara()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			int ws = 1; // arbitrary with default renderer factory.
			AddSimpleTextPara(styles, ws, root);
			theSharpView.Root = root;
			root.SelectAtEnd().Install();
			theSharpView.Focus();
		}
Ejemplo n.º 5
0
		public LayoutCallbacks(RootBox root)
		{
			m_root = root;
			m_root.SuspendPaint(this);
		}
Ejemplo n.º 6
0
		private void InitSeveralBoxes()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			var items = new List<ClientRun>();
			items.Add(new BlockBox(styles, Color.Red, 72000, 36000));
			items.Add(new BlockBox(styles, Color.Blue, 36000, 18000));
			items.Add(new BlockBox(styles, Color.Orange, 18000, 36000));
			items.Add(new BlockBox(styles, Color.Green, 72000, 18000));
			items.Add(new BlockBox(styles, Color.Yellow, 72000, 36000));
			TextSource source = new TextSource(items);
			ParaBox para = new ParaBox(styles, source);
			root.AddBox(para);
			theSharpView.Root = root;
		}
Ejemplo n.º 7
0
		private void InitRedBox()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			BlockBox block = new BlockBox(styles, Color.Red, 72000, 36000);
			root.AddBox(block);
			theSharpView.Root = root;
		}
Ejemplo n.º 8
0
		private void InitStyledText()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			root.RendererFactory = theSharpView.RendererFactory;
			var obj0 = new ParagraphDemo() { Contents = "plain " };
			var obj1 = new ParagraphDemo() { Contents = "bold " };
			var obj2 = new ParagraphDemo() { Contents = "italic " };
			var obj3 = new ParagraphDemo() { Contents = "bold italic " };
			var obj4 = new ParagraphDemo() { Contents = "red on yellow" };
			int ws = 1; // arbitrary with default renderer factory.
			root.Builder.Show(
				Paragraph.Containing(
					Display.Of(() => obj0.Contents, ws).FaceName("Times New Roman"),
					Display.Of(() => obj1.Contents, ws).FaceName("Times New Roman").Bold,
					Display.Of(() => obj2.Contents, ws).FaceName("Times New Roman").Italic,
					Display.Of(() => obj3.Contents, ws).FaceName("Times New Roman").Bold.Italic,
					Display.Of(() => obj4.Contents, ws).ForeColor(Color.Red).BackColor(Color.Yellow)
					).Border(1.Points(), Color.Red).Pads(2.Points(), 3.Points(), 2.Points(), 3.Points())
				);
			root.Builder.Show(
				Paragraph.Containing(
					Display.Of("plain"),
					Display.Of("underOnYellow").Underline(FwUnderlineType.kuntSingle).BackColor(Color.Yellow).FaceName("Times New Roman")
					).Margins(3.Points(), 2.Points(), 5.Points(), 2.Points())
					.Borders(1.Points(), 2.Points(), 3.Points(),4.Points(), Color.Green)
					.BackColor(Color.Pink).Pads(2.Points(), 2.Points(), 2.Points(), 2.Points()),
				Paragraph.Containing(
					Display.Of("doubleRedOnPink").Underline(FwUnderlineType.kuntDouble, Color.Red).BackColor(Color.Pink),
					Display.Of("dotted").Underline(FwUnderlineType.kuntDotted),
					Display.Of("dottedOnYellow").Underline(FwUnderlineType.kuntDotted).BackColor(Color.Yellow)
					),
				Paragraph.Containing(
					Display.Of("dashed").Underline(FwUnderlineType.kuntDashed),
					Display.Of("dashedRed").Underline(FwUnderlineType.kuntDashed).ForeColor(Color.Red),
					Display.Of("squiggle").Underline(FwUnderlineType.kuntSquiggle, Color.Red)
					)
				);
			theSharpView.Root = root;
			root.SelectAtEnd().Install();
			theSharpView.Focus();

		}
Ejemplo n.º 9
0
		private void InitLongText()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			var owner = new ParagraphOwnerDemo();
			var words =
				"This is a bit of text from which we can extract substrings of increasing length to populate various paragraphs in different ways".Split(' ');
			var sb = new StringBuilder();
			for (int i = 0; i < 20; i++)
			{
				var para = new ParagraphDemo();
				if (i < words.Length)
					sb.Append(words[i]);
				para.Contents = sb.ToString();
				if (i < words.Length)
					sb.Append(" ");
				owner.InsertParagraph(0, para);
			}
			int ws = 1; // arbitrary with default renderer factory.
			root.Builder.Show(Display.Of(() => owner.Paragraphs).Using(
				(builder, para) => builder.AddString(() => para.Contents, ws))
				.EditParagraphsUsing(new ParagraphOpsDemo(owner)));
			theSharpView.Root = root;
			root.SelectAtEnd().Install();
			theSharpView.Focus();

		}
Ejemplo n.º 10
0
		private void InitMultiPara()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			var owner = new ParagraphOwnerDemo();
			owner.InsertParagraph(0, new ParagraphDemo());
			int ws = 1; // arbitrary with default renderer factory.
			root.Builder.Show(Display.Of(() => owner.Paragraphs).Using(
				(builder, para) => builder.AddString(()=>para.Contents, ws))
				.EditParagraphsUsing(new ParagraphOpsDemo(owner)));
			theSharpView.Root = root;
			root.SelectAtEnd().Install();
			theSharpView.Focus();
		}
Ejemplo n.º 11
0
 public NoInvalidateLayoutCallbacks(RootBox root) : base(root)
 {
 }
Ejemplo n.º 12
0
 public LayoutCallbacks(RootBox root)
 {
     m_root = root;
     m_root.SuspendPaint(this);
 }