Ejemplo n.º 1
0
        static public void NewColor(VBox pg, string name)
        {
            var tbox = new HBox();
            var tp   = new Label("color"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0);
            var nm   = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0);

#if RottenBackGround
            tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0));
            nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0));
#else
            tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0));
            nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0));
#endif
            tbox.Add(tp);
            tbox.Add(nm);
            var colbox = new HBox(); colbox.SetSizeRequest(400, 25);
            var r      = new Entry("0"); r.SetSizeRequest(75, 25);
            var g      = new Entry("0"); g.SetSizeRequest(75, 25);
            var b      = new Entry("0"); b.SetSizeRequest(75, 25);
            var but    = new Button("Pick"); but.SetSizeRequest(100, 25);
            MainClass.Colors[name] = new MyColor(nm, r, g, b);
            objlink[r]             = name;
            objlink[g]             = name;
            objlink[b]             = name;
            objlink[but]           = name;
            r.Changed += OnColor;
            g.Changed += OnColor;
            b.Changed += OnColor;
            MyDataBase.fields[name]   = "color";
            MyDataBase.defaults[name] = "255;255;255";
            colbox.Add(new Label("R")); colbox.Add(r); r.ModifyBase(StateType.Normal, new Gdk.Color(0x0f, 0x00, 0x00)); r.ModifyText(StateType.Normal, new Gdk.Color(0xff, 0x00, 0x00));
            colbox.Add(new Label("G")); colbox.Add(g); g.ModifyBase(StateType.Normal, new Gdk.Color(0x00, 0x0f, 0x00)); g.ModifyText(StateType.Normal, new Gdk.Color(0x00, 0xff, 0x00));
            colbox.Add(new Label("B")); colbox.Add(b); b.ModifyBase(StateType.Normal, new Gdk.Color(0x00, 0x0f, 0x00)); b.ModifyText(StateType.Normal, new Gdk.Color(0x00, 0x00, 0xff));
            colbox.Add(but);
            but.Clicked += PickColor;
            tbox.Add(colbox);
            pg.Add(tbox);
        }
Ejemplo n.º 2
0
        private void BuildDatePickerWindow()
        {
            Title             = "DatePicker";
            TypeHint          = Gdk.WindowTypeHint.Desktop;
            WindowPosition    = WindowPosition.Mouse;
            BorderWidth       = 1;
            Resizable         = false;
            AllowGrow         = false;
            Decorated         = false;
            DestroyWithParent = true;
            SkipPagerHint     = true;
            SkipTaskbarHint   = true;

            _datebox             = new VBox();
            _datebox.Spacing     = 6;
            _datebox.BorderWidth = 3;

            _calendar                = new RangeCalendar();
            _calendar.CanFocus       = true;
            _calendar.DisplayOptions = CalendarDisplayOptions.ShowHeading;
            _datebox.Add(_calendar);
            Box.BoxChild dateBoxChild = ((Box.BoxChild)(_datebox[_calendar]));
            dateBoxChild.Position = 0;

            Add(_datebox);

            if ((Child != null))
            {
                Child.ShowAll();
            }

            Show();

            ButtonPressEvent                 += new ButtonPressEventHandler(OnButtonPressEvent);
            _calendar.ButtonPressEvent       += new ButtonPressEventHandler(OnCalendarButtonPressEvent);
            _calendar.DaySelected            += new EventHandler(OnCalendarDaySelected);
            _calendar.DaySelectedDoubleClick += new EventHandler(OnCalendarDaySelectedDoubleClick);
        }
Ejemplo n.º 3
0
        public Panel(VBox vBox)

        {
            Table table = new Table(9, 10, true);
            int   index = 0;

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 10; col++)
                {
                    index++;
                    Button button = new Button();
                    table.Attach(button, (uint)col, (uint)col + 1, (uint)row, (uint)row + 1);
                    //button.Label = ("Botón " + index.ToString());
                    button.Label = index.ToString();//insertar número en los botones
                    //button.Clicked += delegate {
                    //button.ModifyBg(StateType.Normal, new Gdk.Color(100, 200, 250));
                    //};
                }
            }
            vBox.Add(table);
            table.ShowAll();
        }
Ejemplo n.º 4
0
        public Panel(VBox vbox1)
        {
            Table table = new Table(10, 9, true);
            int   index = 0;

            for (int row = 0; row < rows; row++)
            {
                for (int colum = 0; colum < colums; colum++)
                {
                    index++;
                    Button button = new Button();
                    table.Attach(button, (uint)colum, (uint)colum + 1, (uint)row, (uint)row + 1);
                    //button.Label = "Button";
                    buttons.Add(button);
                    button.Label = index.ToString();
                    //button.Clicked += delegate
                }
            }

            //button.ModifyBg(StateType.Normal, new Gdk.Color(100, 250, 250));
            vbox1.Add(table);
            table.ShowAll();
        }
Ejemplo n.º 5
0
// ReSharper restore InconsistentNaming


        void InitializeComponents()
        {
            Stream stream = Assembly
                            .GetExecutingAssembly()
                            .GetManifestResourceStream(AppController.Instance.Config.DrawingAreaWindow);

            var glade = new Glade.XML(stream, AppController.Instance.Config.DrawingAreaWindowName, null);

            if (stream != null)
            {
                stream.Close();
            }
            glade.Autoconnect(this);

            //todo: add icon
            //this.IconList = new Pixbuf[]{ new Pixbuf(System.Reflection.Assembly.GetExecutingAssembly(), "LadderLogic.bmp")};
            //this.Icon = this.IconList[0];

            var drw = new ElementDrawing(DrawingAreaController.Instance.Surface, 2, 2);

            vbox1.Add(drw);
            drw.Show();
        }
Ejemplo n.º 6
0
Archivo: Panel.cs Proyecto: kevinrm8/ed
        public Panel(VBox vBox)
        {
            int   index = 0;
            Table table = new Table(3, 3, true);

            for (uint row = 0; row < 3; row++)
            {
                for (uint col = 0; col < 3; col++)
                {
                    index++;
                    Button button = new Button();
                    table.Attach(button, col, col + 1, row, row + 1);

                    button.Label    = "Button " + index.ToString();
                    button.Clicked += delegate
                    {
                        button.ModifyBg(StateType.Normal, new Gdk.Color(100, 200, 250));
                    };
                }
            }
            vBox.Add(table);
            table.ShowAll();
        }
Ejemplo n.º 7
0
        public Panel(VBox vbox1)
        {
            Table table = new Table(3, 3, true);
            int   index = 0;

            for (int row = 0; row < 3; row++)
            {
                for (int colum = 0; colum < 3; colum++)
                {
                    index++;
                    Button button = new Button();
                    table.Attach(button, (uint)colum, (uint)colum + 1, (uint)row, (uint)row + 1);
                    //button.Label = "Button";
                    button.Label    = "BUTTON " + index.ToString();
                    button.Clicked += delegate
                    {
                        button.ModifyBg(StateType.Normal, new Gdk.Color(150, 148, 250));
                    };
                }
            }
            vbox1.Add(table);
            table.ShowAll();
        }
Ejemplo n.º 8
0
        public ExceptionCaughtDialog(ExceptionInfo val, ExceptionCaughtMessage msg)
        {
            Title    = GettextCatalog.GetString("Exception Caught");
            ex       = val;
            widget   = new ExceptionCaughtWidget(val);
            this.msg = msg;

            VBox box = new VBox();

            box.Spacing = 6;
            box.PackStart(widget, true, true, 0);
            HButtonBox buttonBox = new HButtonBox();

            buttonBox.Layout      = ButtonBoxStyle.End;
            buttonBox.BorderWidth = 6;
            buttonBox.Spacing     = 12;

            var copy = new Gtk.Button(GettextCatalog.GetString("Copy"));

            buttonBox.PackStart(copy, false, false, 0);
            copy.Clicked += HandleCopyClicked;

            var close = new Gtk.Button(GettextCatalog.GetString("Close"));

            buttonBox.PackStart(close, false, false, 0);
            close.Clicked   += (sender, e) => msg.Close();
            close.Activated += (sender, e) => msg.Close();

            box.PackStart(buttonBox, false, false, 0);
            VBox.Add(box);

            DefaultWidth  = 500;
            DefaultHeight = 350;

            box.ShowAll();
            ActionArea.Hide();
        }
Ejemplo n.º 9
0
        private Widget CreateCatList()
        {
            var scroll = new ScrolledWindow();
            var box    = new VBox();

            scroll.Add(box);

            var tb = new Toolbar();

            tb.Orientation  = Orientation.Vertical;
            tb.ToolbarStyle = ToolbarStyle.BothHoriz;
            tb.ShowArrow    = false;

            box.Add(tb);

            allButton = createCatButton(TLauncherIndex.Current.catHash["All"]);
            tb.Add(allButton);

            tb.Add(new SeparatorToolItem());

            foreach (var entry in TLauncherIndex.Current.Categories)
            {
                if (!entry.meta)
                {
                    tb.Add(createCatButton(entry));
                }
            }

            var noneButton = createCatButton(TLauncherIndex.Current.catHash["None"]);

            tb.Add(noneButton);

            var frame = new Frame();

            frame.Add(scroll);
            return(frame);
        }
Ejemplo n.º 10
0
        public void AddCodeTab(string filePath)
        {
            // put textview in vbox with 1 spacing so that the path of the
            // opened file can be stored as the name of the vbox
            VBox container = new VBox();

            container.Name    = filePath;
            container.Spacing = 1;

            TextView text = new TextView();

            text.Buffer.Text = System.IO.File.ReadAllText(filePath);

            container.Add(text);

            Label label = new Label();

            label.Text = System.IO.Path.GetFileName(filePath);


            views.AppendPage(container, label);
            views.SetTabDetachable(container, true);
            views.ShowAll();
        }
        public MemberListWindow(string title, Gtk.Window parent, DialogFlags flags, IUnresolvedEntity selectedEntry, params object[] button_data) : base(title, parent, flags, button_data)
        {
            if (IdeApp.Workbench == null)
            {
                return;
            }
            SelectedEntity = selectedEntry;

            _searchView = new Gtk.Entry("");
            _searchView.SetSizeRequest(500, 40);
            _searchView.Changed         += _searchView_Changed;
            _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
            _searchView.KeyPressEvent   += HandleKeyPressEvent;
            _searchView.FocusOutEvent   += HandleFocusOutEvent;
            VBox.Add(_searchView);

            CreateTree();
            _scrolledWindow = new Gtk.ScrolledWindow();
            _scrolledWindow.SetSizeRequest(500, 600);
            _scrolledWindow.Add(_treeView);
            VBox.Add(_scrolledWindow);

            MemberExtensionsHelper.Instance.IsDirty = true;
            UpdateMembers();
            var editor = IdeApp.Workbench.ActiveDocument.Editor;
            var visualInsertLocation = editor.LogicalToVisualLocation(editor.Caret.Location);
            var targetView           = IdeApp.Workbench.RootWindow;

            this.SetSizeRequest(500, 700);

            CanFocus               = true;
            _searchView.CanFocus   = true;
            _searchView.IsEditable = true;
            _searchView.GrabFocus();
            ShowAll();
        }
Ejemplo n.º 12
0
        private void Build()
        {
            var mainVbox = new VBox(false, 0);
            var mainHbox = new HBox(true, 5);
            var leftVox  = new VBox(true, 5);

            this.calendarComponent     = new Components.Calendar();
            this.dayContentComponent   = new Components.DayContent();
            this.monthContentComponent = new Components.MonthContent();
            this.toolbarComponent      = new Components.Toolbar();

            this.toolbarComponent.NewNoteClicked     += this.OnNewNoteClicked;
            this.toolbarComponent.NewExerciseClicked += this.OnNewExerciseClicked;
            this.toolbarComponent.NewMeasureClicked  += this.OnNewMeasureClicked;


            this.calendarComponent.DaySelected += OnDaySelected;

            //left-top
            leftVox.PackStart(this.calendarComponent, true, true, 5);

            //left-bottom
            leftVox.PackStart(this.dayContentComponent, true, true, 5);

            //left
            mainHbox.PackStart(leftVox, true, true, 5);

            //right
            mainHbox.PackStart(this.monthContentComponent, true, true, 5);

            mainVbox.PackStart(this.toolbarComponent, false, false, 0);
            mainVbox.Add(mainHbox);
            this.Add(mainVbox);

            this.OnViewBuilt();
        }
Ejemplo n.º 13
0
        private void ShowPath(string wayTitle, string stopTitle, string arriveTime, double position)
        {
            var title_label = new Label();

            title_label.Name      = "title_label";
            title_label.LabelProp = wayTitle;

            var title_stop_label = new Label();

            title_stop_label.Name      = "title_stop_label";
            title_stop_label.LabelProp = stopTitle;

            var time_stop_label = new Label();

            time_stop_label.Name      = "time_stop_label";
            time_stop_label.LabelProp = arriveTime;

            var time_position_label = new Label();

            time_position_label.Name      = "time_stop_label";
            time_position_label.LabelProp = position.ToString();

            var hbox = new HBox();

            hbox.Add(title_label);
            hbox.Add(title_stop_label);
            hbox.Add(time_stop_label);
            hbox.Add(time_position_label);

            var vbox = new VBox();

            vbox.Add(hbox);
            _control_container.Add(vbox);

            path_main_container.Add(vbox);
        }
Ejemplo n.º 14
0
        public static VBox StatistikaTip(List <AktivnostKorisnika> listak, string tip)
        {
            var items = new List <ColumnItem>();
            var kat   = new List <string>();
            var list  = listak;

            foreach (var x in list)
            {
                var b = new ColumnItem(x.Potrosnja);
                items.Add(b);
                kat.Add(x.Tip);
            }

            if (list.Count > 1)
            {
                int i         = 0;
                var listaBoja = OxyPalettes.Jet(list.Count).Colors;
                foreach (ColumnItem cI in items)
                {
                    cI.Color = listaBoja[i];
                    i++;
                }
            }


            var barSeries = new ColumnSeries
            {
                ItemsSource       = items,
                LabelPlacement    = LabelPlacement.Base,
                LabelFormatString = "{0:,00} kcal"
            };


            var model = new PlotModel {
                Title = "Statistika za tip aktivnosti: " + tip
            };

            model.Series.Add(barSeries);

            model.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Bottom,
                Key         = "Tip aktivnosti",
                ItemsSource = kat
            });

            model.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Left,
                Minimum  = 0
            });

            model.PlotAreaBackground = OxyColors.AliceBlue;
            var pv = new PlotView();

            pv.Model = model;
            var v = new VBox();

            v.Add(pv);
            return(v);
        }
Ejemplo n.º 15
0
        private void Build()
        {
            this.titleLabel = new Label("");
            var fontDescription = new Pango.FontDescription();

            fontDescription.Size = Convert.ToInt32(17 * Pango.Scale.PangoScale);
            this.titleLabel.ModifyFont(fontDescription);
            this.PackStart(this.titleLabel, false, true, 10);

            this.monthNotesComponent     = new MonthNotes();
            this.monthExercisesComponent = new MonthExercises();
            this.monthMeasuresComponent  = new MonthMeasures();

            this.monthExercisesComponentG = new MonthExercisesGraph();
            this.monthMeasuresComponentG  = new MonthMeasuresGraph();

            var nbLibro     = new Gtk.Notebook();
            var nbEjercicio = new Gtk.Notebook();
            var nbMedidas   = new Gtk.Notebook();

            nbEjercicio.AppendPage(
                this.monthExercisesComponent,
                new Gtk.Label("List")
                );
            nbEjercicio.AppendPage(
                this.monthExercisesComponentG,
                new Gtk.Label("Graphic")
                );


            nbMedidas.AppendPage(
                this.monthMeasuresComponent,
                new Gtk.Label("List")
                );
            nbMedidas.AppendPage(
                this.monthMeasuresComponentG,
                new Gtk.Label("Graphic")
                );

            nbLibro.AppendPage(
                this.monthNotesComponent,
                new Gtk.Label("Notes")
                );

            VBox ex = new VBox();

            ex.Add(nbEjercicio);
            nbLibro.AppendPage(
                ex,
                new Gtk.Label("Exercises")
                );

            VBox ey = new VBox();

            ey.Add(nbMedidas);
            nbLibro.AppendPage(
                ey,
                new Gtk.Label("Measures")
                );


            this.Add(nbLibro);

            //Update state and render
            this.OnViewBuilt();
        }
        private void BuildWindow()
        {
            this.Resizable = false;

            BorderWidth       = 6;
            VBox.Spacing      = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            HBox box = new HBox();

            box.BorderWidth = 6;
            box.Spacing     = 12;

            Image image = new Image(PodcastPixbufs.PodcastIcon48);

            image.Yalign = 0.0f;

            box.PackStart(image, false, true, 0);

            VBox content_box = new VBox();

            content_box.Spacing = 12;

            Label header = new Label();

            header.Markup = "<big><b>" + GLib.Markup.EscapeText(Catalog.GetString(
                                                                    "Subscribe to New Podcast Feed")) + "</b></big>";
            header.Justify = Justification.Left;
            header.SetAlignment(0.0f, 0.0f);

            Label message = new Label(Catalog.GetString(
                                          "Please enter the URL of the podcast you wish to subscribe to"));

            message.Wrap    = true;
            message.Justify = Justification.Left;
            message.SetAlignment(0.0f, 0.0f);

            Expander advanced_expander = new Expander("Advanced");

            VBox expander_children = new VBox();

            expander_children.BorderWidth = 6;
            expander_children.Spacing     = 6;

            Label sync_text = new Label(Catalog.GetString(
                                            "When new episodes are available:  "));

            sync_text.SetAlignment(0.0f, 0.0f);
            sync_text.Justify = Justification.Left;

            sync_combo = new SyncPreferenceComboBox();

            expander_children.PackStart(sync_text);
            expander_children.PackStart(sync_combo);

            advanced_expander.Add(expander_children);

            url_entry = new Entry();
            url_entry.ActivatesDefault = true;

            Table table = new Table(1, 2, false);

            table.RowSpacing    = 6;
            table.ColumnSpacing = 12;

            table.Attach(new Label(Catalog.GetString("URL:")), 0, 1, 0, 1,
                         AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            table.Attach(url_entry, 1, 2, 0, 1,
                         AttachOptions.Expand | AttachOptions.Fill,
                         AttachOptions.Shrink, 0, 0);

            table.Attach(advanced_expander, 0, 2, 1, 2,
                         AttachOptions.Expand | AttachOptions.Fill,
                         AttachOptions.Shrink, 0, 0);

            content_box.PackStart(header, false, true, 0);
            content_box.PackStart(message, false, true, 0);

            content_box.PackStart(table, false, true, 0);

            box.PackStart(content_box, false, true, 0);

            AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
            AddButton(Catalog.GetString("Subscribe"), ResponseType.Ok, true);

            box.ShowAll();
            VBox.Add(box);
        }
Ejemplo n.º 17
0
        protected virtual void Build()
        {
            Gui.Initialize((Widget)this);
            this.HeightRequest  = 175;
            this.Name           = "CocoStudio.ControlLib.Windows.LoginDialog";
            this.WindowPosition = WindowPosition.CenterOnParent;
            VBox vbox = this.VBox;

            vbox.Name                     = "dialog1_VBox";
            vbox.BorderWidth              = 2U;
            this.evtbx_border             = new EventBox();
            this.evtbx_border.Name        = "evtbx_border";
            this.evtbx_border.BorderWidth = 10U;
            this.table_main               = new Table(4U, 2U, false);
            this.table_main.Name          = "table_main";
            this.table_main.RowSpacing    = 6U;
            this.table_main.ColumnSpacing = 6U;
            this.hbox_firstRow            = new HBox();
            this.hbox_firstRow.Name       = "hbox_firstRow";
            this.hbox_firstRow.Spacing    = 6;
            this.entry_Name               = new Entry();
            this.entry_Name.WidthRequest  = 250;
            this.entry_Name.CanFocus      = true;
            this.entry_Name.Name          = "entry_Name";
            this.entry_Name.IsEditable    = true;
            this.entry_Name.InvisibleChar = '●';
            this.hbox_firstRow.Add((Widget)this.entry_Name);
            Box.BoxChild boxChild1 = (Box.BoxChild) this.hbox_firstRow[(Widget)this.entry_Name];
            boxChild1.Position               = 0;
            boxChild1.Expand                 = false;
            this.link_RegisterAccount        = new LabelLink((string)null);
            this.link_RegisterAccount.Events = EventMask.ButtonPressMask;
            this.link_RegisterAccount.Name   = "link_RegisterAccount";
            this.hbox_firstRow.Add((Widget)this.link_RegisterAccount);
            Box.BoxChild boxChild2 = (Box.BoxChild) this.hbox_firstRow[(Widget)this.link_RegisterAccount];
            boxChild2.Position = 1;
            boxChild2.Expand   = false;
            boxChild2.Fill     = false;
            this.table_main.Add((Widget)this.hbox_firstRow);
            Table.TableChild tableChild1 = (Table.TableChild) this.table_main[(Widget)this.hbox_firstRow];
            tableChild1.LeftAttach      = 1U;
            tableChild1.RightAttach     = 2U;
            tableChild1.XOptions        = AttachOptions.Fill;
            tableChild1.YOptions        = AttachOptions.Fill;
            this.hbox_fourthRow         = new HBox();
            this.hbox_fourthRow.Name    = "hbox_fourthRow";
            this.hbox_fourthRow.Spacing = 6;
            this.label_remark           = new Label();
            this.label_remark.Name      = "label_remark";
            this.label_remark.LabelProp = Catalog.GetString("(请使用CocoaChina账号登陆)");
            this.hbox_fourthRow.Add((Widget)this.label_remark);
            Box.BoxChild boxChild3 = (Box.BoxChild) this.hbox_fourthRow[(Widget)this.label_remark];
            boxChild3.Position = 0;
            boxChild3.Expand   = false;
            boxChild3.Fill     = false;
            this.table_main.Add((Widget)this.hbox_fourthRow);
            Table.TableChild tableChild2 = (Table.TableChild) this.table_main[(Widget)this.hbox_fourthRow];
            tableChild2.TopAttach             = 3U;
            tableChild2.BottomAttach          = 4U;
            tableChild2.LeftAttach            = 1U;
            tableChild2.RightAttach           = 2U;
            tableChild2.XOptions              = AttachOptions.Fill;
            tableChild2.YOptions              = AttachOptions.Fill;
            this.hbox_secondRow               = new HBox();
            this.hbox_secondRow.Name          = "hbox_secondRow";
            this.hbox_secondRow.Spacing       = 6;
            this.entry_PassWord               = new PassWordEntry();
            this.entry_PassWord.CanFocus      = true;
            this.entry_PassWord.Name          = "entry_PassWord";
            this.entry_PassWord.IsEditable    = true;
            this.entry_PassWord.InvisibleChar = '●';
            this.hbox_secondRow.Add((Widget)this.entry_PassWord);
            ((Box.BoxChild) this.hbox_secondRow[(Widget)this.entry_PassWord]).Position = 0;
            this.link_ForgotPassword        = new LabelLink((string)null);
            this.link_ForgotPassword.Events = EventMask.ButtonPressMask;
            this.link_ForgotPassword.Name   = "link_ForgotPassword";
            this.hbox_secondRow.Add((Widget)this.link_ForgotPassword);
            Box.BoxChild boxChild4 = (Box.BoxChild) this.hbox_secondRow[(Widget)this.link_ForgotPassword];
            boxChild4.Position = 1;
            boxChild4.Expand   = false;
            boxChild4.Fill     = false;
            this.table_main.Add((Widget)this.hbox_secondRow);
            Table.TableChild tableChild3 = (Table.TableChild) this.table_main[(Widget)this.hbox_secondRow];
            tableChild3.TopAttach                   = 1U;
            tableChild3.BottomAttach                = 2U;
            tableChild3.LeftAttach                  = 1U;
            tableChild3.RightAttach                 = 2U;
            tableChild3.XOptions                    = AttachOptions.Fill;
            tableChild3.YOptions                    = AttachOptions.Fill;
            this.hbox_thirdRow                      = new HBox();
            this.hbox_thirdRow.Name                 = "hbox_thirdRow";
            this.hbox_thirdRow.Spacing              = 6;
            this.checkbutton_password               = new CheckButton();
            this.checkbutton_password.CanFocus      = true;
            this.checkbutton_password.Name          = "checkbutton_password";
            this.checkbutton_password.Label         = Catalog.GetString("记住密码");
            this.checkbutton_password.DrawIndicator = true;
            this.checkbutton_password.UseUnderline  = true;
            this.hbox_thirdRow.Add((Widget)this.checkbutton_password);
            Box.BoxChild boxChild5 = (Box.BoxChild) this.hbox_thirdRow[(Widget)this.checkbutton_password];
            boxChild5.Position                       = 0;
            boxChild5.Expand                         = false;
            this.checkbutton_AutoLogin               = new CheckButton();
            this.checkbutton_AutoLogin.CanFocus      = true;
            this.checkbutton_AutoLogin.Name          = "checkbutton_AutoLogin";
            this.checkbutton_AutoLogin.Label         = Catalog.GetString("自动登陆");
            this.checkbutton_AutoLogin.DrawIndicator = true;
            this.checkbutton_AutoLogin.UseUnderline  = true;
            this.hbox_thirdRow.Add((Widget)this.checkbutton_AutoLogin);
            Box.BoxChild boxChild6 = (Box.BoxChild) this.hbox_thirdRow[(Widget)this.checkbutton_AutoLogin];
            boxChild6.Position = 1;
            boxChild6.Expand   = false;
            this.table_main.Add((Widget)this.hbox_thirdRow);
            Table.TableChild tableChild4 = (Table.TableChild) this.table_main[(Widget)this.hbox_thirdRow];
            tableChild4.TopAttach     = 2U;
            tableChild4.BottomAttach  = 3U;
            tableChild4.LeftAttach    = 1U;
            tableChild4.RightAttach   = 2U;
            tableChild4.XOptions      = AttachOptions.Fill;
            tableChild4.YOptions      = AttachOptions.Fill;
            this.label_Name           = new Label();
            this.label_Name.Name      = "label_Name";
            this.label_Name.Xalign    = 1f;
            this.label_Name.LabelProp = Catalog.GetString("用户名");
            this.table_main.Add((Widget)this.label_Name);
            Table.TableChild tableChild5 = (Table.TableChild) this.table_main[(Widget)this.label_Name];
            tableChild5.XOptions          = AttachOptions.Fill;
            tableChild5.YOptions          = AttachOptions.Fill;
            this.label_PassWord           = new Label();
            this.label_PassWord.Name      = "label_PassWord";
            this.label_PassWord.Xalign    = 1f;
            this.label_PassWord.LabelProp = Catalog.GetString("密码");
            this.table_main.Add((Widget)this.label_PassWord);
            Table.TableChild tableChild6 = (Table.TableChild) this.table_main[(Widget)this.label_PassWord];
            tableChild6.TopAttach    = 1U;
            tableChild6.BottomAttach = 2U;
            tableChild6.XOptions     = AttachOptions.Fill;
            tableChild6.YOptions     = AttachOptions.Fill;
            this.evtbx_border.Add((Widget)this.table_main);
            vbox.Add((Widget)this.evtbx_border);
            Box.BoxChild boxChild7 = (Box.BoxChild)vbox[(Widget)this.evtbx_border];
            boxChild7.Position = 0;
            boxChild7.Expand   = false;
            boxChild7.Fill     = false;
            HButtonBox actionArea = this.ActionArea;

            actionArea.Name                = "dialog1_ActionArea";
            actionArea.Spacing             = 10;
            actionArea.BorderWidth         = 5U;
            actionArea.LayoutStyle         = ButtonBoxStyle.End;
            this.buttonCancel              = new Button();
            this.buttonCancel.CanDefault   = true;
            this.buttonCancel.CanFocus     = true;
            this.buttonCancel.Name         = "buttonCancel";
            this.buttonCancel.UseStock     = true;
            this.buttonCancel.UseUnderline = true;
            this.buttonCancel.Label        = "gtk-cancel";
            this.AddActionWidget((Widget)this.buttonCancel, -6);
            ButtonBox.ButtonBoxChild buttonBoxChild1 = (ButtonBox.ButtonBoxChild)actionArea[(Widget)this.buttonCancel];
            buttonBoxChild1.Expand     = false;
            buttonBoxChild1.Fill       = false;
            this.buttonOk              = new Button();
            this.buttonOk.CanDefault   = true;
            this.buttonOk.CanFocus     = true;
            this.buttonOk.Name         = "buttonOk";
            this.buttonOk.UseStock     = true;
            this.buttonOk.UseUnderline = true;
            this.buttonOk.Label        = "gtk-ok";
            this.AddActionWidget((Widget)this.buttonOk, -5);
            ButtonBox.ButtonBoxChild buttonBoxChild2 = (ButtonBox.ButtonBoxChild)actionArea[(Widget)this.buttonOk];
            buttonBoxChild2.Position = 1;
            buttonBoxChild2.Expand   = false;
            buttonBoxChild2.Fill     = false;
            if (this.Child != null)
            {
                this.Child.ShowAll();
            }
            this.DefaultWidth  = 412;
            this.DefaultHeight = 191;
            this.Show();
        }
Ejemplo n.º 18
0
        private Gtk.Widget CreateWorkspaceView()
        {
            ScrolledWindow sw = new ScrolledWindow();

            m_treeView = new Gtk.TreeView();

            //first column has workspaceUnit but presents its friendly name, 2nd column displays type and 3rd displays value
            m_workspaceStore = new Gtk.ListStore(typeof(WorkspaceUnit), typeof(WorkspaceUnit), typeof(WorkspaceUnit));
            m_treeView.Model = m_workspaceStore;

            //create columns with associated cell renderings
            CellRendererText nameRenderer = new CellRendererText();
            TreeViewColumn   nameColumn   = m_treeView.AppendColumn("Name", nameRenderer);

            nameColumn.SetCellDataFunc(nameRenderer, new TreeCellDataFunc(RenderName));

            CellRendererText typeRenderer = new CellRendererText();
            TreeViewColumn   typeColumn   = m_treeView.AppendColumn("Type", typeRenderer);

            typeColumn.SetCellDataFunc(typeRenderer, new TreeCellDataFunc(RenderType));

            TreeViewColumn valueColumn = new TreeViewColumn();

            valueColumn.Title = "Value";
            CellRendererPixbuf valueViewerIconCellRenderer = new CellRendererPixbuf();
            CellRendererText   valueTextRenderer           = new CellRendererText();

            valueViewerIconCellRenderer.Xalign = 0.0f;
            valueColumn.PackEnd(valueTextRenderer, true);
            valueColumn.PackStart(valueViewerIconCellRenderer, false);
            valueColumn.SetCellDataFunc(valueViewerIconCellRenderer, new TreeCellDataFunc(RenderViewerIcon));
            valueColumn.SetCellDataFunc(valueTextRenderer, new TreeCellDataFunc(RenderValue));
            m_treeView.AppendColumn(valueColumn);

            m_treeView.RowActivated += HandleRowActivated;

            // HERZUM SPRINT 3: TLAB-86
            VBox vbox1 = new VBox();

            sw.Add(m_treeView);
            vbox1.Add(sw);
            Box.BoxChild w1 = ((Box.BoxChild)(vbox1 [sw]));
            w1.Position = 0;

            baseline.CanFocus = false;

            Box.BoxChild w2 = ((Box.BoxChild)(vbox1 [baseline]));
            vbox1.Add(baseline);
            w2.Position = 2;
            w2.Expand   = false;
            w2.Fill     = false;


            vbox1.ShowAll();
            return(vbox1);

            //sw.Add(m_treeView);
            //sw.ShowAll();
            //return sw;

            // END HERZUM SPRINT 3: TLAB-86
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Instantiate the View
        /// </summary>
        /// <param name="owner">The owner view</param>
        public PivotTableView(ViewBase owner) : base(owner)
        {
            // Read in the glade file
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.PivotTableView.glade");

            // Assign the interactable objects from glade
            vbox1 = (VBox)builder.GetObject("vbox1");

            leftButton  = (Button)builder.GetObject("leftbutton");
            rightButton = (Button)builder.GetObject("rightbutton");
            storeButton = (Button)builder.GetObject("storebutton");

            leftButton.Name  = "left";
            rightButton.Name = "right";

            filterLabel = (Label)builder.GetObject("filter");

            // Setup the ViewBoxes
            LedgerViewBox = new ViewBox("ledgerbox", this, builder)
            {
                Name = "LedgerViewBox"
            };
            ExpressionViewBox = new ViewBox("expressionbox", this, builder)
            {
                Name = "ExpressionViewBox"
            };
            ValueViewBox = new ViewBox("valuebox", this, builder)
            {
                Name = "ValueViewBox"
            };
            RowViewBox = new ViewBox("rowbox", this, builder)
            {
                Name = "RowViewBox"
            };
            ColumnViewBox = new ViewBox("columnbox", this, builder)
            {
                Name = "ColumnViewBox"
            };
            FilterViewBox = new ViewBox("filterbox", this, builder)
            {
                Name = "FilterViewBox"
            };
            TimeViewBox = new ViewBox("timebox", this, builder)
            {
                Name = "TimeViewBox"
            };

            // Add text options to the ViewBoxes
            ExpressionViewBox.AddText("Sum");
            ExpressionViewBox.AddText("Average");
            ExpressionViewBox.AddText("Max");
            ExpressionViewBox.AddText("Min");

            ValueViewBox.AddText("Gain");
            ValueViewBox.AddText("Loss");

            AddOptions(RowViewBox);
            AddOptions(ColumnViewBox);

            FilterViewBox.AddText("None");
            AddOptions(FilterViewBox);

            TimeViewBox.AddText("Daily");
            TimeViewBox.AddText("Monthly");
            TimeViewBox.AddText("Yearly");

            // Subscribe the left/right buttons to the change pivot event
            leftButton.Clicked  += OnInvokeUpdate;
            rightButton.Clicked += OnInvokeUpdate;

            // Subscribe the store button to the store data event
            storeButton.Clicked += OnStoreData;

            // Add the custom gridview (external to glade)
            Grid = new GridView(owner)
            {
                ReadOnly = true
            };
            vbox1.Add(Grid.MainWidget);

            // Let the viewbase know which widget is the main widget
            mainWidget = vbox1;
        }
Ejemplo n.º 20
0
            public SubTileEditor(TilesetEditor tilesetEditor) : base(0, 0, 0, 0)
            {
                this.tilesetEditor = tilesetEditor;

                Gtk.Box tmpBox;

                Gtk.VBox vbox = new VBox(false, 2);
                vbox.Spacing = 10;

                // Top row: 2 images of the tile, one for selecting, one to show
                // collisions

                subTileViewer = new SubTileViewer();

                subTileViewer.SubTileChangedEvent += delegate() {
                    PullEverything();
                };

                subTileCollisionEditor = new SubTileCollisionEditor();
                subTileCollisionEditor.CollisionsChangedHandler += () => {
                    PullEverything();
                };

                Alignment hAlign = new Alignment(0.5f, 0, 0, 0);

                Gtk.HBox hbox = new HBox(false, 2);
                hbox.Add(subTileViewer);
                hbox.Add(subTileCollisionEditor);
                hAlign.Add(hbox);

                vbox.Add(hAlign);

                // Next row: collision value

                collisionSpinButton               = new SpinButtonHexadecimal(0, 255);
                collisionSpinButton.Digits        = 2;
                collisionSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                    Tileset.SetTileCollision(TileIndex, (byte)collisionSpinButton.ValueAsInt);
                    subTileCollisionEditor.QueueDraw();
                };

                Gtk.Label collisionLabel = new Gtk.Label("Collisions");

                tmpBox = new Gtk.HBox(false, 2);
                tmpBox.Add(collisionLabel);
                tmpBox.Add(collisionSpinButton);
                vbox.Add(tmpBox);

                // Next rows: subtile properties

                var table = new Table(2, 2, false);

                table.ColumnSpacing = 6;
                table.RowSpacing    = 6;

                subTileSpinButton = new SpinButtonHexadecimal(0, 255);
                subTileSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                paletteSpinButton = new SpinButton(0, 7, 1);
                paletteSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                flipXCheckButton          = new Gtk.CheckButton();
                flipXCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                flipYCheckButton          = new Gtk.CheckButton();
                flipYCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                priorityCheckButton          = new Gtk.CheckButton();
                priorityCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                bankCheckButton          = new Gtk.CheckButton();
                bankCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                bankCheckButton.Sensitive = false; // On second thought, nobody actually needs this

                Gtk.Label subTileLabel  = new Gtk.Label("Subtile Index");
                Gtk.Label paletteLabel  = new Gtk.Label("Palette");
                Gtk.Label flipXLabel    = new Gtk.Label("Flip X");
                Gtk.Label flipYLabel    = new Gtk.Label("Flip Y");
                Gtk.Label priorityLabel = new Gtk.Label("Priority");
                Gtk.Label bankLabel     = new Gtk.Label("Bank (0/1)");

                paletteLabel.TooltipText      = "Palette index (0-7)";
                paletteSpinButton.TooltipText = "Palette index (0-7)";

                priorityLabel.TooltipText       = "Check to make colors 1-3 appear above sprites";
                priorityCheckButton.TooltipText = "Check to make colors 1-3 appear above sprites";

                bankLabel.TooltipText       = "This should always be checked.";
                bankCheckButton.TooltipText = "This should always be checked.";

                uint y = 0;

                table.Attach(subTileLabel, 0, 1, y, y + 1);
                table.Attach(subTileSpinButton, 1, 2, y, y + 1);
                y++;
                table.Attach(paletteLabel, 0, 1, y, y + 1);
                table.Attach(paletteSpinButton, 1, 2, y, y + 1);
                y++;
                table.Attach(flipXLabel, 0, 1, y, y + 1);
                table.Attach(flipXCheckButton, 1, 2, y, y + 1);
                y++;
                table.Attach(flipYLabel, 0, 1, y, y + 1);
                table.Attach(flipYCheckButton, 1, 2, y, y + 1);
                y++;
                table.Attach(priorityLabel, 0, 1, y, y + 1);
                table.Attach(priorityCheckButton, 1, 2, y, y + 1);
                y++;
                table.Attach(bankLabel, 0, 1, y, y + 1);
                table.Attach(bankCheckButton, 1, 2, y, y + 1);
                y++;

                vbox.Add(table);
                this.Add(vbox);

                ShowAll();

                PullEverything();
            }
        protected virtual void Build()
        {
            //MainWindow
            Name             = "MainWindow";
            Title            = "Построение yml файла на основе заданных сервисов";
            WindowPosition   = ((WindowPosition)(4));
            DefaultWidth     = PersonalSettings.appConfig.MainWindowWidth;
            DefaultHeight    = PersonalSettings.appConfig.MainWindowHeight;
            MainWindowHeight = PersonalSettings.appConfig.MainWindowWidth;
            MainWindowWidth  = PersonalSettings.appConfig.MainWindowHeight;
            //Main Hbox for separation window
            hbox1         = new HBox();
            hbox1.Name    = "hbox1";
            hbox1.Spacing = 2;

            vbox1         = new VBox();
            vbox1.Name    = "vbox1";
            vbox1.Spacing = 1;

            label1                = new Label();
            label1.Name           = "label1";
            label1.LabelProp      = "Выбранные на данный момент";
            label1.Justify        = ((Justification)(2));
            label1.SingleLineMode = true;
            label1.Expand         = false;
            vbox1.PackStart(label1, false, false, 0);

            //For Selected Services scrolled window
            GtkScrolledWindow2            = new ScrolledWindow();
            GtkScrolledWindow2.Name       = "GtkScrolledWindow1";
            GtkScrolledWindow2.ShadowType = ((ShadowType)(1));

            //Selected Services StoreList of string and Image
            SelectedServices = new ListStore(typeof(int), typeof(string), typeof(Pixbuf), typeof(List <Options>));
            List <Options> temp = new List <Options>();

            temp.Add(new Options(AllServiceOptions.allConfigs[0]));
            temp.Add(AllServiceOptions.allConfigs[1]);
            temp.Add(AllServiceOptions.allConfigs[2]);
            temp.Add(AllServiceOptions.allConfigs[3]);
            temp.Add(AllServiceOptions.allConfigs[4]);
            SelectedServices.AppendValues(0, "Свой сервис", OwnService, temp);
            SelectedServices.SetSortColumnId(0, SortType.Ascending);

            // Selected Services IconViewSettings
            IV_SelectedServices              = new IconView(SelectedServices);
            IV_SelectedServices.CanFocus     = true;
            IV_SelectedServices.Name         = "IV_SelectedServices";
            IV_SelectedServices.ItemWidth    = IV_ItemWidth;
            IV_SelectedServices.TextColumn   = Col_DisplayName;
            IV_SelectedServices.PixbufColumn = Col_Pixbuf;
            GtkScrolledWindow2.Add(IV_SelectedServices);
            vbox1.Add(GtkScrolledWindow2);
            IV_SelectedServices.GrabFocus();
            hbox1.Add(vbox1);
            // Container child hbox1.Gtk.Box+BoxChild
            vbox2         = new VBox();
            vbox2.Spacing = 1;
            // Container child vbox2.Gtk.Box+BoxChild
            label2                = new Label();
            label2.Name           = "label2";
            label2.LabelProp      = "Список всех сервисов";
            label2.Wrap           = true;
            label2.Justify        = ((Justification)(2));
            label2.SingleLineMode = true;
            vbox2.PackStart(label2, false, false, 0);
            // Container child vbox2.Gtk.Box+BoxChild
            vbox4         = new VBox();
            vbox4.Name    = "vbox4";
            vbox4.Spacing = 1;

            // Container child vbox4.Gtk.Box+BoxChild
            hbox3         = new HBox();
            hbox3.Name    = "hbox3";
            hbox3.Spacing = 6;

            Vbox_Search         = new VBox();
            Vbox_Search.Name    = "Vbox_Search";
            Vbox_Search.Spacing = 1;

            // Container child hbox3.Gtk.Box+BoxChild
            SearchS = new Entry();
            SearchS.WidthRequest  = 230;
            SearchS.CanFocus      = true;
            SearchS.Name          = "SearchS";
            SearchS.Text          = "";
            SearchS.IsEditable    = true;
            SearchS.InvisibleChar = '●';
            SearchS.Changed      += new EventHandler(OnSearchSChanged);

            Lbl_Search                = new Label();
            Lbl_Search.Name           = "Lbl_Search";
            Lbl_Search.LabelProp      = "Строка поиска сервиса";
            Lbl_Search.Justify        = Justification.Left;
            Lbl_Search.SingleLineMode = true;
            Lbl_Search.Xalign         = 0F;

            Vbox_Search.PackStart(Lbl_Search, false, false, 0);
            Vbox_Search.PackStart(SearchS, false, false, 0);
            //Just to create empty space after input field
            Vbox_Search.PackStart(new Separator(Orientation.Horizontal), false, false, 0);
            hbox3.PackStart(Vbox_Search, false, false, 0);

            Btn_Create                 = new Button();
            Btn_Create.CanFocus        = true;
            Btn_Create.Name            = "Btn_Search";
            Btn_Create.UseUnderline    = true;
            Btn_Create.Label           = "Создать Yaml";
            Btn_Create.Image           = new Image(CreateYml);
            Btn_Create.ImagePosition   = PositionType.Top;
            Btn_Create.AlwaysShowImage = true;
            Btn_Create.Pressed        += OnCreateYmlPressed;
            hbox3.PackStart(Btn_Create, false, false, 0);

            Btn_Settings                 = new Button();
            Btn_Settings.CanFocus        = true;
            Btn_Settings.Name            = "Btn_Settings";
            Btn_Settings.UseUnderline    = true;
            Btn_Settings.Label           = "Настройки";
            Btn_Settings.Image           = new Image(Settings);
            Btn_Settings.ImagePosition   = PositionType.Top;
            Btn_Settings.AlwaysShowImage = true;
            Btn_Settings.Pressed        += OnSettingsPressed;

            //Btn_Settings.Pressed += OnCreateYmlPressed;
            hbox3.PackStart(Btn_Settings, false, false, 0);

            Loading.Wait();
            //All Services StoreList of their name and Image
            AllServices = new ListStore(typeof(int), typeof(string), typeof(Pixbuf));
            AllServices.SetSortColumnId(0, SortType.Ascending);

            GtkScrolledWindow1            = new ScrolledWindow();
            GtkScrolledWindow1.Name       = "GtkScrolledWindow1";
            GtkScrolledWindow1.ShadowType = ((ShadowType)(1));

            //Adding services to store
            int length = ServicesImg.Length;

            for (int i = 0; i < length; ++i)
            {
                AllServicesList[i].Img = null;
                if (ServicesImg[i] != null)
                {
                    AllServices.AppendValues(i, AllServicesList[i].Name, ServicesImg[i]);
                }
                else
                {
                    AllServices.AppendValues(i, AllServicesList[i].Name, DefaultServiceIcon);
                }
            }

            // All Services IconViewSettings
            IV_AllServices              = new IconView(AllServices);
            IV_AllServices.CanFocus     = true;
            IV_AllServices.Name         = "IV_AllServices";
            IV_AllServices.ItemWidth    = IV_ItemWidth;
            IV_AllServices.TextColumn   = Col_DisplayName;
            IV_AllServices.PixbufColumn = Col_Pixbuf;
            GtkScrolledWindow1.Add(IV_AllServices);
            vbox4.Add(GtkScrolledWindow1);
            IV_AllServices.GrabFocus();

            vbox4.Add(hbox3);
            vbox4.SetChildPacking(hbox3, false, false, 0, PackType.Start);
            vbox2.Add(vbox4);
            hbox1.Add(vbox2);
            Add(hbox1);
            ShowAll();
            DeleteEvent += new DeleteEventHandler(OnDeleteEvent);
            IV_AllServices.ItemActivated         += new ItemActivatedHandler(OnIV_AllServicesItemActivated);
            IV_SelectedServices.ItemActivated    += new ItemActivatedHandler(OnIV_SelectedServicesItemActivated);
            IV_SelectedServices.ButtonPressEvent += new ButtonPressEventHandler(CheckForDelete);
            settingsWindow = new SettingsWindow()
            {
                WindowClosing = ClosedSettingsWindwos
            };
            Task.Run(() => LoadVersionsOfComposeFileFromSite());
        }
Ejemplo n.º 22
0
    public TxtEdit() :  base("Stronghold .tex editor v.0.2")
    {
        offsets  = new UInt32[250];
        sections = new List <TexString>();
        file_dialog();

        SetDefaultSize(800, 600);
        SetPosition(WindowPosition.Center);

        DeleteEvent += delegate {
            Application.Quit();
        };

        Gtk.TreeView tree = new Gtk.TreeView();

        // menu bar
        MenuBar mb       = new MenuBar();
        Menu    filemenu = new Menu();
        Menu    helpmenu = new Menu();

        MenuItem file = new MenuItem("File");

        file.Submenu = filemenu;

        MenuItem open = new MenuItem("Open");

        open.Activated += delegate {
            file_dialog();
        };
        filemenu.Append(open);

        MenuItem reload = new MenuItem("Reload");

        reload.Activated += delegate {
            MessageDialog md = new MessageDialog(this,
                                                 DialogFlags.DestroyWithParent, MessageType.Question,
                                                 ButtonsType.OkCancel, "This will undo all changes. Continue?");
            ResponseType result = (ResponseType)md.Run();
            if (result == ResponseType.Ok)
            {
                sections = new List <TexString>();

                load_file();

                store = new Gtk.TreeStore(typeof(TexString));
                foreach (var sec in sections)
                {
                    store.AppendValues(sec);
                }
                tree.Model = store;
            }

            md.Destroy();
        };
        filemenu.Append(reload);

        MenuItem save = new MenuItem("Save");

        save.Activated += delegate {
            save_backup();
            save_tex();
        };
        filemenu.Append(save);

        MenuItem exit = new MenuItem("Exit");

        exit.Activated += delegate {
            Application.Quit();
        };
        filemenu.Append(exit);

        MenuItem help = new MenuItem("Help");

        help.Submenu = helpmenu;

        MenuItem about = new MenuItem("About");

        about.Activated += about_event;
        helpmenu.Append(about);

        mb.Append(file);
        mb.Append(help);

        VBox vbox = new VBox(false, 2);

        vbox.PackStart(mb, false, false, 0);

        // scrolling area
        ScrolledWindow scroller = new ScrolledWindow();

        scroller.BorderWidth = 5;
        scroller.ShadowType  = ShadowType.In;
        vbox.Add(scroller);

        // tree view
        Gtk.TreeViewColumn sectionColumn = new Gtk.TreeViewColumn();
        sectionColumn.Title = "Text";

        Gtk.CellRendererText sectionCell = new Gtk.CellRendererText();
        sectionCell.Editable = true;
        sectionCell.Edited  += sectionCell_edit;
        sectionColumn.PackStart(sectionCell, true);

        store = new Gtk.TreeStore(typeof(TexString));
        foreach (var sec in sections)
        {
            store.AppendValues(sec);
        }

        sectionColumn.SetCellDataFunc(sectionCell, new Gtk.TreeCellDataFunc(RenderSection));

        tree.AppendColumn(sectionColumn);
        tree.Model = store;
        scroller.Add(tree);

        Add(vbox);

        ShowAll();
    }
Ejemplo n.º 23
0
 public void AddEntry(Widget widget)
 {
     EntryBox.Add(widget);
 }
Ejemplo n.º 24
0
        public ModelDetailsWrapperView(ViewBase owner) : base(owner)
        {
            hbox  = new HBox();
            vbox1 = new VBox();

            modelTypeLabel = new Label
            {
                Xalign    = 0.0f,
                Xpad      = 3,
                UseMarkup = true
            };

            modelDescriptionLabel = new Label()
            {
                Xalign = 0.0f,
                Xpad   = 4
            };
            modelDescriptionLabel.LineWrapMode = Pango.WrapMode.Word;
            modelDescriptionLabel.Wrap         = true;
#if NETFRAMEWORK
            modelDescriptionLabel.ModifyBg(StateType.Normal, new Gdk.Color(131, 0, 131));
#endif
            modelHelpLinkLabel = new LinkButton("", "")
            {
                Xalign = 0.0f,
            };
            modelHelpLinkLabel.Clicked += ModelHelpLinkLabel_Clicked;
#if NETFRAMEWORK
            modelHelpLinkLabel.ModifyBase(StateType.Normal, new Gdk.Color(131, 0, 131));
#endif
            modelHelpLinkLabel.Visible = false;

            Gtk.CellRendererPixbuf pixbufRender = new CellRendererPixbuf();
            pixbufRender.Pixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.MenuImages.Help.png");
            pixbufRender.Xalign = 0.5f;
            Gtk.Image img = new Image(pixbufRender.Pixbuf);
            modelHelpLinkLabel.Image         = img;
            modelHelpLinkLabel.Image.Visible = true;

            modelVersionLabel = new Label()
            {
                Xalign    = 0.0f,
                Xpad      = 4,
                UseMarkup = true
            };
#if NETFRAMEWORK
            modelVersionLabel.ModifyFg(StateType.Normal, new Gdk.Color(150, 150, 150));
            modelVersionLabel.ModifyBg(StateType.Normal, new Gdk.Color(131, 0, 131));
#endif
            modelVersionLabel.LineWrapMode = Pango.WrapMode.Word;
            modelVersionLabel.Wrap         = true;

            bottomView = new Viewport
            {
                ShadowType = ShadowType.None
            };

            hbox.PackStart(modelTypeLabel, false, true, 0);
            hbox.PackStart(modelHelpLinkLabel, false, false, 0);

            vbox1.PackStart(hbox, false, true, 0);
            vbox1.PackStart(modelDescriptionLabel, false, true, 0);
            vbox1.PackStart(modelVersionLabel, false, true, 4);

            vbox1.Add(bottomView);
            vbox1.SizeAllocated += Vbox1_SizeAllocated;

            mainWidget            = vbox1;
            mainWidget.Destroyed += _mainWidget_Destroyed;
        }
Ejemplo n.º 25
0
        public ModelDetailsWrapperView(ViewBase owner) : base(owner)
        {
            string css = "";

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ApsimNG.Resources.Style.clem.css"))
            {
                using StreamReader reader = new StreamReader(stream, System.Text.Encoding.UTF8);
                css = reader.ReadToEnd();
            }

            Gtk.CssProvider css_provider = new CssProvider();
            css_provider.LoadFromData(css);

            hbox   = new HBox();
            vbox1  = new VBox();
            labels = new VBox();

            modelTypeLabel = new Label
            {
                Xalign = 0.0f,
                Xpad   = 3
            };

            hbox.StyleContext.AddProvider(css_provider, Gtk.StyleProviderPriority.Application);
            modelTypeLabel.StyleContext.AddProvider(css_provider, Gtk.StyleProviderPriority.Application);
            modelTypeLabel.StyleContext.AddClass("wrapper_label_type");

            modelDescriptionLabel = new Label()
            {
                Xalign = 0.0f,
                Xpad   = 4
            };
            modelDescriptionLabel.LineWrapMode = Pango.WrapMode.Word;
            modelDescriptionLabel.Wrap         = true;

            modelHelpLinkLabel = new LinkButton("", "")
            {
                Xalign = 0.0f,
            };
            modelHelpLinkLabel.Clicked += ModelHelpLinkLabel_Clicked;

            modelHelpLinkLabel.Visible = false;

            Gtk.CellRendererPixbuf pixbufRender = new CellRendererPixbuf();
            pixbufRender.Pixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.MenuImages.Help.svg");
            pixbufRender.Xalign = 0.5f;
            Gtk.Image img = new Image(pixbufRender.Pixbuf);
            modelHelpLinkLabel.Image         = img;
            modelHelpLinkLabel.Image.Visible = true;

            bottomView = new Viewport
            {
                ShadowType = ShadowType.None
            };

            hbox.PackStart(modelTypeLabel, false, true, 0);
            hbox.PackStart(modelHelpLinkLabel, false, false, 0);

            labels.PackStart(hbox, false, true, 0);
            modelDescriptionLabel.MarginBottom = 5;

            labels.PackStart(modelDescriptionLabel, false, true, 0);
            vbox1.PackStart(labels, false, true, 0);

            ScrolledWindow scroll = new ScrolledWindow();

            scroll.ShadowType = ShadowType.None;
            scroll.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            scroll.Add(bottomView);
            vbox1.Add(scroll);

            mainWidget            = vbox1;
            mainWidget.Destroyed += _mainWidget_Destroyed;
        }
Ejemplo n.º 26
0
        public override void Clicked()
        {
            Box       tmpBox, tmpBox2;
            Alignment tmpAlign;
            Box       vbox = new Gtk.VBox();

            vbox.Spacing = 3;
            Box hbox = new Gtk.HBox();

            hbox.Spacing = 3;

            Box dungeonVreContainer         = new Gtk.VBox();
            Box roomVreContainer            = new Gtk.VBox();
            ValueReferenceEditor dungeonVre = null;
            ValueReferenceEditor roomVre    = null;

            Alignment frame             = new Alignment(0, 0, 0, 0);
            var       dungeonSpinButton = new SpinButton(0, 15, 1);
            var       floorSpinButton   = new SpinButton(0, 15, 1);
            var       roomSpinButton    = new SpinButtonHexadecimal(0, 255, 1);

            roomSpinButton.Digits = 2;
            Minimap minimap = null;

            System.Action RoomChanged = () => {
                Dungeon dungeon = minimap.Map as Dungeon;
                Room    room    = minimap.GetRoom();

                roomSpinButton.Value = room.Index & 0xff;

                var vrs = new List <ValueReference>();
                vrs.Add(new StreamValueReference("Up", room.Index & 0xff, 0, 0, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Right", room.Index & 0xff, 1, 1, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Down", room.Index & 0xff, 2, 2, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Left", room.Index & 0xff, 3, 3, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Key", room.Index & 0xff, 4, 4, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Chest", room.Index & 0xff, 5, 5, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Boss", room.Index & 0xff, 6, 6, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Dark", room.Index & 0xff, 7, 7, DataValueType.ByteBit));

                Stream stream = Project.GetBinaryFile("rooms/" + Project.GameString + "/group" + dungeon.Group + "DungeonProperties.bin");
                foreach (StreamValueReference r in vrs)
                {
                    r.SetStream(stream);
                }

                if (roomVre != null)
                {
                    roomVreContainer.Remove(roomVre);
                }

                var vrg = new ValueReferenceGroup(vrs);
                roomVre = new ValueReferenceEditor(Project, vrg, 4, "Minimap Data");

                roomVreContainer.Add(roomVre);
            };

            System.Action DungeonChanged = () => {
                Dungeon dungeon = Project.GetIndexedDataType <Dungeon>(dungeonSpinButton.ValueAsInt);

                floorSpinButton.Adjustment.Upper = dungeon.NumFloors - 1;
                if (floorSpinButton.ValueAsInt >= dungeon.NumFloors)
                {
                    floorSpinButton.Value = dungeon.NumFloors - 1;
                }

                var vrs = new List <ValueReference>();
                vrs.Add(new ValueReference("Group", 0, DataValueType.String, false));
                vrs.Add(new ValueReference("Wallmaster dest room", 0, DataValueType.Byte));
                vrs.Add(new ValueReference("Bottom floor layout", 0, DataValueType.Byte, false));
                vrs.Add(new ValueReference("# of floors", 0, DataValueType.Byte, false));
                vrs.Add(new ValueReference("Base floor name", 0, DataValueType.Byte));
                vrs.Add(new ValueReference("Floors unlocked with compass", 0, DataValueType.Byte));

                Data data = dungeon.DataStart;
                foreach (ValueReference r in vrs)
                {
                    r.SetData(data);
                    data = data.NextData;
                }

                // Remove last ValueReferenceEditor
                if (dungeonVre != null)
                {
                    dungeonVreContainer.Remove(dungeonVre);
                }

                var vrg = new ValueReferenceGroup(vrs);
                dungeonVre = new ValueReferenceEditor(Project, vrg, "Base Data");

                dungeonVre.AddDataModifiedHandler(() => {
                    floorSpinButton.Adjustment.Upper = dungeon.NumFloors;
                    minimap.GenerateImage();
                    RoomChanged();
                });

                // Replace the "group" option with a custom widget for finer
                // control.
                SpinButton groupSpinButton = new SpinButton(4, 5, 1);
                groupSpinButton.Value         = dungeon.Group;
                groupSpinButton.ValueChanged += (c, d) => {
                    vrg.SetValue("Group", ">wGroup" + groupSpinButton.ValueAsInt + "Flags");
                };
                dungeonVre.ReplaceWidget(0, groupSpinButton);
                dungeonVre.ShowAll();

                // Tooltips
                dungeonVre.SetTooltip(0, "Also known as the high byte of the room index.");
                dungeonVre.SetTooltip(1, "The low byte of the room index wallmasters will send you to.");
                dungeonVre.SetTooltip(2, "The index of the layout for the bottom floor. Subsequent floors will use subsequent indices.");
                dungeonVre.SetTooltip(4, "Determines what the game will call the bottom floor. For a value of:\n$00: The bottom floor is 'B3'.\n$01: The bottom floor is 'B2'.\n$02: The bottom floor is 'B1'.\n$03: The bottom floor is 'F1'.");
                dungeonVre.SetTooltip(5, "A bitset of floors that will appear on the map when the compass is obtained.\n\nEg. If this is $05, then floors 0 and 2 will be unlocked (bits 0 and 2 are set).");

                dungeonVreContainer.Add(dungeonVre);
                minimap.SetMap(dungeon);
                minimap.Floor = floorSpinButton.ValueAsInt;

                RoomChanged();
            };

            dungeonSpinButton.ValueChanged += (a, b) => { DungeonChanged(); };
            floorSpinButton.ValueChanged   += (a, b) => { DungeonChanged(); };

            frame.Add(vbox);

            tmpBox = new Gtk.HBox();
            tmpBox.Add(new Gtk.Label("Dungeon "));
            tmpBox.Add(dungeonSpinButton);
            tmpBox.Add(new Gtk.Label("Floor "));
            tmpBox.Add(floorSpinButton);
            tmpAlign = new Alignment(0, 0, 0, 0);
            tmpAlign.Add(tmpBox);

            vbox.Add(tmpAlign);
            vbox.Add(hbox);

            // Leftmost column

            tmpBox = new VBox();
            tmpBox.Add(dungeonVreContainer);

            var addFloorButton = new Button("Add Floor");

            addFloorButton.Image    = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button);
            addFloorButton.Clicked += (a, b) => {
                Dungeon dungeon = minimap.Map as Dungeon;

                int newFloorIndex = dungeon.FirstLayoutIndex + dungeon.NumFloors;

                // Shift all subsequent layouts 64 bytes down in the data file
                Stream layoutFile = Project.GetBinaryFile("rooms/" + Project.GameString + "/dungeonLayouts.bin");
                layoutFile.SetLength(layoutFile.Length + 64);
                for (int i = (int)layoutFile.Length / 64 - 1; i > newFloorIndex; i--)
                {
                    var buf = new byte[64];
                    layoutFile.Position = (i - 1) * 64;
                    layoutFile.Read(buf, 0, 64);
                    layoutFile.Write(buf, 0, 64);
                }

                // Clear the new floor
                layoutFile.Position = newFloorIndex * 64;
                for (int j = 0; j < 64; j++)
                {
                    layoutFile.WriteByte(0);
                }

                // Shift each dungeon's "FirstLayoutIndex" to match the shifted layouts.
                for (int i = 0; i < Project.GetNumDungeons(); i++)
                {
                    Dungeon d2 = Project.GetIndexedDataType <Dungeon>(i);
                    if (d2.FirstLayoutIndex >= newFloorIndex)
                    {
                        d2.FirstLayoutIndex++;
                    }
                }

                dungeon.NumFloors     = dungeon.NumFloors + 1;
                floorSpinButton.Value = dungeon.NumFloors - 1;
                DungeonChanged();
            };
            tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0);
            tmpAlign.Add(addFloorButton);
            tmpBox.Add(tmpAlign);

            var removeFloorButton = new Button("Remove Top Floor");

            removeFloorButton.Image    = new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Button);
            removeFloorButton.Clicked += (a, b) => {
                Dungeon dungeon = minimap.Map as Dungeon;

                if (dungeon.NumFloors <= 1)
                {
                    return;
                }

                Gtk.MessageDialog d = new MessageDialog(null,
                                                        DialogFlags.DestroyWithParent,
                                                        MessageType.Warning,
                                                        ButtonsType.YesNo,
                                                        "Are you quite certain that you wish to delete the top floor of this dungeon?");
                var response = (ResponseType)d.Run();
                d.Destroy();

                if (response == Gtk.ResponseType.Yes)
                {
                    int deletedFloorIndex = dungeon.FirstLayoutIndex + dungeon.NumFloors - 1;

                    // Shift all subsequent layouts 64 bytes up in the data file
                    Stream layoutFile = Project.GetBinaryFile("rooms/" + Project.GameString + "/dungeonLayouts.bin");
                    for (int i = deletedFloorIndex; i < layoutFile.Length / 64 - 1; i++)
                    {
                        var buf = new byte[64];
                        layoutFile.Position = (i + 1) * 64;
                        layoutFile.Read(buf, 0, 64);
                        layoutFile.Position = i * 64;
                        layoutFile.Write(buf, 0, 64);
                    }

                    layoutFile.SetLength(layoutFile.Length - 64);

                    // Shift each dungeon's "FirstLayoutIndex" to match the shifted layouts.
                    for (int i = 0; i < Project.GetNumDungeons(); i++)
                    {
                        Dungeon d2 = Project.GetIndexedDataType <Dungeon>(i);
                        if (d2.FirstLayoutIndex > deletedFloorIndex)
                        {
                            d2.FirstLayoutIndex--;
                        }
                    }

                    dungeon.NumFloors = dungeon.NumFloors - 1;

                    DungeonChanged();
                }
            };
            tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0);
            tmpAlign.Add(removeFloorButton);
            tmpBox.Add(tmpAlign);

            hbox.Add(tmpBox);

            // Middle column (minimap)

            minimap = new Minimap();
            minimap.TileSelectedEvent += (sender) => {
                RoomChanged();
            };

            hbox.Add(minimap);

            // Rightmost column

            tmpAlign = new Alignment(0, 0, 0, 0);
            tmpAlign.Add(roomVreContainer);

            tmpBox2 = new HBox();
            tmpBox2.Add(new Gtk.Label("Room "));
            roomSpinButton.ValueChanged += (a, b) => {
                (minimap.Map as Dungeon).SetRoom(minimap.SelectedX, minimap.SelectedY,
                                                 minimap.Floor, roomSpinButton.ValueAsInt);
                minimap.GenerateImage();
                RoomChanged();
            };
            tmpBox2.Add(roomSpinButton);

            tmpBox = new VBox();
            tmpBox.Add(tmpBox2);
            tmpBox.Add(tmpAlign);

            hbox.Add(tmpBox);



            Window w = new Window(null);

            w.Add(frame);
            w.ShowAll();

            Map map = manager.GetActiveMap();

            if (map is Dungeon)
            {
                dungeonSpinButton.Value = map.Index;
            }

            DungeonChanged();
        }
Ejemplo n.º 27
0
        private void Build()
        {
            Icon           = PintaCore.Resources.GetIcon("Menu.Image.Resize.png");
            WindowPosition = WindowPosition.CenterOnParent;

            DefaultWidth  = 300;
            DefaultHeight = 200;

            percentageRadio = new RadioButton(Catalog.GetString("By percentage:"));
            absoluteRadio   = new RadioButton(percentageRadio, Catalog.GetString("By absolute size:"));

            percentageSpinner = new SpinButton(1, 1000, 1);
            widthSpinner      = new SpinButton(1, 10000, 1);
            heightSpinner     = new SpinButton(1, 10000, 1);

            aspectCheckbox = new CheckButton(Catalog.GetString("Maintain aspect ratio"));

            const int spacing   = 6;
            var       main_vbox = new VBox()
            {
                Spacing = spacing, BorderWidth = 12
            };

            var hbox_percent = new HBox()
            {
                Spacing = spacing
            };

            hbox_percent.PackStart(percentageRadio, true, true, 0);
            hbox_percent.PackStart(percentageSpinner, false, false, 0);
            hbox_percent.PackEnd(new Label("%"), false, false, 0);
            main_vbox.PackStart(hbox_percent, false, false, 0);

            main_vbox.PackStart(absoluteRadio, false, false, 0);

            var hbox_width = new HBox()
            {
                Spacing = spacing
            };

            hbox_width.PackStart(new Label(Catalog.GetString("Width:")), false, false, 0);
            hbox_width.PackStart(widthSpinner, false, false, 0);
            hbox_width.PackStart(new Label(Catalog.GetString("pixels")), false, false, 0);
            main_vbox.PackStart(hbox_width, false, false, 0);

            var hbox_height = new HBox()
            {
                Spacing = spacing
            };

            hbox_height.PackStart(new Label(Catalog.GetString("Height:")), false, false, 0);
            hbox_height.PackStart(heightSpinner, false, false, 0);
            hbox_height.PackStart(new Label(Catalog.GetString("pixels")), false, false, 0);
            main_vbox.PackStart(hbox_height, false, false, 0);

            main_vbox.PackStart(aspectCheckbox, false, false, 0);

            VBox.BorderWidth = 2;
            VBox.Add(main_vbox);

            ShowAll();
        }
        public VentanaContactosModificar() : base("Modificar contactos")
        {
            //Config
            BorderWidth = 10;
            SetDefaultSize(250, 200);
            SetPosition(WindowPosition.Center);

            VBox Main = new VBox();

            //TODO ESTA TARDE

            comboBox          = new ComboBox(Agenda.Get().ToStringCB());
            comboBox.Changed += cambiarContacto;

            Button botonModificar = new Button("Modificar");

            botonModificar.Clicked += modificarContacto;

            Nombre    = new Entry();
            Apellidos = new Entry();
            Direccion = new Entry();
            Telefono  = new Entry();
            Email     = new Entry();

            Label labelNombreContacto = new Label("Nombre");

            labelNombreContacto.SetAlignment(0, 1);
            Label labelApellidosContacto = new Label("Apellidos");

            labelApellidosContacto.SetAlignment(0, 1);
            Label labelDireccionContacto = new Label("Dirección");

            labelDireccionContacto.SetAlignment(0, 1);
            Label labelTelefonoContacto = new Label("Teléfono");

            labelTelefonoContacto.SetAlignment(0, 1);
            Label labelEmailContacto = new Label("Email");

            labelEmailContacto.SetAlignment(0, 1);

            Main.Add(comboBox);
            Main.Add(labelNombreContacto);
            Main.Add(Nombre);
            Main.Add(labelApellidosContacto);
            Main.Add(Apellidos);
            Main.Add(labelDireccionContacto);
            Main.Add(Direccion);
            Main.Add(labelTelefonoContacto);
            Main.Add(Telefono);
            Main.Add(labelEmailContacto);
            Main.Add(Email);
            Main.Add(botonModificar);

            this.Add(Main);
            this.ShowAll();
        }
Ejemplo n.º 29
0
        private void BuildDialog()
        {
            // Layout table for preset, width, and height
            var layout_table = new Table(3, 2, false);

            layout_table.RowSpacing    = 5;
            layout_table.ColumnSpacing = 6;

            // Preset Combo
            var size_label = new Label(Catalog.GetString("Preset:"));

            size_label.SetAlignment(1f, .5f);

            var preset_entries = new List <string> ();

            if (has_clipboard)
            {
                preset_entries.Add(Catalog.GetString("Clipboard"));
            }

            preset_entries.Add(Catalog.GetString("Custom"));
            preset_entries.AddRange(preset_sizes.Select(p => string.Format("{0} x {1}", p.Width, p.Height)));

            preset_combo        = new ComboBox(preset_entries.ToArray());
            preset_combo.Active = 0;

            layout_table.Attach(size_label, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            layout_table.Attach(preset_combo, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // Width Entry
            var width_label = new Label(Catalog.GetString("Width:"));

            width_label.SetAlignment(1f, .5f);

            width_entry = new Entry();
            width_entry.WidthRequest     = 50;
            width_entry.ActivatesDefault = true;

            var width_units = new Label(Catalog.GetString("pixels"));

            var width_hbox = new HBox();

            width_hbox.PackStart(width_entry, false, false, 0);
            width_hbox.PackStart(width_units, false, false, 5);

            layout_table.Attach(width_label, 0, 1, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            layout_table.Attach(width_hbox, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // Height Entry
            var height_label = new Label(Catalog.GetString("Height:"));

            height_label.SetAlignment(1f, .5f);

            height_entry = new Entry();
            height_entry.WidthRequest     = 50;
            height_entry.ActivatesDefault = true;

            var height_units = new Label(Catalog.GetString("pixels"));

            var height_hbox = new HBox();

            height_hbox.PackStart(height_entry, false, false, 0);
            height_hbox.PackStart(height_units, false, false, 5);

            layout_table.Attach(height_label, 0, 1, 2, 3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            layout_table.Attach(height_hbox, 1, 2, 2, 3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // Orientation Radio options
            var orientation_label = new Label(Catalog.GetString("Orientation:"));

            orientation_label.SetAlignment(0f, .5f);

            portrait_radio = new RadioButton(Catalog.GetString("Portrait"));
            var portrait_image = new Image(PintaCore.Resources.GetIcon(Stock.OrientationPortrait, 16));

            var portrait_hbox = new HBox();

            portrait_hbox.PackStart(portrait_image, false, false, 7);
            portrait_hbox.PackStart(portrait_radio, false, false, 0);

            landscape_radio = new RadioButton(portrait_radio, Catalog.GetString("Landscape"));
            var landscape_image = new Image(PintaCore.Resources.GetIcon(Stock.OrientationLandscape, 16));

            var landscape_hbox = new HBox();

            landscape_hbox.PackStart(landscape_image, false, false, 7);
            landscape_hbox.PackStart(landscape_radio, false, false, 0);

            // Orientation VBox
            var orientation_vbox = new VBox();

            orientation_vbox.PackStart(orientation_label, false, false, 4);
            orientation_vbox.PackStart(portrait_hbox, false, false, 0);
            orientation_vbox.PackStart(landscape_hbox, false, false, 0);

            // Background Color options
            var background_label = new Label(Catalog.GetString("Background:"));

            background_label.SetAlignment(0f, .5f);

            white_bg_radio = new RadioButton(Catalog.GetString("White"));
            var image_white = new Image(GdkExtensions.CreateColorSwatch(16, new Gdk.Color(255, 255, 255)));

            var hbox_white = new HBox();

            hbox_white.PackStart(image_white, false, false, 7);
            hbox_white.PackStart(white_bg_radio, false, false, 0);

            secondary_bg_radio = new RadioButton(white_bg_radio, Catalog.GetString("Background Color"));
            var image_bg = new Image(GdkExtensions.CreateColorSwatch(16, PintaCore.Palette.SecondaryColor.ToGdkColor()));

            var hbox_bg = new HBox();

            hbox_bg.PackStart(image_bg, false, false, 7);
            hbox_bg.PackStart(secondary_bg_radio, false, false, 0);

            trans_bg_radio = new RadioButton(secondary_bg_radio, Catalog.GetString("Transparent"));
            var image_trans = new Image(GdkExtensions.CreateTransparentColorSwatch(true));

            var hbox_trans = new HBox();

            hbox_trans.PackStart(image_trans, false, false, 7);
            hbox_trans.PackStart(trans_bg_radio, false, false, 0);

            // Background VBox
            var background_vbox = new VBox();

            background_vbox.PackStart(background_label, false, false, 4);
            background_vbox.PackStart(hbox_white, false, false, 0);

            if (allow_background_color)
            {
                background_vbox.PackStart(hbox_bg, false, false, 0);
            }

            background_vbox.PackStart(hbox_trans, false, false, 0);

            // Put all the options together
            var options_vbox = new VBox();

            options_vbox.Spacing = 10;

            options_vbox.PackStart(layout_table, false, false, 3);
            options_vbox.PackStart(orientation_vbox, false, false, 0);
            options_vbox.PackStart(background_vbox, false, false, 4);

            // Layout the preview + the options
            preview = new PreviewArea();

            var preview_label = new Label(Catalog.GetString("Preview"));

            var preview_vbox = new VBox();

            preview_vbox.PackStart(preview_label, false, false, 0);
            preview_vbox.PackStart(preview, true, true, 0);


            var main_hbox = new HBox(false, 10);

            main_hbox.PackStart(options_vbox, false, false, 0);
            main_hbox.PackStart(preview_vbox, true, true, 0);

            VBox.Add(main_hbox);

            ShowAll();
        }
Ejemplo n.º 30
0
 public void AddOption(Widget widget)
 {
     OptionArea.Add(widget);
 }