Пример #1
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.RGBA color = new Gdk.RGBA();
            color.Parse("black");
            eventBox.OverrideBackgroundColor(StateFlags.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);
        }
Пример #2
0
		private void ChangeColorCallback (object o, EventArgs args)
		{
			using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog ("Changing color")) {
				colorSelectionDialog.TransientFor = this;
				colorSelectionDialog.ColorSelection.SetPreviousRgba (color);
				colorSelectionDialog.ColorSelection.CurrentRgba = color;
				colorSelectionDialog.ColorSelection.HasPalette = true;

				if (colorSelectionDialog.Run () == (int) ResponseType.Ok) {
					color = colorSelectionDialog.ColorSelection.CurrentRgba;
					drawingArea.OverrideBackgroundColor (StateFlags.Normal, color);
				}

				colorSelectionDialog.Hide ();
			}
		}
        private void ChangeColorCallback(object o, EventArgs args)
        {
            using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog("Changing color")) {
                colorSelectionDialog.TransientFor = this;
                colorSelectionDialog.ColorSelection.SetPreviousRgba(color);
                colorSelectionDialog.ColorSelection.CurrentRgba = color;
                colorSelectionDialog.ColorSelection.HasPalette  = true;

                if (colorSelectionDialog.Run() == (int)ResponseType.Ok)
                {
                    color = colorSelectionDialog.ColorSelection.CurrentRgba;
                    drawingArea.OverrideBackgroundColor(StateFlags.Normal, color);
                }

                colorSelectionDialog.Hide();
            }
        }
Пример #4
0
 public static Cairo.Color ToCairoColor(this Gdk.RGBA color)
 {
     return(new Cairo.Color(color.Red, color.Green, color.Blue, color.Alpha));
 }
Пример #5
0
 public static Cairo.Color GdkRGBAToCairoColor(Gdk.RGBA rgba)
 {
     return(new Cairo.Color(rgba.Red, rgba.Green, rgba.Blue, rgba.Alpha));
 }
Пример #6
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.RGBA color = new Gdk.RGBA ();
			color.Parse ("black");
			eventBox.OverrideBackgroundColor (StateFlags.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);
		}