Inheritance: Xwt.Widget
コード例 #1
0
ファイル: Splash.cs プロジェクト: hamekoz/hamekoz-sharp
        public Splash()
        {
            Decorated = false;
            ShowInTaskbar = false;
            box = new VBox {
                Margin = -2,
            };
            imageView = new ImageView {
                Image = Image.FromResource (Resources.Splash),
            };
            progressBar = new ProgressBar {
                Indeterminate = true,
                TooltipText = Catalog.GetString ("Loading..."),
            };
            info = new Label {
                Text = Catalog.GetString ("Loading..."),
                TextAlignment = Alignment.Center,
            };
            box.PackStart (imageView);
            box.PackEnd (progressBar);
            box.PackEnd (info);

            Content = box;

            InitialLocation = WindowLocation.CenterScreen;
        }
コード例 #2
0
ファイル: MenuSamples.cs プロジェクト: m13253/xwt
		public MenuSamples ()
		{
			Label la = new Label ("Right click here to show the context menu");
			menu = new Menu ();
			menu.Items.Add (new MenuItem ("One"));
			menu.Items.Add (new MenuItem ("Two"));
			menu.Items.Add (new MenuItem ("Three"));
			menu.Items.Add (new SeparatorMenuItem ());

			var rgroup = new RadioButtonMenuItemGroup ();
			menu.Items.Add (new RadioButtonMenuItem ("Opt 1") { Group = rgroup, Sensitive = false });
			menu.Items.Add (new RadioButtonMenuItem ("Opt 2") { Group = rgroup, Checked = true });
			menu.Items.Add (new RadioButtonMenuItem ("Opt 3") { Group = rgroup });

			menu.Items.Add (new SeparatorMenuItem ());

			menu.Items.Add (new CheckBoxMenuItem ("Check 1"));
			menu.Items.Add (new CheckBoxMenuItem ("Check 2") { Checked = true });

			menu.Items.Add (new SeparatorMenuItem ());

			var subMenu = new MenuItem ("Submenu");
			subMenu.SubMenu = new Menu ();
			var subZoomIn = new MenuItem (new Command ("Zoom+", StockIcons.ZoomIn));
			var subZoomOut = new MenuItem (new Command ("Zoom-", StockIcons.ZoomOut));
			subMenu.SubMenu.Items.Add (subZoomIn);
			subMenu.SubMenu.Items.Add (subZoomOut);
			menu.Items.Add (subMenu);

			subZoomIn.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom+' item clicked.");
			subZoomOut.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom-' item clicked.");

			la.ButtonPressed += HandleButtonPressed;
			PackStart (la);
		}
コード例 #3
0
ファイル: XwtLabelNode.cs プロジェクト: ksigne/xwt-extensions
 public override Xwt.Widget Makeup(IXwtWrapper Parent)
 {
     Xwt.Label Target = new Xwt.Label()
     {
         TextAlignment = this.Align,
         Text = this.Text,
         Ellipsize = this.Ellipsize,
         Wrap = this.Wrap
     };
     if (this.Markup != "")
         Target.Markup = this.Markup;
     if (this.Color != "")
         Target.TextColor = Xwt.Drawing.Color.FromName(this.Color);
     //Binding
     if (Source != "")
     {
         Target.Text = (string)PathBind.GetValue(Source, Parent, "");
         Parent.PropertyChanged += (o, e) =>
         {
             if (e.PropertyName == this.Source.Split('.')[0])
                 Xwt.Application.Invoke(() => Target.Text = (string)PathBind.GetValue(Source, Parent, ""));
         };
     }
     WindowController.TryAttachEvent(Target, "LinkClicked", Parent, LinkClicked);
     InitWidget(Target, Parent);
     return Target;
 }
コード例 #4
0
ファイル: ScrollbarSample.cs プロジェクト: m13253/xwt
		public ScrollbarSample ()
		{
			WidthRequest = 300;
			HeightRequest = 300;

			canvas = new Canvas ();
			label = new Label ("Use the scrollbars\nto move this label");
			canvas.AddChild (label);

			Add (canvas, 0, 0, hexpand:true, vexpand:true);

			vscroll = new VScrollbar () {
				LowerValue = 0,
				UpperValue = 300,
				PageIncrement = 10,
				PageSize = 50,
				StepIncrement = 1
			};
			Add (vscroll, 1, 0, vexpand:true);
			
			hscroll = new HScrollbar () {
				LowerValue = 0,
				UpperValue = 300,
				PageIncrement = 10,
				PageSize = 50,
				StepIncrement = 1
			};
			Add (hscroll, 0, 1, hexpand:true);

			vscroll.ValueChanged += HandleValueChanged;
			hscroll.ValueChanged += HandleValueChanged;
		}
コード例 #5
0
		public DependencyWidget (IConnectedService service, IConnectedServiceDependency dependency)
		{
			Dependency = dependency;
			Service = service;

			iconView = new ImageView (dependency.Icon.WithSize (Xwt.IconSize.Small));
			nameLabel = new Label (dependency.DisplayName);

			statusIconView = new ImageView ();
			statusLabel = new Label ();
			statusLabel.LinkClicked += (sender, e) => {
				if (dependency.Status == Status.NotAdded)
					dependency.AddToProject (CancellationToken.None);
				e.SetHandled ();
			};

			container = new HBox ();
			container.PackStart (iconView);
			container.PackStart (nameLabel);
			container.PackStart (statusIconView);
			container.PackStart (statusLabel);

			Content = container;
			Update ();

			dependency.StatusChanged += HandleDependencyStatusChange;
			service.StatusChanged += HandleServiceStatusChanged;
		}
コード例 #6
0
		public DependenciesSectionWidget (IConfigurationSection section) 
		{
			this.section = section;

			widget = new VBox ();

			if (this.section.Service.Dependencies.Length == 0) {
				widget.PackStart (new Label { Text = GettextCatalog.GetString ("This service has no dependencies") });
				return;
			}

			bool firstCategory = true;

			foreach (var category in this.section.Service.Dependencies.Select (d => d.Category).Distinct ()) {
				var categoryIcon = new ImageView (category.Icon.WithSize (IconSize.Small));
				var categoryLabel = new Label (category.Name);
				var categoryBox = new HBox ();

				if (!firstCategory)
					categoryBox.MarginTop += 5;

				categoryBox.PackStart (categoryIcon);
				categoryBox.PackStart (categoryLabel);
				widget.PackStart (categoryBox);

				foreach (var dependency in this.section.Service.Dependencies.Where (d => d.Category == category)) {
					widget.PackStart (new DependencyWidget (section.Service, dependency) {
						MarginLeft = category.Icon.Size.Width / 2
					});
				}

				if (firstCategory)
					firstCategory = false;
			}
		}
コード例 #7
0
ファイル: TextEntries.cs プロジェクト: jbeaurain/xwt
        public TextEntries()
        {
            TextEntry te1 = new TextEntry ();
            PackStart (te1);

            Label la = new Label ();
            PackStart (la);
            te1.Changed += delegate {
                la.Text = "Text: " + te1.Text;
            };

            PackStart (new Label ("Entry with small font"));
            TextEntry te2 = new TextEntry ();
            te2.Font = te2.Font.WithScaledSize (0.5);
            PackStart (te2);

            PackStart (new Label ("Entry with placeholder text"));
            TextEntry te3 = new TextEntry ();
            te3.PlaceholderText = "Placeholder text";
            PackStart (te3);

            PackStart (new Label ("Entry with no frame"));
            TextEntry te4 = new TextEntry();
            te4.ShowFrame = false;
            PackStart (te4);

            TextEntry te5 = new TextEntry ();
            te5.Text = "I should be centered!";
            te5.TextAlignment = Alignment.Center;
            PackStart (te5);
        }
コード例 #8
0
ファイル: DatePickerSample.cs プロジェクト: m13253/xwt
		public DatePickerSample ()
		{
			var dtp = new DatePicker (DateTime.Now);
			PackStart (dtp);

			Label la1 = new Label ("Initial Value: " + dtp.DateTime);
			PackStart (la1);
			dtp.ValueChanged += delegate {
				la1.Text = "Value changed: " + dtp.DateTime;
			};

			var dp = new DatePicker (DatePickerStyle.Date);
			PackStart (dp);

			Label la2 = new Label ("Initial Value: " + dp.DateTime);
			PackStart (la2);
			dp.ValueChanged += delegate {
				la2.Text = "Value changed: " + dp.DateTime;
			};

			var tp = new DatePicker (DatePickerStyle.Time, DateTime.MinValue);
			PackStart (tp);

			Label la3 = new Label ("Initial Value: " + tp.DateTime);
			PackStart (la3);
			tp.ValueChanged += delegate {
				la3.Text = "Value changed: " + tp.DateTime;
			};
		}
コード例 #9
0
        private void Build()
        {
            this.Icon = Xwt.Drawing.Image.FromResource("URMSimulator.Resources.urm.png");
            this.Title = "About";
            this.Resizable = false;
            this.Buttons.Add(new DialogButton(Command.Close));

            vbox1 = new VBox();

            image1 = new ImageView();
            image1.WidthRequest = 320;
            image1.HeightRequest = 270;
            vbox1.PackStart(image1);

            labelProgramName = new Label();
            labelProgramName.TextAlignment = Alignment.Center;
            vbox1.PackStart(labelProgramName);

            labelComments = new Label();
            labelComments.TextAlignment = Alignment.Center;
            vbox1.PackStart(labelComments);

            hbox1 = new HBox();

            hbox1.PackStart(new HBox(), true);

            labelWebsite = new LinkLabel();
            labelWebsite.TextAlignment = Alignment.Center; //text aligment doesn't work with Xwt.WPF
            hbox1.PackStart(labelWebsite, false);

            hbox1.PackStart(new HBox(), true);
            vbox1.PackStart(hbox1);

            this.Content = vbox1;
        }
コード例 #10
0
ファイル: PluginTitleWidget.cs プロジェクト: fourtf/4Plug
        public PluginTitleWidget(PluginType type)
        {
            PluginType = type;

            label = new Label()
            {
                Text = type.GetName(),
                TextColor = type.GetColor(),
                Font = Font.WithScaledSize(2d),
                HeightRequest = 30,
                WidthRequest = 400,
            };

            MarginTop = 8;

            HeightRequest = 30;
            WidthRequest = 400;

            AddChild(label, 0, 0);

            if (App.InitOpacityAnimation != null)
            {
                Opacity = 0;
                App.InitOpacityAnimation(this);
            }
        }
コード例 #11
0
ファイル: RadioButtonSample.cs プロジェクト: m13253/xwt
		public RadioButtonSample ()
		{
			var b1 = new RadioButton ("Item 1");
			var b2 = new RadioButton ("Item 2 (red background)");
			b2.BackgroundColor = Xwt.Drawing.Colors.Red;
			var b3 = new RadioButton ("Item 3");
			b2.Group = b3.Group = b1.Group;
			PackStart (b1);
			PackStart (b2);
			PackStart (b3);

			var la = new Label ();
			la.Hide ();
			b1.Group.ActiveRadioButtonChanged += delegate {
				la.Show ();
				la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
			};
			PackStart (la);

			PackStart (new HSeparator ());

			var box = new VBox ();
			box.PackStart (new Label ("First Option"));
			box.PackStart (new Label ("Second line"));

			var b4 = new RadioButton (box);
			var b5 = new RadioButton ("Second Option");
			var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
			PackStart (b4);
			PackStart (b5);
			PackStart (b6);
			b4.Group = b5.Group = b6.Group;
		}
コード例 #12
0
ファイル: RadioButtonSample.cs プロジェクト: Gaushick/xwt
        public RadioButtonSample()
        {
            var b1 = new RadioButton ("Item 1");
            var b2 = new RadioButton ("Item 2");
            var b3 = new RadioButton ("Item 3");
            b2.Group = b3.Group = b1.Group;
            PackStart (b1);
            PackStart (b2);
            PackStart (b3);

            var la = new Label ();
            la.Hide ();
            b1.Group.ActiveRadioButtonChanged += delegate {
                la.Show ();
                la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
            };
            PackStart (la);

            PackStart (new HSeparator ());

            var box = new VBox ();
            box.PackStart (new Label ("First Option"));
            box.PackStart (new Label ("Second line"));

            var b4 = new RadioButton (box);
            var b5 = new RadioButton ("Second Option");
            PackStart (b4);
            PackStart (b5);
            b4.Group = b5.Group;
        }
コード例 #13
0
ファイル: Labels.cs プロジェクト: nite2006/xwt
        public Labels()
        {
            Label la = new Label ("Simple label");
            PackStart (la);

            la = new Label ("Label with red background") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0)
            };
            PackStart (la);

            la = new Label ("Label with red background and blue foreground") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
                TextColor = new Xwt.Drawing.Color (0, 0, 1)
            };
            PackStart (la);

            la = new Label ("A crazy long label text with a lots of content and information in it but fortunately it should appear wrapped");
            la.Wrap = WrapMode.Word;
            PackStart (la);

            la = new Label ("Another Label with red background") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
                TextColor = new Xwt.Drawing.Color (0, 0, 1)
            };
            PackStart (la);

            la = new Label () { Markup = "Label with <b>bold</b> and <span color='#ff0000'>red</span> text" };
            PackStart (la);

            la = new Label () { Markup = "Label with a <a href='http://xamarin.com'>link</a> to a web site." };
            PackStart (la);
        }
コード例 #14
0
ファイル: AddPluginWidget.cs プロジェクト: fourtf/4Plug
        public AddPluginWidget(PluginType type)
        {
            PluginType = type;
            HeightRequest = PluginWidget.Size.Height;
            WidthRequest = PluginWidget.Size.Width;

            Margin = PluginWidget.Margin;

            Cursor = CursorType.Hand;

            Label l = new Label("Add new " + type.GetName());
            //l.TextColor = type.GetColor();

            l.TextAlignment = Alignment.Center;

            AddChild(l, new Rectangle(0, 0, PluginWidget.Size.Width, PluginWidget.Size.Height));

            BackgroundColor = type.GetBGColor();

            if (App.InitDropShadow != null)
                App.InitDropShadow(this);

            if (App.InitOpacityAnimation != null)
            {
                Opacity = 0;
                App.InitOpacityAnimation(this);
            }
        }
コード例 #15
0
ファイル: LabelTests.cs プロジェクト: m13253/xwt
		public void AlignCenter ()
		{
			var la = new Label ("Some text here");
			la.TextAlignment = Alignment.Center;
			la.BackgroundColor = Xwt.Drawing.Colors.LightGray;
			CheckWidgetRender ("Label.AlignCenter.png", la);
		}
コード例 #16
0
ファイル: LoginView.cs プロジェクト: Luigifan/TrueCraft
        public LoginView(LauncherWindow window)
        {
            Window = window;
            this.MinWidth = 250;

            ErrorLabel = new Label("Username or password incorrect")
            {
                TextColor = Color.FromBytes(255, 0, 0),
                TextAlignment = Alignment.Center,
                Visible = false
            };
            UsernameText = new TextEntry();
            PasswordText = new PasswordEntry();
            LogInButton = new Button("Log In");
            RegisterButton = new Button("Register");
            RememberCheckBox = new CheckBox("Remember Me");
            UsernameText.Text = UserSettings.Local.Username;
            if (UserSettings.Local.AutoLogin)
            {
                PasswordText.Password = UserSettings.Local.Password;
                RememberCheckBox.Active = true;
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft-logo.png"))
                TrueCraftLogoImage = new ImageView(Image.FromStream(stream));

            UsernameText.PlaceholderText = "Username";
            PasswordText.PlaceholderText = "Password";
            PasswordText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                    LogInButton_Clicked(sender, e);
            };
            UsernameText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                    LogInButton_Clicked(sender, e);
            };
            RegisterButton.Clicked += (sender, e) =>
            {
                if (RegisterButton.Label == "Register")
                    Window.WebView.Url = "http://truecraft.io/register";
                else
                {
                    Window.User.Username = UsernameText.Text;
                    Window.User.SessionId = "-";
                    Window.MainContainer.Remove(this);
                    Window.MainContainer.PackEnd(Window.MainMenuView = new MainMenuView(Window));
                }
            };
            LogInButton.Clicked += LogInButton_Clicked;

            this.PackStart(TrueCraftLogoImage);
            this.PackEnd(RegisterButton);
            this.PackEnd(LogInButton);
            this.PackEnd(RememberCheckBox);
            this.PackEnd(PasswordText);
            this.PackEnd(UsernameText);
            this.PackEnd(ErrorLabel);
        }
コード例 #17
0
ファイル: TextEntries.cs プロジェクト: RevolutionSmythe/xwt
        public TextEntries()
        {
            TextEntry te1 = new TextEntry ();
            PackStart (te1);

            Label la = new Label ();
            PackStart (la);
            te1.Changed += delegate {
                la.Text = "Text: " + te1.Text;
            };

            PackStart (new Label ("Entry with small font"));
            TextEntry te2 = new TextEntry ();
            te2.Font = te2.Font.WithSize (te2.Font.Size / 2);
            PackStart (te2);

            PackStart (new Label ("Entry with placeholder text"));
            TextEntry te3 = new TextEntry ();
            te3.PlaceholderText = "Placeholder text";
            PackStart (te3);

            PackStart (new Label ("Entry with no frame"));
            TextEntry te4 = new TextEntry();
            te4.ShowFrame = false;
            PackStart (te4);
        }
コード例 #18
0
ファイル: MouseCursors.cs プロジェクト: m13253/xwt
		public MouseCursors ()
		{
			PackStart (new Label ("Move the mouse over the labels \nto see the cursors:"));
			var cursorTypes = typeof (CursorType).GetFields (BindingFlags.Public | BindingFlags.Static);
			var perRow = 6;

			HBox row = null;
			for (var i = 0; i < cursorTypes.Length; i++) {
				if (cursorTypes [i].FieldType != typeof (CursorType))
					continue;

				if ((i % perRow) == 0) {
					if (row != null)
						PackStart (row);
					row = new HBox ();
				}

				var cursor = (CursorType)cursorTypes [i].GetValue (typeof(CursorType));
				var label = new Label (cursorTypes [i].Name);
				label.BackgroundColor = Colors.White;
				label.Cursor = cursor;

				row.PackStart (label);
			}
			if (row != null)
				PackStart (row);
		}
コード例 #19
0
ファイル: Labels.cs プロジェクト: garuma/xwt
        public Labels()
        {
            Label la = new Label ("Simple label");
            PackStart (la);

            la = new Label ("Label with red background") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0)
            };
            PackStart (la);

            la = new Label ("Label with red background and blue foreground") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
                TextColor = new Xwt.Drawing.Color (0, 0, 1)
            };
            PackStart (la);

            la = new Label ("A crazy long label text with a lots of content and information in it but fortunately it should appear wrapped");
            la.Wrap = WrapMode.Word;
            PackStart (la);

            la = new Label ("Another Label with red background") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
                TextColor = new Xwt.Drawing.Color (0, 0, 1)
            };
            PackStart (la);
        }
コード例 #20
0
ファイル: DownloadPluginWidget.cs プロジェクト: fourtf/4Plug
        public DownloadHudWidget(string title)
        {
            PluginType = FPlug.PluginType.Downloading;
            HasBorder = true;

            progressLabel = new Label();
            progressLabel.MinWidth = 400;
            progressLabel.WidthRequest = 400;
            progressLabel.Text = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

            AddChild(new Label(title), 16, 8);

            AddChild(progressLabel, new Rectangle(16, 24, 400, 20));

            client = new WebClient() { Proxy = null };

            client.DownloadProgressChanged += (s, e) =>
            {
                Application.Invoke(() => progressLabel.Text = (e.BytesReceived < 1048576 ? e.BytesReceived / 1024 + " KiB: " : (float)(int)(((float)e.BytesReceived / 1048576) * 100) / 100 + " MiB: ") + (e.ProgressPercentage == 0 ? "?%" : e.ProgressPercentage + "%"));
            };

            client.DownloadDataCompleted += (s, e) =>
            {
                if (!e.Cancelled)
                {
                    Application.Invoke(() => progressLabel.Text = "Download Completed!");
                    if (DownloadFinished != null)
                        DownloadFinished(this, e);
                }
            };

            // client.DownloadFileAsync(new Uri("https://github.com/Sevin7/7HUD/archive/master.zip"), "7hud.zip");
        }
コード例 #21
0
ファイル: Checkboxes.cs プロジェクト: m13253/xwt
		public Checkboxes ()
		{
			var a = new CheckBox ("Normal checkbox");
			var b = new CheckBox ("Disabled") { Sensitive = false };
			var c = new CheckBox ("Allows mixed (with red background)") { AllowMixed = true };
			c.BackgroundColor = Xwt.Drawing.Colors.Red;

			a.Toggled += (sender, e) => b.Sensitive = a.Active;

			PackStart (a);
			PackStart (b);

			PackStart (new CheckBox ("Mixed to start") { AllowMixed = true, State = CheckBoxState.Mixed });
			PackStart (c);
			
			int clicks = 0, toggles = 0;
			Label la = new Label ();
			PackStart (la);
			
			c.Clicked += delegate {
				clicks++;
				la.Text = string.Format ("state:{0}, clicks:{1}, toggles:{2}", c.State, clicks, toggles);
			};
			
			c.Toggled += delegate {
				toggles++;
				la.Text = string.Format ("state:{0}, clicks:{1}, toggles:{2}", c.State, clicks, toggles);
			};
		}
コード例 #22
0
        public TaskView(IQueueableTask task)
        {
            if (task == null) throw new ArgumentNullException(nameof(task));
            Task = task;
            task.StatusChanged += Task_StatusChanged;

            _nameLabel = new Label
            {
                Font = Font.SystemFont.WithWeight(FontWeight.Bold).WithSize(15)
            };
            _descriptionlabel = new Label
            {
                Font = Font.SystemFont.WithStyle(FontStyle.Italic)
            };

            _spinner = new Spinner {Visible = false};

            var hBox = new HBox();
            hBox.PackStart(_spinner);
            hBox.PackStart(_descriptionlabel);

            PackStart(_nameLabel);
            PackStart(hBox);

            HeightRequest = 64;
            MinHeight = 64;

            UpdateLabels();
        }
コード例 #23
0
 protected virtual void PopulateViewBoxWithTitle(VBox vBox, IAsset asset)
 {
     var title = new Label(asset.Name)
     {
         Font = Font.SystemFont.WithSize(17.5).WithWeight(FontWeight.Bold)
     };
     vBox.PackStart(title);
 }
コード例 #24
0
ファイル: InternalChildrenTests.cs プロジェクト: m13253/xwt
		public void InvalidAdd3 ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			HBox b = new HBox ();
			b.PackStart (c1);
			co.Add (c1);
		}
コード例 #25
0
ファイル: LabelTests.cs プロジェクト: m13253/xwt
		public void DefaultValues ()
		{
			var la = new Label ();
			Assert.AreEqual ("", la.Text);
			Assert.AreEqual (Alignment.Start, la.TextAlignment);
			Assert.AreEqual (EllipsizeMode.None, la.Ellipsize);
			Assert.AreEqual (WrapMode.None, la.Wrap);
		}
コード例 #26
0
		void BuildUi ()
		{
			Clear ();
			var label = new Label ("Group by:");
			labels.Add (label);
			PackStart (label);
			BuildProviderSelectors (RootGroupingProvider, RootGroupingProvider.Next);
		}
コード例 #27
0
ファイル: MainWindow.cs プロジェクト: carlosalberto/xwt
        public MainWindow()
        {
            Menu menu = new Menu ();

            var file = new MenuItem ("File");
            file.SubMenu = new Menu ();
            file.SubMenu.Items.Add (new MenuItem ("Open"));
            file.SubMenu.Items.Add (new MenuItem ("New"));
            file.SubMenu.Items.Add (new MenuItem ("Close"));
            menu.Items.Add (file);

            var edit = new MenuItem ("Edit");
            edit.SubMenu = new Menu ();
            edit.SubMenu.Items.Add (new MenuItem ("Copy"));
            edit.SubMenu.Items.Add (new MenuItem ("Cut"));
            edit.SubMenu.Items.Add (new MenuItem ("Paste"));
            menu.Items.Add (edit);

            MainMenu = menu;

            HBox box = new HBox ();

            icon = Image.FromResource (typeof(App), "class.png");

            store = new TreeStore (nameCol, iconCol, widgetCol);
            samplesTree = new TreeView ();
            samplesTree.Columns.Add ("Name", iconCol, nameCol);

            AddSample (null, "Boxes", typeof(Boxes));
            AddSample (null, "Buttons", typeof(ButtonSample));
            AddSample (null, "ComboBox", typeof(ComboBoxes));
            //			AddSample (null, "Designer", typeof(Designer));
            AddSample (null, "Drag & Drop", typeof(DragDrop));
            var n = AddSample (null, "Drawing", null);
            AddSample (n, "Canvas with Widget", typeof(CanvasWithWidget));
            AddSample (n, "Chart", typeof(ChartSample));
            AddSample (n, "Transformations", typeof(DrawingTransforms));
            AddSample (null, "Images", typeof(Images));
            AddSample (null, "List View", typeof(ListView1));
            AddSample (null, "Notebook", typeof(NotebookSample));
            //			AddSample (null, "Scroll View", typeof(ScrollWindowSample));
            AddSample (null, "Text Entry", typeof(TextEntries));
            AddSample (null, "Windows", typeof(Windows));

            samplesTree.DataSource = store;

            box.PackStart (samplesTree);

            sampleBox = new VBox ();
            title = new Label ("Sample:");
            sampleBox.PackStart (title, BoxMode.None);

            box.PackStart (sampleBox, BoxMode.FillAndExpand);

            Content = box;

            samplesTree.SelectionChanged += HandleSamplesTreeSelectionChanged;
        }
コード例 #28
0
ファイル: SplashWindow.cs プロジェクト: fourtf/4Plug
        public SplashWindow()
        {
            Icon = App.Icon;

            Width = 550;

            Title = "4Plug First Use";
            Resizable = false;

            VBox V = new VBox();
            Content = V;

            Label lbl;

            lbl = new Label("A small introduction.") { Font = Font.FromName("Segoe UI Light 24"), TextColor = PluginType.Vpk.GetColor() };
            V.PackStart(lbl);

            lbl = new Label("This tool allows you to quickly enable/disable mods as well as install new ones.");
            V.PackStart(lbl);

            lbl = new Label(""); V.PackStart(lbl);

            lbl = new Label("This is what a mod looks like in 4Plug!") { Font = Font.FromName("Segoe UI Light 24"), TextColor = PluginType.Unknown.GetColor() };
            V.PackStart(lbl);

            lbl = new Label("You can enable/disable mods by clicking on the image.");
            V.PackStart(lbl);

            //lbl = new Label("Uninstalled mods are saved in the \"custom_\" instead of the \"custom\" folder of you game.");
            //V.PackStart(lbl);

            lbl = new Label("");

            DummyPluginWidget dummy = new DummyPluginWidget(lbl);
            dummy.MarginTop += 16;
            dummy.MarginBottom += 8;
            V.PackStart(dummy);

            V.PackStart(lbl);

            lbl = new Label(""); V.PackStart(lbl);

            {
                HBox box = new HBox();
                Button btn;

                btn = new Button(" Got it! ");
                box.PackEnd(btn);
                btn.Clicked += (s, e) => { Close(); };

                Label lbl2;
                lbl2 = new Label(" Feel free to leave feedback (mainmenu -> submit feedback) later ");
                box.PackStart(lbl2);
                //btn.Clicked += (s, e) => { new SubmitFeedbackWindow("via Splash Window").Run(); };

                V.PackStart(box);
            }
        }
コード例 #29
0
ファイル: FolderSelectorSample.cs プロジェクト: akrisiun/xwt
 public FolderSelectorSample()
 {
     FolderSelector fsel;
     Label label;
     PackStart (new Label ("An open file selector:"));
     PackStart (fsel = new FolderSelector ());
     PackStart (label = new Label ());
     fsel.FolderChanged += (sender, e) => { label.Text = "Folder changed: " + fsel.Folder; };
 }
コード例 #30
0
ファイル: PointPlotSample.cs プロジェクト: parnham/NPlot
        public PointPlotSample()
            : base()
        {
            infoText = "";
            infoText += "Sinc Function Example. Demonstrates - \n";
            infoText += " * Charting LinePlot and PointPlot at the same time. \n";
            infoText += " * Adding a legend.";

            plotCanvas.Clear(); // clear everything. reset fonts. remove plot components etc.

            System.Random r = new Random();
            double[] a = new double[100];
            double[] b = new double[100];
            double mult = 0.00001f;
            for (int i=0; i<100; ++i) {
                a[i] = ((double)r.Next(1000)/5000.0f-0.1f)*mult;
                if (i == 50) {
                    b[i] = 1.0f*mult;
                }
                else {
                    b[i] = Math.Sin ((((double)i-50.0)/4.0))/(((double)i-50.0)/4.0);
                    b[i] *= mult;
                }
                a[i] += b[i];
            }

            Marker m = new Marker (Marker.MarkerType.Cross1, 6, Colors.Blue);
            PointPlot pp = new PointPlot (m);
            pp.OrdinateData = a;
            pp.AbscissaData = new StartStep (-500.0, 10.0);
            pp.Label = "Random";
            plotCanvas.Add (pp);

            LinePlot lp = new LinePlot ();
            lp.OrdinateData = b;
            lp.AbscissaData = new StartStep( -500.0, 10.0 );
            lp.LineColor = Colors.Red;
            lp.LineWidth = 2;
            plotCanvas.Add (lp);

            plotCanvas.Title = "Sinc Function";
            plotCanvas.YAxis1.Label = "Magnitude";
            plotCanvas.XAxis1.Label = "Position";

            Legend legend = new Legend();
            legend.AttachTo (XAxisPosition.Top, YAxisPosition.Left);
            legend.VerticalEdgePlacement = Legend.Placement.Inside;
            legend.HorizontalEdgePlacement = Legend.Placement.Inside;
            legend.YOffset = 8;

            plotCanvas.Legend = legend;
            plotCanvas.LegendZOrder = 1; // default zorder for adding idrawables is 0, so this puts legend on top.

            PackStart (plotCanvas.Canvas, true);
            Label la = new Label (infoText);
            PackStart (la);
        }