예제 #1
0
        public ReportViewer()
        {
            // Setup layout boxes
            vboxContents = new Xwt.VBox();
            vboxToolMenu = new Xwt.HBox();

            // Setup tool button menu
            Xwt.Button buttonExport = new Xwt.Button("Export");
            buttonExport.Clicked += delegate(object sender, EventArgs e) {
                SaveAs();
            };
            vboxToolMenu.PackStart(buttonExport);

            Xwt.Button buttonPrint = new Xwt.Button("Print");
            vboxToolMenu.PackStart(buttonPrint);

            // Add vboxContent widgets
            vboxPages = new Xwt.VBox();
            vboxContents.PackStart(vboxToolMenu);
            vboxContents.PackStart(vboxPages);

            // Setup Controls Contents
            scrollView = new Xwt.ScrollView();
            scrollView.Content = vboxContents;
            scrollView.VerticalScrollPolicy = ScrollPolicy.Automatic;
            scrollView.BorderVisible = true;
            this.PackStart(scrollView, BoxMode.FillAndExpand);

            Parameters = new ListDictionary();

            ShowErrors = false;
        }
예제 #2
0
        public ReportViewer()
        {
            // Setup layout boxes
            vboxContents = new Xwt.VBox();
            vboxToolMenu = new Xwt.HBox();

            // Setup tool button menu
            Xwt.Button buttonExport = new Xwt.Button("Export");
            buttonExport.Clicked += delegate(object sender, EventArgs e)
            {
                SaveAs();
            };
            vboxToolMenu.PackStart(buttonExport);

            Xwt.Button buttonPrint = new Xwt.Button("Print");
            vboxToolMenu.PackStart(buttonPrint);

            // Add vboxContent widgets
            vboxPages = new Xwt.VBox();
            vboxContents.PackStart(vboxToolMenu);
            vboxContents.PackStart(vboxPages);


            // Setup Controls Contents
            scrollView         = new Xwt.ScrollView();
            scrollView.Content = vboxContents;
            scrollView.VerticalScrollPolicy = ScrollPolicy.Automatic;
            scrollView.BorderVisible        = true;
            this.PackStart(scrollView, true, true);

            Parameters = new ListDictionary();

            ShowErrors = false;
        }
예제 #3
0
        static void Main(string[] args)
        {
#if GTK
            Application.Initialize(Xwt.ToolkitType.Gtk);
#else
            Application.Initialize(Xwt.ToolkitType.XamMac);
#endif
            var mainWindow = new MacXwtAccInspectorWindow();
            mainWindow.Width  = 1024;
            mainWindow.Height = 768;
            mainWindow.Title  = "Example Debug Xwt.Mac";
            var verticalBox = new Xwt.VBox();
            mainWindow.Content = verticalBox;

            var hbox = new Xwt.HBox();
            hbox.PackStart(new Xwt.Label("First"));
            hbox.PackStart(new Xwt.Label("Second"));
            hbox.PackStart(new Xwt.TextEntry()
            {
                Text = "Text1"
            });
            hbox.PackStart(new Xwt.Button()
            {
                Label = "Button1"
            });
            verticalBox.PackStart(hbox);

            mainWindow.Show();

            Application.Run();
            mainWindow.Dispose();
        }
예제 #4
0
        public DeviceListControl()
        {
            deviceListStoreMirror = new List <DeviceInfo> ();

            uiThreadScheduler = TaskScheduler.Current;

            //
            // Device List
            //
            deviceListStore = new ListStore(idField, enabledField, nameField);
            deviceListView  = new ListView(deviceListStore);
            var enabledColumn = new Xwt.ListViewColumn(
                "Enabled",
                new Xwt.CheckBoxCellView(enabledField)
            {
                Editable = true
            });

            deviceListView.Columns.Add(enabledColumn);
            var nameColumn = new Xwt.ListViewColumn(
                "Device",
                new Xwt.TextCellView(nameField)
            {
                Editable = false
            });

            deviceListView.Columns.Add(nameColumn);

            deviceList.CollectionChanged += (s, e) => {
                Application.Invoke(() => Devices_CollectionChanged(s, e));
            };
            PrepopulateList();
            deviceListView.ButtonPressed += DeviceListView_ButtonPressed;

            //
            // Toolbar
            //
            var toolbar = new Xwt.HBox();

            toolbar.PackStart(refreshButton);
            toolbar.PackStart(statusLabel);
            refreshButton.Clicked += RefreshButton_Clicked;

            //
            // Main UI
            //
            var vbox = new Xwt.VBox();

            vbox.PackStart(toolbar);
            vbox.PackStart(deviceListView, fill: true, expand: true);

            Widget = vbox;
        }
예제 #5
0
        public ReportViewer()
        {
            vboxPages          = new Xwt.VBox();
            scrollView         = new Xwt.ScrollView();
            scrollView.Content = vboxPages;
            scrollView.VerticalScrollPolicy = ScrollPolicy.Always;
            scrollView.BorderVisible        = true;
            this.PackStart(scrollView, BoxMode.FillAndExpand);

            Parameters = new ListDictionary();

            ShowErrors = false;
        }
예제 #6
0
        public ReportViewer()
        {
            vboxPages = new Xwt.VBox();
            scrollView = new Xwt.ScrollView();
            scrollView.Content = vboxPages;
            scrollView.VerticalScrollPolicy = ScrollPolicy.Automatic;
            scrollView.BorderVisible = true;
            this.PackStart(scrollView, BoxMode.FillAndExpand);

            Parameters = new ListDictionary();

            ShowErrors = false;
        }
예제 #7
0
        public void Update(IEnumerable <object> content)
        {
            // Translate intermediate objects to UIElements.
            var contentViewElements = content.Select(
                item => this.viewElementFactoryService.CreateViewElement <Xwt.Widget>(
                    this.textView, item))
                                      .Where(item => item != null);

            var vbox = new Xwt.VBox();

            foreach (var view in contentViewElements)
            {
                vbox.PackStart(view, margin: 4);
            }
            this.popup.Content = vbox;
        }
예제 #8
0
        public override Xwt.Widget Makeup(IXwtWrapper Parent)
        {
            Xwt.Notebook Target = new Xwt.Notebook()
            {
                TabOrientation = this.Orientation
            };

            InitWidget(Target, Parent);

            if (this.Tabs != null)
            foreach (XwtNotebookTabNode Node in this.Tabs)
            {
                Xwt.Widget TWidget;
                if (Node.Items != null && Node.Items.Count() > 0)
                    TWidget = Node.Items[0].Makeup(Parent);
                else TWidget = new Xwt.VBox();
                Target.Add(TWidget, Node.Text);
            }

            Target.CurrentTabIndex = this.CurrentTab;

            return Target;
        }
예제 #9
0
        public void Update(IEnumerable <object> content)
        {
            // Translate intermediate objects to UIElements.
            var contentViewElements = content.Select(
                item => this.viewElementFactoryService.CreateViewElement <Xwt.Widget>(
                    this.textView, item))
                                      .Where(item => item != null);

            //var control = new WpfToolTipControl (this.WpfTextView) {
            //	// Translate intermediate to UI.
            //	DataContext = new WpfToolTipViewModel (
            //		this.parameters,
            //		contentViewElements,
            //		this.presenterStyle)
            //};
            var vbox = new Xwt.VBox();

            foreach (var view in contentViewElements)
            {
                vbox.PackStart(view);
            }
            this.popup.Content = vbox;
        }
예제 #10
0
        public ButtonSample()
        {
            Button b1 = new Button("Click me");

            b1.Clicked += delegate {
                b1.Label = "Clicked!";
            };
            PackStart(b1);

            Button b2 = new Button("Click me");

            b2.Style    = ButtonStyle.Flat;
            b2.Clicked += delegate {
                b2.Label = "Clicked!";
            };
            PackStart(b2);

            PackStart(new Button(StockIcons.ZoomIn.WithSize(22)));
            PackStart(new Button(new CustomImage().WithSize(22), "with red background")
            {
                BackgroundColor = Colors.Red
            });

            MenuButton mb  = new MenuButton("This is a Menu Button");
            Menu       men = new Menu();

            men.Items.Add(new MenuItem("First"));
            men.Items.Add(new MenuItem("Second"));
            men.Items.Add(new MenuItem("Third"));
            men.Items.Add(new SeparatorMenuItem());
            men.Items.Add(new CheckBoxMenuItem("Check")
            {
                Checked = true
            });
            men.Items.Add(new RadioButtonMenuItem("Radio")
            {
                Checked = true
            });
            men.Items.Add(new MenuItem("With image")
            {
                Image = Image.FromResource(typeof(App), "class.png")
            });

            mb.Menu = men;
            PackStart(mb);
            foreach (var mi in men.Items)
            {
                var cmi = mi;
                mi.Clicked += delegate {
                    mb.Label = cmi.Label + " Clicked";
                };
            }

            ToggleButton tb = new ToggleButton("Toggle me");

            PackStart(tb);

            var b = new Button("Mini button");

            b.Style = ButtonStyle.Borderless;
            PackStart(b);

            tb       = new ToggleButton("Mini toggle");
            tb.Style = ButtonStyle.Borderless;
            PackStart(tb);

            b      = new Button(" ? ");
            b.Type = ButtonType.Help;
            PackStart(b);


            var child     = new VBox();
            var container = new MyWidget {
                Content = child
            };

            var button = new Xwt.Button("Click to add a child");

            button.Clicked += delegate {
                child.PackStart(new Xwt.Label("Child" + child.Children.Count()));
            };

            var content = new Xwt.VBox();

            content.PackStart(button);
            content.PackStart(container);

            PackStart(content);
        }
예제 #11
0
        public ButtonSample()
        {
            Button b1 = new Button ("Click me");
            b1.Clicked += delegate {
                b1.Label = "Clicked!";
            };
            PackStart (b1);

            Button b2 = new Button ("Click me");
            b2.Style = ButtonStyle.Flat;
            b2.Clicked += delegate {
                b2.Label = "Clicked!";
            };
            PackStart (b2);

            PackStart (new Button (Image.FromIcon (StockIcons.ZoomIn, IconSize.Medium)));

            MenuButton mb = new MenuButton ("This is a Menu Button");
            Menu men = new Menu ();
            men.Items.Add (new MenuItem ("First"));
            men.Items.Add (new MenuItem ("Second"));
            men.Items.Add (new MenuItem ("Third"));
            men.Items.Add (new SeparatorMenuItem ());
            men.Items.Add (new CheckBoxMenuItem ("Check") { Checked = true });
            men.Items.Add (new RadioButtonMenuItem ("Radio") { Checked = true });
            men.Items.Add (new MenuItem ("With image") { Image = Image.FromResource (typeof(App), "class.png") });

            mb.Menu = men;
            PackStart (mb);
            foreach (var mi in men.Items) {
                var cmi = mi;
                mi.Clicked += delegate {
                    mb.Label = cmi.Label + " Clicked";
                };
            }

            ToggleButton tb = new ToggleButton ("Toggle me");
            PackStart (tb);

            var b = new Button ("Mini button");
            b.Style = ButtonStyle.Borderless;
            PackStart (b);

            tb = new ToggleButton ("Mini toggle");
            tb.Style = ButtonStyle.Borderless;
            PackStart (tb);

            var child = new VBox ();
            var container = new MyWidget { Content = child };

            var button = new Xwt.Button ("Click to add a child");
            button.Clicked += delegate {
                child.PackStart (new Xwt.Label ("Child" + child.Children.Count ()), BoxMode.Fill);
            };

            var content = new Xwt.VBox ();
            content.PackStart (button, BoxMode.Fill);
            content.PackStart (container, BoxMode.Fill);

            PackStart (content);
        }
예제 #12
0
파일: Buttons.cs 프로젝트: sergueik/xwt_swd
        public ButtonSample()
        {
            Button b1 = new Button("Click me");
            b1.Clicked += delegate
            {
                b1.Label = "Clicked!";
            };
            PackStart(b1, false, false);

            Button b2 = new Button("Click me");
            b2.Style = ButtonStyle.Flat;
            b2.Clicked += delegate
            {
                b2.Label = "Clicked!";
            };
            PackStart(b2);

            PackStart(new Button(StockIcons.ZoomIn.WithSize(22)));
            PackStart(new Button(StockIcons.ZoomIn.WithSize(32), "Custom Size") { WidthRequest = 110, MinHeight = 50 });

            var hbox = new HBox();
            hbox.PackStart(new Button(StockIcons.ZoomIn.WithSize(22), "Zoom In") { ImagePosition = ContentPosition.Top });
            hbox.PackStart(new Button(StockIcons.ZoomOut.WithSize(22), "Zoom Out") { ImagePosition = ContentPosition.Bottom });
            hbox.PackStart(new Button(StockIcons.Information.WithSize(48), "Info") { ImagePosition = ContentPosition.Top }, true);
            hbox.PackEnd(new Button("Custom" + Environment.NewLine + "Width") { MinWidth = 110 });
            PackStart(hbox);

            PackStart(new Button(new CustomImage().WithSize(22), "with red background") { BackgroundColor = Colors.Red });

            MenuButton mb = new MenuButton("This is a Menu Button");
            Menu men = new Menu();
            men.Items.Add(new MenuItem("First"));
            men.Items.Add(new MenuItem("Second"));
            men.Items.Add(new MenuItem("Third"));
            men.Items.Add(new SeparatorMenuItem());
            men.Items.Add(new CheckBoxMenuItem("Check") { Checked = true });
            men.Items.Add(new RadioButtonMenuItem("Radio") { Checked = true });
            men.Items.Add(new MenuItem("With image") { Image = Image.FromResource(typeof(App), "class.png") });

            mb.Menu = men;
            PackStart(mb);
            foreach (var mi in men.Items)
            {
                var cmi = mi;
                mi.Clicked += delegate
                {
                    mb.Label = cmi.Label + " Clicked";
                };
            }

            ToggleButton tb1 = new ToggleButton("Toggle me");
            ToggleButton tb2 = new ToggleButton("Mini toggle");
            tb1.Toggled += delegate(object sender, EventArgs e)
            {
                if (tb1.Active)
                    tb1.Label = "Toggled";
                else
                    tb1.Label = "Untoggled";
                tb2.Active = tb1.Active;
            };
            PackStart(tb1);

            var b = new Button("Mini button");
            b.Style = ButtonStyle.Borderless;
            PackStart(b);

            tb2.Style = ButtonStyle.Borderless;
            tb2.Toggled += delegate(object sender, EventArgs e)
            {
                if (tb2.Active)
                    tb2.Label = "Toggled";
                else
                    tb2.Label = "Untoggled";
                tb1.Active = tb2.Active;
            };
            PackStart(tb2);

            b = new Button(" ? ");
            b.Type = ButtonType.Help;
            PackStart(b);

            var child = new VBox();
            var container = new MyWidget { Content = child };

            var button = new Xwt.Button("Click to add a child");
            /*
            button.Clicked += delegate {
                child.PackStart (new Xwt.Label ("Child" + child.Children.Count ()));
            };
            */
            var content = new Xwt.VBox();
            content.PackStart(button);
            content.PackStart(container);

            PackStart(content);
        }
예제 #13
0
        public ButtonSample()
        {
            Button b1 = new Button("Click me");

            b1.Clicked += delegate {
                b1.Label = "Clicked!";
            };
            PackStart(b1, false, false);

            Button b2 = new Button("Click me");

            b2.Style    = ButtonStyle.Flat;
            b2.Clicked += delegate {
                b2.Label = "Clicked!";
            };
            PackStart(b2);

            PackStart(new Button(StockIcons.ZoomIn.WithSize(22)));
            PackStart(new Button(StockIcons.ZoomIn.WithSize(32), "Custom Size")
            {
                WidthRequest = 110, MinHeight = 50
            });

            var hbox = new HBox();

            hbox.PackStart(new Button(StockIcons.ZoomIn.WithSize(22), "Zoom In")
            {
                ImagePosition = ContentPosition.Top
            });
            hbox.PackStart(new Button(StockIcons.ZoomOut.WithSize(22), "Zoom Out")
            {
                ImagePosition = ContentPosition.Bottom
            });
            hbox.PackStart(new Button(StockIcons.Information.WithSize(48), "Info")
            {
                ImagePosition = ContentPosition.Top
            }, true);
            hbox.PackEnd(new Button("Custom" + Environment.NewLine + "Width")
            {
                MinWidth = 110
            });
            PackStart(hbox);


            PackStart(new Button(new CustomImage().WithSize(22), "with red background")
            {
                BackgroundColor = Colors.Red
            });

            MenuButton mb  = new MenuButton("This is a Menu Button");
            Menu       men = new Menu();

            men.Items.Add(new MenuItem("First"));
            men.Items.Add(new MenuItem("Second"));
            men.Items.Add(new MenuItem("Third"));
            men.Items.Add(new SeparatorMenuItem());
            men.Items.Add(new MenuItem()
            {
                Markup = "<span color='blue'>Formatted</span> Item"
            });
            men.Items.Add(new SeparatorMenuItem()); men.Items.Add(new CheckBoxMenuItem("Check")
            {
                Checked = true
            });
            men.Items.Add(new RadioButtonMenuItem("Radio")
            {
                Checked = true
            });
            men.Items.Add(new MenuItem("With image")
            {
                Image = Image.FromResource(typeof(App), "class.png")
            });

            mb.Menu = men;
            PackStart(mb);
            foreach (var mi in men.Items)
            {
                var cmi = mi;
                mi.Clicked += delegate {
                    mb.Markup = cmi.Markup ?? cmi.Label + " Clicked";
                };
            }

            ToggleButton tb1 = new ToggleButton("Toggle me");
            ToggleButton tb2 = new ToggleButton("Mini toggle");

            tb1.Toggled += delegate(object sender, EventArgs e) {
                if (tb1.Active)
                {
                    tb1.Label = "Toggled";
                }
                else
                {
                    tb1.Label = "Untoggled";
                }
                tb2.Active = tb1.Active;
            };
            PackStart(tb1);

            var b = new Button("Mini button");

            b.Style = ButtonStyle.Borderless;
            PackStart(b);

            tb2.Style    = ButtonStyle.Borderless;
            tb2.Toggled += delegate(object sender, EventArgs e) {
                if (tb2.Active)
                {
                    tb2.Label = "Toggled";
                }
                else
                {
                    tb2.Label = "Untoggled";
                }
                tb1.Active = tb2.Active;
            };
            PackStart(tb2);

            b      = new Button(" ? ");
            b.Type = ButtonType.Help;
            PackStart(b);

            var fb = new Button("Formatted Content Button");

            fb.Markup = "<b>Formatted</b> <span color='blue'>Content</span> Button";
            PackStart(fb);

            var child     = new VBox();
            var container = new MyWidget {
                Content = child
            };

            var button = new Xwt.Button("Click to add a child");

            button.Clicked += delegate {
                child.PackStart(new Xwt.Label("Child" + child.Children.Count()));
            };

            var content = new Xwt.VBox();

            content.PackStart(button);
            content.PackStart(container);

            PackStart(content);
        }
예제 #14
0
        public DefaultColorSelectorBackend()
        {
            HBox  box    = new HBox();
            Table selBox = new Table();

            hsBox                   = new HueBox();
            hsBox.Light             = 0.5;
            lightBox                = new LightBox();
            hsBox.SelectionChanged += delegate {
                lightBox.Hue        = hsBox.SelectedColor.Hue;
                lightBox.Saturation = hsBox.SelectedColor.Saturation;
            };

            colorBox = new ColorSelectionBox()
            {
                MinHeight = 20
            };

            selBox.Add(hsBox, 0, 0);
            selBox.Add(lightBox, 1, 0);

            box.PackStart(selBox);

            const int entryWidth = 40;
            VBox      entryBox   = new VBox();
            Table     entryTable = new Table();

            entryTable.Add(CreateLabel(Application.TranslationCatalog.GetString("Color:")), 0, 0);
            entryTable.Add(colorBox, 1, 0, colspan: 4);
            entryTable.Add(new HSeparator(), 0, 1, colspan: 5);

            int r        = 2;
            var hueLabel = CreateLabel();

            entryTable.Add(hueLabel, 0, r);
            entryTable.Add(hueEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 360, Digits = 0, IncrementValue = 1
            }, 1, r++);
            SetupEntry(hueEntry, hueLabel, Application.TranslationCatalog.GetString("Hue"));

            var satLabel = CreateLabel();

            entryTable.Add(satLabel, 0, r);
            entryTable.Add(satEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1
            }, 1, r++);
            SetupEntry(satEntry, satLabel, Application.TranslationCatalog.GetString("Saturation"));

            var lightLabel = CreateLabel();

            entryTable.Add(lightLabel, 0, r);
            entryTable.Add(lightEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 100, Digits = 0, IncrementValue = 1
            }, 1, r++);
            SetupEntry(lightEntry, lightLabel, Application.TranslationCatalog.GetString("Light"));

            r = 2;
            var redLabel = CreateLabel();

            entryTable.Add(redLabel, 3, r);
            entryTable.Add(redEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);
            SetupEntry(redEntry, redLabel, Application.TranslationCatalog.GetString("Red"));

            var greenLabel = CreateLabel();

            entryTable.Add(greenLabel, 3, r);
            entryTable.Add(greenEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);
            SetupEntry(greenEntry, greenLabel, Application.TranslationCatalog.GetString("Green"));

            var blueLabel = CreateLabel();

            entryTable.Add(blueLabel, 3, r);
            entryTable.Add(blueEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r++);
            SetupEntry(blueEntry, blueLabel, Application.TranslationCatalog.GetString("Blue"));

            entryTable.Add(alphaSeparator = new HSeparator(), 0, r++, colspan: 5);
            var alphaLabel = CreateLabel();

            entryTable.Add(alphaLabel, 0, r);
            entryTable.Add(alphaSlider = new HSlider()
            {
                MinimumValue = 0, MaximumValue = 255,
            }, 1, r, colspan: 3);
            entryTable.Add(alphaEntry = new SpinButton()
            {
                MinWidth = entryWidth, MinimumValue = 0, MaximumValue = 255, Digits = 0, IncrementValue = 1
            }, 4, r);
            SetupEntry(alphaEntry, alphaLabel, Application.TranslationCatalog.GetString("Opacity"));

            // Don't allow the slider to get keyboard focus, as it doesn't really work with the keyboard and the opacity
            // spin button takes its place
            alphaSlider.CanGetFocus      = false;
            alphaSlider.Accessible.Label = Application.TranslationCatalog.GetString("Opacity");

            alphaControls.Add(alphaSeparator);
            alphaControls.Add(alphaLabel);
            alphaControls.Add(alphaEntry);

            entryBox.PackStart(entryTable);
            box.PackStart(entryBox);
            Content = box;

            hsBox.SelectionChanged    += HandleColorBoxSelectionChanged;
            lightBox.SelectionChanged += HandleColorBoxSelectionChanged;

            hueEntry.ValueChanged    += HandleHslChanged;
            satEntry.ValueChanged    += HandleHslChanged;
            lightEntry.ValueChanged  += HandleHslChanged;
            redEntry.ValueChanged    += HandleRgbChanged;
            greenEntry.ValueChanged  += HandleRgbChanged;
            blueEntry.ValueChanged   += HandleRgbChanged;
            alphaEntry.ValueChanged  += HandleAlphaChanged;
            alphaSlider.ValueChanged += HandleAlphaChanged;

            Color = Colors.White;
        }