Inheritance: Xwt.WindowFrame
コード例 #1
0
ファイル: Program.cs プロジェクト: oxyplot/oxyplot-xwt
        public static void Main(string[] args)
        {
            Application.Initialize (ToolkitType.Gtk);

            var plotModel = new PlotModel
            {
                Title = "Trigonometric functions",
                Subtitle = "Example using the FunctionSeries",
                PlotType = PlotType.Cartesian,
                Background = OxyColors.White
            };
            plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
            plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
            plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });

            var plotView = new OxyPlot.Xwt.PlotView { Model = plotModel };
            plotView.Visible = true;
            plotView.MinWidth = 400;
            plotView.MinHeight = 400;

            Window w = new Window {
                Title = "OxyPlot Xwt Demo Application",
                Width = 600,
                Height = 600,
                Content = plotView
            };

            w.CloseRequested += (s, a) => Application.Exit ();

            w.Show ();
            Application.Run ();
            w.Dispose ();
            Application.Dispose ();
        }
コード例 #2
0
ファイル: TextLinkEditMode.cs プロジェクト: radtek/datawf
        protected override void GetRequiredPosition(TextEditor Editor, Xwt.Window tipWindow, out double requiredWidth, out double xalign)
        {
            TooltipWindow win = (TooltipWindow)tipWindow;

            requiredWidth = win.SetMaxWidth(win.Screen.VisibleBounds.Width);
            xalign        = 0.5;
        }
コード例 #3
0
        WindowTransparencyDecorator(Xwt.Window window)
        {
            this.window = window;

            window.Shown    += ShownHandler;
            window.Hidden   += HiddenHandler;
            window.Disposed += DestroyedHandler;
        }
コード例 #4
0
ファイル: WidgetTests.cs プロジェクト: m13253/xwt
		public void ParentWindow ()
		{
			var w = CreateWidget ();
			var win = new Window ();
			win.Content = w;
			Assert.AreSame (win, w.ParentWindow);
			win.Dispose ();
		}
コード例 #5
0
ファイル: BoxTests.cs プロジェクト: m13253/xwt
		Box PrepareBox (Window win)
		{
			win.Padding = 0;
			win.Size = new Size (100, 100);
			var box = CreateBox ();
			win.Content = box;
			return box;
		}
コード例 #6
0
ファイル: XwtTest.cs プロジェクト: m13253/xwt
		public void CheckWidgetRender (string refImageName, Xwt.Widget widget, int winWidth = 300, int winHeight = 100)
		{
			using (var win = new Window { Width = winWidth, Height = winHeight }) {
				win.Content = widget;
				ShowWindow (win);
				var img = Toolkit.CurrentEngine.RenderWidget (widget);
				ReferenceImageManager.CheckImage (refImageName, img);
			}
		}
コード例 #7
0
 public void Run()
 {
     ApplicationExtensions.InvokeInUIThread(() => {
         var window = new Window();
         window.Width = 800;
         window.Height = 600;
         window.Content = new LogViewer(LuceneLoggerBackend.Instance);
         window.Show();
     });
 }
コード例 #8
0
ファイル: BoxTests.cs プロジェクト: m13253/xwt
		public void SinglePackExpand ()
		{
			using (Window win = new Window ()) {
				var box = PrepareBox (win);
				SquareBox c = new SquareBox ();
				box.PackStart (c, true);
				ShowWindow (win);

				Assert.AreEqual (ToScreenBounds (win, new Rectangle (0, 0, 100, 100)), c.ScreenBounds);
			}
		}
コード例 #9
0
ファイル: XwtTest.cs プロジェクト: m13253/xwt
		public void ShowWindow (Window win)
		{
			var ev = new ManualResetEvent (false);

			win.Shown += delegate {
				ev.Set ();
			};

			win.Show ();
			ev.WaitForEvent ();
			Application.MainLoop.DispatchPendingEvents ();
		}
コード例 #10
0
ファイル: ContainerTests.cs プロジェクト: m13253/xwt
		public void ChildAlignment ()
		{
			using (var win = new Window ()) {
				var c = CreateWidget ();
				win.Content = c;
				win.Size = new Size (100, 100);
				var box = new SquareBox (10);
				AddChild (c, box);
				ShowWindow (win);
				VerifyAlignment (box);
			}
		}
コード例 #11
0
ファイル: WindowTests.cs プロジェクト: StEvUgnIn/xwt
		public void DefaultSize ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				Assert.AreEqual (200, test.ScreenBounds.Width);
				Assert.AreEqual (100, test.ScreenBounds.Height);
			}
		}
コード例 #12
0
ファイル: ScrollableWidgetTests.cs プロジェクト: m13253/xwt
		public void BasicScrolling ()
		{
			var list = CreateScrollableWidget ();

			Window w = new Window ();
			w.Content = (Widget) list;
			w.Width = w.Height = 300;
			ShowWindow (w);

			// Vertical

			Assert.AreEqual (list.VerticalScrollControl.LowerValue, list.VerticalScrollControl.Value);

			int changed = 0;
			list.VerticalScrollControl.ValueChanged += delegate {
				changed++;
			};

			var mid = Math.Truncate ((list.VerticalScrollControl.UpperValue - list.VerticalScrollControl.LowerValue) / 2);
			list.VerticalScrollControl.Value = mid;

			Assert.AreEqual (1, changed);
			Assert.AreEqual (mid, list.VerticalScrollControl.Value);

			Assert.IsTrue (list.VerticalScrollControl.UpperValue > list.VerticalScrollControl.LowerValue);
			Assert.IsTrue (list.VerticalScrollControl.PageSize > 0);
			Assert.IsTrue (list.VerticalScrollControl.PageIncrement > 0);
			Assert.IsTrue (list.VerticalScrollControl.StepIncrement > 0);
			Assert.IsTrue (list.VerticalScrollControl.PageIncrement <= list.VerticalScrollControl.PageSize);

			// Horizontal

			Assert.AreEqual (list.VerticalScrollControl.LowerValue, list.HorizontalScrollControl.Value);

			changed = 0;
			list.HorizontalScrollControl.ValueChanged += delegate {
				changed++;
			};

			mid = Math.Truncate ((list.HorizontalScrollControl.UpperValue - list.HorizontalScrollControl.LowerValue) / 2);
			list.HorizontalScrollControl.Value = mid;

			Assert.AreEqual (1, changed);
			Assert.AreEqual (mid, list.HorizontalScrollControl.Value);

			Assert.IsTrue (list.HorizontalScrollControl.UpperValue > list.HorizontalScrollControl.LowerValue);
			Assert.IsTrue (list.HorizontalScrollControl.PageSize > 0);
			Assert.IsTrue (list.HorizontalScrollControl.PageIncrement > 0);
			Assert.IsTrue (list.HorizontalScrollControl.StepIncrement > 0);
			Assert.IsTrue (list.HorizontalScrollControl.PageIncrement <= list.HorizontalScrollControl.PageSize);
		}
コード例 #13
0
ファイル: WidgetTests.cs プロジェクト: jbeaurain/xwt
        public void Focus()
        {
            using (var win = new Window ()) {
                var w = CreateWidget ();

                HBox box = new HBox ();
                TextEntry e = new TextEntry ();
                box.PackStart (e);
                box.PackStart (w);
                win.Content = box;
                win.Show ();
                win.Present ();

                Application.MainLoop.DispatchPendingEvents ();

                e.SetFocus ();

                Application.MainLoop.DispatchPendingEvents ();

                Assert.IsFalse (w.HasFocus);
            //		Assert.IsTrue (w.CanGetFocus);

                int gotFocus = 0;
                w.GotFocus += delegate {
                    gotFocus++;
                };

                w.SetFocus ();

                if (w.CanGetFocus) {
                    Assert.IsTrue (w.HasFocus);
                    Assert.AreEqual (1, gotFocus);

                    int lostFocus = 0;
                    w.LostFocus += delegate {
                        lostFocus++;
                    };

                    e.SetFocus ();

                    Assert.IsFalse (w.HasFocus);
                    //			Assert.AreEqual (1, lostFocus);
                } else {
                    Assert.IsFalse (w.HasFocus);
                    Assert.AreEqual (0, gotFocus);
                }
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: sergueik/xwt_swd
        static void Main(string[] args)
        {
            string dataFolderPath = Directory.GetCurrentDirectory();
            string database = String.Format("{0}\\data.db", dataFolderPath);
            dataSource = "data source=" + database;
            tableName = "product";

            tableName = "product";

            PlotHelper.createTable(dataSource,tableName);
            PlotHelper.TestConnection(dataSource);

            // TODO: add Xwt.WPF.dll to vendor directory
            Application.Initialize(ToolkitType.Gtk);
            Window MainWindow = new Window()
            {
                Title = "Xwt Demo Application",
                Width = 500,
                Height = 400
            };
            MainWindow.CloseRequested += (o, e) =>
            {
                Application.Exit();
            };
            Menu MainMenu = new Menu();
            RichTextView TextView = new RichTextView();
            MenuItem FileOpenMenuItem = new MenuItem("???????");
            Menu FileMenu = new Menu();
            FileOpenMenuItem.Clicked += (o, e) =>
            {
                OpenFileDialog Dialog = new OpenFileDialog("??????? ????");
                if (Dialog.Run(MainWindow))
                {
                    TextView.LoadFile(Dialog.FileName, Xwt.Formats.TextFormat.Markdown);
                }
            };
            MenuItem FileMenuItem = new MenuItem("????") { SubMenu = FileMenu };
            FileMenu.Items.Add(FileOpenMenuItem);
            MainMenu.Items.Add(FileMenuItem);

            MainWindow.MainMenu = MainMenu;
            var n = new NotebookSample();

            MainWindow.Content = n;

            MainWindow.Show();
            Application.Run();
        }
コード例 #15
0
ファイル: WidgetTests.cs プロジェクト: jbeaurain/xwt
        public void Coordinates()
        {
            double padding = 40;
            using (var win = new Window ()) {
                var w = CreateWidget ();
                w.MinWidth = 1;
                w.MinHeight = 1;
                win.Content = w;
                win.Padding = padding;
                win.Location = new Point (300,300);

                ShowWindow (win);

                Assert.AreEqual (w.ScreenBounds, win.ScreenBounds.Inflate (-padding,-padding));
            }
        }
コード例 #16
0
ファイル: WindowTests.cs プロジェクト: shines77/xwt
 public void ContentMargin()
 {
     using (var win = new Window ()) {
         win.Padding = 0;
         SquareBox test = new SquareBox ();
         test.MinWidth = 200;
         test.MinHeight = 200;
         test.Margin = 5;
         win.Content = test;
         ShowWindow (win);
         Assert.AreEqual (210, win.Size.Width);
         Assert.AreEqual (210, win.Size.Height);
         Assert.AreEqual (200, test.ScreenBounds.Width);
         Assert.AreEqual (200, test.ScreenBounds.Height);
     }
 }
コード例 #17
0
ファイル: TooltipProvider.cs プロジェクト: radtek/datawf
        public virtual Xwt.Window ShowTooltipWindow(TextEditor editor, double offset, Xwt.ModifierKeys modifierState, Point mouse, TooltipItem item)
        {
            Xwt.Window tipWindow = CreateTooltipWindow(editor, offset, modifierState, item);
            if (tipWindow == null)
            {
                return(null);
            }

            var point = editor.ConvertToScreenCoordinates(mouse);

            double w;
            double xalign;

            GetRequiredPosition(editor, tipWindow, out w, out xalign);
            w += 10;

            Rectangle geometry = editor.ParentWindow.Screen.VisibleBounds;

            point.X -= (int)((double)w * xalign);
            point.Y += 10;

            if (point.X + w >= geometry.X + geometry.Width)
            {
                point.X = geometry.X + geometry.Width - w;
            }
            if (point.X < geometry.Left)
            {
                point.X = geometry.Left;
            }

            var h = tipWindow.Size.Height;

            if (point.Y + h >= geometry.Y + geometry.Height)
            {
                point.Y = geometry.Y + geometry.Height - h;
            }
            if (point.Y < geometry.Top)
            {
                point.Y = geometry.Top;
            }

            tipWindow.Location = point;

            tipWindow.Show();

            return(tipWindow);
        }
コード例 #18
0
        public static void Main(string[] args)
        {
            Mutex mutex = new System.Threading.Mutex(false, "OwnCloudCalendarConnerctor");
            try
            {
                if (mutex.WaitOne(0, false))
                {
                    string logConfigFile = AppDomain.CurrentDomain.BaseDirectory + @"config.log4net";
                    log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(logConfigFile));

                    Application.Initialize(ToolkitType.Gtk);
                    Xwt.Drawing.Image iconImage = Xwt.Drawing.Image.FromFile(@"D:\Vladimir Varagic\Privatno\Diplomski rad\svnVersion\ownCloudCalendar\trunk\ownCloudCalendarProject\ownCloudCalendar\ownCloudCalendarXWT\Images\20141129064955676_easyicon_net_32.ico");

                    var mainWindow = new Window()
                    {
                        Title = "ownCloud Calendar Client",
                        Width = 500,
                        Height = 250,
                        Icon = iconImage
                    };

                    mainWindow.Resizable = false;

                    LogIn logIn = new LogIn();

                    mainWindow.Content = logIn;

                    mainWindow.Show();
                    Application.Run();
                    mainWindow.Dispose();

                }
                else
                {
                    Application.Initialize(ToolkitType.Gtk);
                    MessageDialog.ShowMessage("An instance of the application is already running.");
                }
            }
            finally
            {
                if (mutex != null)
                {
                    mutex.Close();
                    mutex = null;
                }
            }
        }
コード例 #19
0
ファイル: Windows.cs プロジェクト: joncham/xwt
        public Windows()
        {
            Button b = new Button ("Show borderless window");
            PackStart (b);
            b.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = b.ScreenBounds;
                w.Bounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Bounds.Width, w.Bounds.Height);
                w.Show ();
            };
            b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Attach (new Label ("Some field:"), 0, 1, 0, 1);
                t.Attach (new TextEntry (), 1, 2, 0, 1);
                t.Attach (new Label ("Another field:"), 0, 1, 1, 2);
                t.Attach (new TextEntry (), 1, 2, 1, 2);
                d.Content = t;

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + r.Label;
                d.Dispose ();
            };
        }
コード例 #20
0
ファイル: LabelTests.cs プロジェクト: m13253/xwt
		public void AlignCenterWrappedChangeText ()
		{
			var la = new Label ("Some text here");
			la.TextAlignment = Alignment.Center;
			la.Wrap = WrapMode.Word;
			la.WidthRequest = 200;
			la.BackgroundColor = Xwt.Drawing.Colors.LightGray;

			using (var win = new Window { Width = 200, Height = 100 }) {
				win.Content = la;
				ShowWindow (win);
				la.Text = "Some text here Some text here";
				WaitForEvents ();
				var img = Toolkit.CurrentEngine.RenderWidget (la);
				ReferenceImageManager.CheckImage ("Label.AlignCenterWrappedChangeText.png", img);
			}
		}
コード例 #21
0
        public void Detach()
        {
            if (window == null)
            {
                return;
            }

            //remove the snooper
            HiddenHandler(null, null);

            //annul allreferences between this and the window
            window.Content.KeyPressed  -= KeyPressed;
            window.Content.KeyReleased -= KeyReleased;
            window.Shown    -= ShownHandler;
            window.Hidden   -= HiddenHandler;
            window.Disposed -= DestroyedHandler;
            window           = null;
        }
コード例 #22
0
 public void ShowAnalyser(IAnalyzableBackendAnalyzer analyzer, string name)
 {
     var guiWidget = analyzer as IHasWidget;
     if(guiWidget == null)
     {
         throw new ArgumentException("Wrong analyzer provided, expected object of type 'IHasGUIWidget'");
     }
     
     var window = new Window();
     window.Title = name;
     window.Height = 600;
     window.Width = 800;
     
     window.Content = guiWidget.Widget;
     
     openedWindows.Add(analyzer, window);
     window.Closed += (sender, e) => openedWindows.Remove(analyzer);
     
     window.Show();
 }
コード例 #23
0
ファイル: Program.cs プロジェクト: hardsoft/My-FyiReporting
        public static void Main(string [] args)
        {
            Application.Initialize("Xwt.GtkBackend.GtkEngine, Xwt.Gtk, Version=1.0.0.0");

            Window w = new Window();
            w.Title = "Xwt Demo Application";
            w.Width = 500;
            w.Height = 400;

            ReportViewer rv = new ReportViewer();
            rv.LoadReport(new Uri(@"C:\Users\Peter\Projects\My-FyiReporting\Examples\SqliteExamples\SimpleTest1.rdl"));

            w.Content = rv;

            w.Show();

            Application.Run();

            w.Dispose();
        }
コード例 #24
0
ファイル: WindowTests.cs プロジェクト: StEvUgnIn/xwt
		public void FixedContentGrowMakesWindowGrow ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				test.ForceSize = true;
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				test.Size = 300;
				// The preferred size grows, and it is bigger that the constraint provided
				// by the window (the initial size of the window), so the window grows to adapt
				WaitForEvents ();
				Assert.AreEqual (300, win.Size.Width);
				Assert.AreEqual (150, win.Size.Height);
				Assert.AreEqual (300, test.ScreenBounds.Width);
				Assert.AreEqual (150, test.ScreenBounds.Height);
			}
		}
コード例 #25
0
ファイル: WindowTests.cs プロジェクト: StEvUgnIn/xwt
		public void FlexibleContentGrowMakesWindowNotGrow ()
		{
			using (var win = new Window ()) {
				win.Padding = 0;
				var test = new VariableSizeBox (200);
				win.Content = test;
				ShowWindow (win);
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				test.Size = 300;
				// The preferred size grows, but the widget honors the constraint given
				// by the window (the initial size of the window), so it doesn't make
				// the window grow
				WaitForEvents ();
				Assert.AreEqual (200, win.Size.Width);
				Assert.AreEqual (100, win.Size.Height);
				Assert.AreEqual (200, test.ScreenBounds.Width);
				Assert.AreEqual (100, test.ScreenBounds.Height);
			}
		}
コード例 #26
0
ファイル: TreeViewTests.cs プロジェクト: m13253/xwt
		public void HiddenTree ()
		{
			var f = new DataField<string> ();
			TreeStore ts = new TreeStore (f);
			var node = ts.AddNode ().SetValue (f, "1").AddChild ().SetValue (f, "2").AddChild ().SetValue (f, "3");
			var tree = new TreeView (ts);

			Window w = new Window ();
			Notebook nb = new Notebook ();
			nb.Add (new Label ("Hi"), "One");
			nb.Add (tree, "Two");
			w.Content = nb;
			ShowWindow (w);

			tree.ScrollToRow (node.CurrentPosition);

			tree.Columns.Add ("Hi", f);

			tree.ScrollToRow (node.CurrentPosition);
		}
コード例 #27
0
ファイル: Windows.cs プロジェクト: carlosalberto/xwt
 public Windows()
 {
     Button b = new Button ("Show borderless window");
     PackStart (b);
     b.Clicked += delegate {
         Window w = new Window ();
         w.Decorated = false;
         Button c = new Button ("This is a window");
     //				c.Margin.SetAll (10);
         w.Content = c;
         c.Clicked += delegate {
             w.Dispose ();
         };
         var bpos = b.ScreenBounds;
         w.Bounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Bounds.Width, w.Bounds.Height);
         w.Show ();
     };
     b = new Button ("Show message dialog");
     PackStart (b);
     b.Clicked += delegate {
         MessageDialog.ShowMessage (ParentWindow, "Hi there!");
     };
 }
コード例 #28
0
ファイル: Windows.cs プロジェクト: RevolutionSmythe/xwt
        public Windows()
        {
            Button b = new Button ("Show borderless window");
            PackStart (b);
            b.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = b.ScreenBounds;
                w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Width, w.Height);
                w.Show ();
            };
            b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Attach (new Label ("Some field:"), 0, 1, 0, 1);
                t.Attach (new TextEntry (), 1, 2, 0, 1);
                t.Attach (new Label ("Another field:"), 0, 1, 1, 2);
                t.Attach (new TextEntry (), 1, 2, 1, 2);
                d.Content = t;

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + r.Label;
                d.Dispose ();
            };

            b = new Button ("Show Open File dialog");
            PackStart (b);
            b.Clicked += delegate {
                OpenFileDialog dlg = new OpenFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Save File dialog");
            PackStart (b);
            b.Clicked += delegate {
                SaveFileDialog dlg = new SaveFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Select Folder dialog (Multi select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder");
                dlg.Multiselect = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder");
                dlg.Multiselect = false;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Color dialog");
            PackStart (b);
            b.Clicked += delegate {
                SelectColorDialog dlg = new SelectColorDialog ("Select a color");
                dlg.SupportsAlpha = true;
                dlg.Color = Xwt.Drawing.Colors.AliceBlue;
                if (dlg.Run (ParentWindow))
                    MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ());
            };

            b = new Button("Show window shown event");
            PackStart(b);
            b.Clicked += delegate
            {
                Window w = new Window();
                w.Decorated = false;
                Button c = new Button("This is a window with events on");
                w.Content = c;
                c.Clicked += delegate
                {
                    w.Dispose();
                };
                w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown");
                w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden");

                w.Show();

            };
        }
コード例 #29
0
ファイル: WidgetTests.cs プロジェクト: jbeaurain/xwt
        public void MinSize()
        {
            using (var win = new Window ()) {
                var w = CreateWidget ();

                VBox box1 = new VBox ();
                HBox box2 = new HBox ();
                HBox f = new HBox ();
                f.MinWidth = 10;
                f.MinHeight = 10;
                box1.PackStart (box2);
                box2.PackStart (f);
                f.PackStart (w, BoxMode.FillAndExpand);
                win.Content = box1;

                ShowWindow (win);

                var defw = w.Size.Width;
                var defh = w.Size.Height;

                w.MinWidth = 300;
                w.MinHeight = 400;
                WaitForEvents ();
                Assert.AreEqual (300d, w.MinWidth);
                Assert.AreEqual (300d, w.Size.Width);

                Assert.AreEqual (400d, w.MinHeight);
                Assert.AreEqual (400d, w.Size.Height);

                w.MinWidth = -1;
                w.MinHeight = -1;

                WaitForEvents ();
                Assert.AreEqual (-1, w.MinWidth);
                Assert.AreEqual (defw, w.Size.Width);

                Assert.AreEqual (-1, w.MinHeight);
                Assert.AreEqual (defh, w.Size.Height);
            }
        }
コード例 #30
0
ファイル: TooltipProvider.cs プロジェクト: radtek/datawf
 public virtual bool IsInteractive(TextEditor editor, Xwt.Window tipWindow)
 {
     return(false);
 }
コード例 #31
0
        private void btnSyncCalendar_Click()
        {
            try
            {
                string validationMessage = ValidateControls();

                if (!String.IsNullOrEmpty(validationMessage))
                {
                    MessageDialog.ShowError(this.ParentWindow, validationMessage);
                    return;
                }

                IICalendarCollection iCalCollection = GetCalendarEventsData();

                if (iCalCollection == null)
                {
                    MessageDialog.ShowMessage(this.ParentWindow, "There is no calendar with the name " + txtCalendarName.Text.Trim());
                }
                else
                {
                    Hide();
                    int? syncTimerInterval = null;
                    if (!String.IsNullOrEmpty(txtTimerInterval.Text))
                    {
                        syncTimerInterval = Convert.ToInt32(txtTimerInterval.Text);
                    }

                    this.ParentWindow.Hide();

                    var eventListWindow = new Window()
                    {
                        Title = "ownCloud Calendar Client",
                        Width = 500,
                        Height = 500
                    };
                    eventListWindow.Resizable = false;
                    eventListWindow.ShowInTaskbar = false;
                    EventsList eventsList = new EventsList(iCalCollection, cbAutomaticSync.Active, syncTimerInterval, txtCalendarName.Text, serverUrl, username, password, serverAddress);
                    eventListWindow.Content = eventsList;
                    eventListWindow.Show();

                    if (eventsList.IsHiden)
                    {
                        HideForm();
                    }
                    else
                    {
                        //this.ParentWindow.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
コード例 #32
0
ファイル: ImageBuilder.cs プロジェクト: samclarke/xwt
 public BitmapImage ToBitmap(Window renderTarget, ImageFormat format = ImageFormat.ARGB32)
 {
     return ToVectorImage ().ToBitmap (renderTarget, format);
 }
コード例 #33
0
ファイル: WidgetTests.cs プロジェクト: nite2006/xwt
        public void RequestedSize()
        {
            using (var win = new Window ()) {
                var w = CreateWidget ();

                VBox box1 = new VBox ();
                HBox box2 = new HBox ();
                HBox f = new HBox ();
                box1.PackStart (box2);
                box2.PackStart (f);
                f.PackStart (w, true);
                win.Content = box1;

                ShowWindow (win);

                WaitForEvents ();
                var defw = w.Size.Width;
                var defh = w.Size.Height;

                w.WidthRequest = 300;
                w.HeightRequest = 400;
                WaitForEvents ();
                Assert.AreEqual (300d, w.WidthRequest);
                Assert.AreEqual (300d, w.Size.Width);

                Assert.AreEqual (400d, w.HeightRequest);
                Assert.AreEqual (400d, w.Size.Height);

                // Size request has priority over min size

                w.MinWidth = 310;
                w.MinHeight = 410;
                WaitForEvents ();
                Assert.AreEqual (300d, w.Size.Width);
                Assert.AreEqual (400d, w.Size.Height);

                w.MinWidth = 290;
                w.MinHeight = 390;
                WaitForEvents ();
                Assert.AreEqual (300d, w.Size.Width);
                Assert.AreEqual (400d, w.Size.Height);

                // Size request has priority over preferred size, so it can make a widget smaller than the default size

                w.MinWidth = -1;
                w.MinHeight = -1;

                if (defw > 1) {
                    w.WidthRequest = defw - 1;
                    WaitForEvents ();
                    Assert.AreEqual (defw - 1, w.WidthRequest);
                    Assert.AreEqual (defw - 1, w.Size.Width);
                }
                if (defh > 1) {
                    w.HeightRequest = defh - 1;
                    WaitForEvents ();
                    Assert.AreEqual (defh - 1, w.HeightRequest);
                    Assert.AreEqual (defh - 1, w.Size.Height);
                }

                w.WidthRequest = -1;
                w.HeightRequest = -1;

                WaitForEvents ();
                Assert.AreEqual (-1, w.WidthRequest);
                Assert.AreEqual (defw, w.Size.Width);

                Assert.AreEqual (-1, w.HeightRequest);
                Assert.AreEqual (defh, w.Size.Height);
            }
        }
コード例 #34
0
ファイル: WidgetTests.cs プロジェクト: nite2006/xwt
        public void MinSize()
        {
            using (var win = new Window ()) {
                var w = CreateWidget ();

                VBox box1 = new VBox ();
                HBox box2 = new HBox ();
                HBox f = new HBox ();
                f.MinWidth = 10;
                f.MinHeight = 10;
                box1.PackStart (box2);
                box2.PackStart (f);
                f.PackStart (w, true);
                win.Content = box1;

                ShowWindow (win);

                WaitForEvents ();
                var defw = w.Size.Width;
                var defh = w.Size.Height;

                // Min size has priority over the preferred size

                w.MinWidth = 300;
                w.MinHeight = 400;
                WaitForEvents ();
                Assert.AreEqual (300d, w.MinWidth);
                Assert.AreEqual (300d, w.Size.Width);

                Assert.AreEqual (400d, w.MinHeight);
                Assert.AreEqual (400d, w.Size.Height);

                if (defw > 1) {
                    w.MinWidth = defw - 1;
                    WaitForEvents ();
                    Assert.AreEqual (defw - 1, w.MinWidth);
                    Assert.AreEqual (defw, w.Size.Width);
                }
                if (defh > 1) {
                    w.MinHeight = defh - 1;
                    WaitForEvents ();
                    Assert.AreEqual (defh - 1, w.MinHeight);
                    Assert.AreEqual (defh, w.Size.Height);
                }

                w.MinWidth = -1;
                w.MinHeight = -1;

                WaitForEvents ();
                Assert.AreEqual (-1, w.MinWidth);
                Assert.AreEqual (defw, w.Size.Width);

                Assert.AreEqual (-1, w.MinHeight);
                Assert.AreEqual (defh, w.Size.Height);
            }
        }
コード例 #35
0
ファイル: TooltipProvider.cs プロジェクト: radtek/datawf
 protected virtual void GetRequiredPosition(TextEditor editor, Xwt.Window tipWindow, out double requiredWidth, out double xalign)
 {
     requiredWidth = tipWindow.Width;
     xalign        = 0.5;
 }
コード例 #36
0
ファイル: Windows.cs プロジェクト: nite2006/xwt
        public Windows()
        {
            Button bp = new Button ("Show borderless window");
            PackStart (bp);
            bp.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = bp.ScreenBounds;
                w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + bp.Size.Height, w.Width, w.Height);
                w.Show ();
            };
            Button b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Add (new Label ("Some field:"), 0, 0);
                t.Add (new TextEntry (), 1, 0);
                t.Add (new Label ("Another field:"), 0, 1);
                t.Add (new TextEntry (), 1, 1);
                d.Content = t;
                d.CloseRequested += delegate(object sender, CloseRequestedEventArgs args) {
                    args.AllowClose = MessageDialog.Confirm ("Really close?", Command.Close);
                };

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + (r != null ? r.Label : "(Closed)");
                d.Dispose ();
            };

            b = new Button ("Show Open File dialog");
            PackStart (b);
            b.Clicked += delegate {
                OpenFileDialog dlg = new OpenFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Save File dialog");
            PackStart (b);
            b.Clicked += delegate {
                SaveFileDialog dlg = new SaveFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Select Folder dialog (Multi select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder");
                dlg.Multiselect = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder");
                dlg.Multiselect = false;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select, allow creation)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select or create a folder");
                dlg.Multiselect = false;
                dlg.CanCreateFolders = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected/created!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Color dialog");
            PackStart (b);
            b.Clicked += delegate {
                SelectColorDialog dlg = new SelectColorDialog ("Select a color");
                dlg.SupportsAlpha = true;
                dlg.Color = Xwt.Drawing.Colors.AliceBlue;
                if (dlg.Run (ParentWindow))
                    MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ());
            };

            b = new Button("Show window shown event");
            PackStart(b);
            b.Clicked += delegate
            {
                Window w = new Window();
                w.Decorated = false;
                Button c = new Button("This is a window with events on");
                w.Content = c;
                c.Clicked += delegate
                {
                    w.Dispose();
                };
                w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown");
                w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden");

                w.Show();

            };

            b = new Button("Show dialog with dynamically updating content");
            PackStart(b);
            b.Clicked += delegate
            {
                var dialog = new Dialog ();
                dialog.Content = new Label ("Hello World");
                Xwt.Application.TimeoutInvoke (TimeSpan.FromSeconds (2), () => {
                    dialog.Content = new Label ("Goodbye World");
                    return false;
                });
                dialog.Run ();
            };
        }
コード例 #37
0
 public static WindowTransparencyDecorator Attach(Xwt.Window window)
 {
     return(new WindowTransparencyDecorator(window));
 }
コード例 #38
0
        public static void Main(string[] args)
        {
            Application.Initialize();

            var w = new Xwt.Window();

            w.Padding = 0;
            w.Title   = "Teststestse";
            w.Hidden += (object s, EventArgs ea) => {
                Application.Exit();
                w.Dispose();
            };

            var vb = new VBox();

            w.Content = vb;

            TooltipWindow ttw = null;
            var           b   = new Button("Show tooltip");

            b.Clicked += (object s, EventArgs ea) => {
                if (ttw != null)
                {
                    ttw.Dispose();
                }

                ttw = new TooltipWindow();
                ttw.TransientFor = w;
                ttw.Show();
            };

            vb.PackStart(b);

            b          = new Button("Hide tooltip");
            b.Clicked += (object s, EventArgs ea) => {
                if (ttw != null)
                {
                    ttw.Dispose();
                }
            };

            vb.PackStart(b);

            var mc = new MyMainComponent();

            mc.LineColor        = Colors.Green;
            mc.ExpandHorizontal = true;
            vb.PackStart(mc);

            var scr = new HScrollbar();

            scr.ExpandHorizontal = true;
            vb.PackEnd(scr);

            scr.LowerValue    = 0;
            scr.UpperValue    = 1;
            scr.PageSize      = 0.05;
            scr.PageIncrement = 0.05;


            mc = new MyMainComponent {
                LineColor = Colors.Blue, WidthRequest = 400, HeightRequest = 40
            };
            vb.PackEnd(mc);
            mc.ExpandHorizontal = true;
            mc.ExpandVertical   = true;

            scr.ValueChanged += (object o, EventArgs ea) =>
            {
                mc.modValue = scr.Value;
                mc.QueueDraw();
            };

            var button = new Button("Hello");

            mc.AddChild(button, 50, 20);

            w.Show();



            Application.Run();
            Application.Dispose();
        }