Ejemplo n.º 1
0
        public DragDrop()
        {
            HBox box = new HBox();

            SimpleBox b1 = new SimpleBox(30);

            box.PackStart(b1);

            b2 = new Button("Drop here");
            box.PackEnd(b2);

            b1.ButtonPressed += delegate {
                var d = b1.CreateDragOperation();
                d.Data.AddValue("Hola");
                var img = Image.FromResource(GetType(), "class.png");
                d.SetDragImage(img, (int)img.Size.Width, (int)img.Size.Height);
                d.AllowedActions = DragDropAction.All;
                d.Start();
            };

            b2.SetDragDropTarget(TransferDataType.Text, TransferDataType.Uri);
            PackStart(box);

            b2.DragDrop += HandleB2DragDrop;
            b2.DragOver += HandleB2DragOver;
        }
Ejemplo n.º 2
0
        public Tables()
        {
            Table t = new Table ();

            SimpleBox b = new SimpleBox (200, 20);
            t.Attach (b, 0, 1, 0, 1);

            b = new SimpleBox (5, 20);
            t.Attach (b, 1, 2, 0, 1);

            b = new SimpleBox (250, 20);
            t.Attach (b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand);

            b = new SimpleBox (300, 20);
            t.Attach (b, 1, 3, 2, 3);

            b = new SimpleBox (100, 20);
            t.Attach (b, 2, 3, 3, 4);

            b = new SimpleBox (450, 20);
            t.Attach (b, 0, 3, 4, 5);

            PackStart (t);

            HBox box = new HBox ();
            PackStart (box);
            t = new Table ();
            t.Attach (new Label ("One:"), 0, 1, 0, 1);
            t.Attach (new TextEntry (), 1, 2, 0, 1);
            t.Attach (new Label ("Two:"), 0, 1, 1, 2);
            t.Attach (new TextEntry (), 1, 2, 1, 2);
            t.Attach (new Label ("Three:"), 0, 1, 2, 3);
            t.Attach (new TextEntry (), 1, 2, 2, 3);
            box.PackStart (t);
        }
Ejemplo n.º 3
0
        public DragDrop()
        {
            HBox box = new HBox ();

            SimpleBox b1 = new SimpleBox (30);
            box.PackStart (b1, BoxMode.None);

            b2 = new Button ("Drop here");
            box.PackEnd (b2, BoxMode.None);

            b1.ButtonPressed += delegate {
                var d = b1.CreateDragOperation ();
                d.Data.AddValue ("Hola");
                var img = Image.FromResource (GetType(), "class.png");
                d.SetDragImage (img, (int)img.Size.Width, (int)img.Size.Height);
                d.AllowedActions = DragDropAction.All;
                d.Start ();
            };

            b2.SetDragDropTarget (TransferDataType.Text, TransferDataType.Uri);
            PackStart (box);

            b2.DragDrop += HandleB2DragDrop;
            b2.DragOver += HandleB2DragOver;
        }
Ejemplo n.º 4
0
        public Boxes()
        {
            HBox box1 = new HBox();

            VBox box2 = new VBox();

            box2.PackStart(new SimpleBox(30), BoxMode.None);
            box2.PackStart(new SimpleBox(30), BoxMode.None);
            box2.PackStart(new SimpleBox(30), BoxMode.FillAndExpand);

            box1.PackStart(box2, BoxMode.FillAndExpand);
            box1.PackStart(new SimpleBox(30), BoxMode.None);
            box1.PackStart(new SimpleBox(30), BoxMode.Expand);
            PackStart(box1, BoxMode.None);

            HBox box3 = new HBox();

            box3.PackEnd(new SimpleBox(30));
            box3.PackStart(new SimpleBox(20)
            {
                Color = new Color(1, 0.5, 0.5)
            });
            box3.PackEnd(new SimpleBox(40));
            box3.PackStart(new SimpleBox(10)
            {
                Color = new Color(1, 0.5, 0.5)
            });
            box3.PackEnd(new SimpleBox(30));
            box3.PackStart(new SimpleBox(10)
            {
                Color = new Color(1, 0.5, 0.5)
            }, BoxMode.FillAndExpand);
            PackStart(box3);

            HBox   box4 = new HBox();
            Button b    = new Button("Click me");

            b.Clicked += delegate {
                b.Label = "Button has grown";
            };
            box4.PackStart(new SimpleBox(30), BoxMode.FillAndExpand);
            box4.PackStart(b);
            box4.PackStart(new SimpleBox(30), BoxMode.FillAndExpand);
            PackStart(box4);

            HBox   box5 = new HBox();
            Button b2   = new Button("Hide / Show");

            box5.PackStart(new SimpleBox(30), BoxMode.FillAndExpand);
            var hsb = new SimpleBox(20);

            box5.PackStart(hsb, BoxMode.None);
            box5.PackStart(b2);
            box5.PackStart(new SimpleBox(30), BoxMode.FillAndExpand);
            b2.Clicked += delegate {
                hsb.Visible = !hsb.Visible;
            };
            PackStart(box5);
        }
Ejemplo n.º 5
0
        public ScrollWindowSample()
        {
            ScrollView v1 = new ScrollView();
            VBox       b1 = new VBox();

            for (int n = 0; n < 30; n++)
            {
                b1.PackStart(new Label("Line " + n), BoxMode.None);
            }
            Button u = new Button("Click to remove");

            u.Clicked += delegate {
                b1.Remove(u);
            };
            b1.PackStart(u);

            v1.Content = b1;
            v1.VerticalScrollPolicy = ScrollPolicy.Always;
            PackStart(v1, BoxMode.FillAndExpand);

            ScrollView v2 = new ScrollView();
            VBox       b2 = new VBox();

            for (int n = 0; n < 10; n++)
            {
                b2.PackStart(new Label("Line " + n), BoxMode.None);
            }
            v2.Content = b2;
            v2.VerticalScrollPolicy = ScrollPolicy.Never;
            PackStart(v2, BoxMode.FillAndExpand);

            ScrollView v3 = new ScrollView();
            VBox       b3 = new VBox();
            Button     b  = new Button("Click to add items");

            b.Clicked += delegate {
                for (int n = 0; n < 10; n++)
                {
                    b3.PackStart(new Label("Line " + n), BoxMode.None);
                }
            };
            b3.PackStart(b);
            v3.Content = b3;
            v3.VerticalScrollPolicy = ScrollPolicy.Automatic;
            PackStart(v3, BoxMode.FillAndExpand);

            ScrollView v4 = new ScrollView();

            PackStart(v4, BoxMode.FillAndExpand);
            SimpleBox sb = new SimpleBox(1000);

            v4.Content = sb;
            v4.VerticalScrollPolicy = ScrollPolicy.Always;
        }
Ejemplo n.º 6
0
Archivo: Boxes.cs Proyecto: joncham/xwt
        public Boxes()
        {
            HBox box1 = new HBox ();

            VBox box2 = new VBox ();
            box2.PackStart (new SimpleBox (30), BoxMode.None);
            box2.PackStart (new SimpleBox (30), BoxMode.None);
            box2.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);

            box1.PackStart (box2, BoxMode.FillAndExpand);
            box1.PackStart (new SimpleBox (30), BoxMode.None);
            box1.PackStart (new SimpleBox (30), BoxMode.Expand);
            PackStart (box1, BoxMode.None);

            HBox box3 = new HBox ();
            box3.PackEnd (new SimpleBox (30));
            box3.PackStart (new SimpleBox (20) {Color = new Color (1, 0.5, 0.5)});
            box3.PackEnd (new SimpleBox (40));
            box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)});
            box3.PackEnd (new SimpleBox (30));
            box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)}, BoxMode.FillAndExpand);
            PackStart (box3);

            HBox box4 = new HBox ();
            Button b = new Button ("Click me");
            b.Clicked += delegate {
                b.Label = "Button has grown";
            };
            box4.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            box4.PackStart (b);
            box4.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            PackStart (box4);

            HBox box5 = new HBox ();
            Button b2 = new Button ("Hide / Show");
            box5.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            var hsb = new SimpleBox (20);
            box5.PackStart (hsb, BoxMode.None);
            box5.PackStart (b2);
            box5.PackStart (new SimpleBox (30), BoxMode.FillAndExpand);
            b2.Clicked += delegate {
                hsb.Visible = !hsb.Visible;
            };
            PackStart (box5);

            HBox box6 = new HBox ();
            for (int n=0; n<15; n++) {
                var w = new Label ("TestLabel" + n);
                w.MinWidth = 10;
                box6.PackStart (w);
            }
            PackStart (box6);
        }
Ejemplo n.º 7
0
        public Tables()
        {
            Table t = new Table();

            SimpleBox b = new SimpleBox(200, 20);

            t.Add(b, 0, 0);

            b = new SimpleBox(5, 20);
            t.Add(b, 1, 0);

            b = new SimpleBox(250, 20);
            t.Add(b, 0, 1, colspan: 2, hexpand: true, vexpand: true);

            b = new SimpleBox(300, 20);
            t.Add(b, 1, 2, colspan: 2);

            b = new SimpleBox(100, 20);
            t.Add(b, 2, 3);

            b = new SimpleBox(450, 20);
            t.Add(b, 0, 4, colspan: 3);

            PackStart(t);

            HBox box = new HBox();

            PackStart(box);
            t = new Table();
            t.Add(new Label("One:"), 0, 0);
            t.Add(new TextEntry(), 1, 0);
            t.Add(new Label("Two:"), 0, 1);
            t.Add(new TextEntry(), 1, 1);
            t.Add(new Label("Three:"), 0, 2);
            t.Add(new TextEntry(), 1, 2);
            t.InsertRow(1, 2);
            t.Add(new Label("One-and-a-half"), 0, 1);
            t.Add(new TextEntry()
            {
                PlaceholderText = "Just inserted"
            }, 1, 1);
            t.InsertRow(1, 2);
            t.Add(new SimpleBox(300, 20), 0, 1, colspan: 2);
            box.PackStart(t);
        }
Ejemplo n.º 8
0
        public Tables()
        {
            Table t = new Table();

            SimpleBox b = new SimpleBox(200, 20);

            t.Attach(b, 0, 1, 0, 1);

            b = new SimpleBox(5, 20);
            t.Attach(b, 1, 2, 0, 1);

            b = new SimpleBox(250, 20);
            t.Attach(b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand);

            b = new SimpleBox(300, 20);
            t.Attach(b, 1, 3, 2, 3);

            b = new SimpleBox(100, 20);
            t.Attach(b, 2, 3, 3, 4);

            b = new SimpleBox(450, 20);
            t.Attach(b, 0, 3, 4, 5);

            PackStart(t);

            HBox box = new HBox();

            PackStart(box);
            t = new Table();
            t.Attach(new Label("One:"), 0, 1, 0, 1);
            t.Attach(new TextEntry(), 1, 2, 0, 1);
            t.Attach(new Label("Two:"), 0, 1, 1, 2);
            t.Attach(new TextEntry(), 1, 2, 1, 2);
            t.Attach(new Label("Three:"), 0, 1, 2, 3);
            t.Attach(new TextEntry(), 1, 2, 2, 3);
            t.InsertRow(1, 2);
            t.Attach(new Label("One-and-a-half"), 0, 1, 1, 2);
            t.Attach(new TextEntry()
            {
                PlaceholderText = "Just inserted"
            }, 1, 2, 1, 2);
            t.InsertRow(1, 2);
            t.Attach(new SimpleBox(300, 20), 0, 2, 1, 2);
            box.PackStart(t);
        }
Ejemplo n.º 9
0
        public ScrollWindowSample()
        {
            ScrollView v1 = new ScrollView ();
            VBox b1 = new VBox ();
            for (int n=0; n<30; n++)
                b1.PackStart (new Label ("Line " + n), BoxMode.None);
            Button u = new Button ("Click to remove");
            u.Clicked += delegate {
                b1.Remove (u);
            };
            b1.PackStart (u);

            v1.Content = b1;
            v1.VerticalScrollPolicy = ScrollPolicy.Always;
            v1.BorderVisible = false;
            PackStart (v1, BoxMode.FillAndExpand);

            ScrollView v2 = new ScrollView ();
            VBox b2 = new VBox ();
            for (int n=0; n<10; n++)
                b2.PackStart (new Label ("Line " + n), BoxMode.None);
            v2.Content = b2;
            v2.VerticalScrollPolicy = ScrollPolicy.Never;
            PackStart (v2, BoxMode.FillAndExpand);

            ScrollView v3 = new ScrollView ();
            VBox b3 = new VBox ();
            Button b = new Button ("Click to add items");
            b.Clicked += delegate {
                for (int n=0; n<10; n++)
                    b3.PackStart (new Label ("Line " + n), BoxMode.None);
            };
            b3.PackStart (b);
            v3.Content = b3;
            v3.VerticalScrollPolicy = ScrollPolicy.Automatic;
            PackStart (v3, BoxMode.FillAndExpand);

            ScrollView v4 = new ScrollView ();
            PackStart (v4, BoxMode.FillAndExpand);
            SimpleBox sb = new SimpleBox (1000);
            v4.Content = sb;
            v4.VerticalScrollPolicy = ScrollPolicy.Always;
        }
Ejemplo n.º 10
0
        public Tables()
        {
            Table t = new Table ();

            SimpleBox b = new SimpleBox (200, 20);
            t.Attach (b, 0, 1, 0, 1);

            b = new SimpleBox (5, 20);
            t.Attach (b, 1, 2, 0, 1);

            b = new SimpleBox (250, 20);
            t.Attach (b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand);

            b = new SimpleBox (300, 20);
            t.Attach (b, 1, 3, 2, 3);

            b = new SimpleBox (100, 20);
            t.Attach (b, 2, 3, 3, 4);

            b = new SimpleBox (450, 20);
            t.Attach (b, 0, 3, 4, 5);

            PackStart (t);

            HBox box = new HBox ();
            PackStart (box);
            t = new Table ();
            t.Attach (new Label ("One:"), 0, 1, 0, 1);
            t.Attach (new TextEntry (), 1, 2, 0, 1);
            t.Attach (new Label ("Two:"), 0, 1, 1, 2);
            t.Attach (new TextEntry (), 1, 2, 1, 2);
            t.Attach (new Label ("Three:"), 0, 1, 2, 3);
            t.Attach (new TextEntry (), 1, 2, 2, 3);
            t.InsertRow (1, 2);
            t.Attach (new Label ("One-and-a-half"), 0, 1, 1, 2);
            t.Attach (new TextEntry () { PlaceholderText = "Just inserted" }, 1, 2, 1, 2);
            t.InsertRow (1, 2);
            t.Attach (new SimpleBox (300, 20), 0, 2, 1, 2);
            box.PackStart (t);
        }
Ejemplo n.º 11
0
Archivo: Tables.cs Proyecto: m13253/xwt
		public Tables ()
		{
			Table t = new Table ();
			
			SimpleBox b = new SimpleBox (200, 20);
			t.Add (b, 0, 0);
			
			b = new SimpleBox (5, 20);
			t.Add (b, 1, 0);
			
			b = new SimpleBox (250, 20);
			t.Add (b, 0, 1, colspan:2, hexpand:true, vexpand:true);
			
			b = new SimpleBox (300, 20);
			t.Add (b, 1, 2, colspan:2);
			
			b = new SimpleBox (100, 20);
			t.Add (b, 2, 3);
			
			b = new SimpleBox (450, 20);
			t.Add (b, 0, 4, colspan:3);
			
			PackStart (t);
			
			HBox box = new HBox ();
			PackStart (box);
			t = new Table ();
			t.Add (new Label ("One:"), 0, 0);
			t.Add (new TextEntry (), 1, 0);
			t.Add (new Label ("Two:"), 0, 1);
			t.Add (new TextEntry (), 1, 1);
			t.Add (new Label ("Three:"), 0, 2);
			t.Add (new TextEntry (), 1, 2);
			t.InsertRow (1, 2);
			t.Add (new Label ("One-and-a-half"), 0, 1);
			t.Add (new TextEntry () { PlaceholderText = "Just inserted" }, 1, 1);
			t.InsertRow (1, 2);
			t.Add (new SimpleBox (300, 20), 0, 1, colspan:2);
			box.PackStart (t);
		}
Ejemplo n.º 12
0
        public Tables()
        {
            Table t = new Table();

            SimpleBox b = new SimpleBox(200, 20);

            t.Attach(b, 0, 1, 0, 1);

            b = new SimpleBox(10, 20);
            t.Attach(b, 1, 2, 0, 1);

            b = new SimpleBox(500, 20);
            t.Attach(b, 0, 2, 1, 2, AttachOptions.Expand, AttachOptions.Expand);

            b = new SimpleBox(600, 20);
            t.Attach(b, 1, 3, 2, 3);

            b = new SimpleBox(200, 20);
            t.Attach(b, 2, 3, 3, 4);

            b = new SimpleBox(900, 20);
            t.Attach(b, 0, 3, 4, 5);

            PackStart(t);

            HBox box = new HBox();

            PackStart(box);
            t = new Table();
            t.Attach(new Label("One:"), 0, 1, 0, 1);
            t.Attach(new TextEntry(), 1, 2, 0, 1);
            t.Attach(new Label("Two:"), 0, 1, 1, 2);
            t.Attach(new TextEntry(), 1, 2, 1, 2);
            t.Attach(new Label("Three:"), 0, 1, 2, 3);
            t.Attach(new TextEntry(), 1, 2, 2, 3);
            box.PackStart(t);
        }
Ejemplo n.º 13
0
		public Boxes ()
		{
			HBox box1 = new HBox ();
			
			VBox box2 = new VBox ();
			box2.PackStart (new SimpleBox (30));
			box2.PackStart (new SimpleBox (30));
			box2.PackStart (new SimpleBox (30), true);
			
			box1.PackStart (box2, true);
			box1.PackStart (new SimpleBox (30));
			box1.PackStart (new SimpleBox (30), expand:true, fill:false);
			PackStart (box1);
			
			HBox box3 = new HBox ();
			box3.PackEnd (new SimpleBox (30));
			box3.PackStart (new SimpleBox (20) {Color = new Color (1, 0.5, 0.5)});
			box3.PackEnd (new SimpleBox (40));
			box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)});
			box3.PackEnd (new SimpleBox (30));
			box3.PackStart (new SimpleBox (10) {Color = new Color (1, 0.5, 0.5)}, true);
			PackStart (box3);
			
			HBox box4 = new HBox ();
			Button b = new Button ("Click me");
			b.Clicked += delegate {
				b.Label = "Button has grown";
			};
			box4.PackStart (new SimpleBox (30), true);
			box4.PackStart (b);
			box4.PackStart (new SimpleBox (30), true);
			PackStart (box4);
			
			HBox box5 = new HBox ();
			Button b2 = new Button ("Hide / Show");
			box5.PackStart (new SimpleBox (30), true);
			var hsb = new SimpleBox (20);
			box5.PackStart (hsb);
			box5.PackStart (b2);
			box5.PackStart (new SimpleBox (30), true);
			b2.Clicked += delegate {
				hsb.Visible = !hsb.Visible;
			};
			PackStart (box5);
			
			HBox box6 = new HBox ();
			for (int n=0; n<15; n++) {
				var w = new Label ("TestLabel" + n);
				w.WidthRequest = 10;
				box6.PackStart (w);
			}
			PackStart (box6);

			VBox box7 = new VBox () { Spacing = 0 };
			box7.BackgroundColor = Colors.White;

			box7.PackStart (new Label("Hi there") { Margin = new WidgetSpacing (10, 10, 0, 0) });
			box7.PackStart (new SpecialWidget() { MarginTop = 15 });
			box7.PackStart (new SpecialWidget() { Margin = 5 });
			PackStart (box7);
		}