Esempio n. 1
0
		private void AttachWidgets (TextView textView)
		{
			// This is really different from the C version, but the
			// C versions seems a little pointless.

			Button button = new Button ("Click Me");
			button.Clicked +=  new EventHandler(EasterEggCB);
			textView.AddChildAtAnchor (button, buttonAnchor);
			button.ShowAll ();

			ComboBox combo = ComboBox.NewText ();
			combo.AppendText ("Option 1");
			combo.AppendText ("Option 2");
			combo.AppendText ("Option 3");

 			textView.AddChildAtAnchor (combo, menuAnchor);

			HScale scale = new HScale (null);
			scale.SetRange (0,100);
			scale.SetSizeRequest (70, -1);
			textView.AddChildAtAnchor (scale, scaleAnchor);
			scale.ShowAll ();

			Gtk.Image image = Gtk.Image.LoadFromResource ("floppybuddy.gif");
			textView.AddChildAtAnchor (image, animationAnchor);
			image.ShowAll ();

			Entry entry = new Entry ();
			textView.AddChildAtAnchor (entry, entryAnchor);
			entry.ShowAll ();
		}
Esempio n. 2
0
		private void RecursiveAttach (int depth, TextView view, TextChildAnchor anchor)
		{
			if (depth > 4)
				return;

			TextView childView = new TextView (view.Buffer);

			// Event box is to add a black border around each child view
			EventBox eventBox = new EventBox ();
			Gdk.Color color = new Gdk.Color ();
			Gdk.Color.Parse ("black", ref color);
			eventBox.ModifyBg (StateType.Normal, color);

			Alignment align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f);
			align.BorderWidth = 1;

			eventBox.Add (align);
			align.Add (childView);

			view.AddChildAtAnchor (eventBox, anchor);

			RecursiveAttach (depth+1, childView, anchor);
		}