示例#1
0
    private void createGui(Gtk.Window app1, ChronopicRegisterPort crp, string labelStr)
    {
        chronopic_contacts_real_win              = new Window("Chronopic connection");
        chronopic_contacts_real_win.AllowGrow    = false;
        chronopic_contacts_real_win.Modal        = true;
        chronopic_contacts_real_win.TransientFor = app1;
        chronopic_contacts_real_win.BorderWidth  = 20;

        chronopic_contacts_real_win.DeleteEvent += on_delete_event;

        Gtk.VBox vbox_main = new Gtk.VBox(false, 20);
        chronopic_contacts_real_win.Add(vbox_main);

        LogB.Information("Connecting real (starting connection)");
        LogB.Information("Press test button on Chronopic");

        Gtk.Label labelMessage = new Gtk.Label();
        labelMessage.Text = labelStr + "\n" +
                            "\n" + Catalog.GetString("Port") + ": " + crp.Port +
                            "\n" + Catalog.GetString("Serial Number") + ": " + crp.SerialNumber;
        vbox_main.Add(labelMessage);

        progressbar = new Gtk.ProgressBar();
        vbox_main.Add(progressbar);

        Gtk.Button button_cancel = new Gtk.Button("Cancel");
        button_cancel.Clicked += new EventHandler(on_button_cancel_clicked);
        Gtk.HButtonBox hbox = new Gtk.HButtonBox();
        hbox.Add(button_cancel);
        vbox_main.Add(hbox);

        chronopic_contacts_real_win.ShowAll();
    }
    private void createContent(int connectedCount, int unknownCount)
    {
        //create top hbox
        Gtk.HBox hbox = new Gtk.HBox(false, 12);

        Pixbuf pixbuf = new Pixbuf(null, Util.GetImagePath(false) + "image_chronopic_connect_big.png");

        //hbox image
        Gtk.Image image = new Gtk.Image();
        image.Pixbuf = pixbuf;
        hbox.Add(image);

        //hbox label
        Gtk.Label label = new Gtk.Label();
        label.Text = writeLabel(connectedCount, unknownCount);
        hbox.Add(label);
        vbox_main.Add(hbox);

        //table
        if (connectedCount > 0)
        {
            createTable();
            Gtk.VBox vboxTV = new Gtk.VBox(false, 10);
            vboxTV.Add(table_main);
            vbox_main.Add(vboxTV);
        }
    }
        /// <summary>
        /// Creates the config widget.
        /// </summary>
        /// <returns>The config widget.</returns>
        public override Gtk.Widget CreateConfigWidget()
        {
            var container = new VBox();
            var citiesNumber = new SpinButton(2, 10000, 2);
            citiesNumber.Text = "Number of cities";
            citiesNumber.Value = m_numberOfCities;
            citiesNumber.ValueChanged += delegate
            {
                m_numberOfCities = citiesNumber.ValueAsInt - (citiesNumber.ValueAsInt % 2);
                citiesNumber.Value = m_numberOfCities;
                OnReconfigured();
            };
            container.Add(citiesNumber);

            var generateButton = new Button();
            generateButton.Label = "Generate cities";
            generateButton.Clicked += delegate
            {
                m_numberOfCities = citiesNumber.ValueAsInt;
                OnReconfigured();
            };
            container.Add(generateButton);

            var showIndexes = new CheckButton();
            showIndexes.Active = m_showIndexes;
            showIndexes.Label = "Show indexes";
            showIndexes.Toggled += delegate
            {
                m_showIndexes = showIndexes.Active;
            };

            container.Add(showIndexes);

            return container;
        }
 public override Widget ConfigurationWidget()
 {
     VBox h = new VBox ();
     r = new HScale (0, 100, 1);
     r.ModifyBg (StateType.Selected, new Color (0xff, 0, 0));
     r.Value = 80;
     r.ValueChanged += SettingsChanged;
     h.Add (r);
     g = new HScale (0, 100, 1);
     g.ModifyBg (StateType.Selected, new Color (0, 0xff, 0));
     g.Value = 10;
     g.ValueChanged += SettingsChanged;
     h.Add (g);
     b = new HScale (0, 100, 1);
     b.ModifyBg (StateType.Selected, new Color (0, 0, 0xff));
     b.Value = 10;
     b.ValueChanged += SettingsChanged;
     h.Add (b);
     c = new Curve ();
     c.CurveType = CurveType.Spline;
     c.SetRange (0, 255, 0, 255);
     h.Add (c);
     Button btn = new Button (Gtk.Stock.Refresh);
     btn.Clicked += delegate {UpdatePreview ();};
     h.Add (btn);
     return h;
 }
示例#5
0
文件: Splash.cs 项目: Sylvia-We/cew
        public Splash() : base(Gtk.WindowType.Toplevel)
        {
            /* set background image */
            Gdk.Pixbuf one = new Gdk.Pixbuf(Functions.logoFile);

            Gtk.VBox vbox = new Gtk.VBox();

            Gtk.Image image = new Gtk.Image(one);
            vbox.Add(image);

            Label startLabel = new Label();

            startLabel.Text = "CEW startet...";
            vbox.Add(startLabel);

            this.Add(vbox);

            this.SetSizeRequest(500, 300);
            this.WindowPosition  = WindowPosition.Center;
            this.Decorated       = false;
            this.HasFocus        = false;
            this.HasFrame        = false;
            this.KeepAbove       = true;
            this.Modal           = false;
            this.SkipPagerHint   = true;
            this.SkipTaskbarHint = true;
            this.TypeHint        = Gdk.WindowTypeHint.Splashscreen;
            this.ShowAll();

            Hourglass = true;
            while (Application.EventsPending())
            {
                Application.RunIteration();
            }
        }
示例#6
0
        public CategoriaListView()
        {
            TreeViewHelper t=new TreeViewHelper(treeView,"Select * from categoria");
            Gtk.Action refreshAction = new Gtk.Action("refreshAction", null, null, Stock.Refresh);
            //tengo acceso al actionGroup de IEntityListView
            actionGroup.Add(refreshAction);
            refreshAction.Activated += delegate {t.Refresh ();};
            Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit);
            actionGroup.Add(editAction);
            editAction.Activated += delegate {
                Window ventana=new Window("Editar");
                ventana.SetDefaultSize(500,500);
                VBox h=new VBox(true,10);
                ventana.Add (h);
                Label enunciado=new Label("Introduce el nuevo valor:");
                h.Add (enunciado);
                Entry caja=new Entry();
                h.Add (caja);
                Button b=new Button("Editar");
                h.Add (b);
                b.Clicked+=delegate
                {
                    IDbCommand dbCommand=App.Instance.DbConnection.CreateCommand();
                    dbCommand.CommandText =
                    string.Format ("update categoria set nombre='{1}' where id={0}", t.Id,caja.Text);
                    dbCommand.ExecuteNonQuery ();
                };

                ventana.ShowAll();

            };
        }
示例#7
0
        /// <summary>
        /// Runs in a separate thread.
        /// </summary>
        public void DoWork()
        {
            Application.Init();

            //Create the Window
            myWin = new Window("N'Oubliez pas les paroles  - Fenêtre de contrôle");
            myWin.DeleteEvent += this.OnWindowDeleteEvent;

            vBox = new VBox();
            myWin.Add(vBox);

            myPlayerScoreController = new PlayerScoreController(this);
            vBox.Add(myPlayerScoreController.GetPaneBox());

            mySongTestController = new SongTestController(this);
            vBox.Add(mySongTestController.GetPaneBox());

            // Rend tout visible
            myWin.ShowAll();

            // start the message pump
            messagePumper.Start();

            Application.Run();
        }
示例#8
0
        private void Build ()
        {
            // Section label + line
            var hbox1 = new HBox (false, 6);

            var label = new Label ();
            label.LabelProp = Mono.Unix.Catalog.GetString ("Random Noise");

            hbox1.PackStart (label, false, false, 0);
            hbox1.PackStart (new HSeparator (), true, true, 0);

            // Reseed button
            button1 = new Button ();
            button1.WidthRequest = 88;
            button1.CanFocus = true;
            button1.UseUnderline = true;
            button1.Label = Mono.Unix.Catalog.GetString ("Reseed");

            var hbox2 = new HBox (false, 6);
            hbox2.PackStart (button1, false, false, 0);

            // Main layout
            var vbox = new VBox (false, 6);

            vbox.Add (hbox1);
            vbox.Add (hbox2);

            Add (vbox);

            vbox.ShowAll ();
        }
示例#9
0
        public DateMultiSelect()
        {
            DateTime now = DateTime.Now;

            this.ShadowType  = ShadowType.EtchedOut;
            this.BorderWidth = 0;

            MonthCombo = new ComboBox();
            DayCombo   = new ComboBox();
            YearCombo  = new ComboBox();
            Calendar   = new Gtk.Calendar();

            TopVbox   = new VBox();
            ComboHbox = new HBox();

            ComboHbox.Add(MonthCombo);
            ComboHbox.Add(DayCombo);
            ComboHbox.Add(YearCombo);

            TopVbox.Add(ComboHbox);

            TopVbox.Add(Calendar);

            this.Add(TopVbox);

            SetDate(DateTime.Now);

            MonthCombo.Changed   += OnComboChanged;
            DayCombo.Changed     += OnComboChanged;
            YearCombo.Changed    += OnComboChanged;
            Calendar.DaySelected += OnCalendarChanged;

            ShowAll();
        }
示例#10
0
        void BuildLayout ()
        {
            primary_vbox = new VBox ();
            
            var label = new Label ("Super duper test UI!");
            label.Show ();
            primary_vbox.Add (label);
            
            var button_box = new HButtonBox ();
            button_box.Show ();
            primary_vbox.Add (button_box);
            
            var folder_button = new FileChooserButton ("Select import folder", FileChooserAction.SelectFolder);
            folder_button.FileSet += delegate {
                folder = folder_button.Uri;
                Log.Information ("Selected " + folder);
            };
            folder_button.Show ();
            button_box.Add (folder_button);
            
            var import_button = new Button { Label = "Start Import" };
            import_button.Activated += StartImport;
            import_button.Clicked += StartImport;
            import_button.Show ();
            button_box.Add (import_button);

            primary_vbox.Show ();
            Add (primary_vbox);
        }
示例#11
0
        public SetupDialog()
            : base("Setup Map")
        {
            cellSizeSpin = new SpinButton (0.1, 1.0, 0.1);
            cellSizeSpin.Value = 0.3;
            cellSizeSpin.Changed += CellSizeSpin_Changed;

            widthSpin = new SpinButton (3.0, 10.0, 0.3);
            widthSpin.Value = 9.9;

            heightSpin = new SpinButton (3.0, 10.0, 0.3);
            heightSpin.Value = 4.5;

            portEntry = new Entry ("/dev/tty");
            portEntry.Activated += PortEntry_Activated;

            createButton = new Button ("Create");
            createButton.Clicked += CreateButton_Clicked;

            HBox widthHBox = new HBox (false, 60);
            widthHBox.Add (new Label ("Width: "));
            widthHBox.Add (widthSpin);

            HBox heightHBox = new HBox (false, 60);
            heightHBox.Add (new Label ("Height: "));
            heightHBox.Add (heightSpin);

            HBox cellHBox = new HBox (false, 60);
            cellHBox.Add (new Label ("Cell Size: "));
            cellHBox.Add (cellSizeSpin);

            HBox portHBox = new HBox (false, 60);
            portHBox.Add (new Label ("Port: "));
            portHBox.Add (portEntry);

            HBox createHbox = new HBox (false, 0);
            createHbox.Add (createButton);

            VBox vBox = new VBox (false, 10);
            vBox.BorderWidth = 10;
            vBox.Add (widthHBox);
            vBox.Add (heightHBox);
            vBox.Add (cellHBox);
            vBox.Add (portHBox);
            vBox.Add (createHbox);

            Add (vBox);

            SetPosition (WindowPosition.Center);
            Resizable = false;

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

            Shown += OnShown;
        }
示例#12
0
        private void Build()
        {
            this.Title = Catalog.GetString("Select Folder");
            this.DefaultWidth = 350;

#if GTK2
            VBox w1 = this.VBox;
#elif GTK3
            Box w1 = this.ContentArea;
#endif
            w1.Spacing = 6;
            w1.BorderWidth = ((uint)(2));

            vbox1 = new VBox();
            vbox1.Spacing = 4;

            hbox1 = new HBox();

            entryPath = new Entry();
            hbox1.PackStart(entryPath, true, true, 0);

            buttonBrowse = new Button("...");
            buttonBrowse.Clicked += ButtonBrowse_Clicked;
            hbox1.PackStart(buttonBrowse, false, false, 1);

            vbox1.Add(hbox1);

            hbox2 = new HBox();

            for (uint i = 0; i < symbols.Length; i++)
            {
                var buttonSymbol = new Button(symbols[i]);
                buttonSymbol.Clicked += ButtonSymbol_Clicked;
                hbox2.PackStart(buttonSymbol, true, true, i);
            }

            vbox1.Add(hbox2);

            w1.Add(vbox1);

            this.AddButton(Catalog.GetString("Ok"), ResponseType.Ok);
            this.AddButton(Catalog.GetString("Cancel"), ResponseType.Cancel);
            this.DefaultResponse = ResponseType.Ok;

#if GTK3
            var geom = new Gdk.Geometry();
            geom.MinWidth = this.DefaultWidth;
            geom.MinHeight = this.DefaultHeight;
            geom.MaxWidth = 1000;
            geom.MaxHeight = this.DefaultHeight;
            this.SetGeometryHints(this, geom, Gdk.WindowHints.MinSize | Gdk.WindowHints.MaxSize);
#endif

            this.Response += OnResponse;
            this.ShowAll();
        }
示例#13
0
        private TextView textView; // Textview to hold landmark information.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.MapWindow"/> class.
        /// </summary>
        /// <param name="mapView">Map view contained in this window.</param>
        public MapWindow(MapView mapView)
            : base("Map")
        {
            robot = mapView.RobotView.Robot;

            this.mapView = mapView;

            // Subscribe to events.
            mapView.MapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update);
            mapView.RobotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update);

            SetPosition (WindowPosition.Center);
            Resizable = false;

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

            TextBuffer textBuffer = new TextBuffer (new TextTagTable ());

            textView = new TextView ();
            textView.Indent = 10;
            textView.Editable = false;
            textView.Buffer = textBuffer;
            textView.CursorVisible = false;
            textView.SetSizeRequest (mapView.ViewWidth, 150);

            foreach (Landmark landmark in mapView.MapModel.Landmarks)
            {
                this.textView.Buffer.Text += landmark.ToString ();
            }

            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.Add (textView);

            commandEntry = new Entry ();
            commandEntry.Activated += CommandEntry_OnActivated;

            sendButton = new Button ("Send");
            sendButton.Clicked += SendButton_OnClick;

            HBox hbox = new HBox (false, 0);
            hbox.Add (commandEntry);
            hbox.Add (sendButton);

            VBox vbox = new VBox (false, 0);
            vbox.Add (this.mapView);
            vbox.Add (scrolledWindow);
            vbox.Add (hbox);

            Add (vbox);
            Shown += OnShown;
        }
示例#14
0
        public RolloversFrame(SliceData sliceData)
            : base(_("Rollovers"))
        {
            var vbox = new VBox(false, 12);
              Add(vbox);

              vbox.Add(CreateRolloverButton(sliceData));

              var label = new Label(_("Rollover enabled: no"));
              vbox.Add(label);
        }
示例#15
0
        public Dialog(VariableSet variables)
            : base(_("UpdateCheck"), variables)
        {
            var vbox = new VBox(false, 12) {BorderWidth = 12};
              VBox.PackStart(vbox, true, true, 0);

              var table = new GimpTable(4, 3)
            {ColumnSpacing = 6, RowSpacing = 6};
              vbox.PackStart(table, true, true, 0);

              table.Attach(new GimpCheckButton(_("Check _GIMP"),
                       GetVariable<bool>("check_gimp")),
               0, 1, 0, 1);

              table.Attach(new GimpCheckButton(_("Check G_IMP#"),
                       GetVariable<bool>("check_gimp_sharp")),
               0, 1, 1, 2);

              table.Attach(new GimpCheckButton(_("Check _Unstable Releases"),
                       GetVariable<bool>("check_unstable")),
               0, 1, 2, 3);

              var enableProxy = GetVariable<bool>("enable_proxy");
              var httpProxy = GetVariable<string>("http_proxy");
              var port = GetVariable<string>("port");

              string tmp = Gimp.RcQuery("update-enable-proxy");
              enableProxy.Value = (tmp != null || tmp == "true");
              httpProxy.Value =  Gimp.RcQuery("update-http-proxy") ?? "";
              port.Value = Gimp.RcQuery("update-port") ?? "";

              var expander = new Expander(_("Proxy settings"));
              var proxyBox = new VBox(false, 12);

              proxyBox.Add(new GimpCheckButton(_("Manual proxy configuration"),
                       enableProxy));

              var hbox = new HBox(false, 12) {Sensitive = enableProxy.Value};
              proxyBox.Add(hbox);

              hbox.Add(new Label(_("HTTP Proxy:")));
              hbox.Add(new GimpEntry(httpProxy));

              hbox.Add(new Label(_("Port:")));
              hbox.Add(new GimpEntry(port) {WidthChars = 4});

              enableProxy.ValueChanged += delegate
            {
              hbox.Sensitive = enableProxy.Value;
            };

              expander.Add(proxyBox);
              table.Attach(expander, 0, 1, 3, 4);
        }
示例#16
0
 public static void CreateNotficationWindow(string notification)
 {
     Gtk.Window nWin = new Gtk.Window(WindowType.Toplevel);
     Gtk.VBox ctr = new Gtk.VBox();
     ctr.Add( new Gtk.Label(notification));
     Gtk.Button btn = new Gtk.Button();
     btn.Label = "Close";
     btn.Clicked += (sender, e) => nWin.Destroy();
     ctr.Add(btn);
     nWin.Add(ctr);
     nWin.ShowAll();
 }
示例#17
0
        private static Gtk.Dialog Alert(string primary, string secondary, Image aImage, Gtk.Window parent)
        {
            Gtk.Dialog retval = new Gtk.Dialog("", parent, Gtk.DialogFlags.DestroyWithParent);

              // graphic items
              Gtk.HBox hbox;
              		Gtk.VBox labelBox;
              		Gtk.Label labelPrimary;
              		Gtk.Label labelSecondary;

            // set-up dialog
            retval.Modal=true;
            retval.BorderWidth=6;
            retval.HasSeparator=false;
            retval.Resizable=false;

            retval.VBox.Spacing=12;

            hbox=new Gtk.HBox();
            hbox.Spacing=12;
            hbox.BorderWidth=6;
            retval.VBox.Add(hbox);

            // set-up image
            aImage.Yalign=0.0F;
            hbox.Add(aImage);

            // set-up labels
            labelPrimary=new Gtk.Label();
            labelPrimary.Yalign=0.0F;
            labelPrimary.Xalign=0.0F;
            labelPrimary.UseMarkup=true;
            labelPrimary.Wrap=true;

            labelSecondary=new Gtk.Label();
            labelSecondary.Yalign=0.0F;
            labelSecondary.Xalign=0.0F;
            labelSecondary.UseMarkup=true;
            labelSecondary.Wrap=true;

            labelPrimary.Markup="<span weight=\"bold\" size=\"larger\">"+primary+"</span>";
            labelSecondary.Markup="\n"+secondary;

            labelBox=new VBox();
            labelBox.Add(labelPrimary);
            labelBox.Add(labelSecondary);

            hbox.Add(labelBox);

            return retval;
        }
示例#18
0
        public MainWindow()
            : base(WindowType.Toplevel)
        {
            Console.WriteLine("MainWindow...");
            this.Title = "GefGlue Demo (Gtk#)";
            this.SetSizeRequest(800, 600);

            var vBox = new VBox();
            vBox.Visible = true;
            vBox.Homogeneous = false;

            var hBox = new HBox();
            hBox.Visible = true;

            var backButton = new Button();
            backButton.Visible = true;
            backButton.Label = "Back";

            var forwardButton = new Button();
            forwardButton.Visible = true;
            forwardButton.Label = "Forward";

            Console.WriteLine("new CefWebBrowserWidget()...");
            var browser = new CefGlue.GtkSharp.CefWebBrowserWidget();
            browser.Visible = true;
            Console.WriteLine("new CefWebBrowserWidget()... done");

            var statusBar = new Statusbar();
            statusBar.Visible = true;

            // Layout
            hBox.Add(backButton);
            hBox.Add(forwardButton);
            vBox.Add(hBox);
            vBox.Add(browser);
            vBox.Add(statusBar);
            this.Add(vBox);

            var vw1 = ((Box.BoxChild)(vBox[hBox]));
            vw1.Expand = false;
            vw1.Fill = false;

            var vw3 = ((Box.BoxChild)(vBox[statusBar]));
            vw3.Expand = false;
            vw3.Fill = false;

            //Show Everything
            Console.WriteLine("ShowAll()...");
            // this.ShowAll();
            Console.WriteLine("ShowAll()... done");
        }
示例#19
0
 public MainWindow() : base("Gtk Embedding Demo")
 {
     var root = new HBox();
     var left  = new VBox();
     left.Add(new Button("I'm GTK button"));
     left.Add(new Calendar());
     root.PackEnd(left, false, false, 0);
     var host = new GtkAvaloniaControlHost() {Content = new MainView()};
     host.SetSizeRequest(600, 600);
     root.PackStart(host, true, true, 0);
     Add(root);
     
     ShowAll();
 }
示例#20
0
        public CellPropertiesFrame(RectangleSet rectangles)
            : base(_("Cell Properties"))
        {
            var vbox = new VBox(false, 12);
              Add(vbox);

              var table = new GimpTable(3, 2, false)
            {ColumnSpacing = 6, RowSpacing = 6};

              vbox.Add(table);

              _url = new Entry();
              table.AttachAligned(0, 0, _("_Link:"), 0.0, 0.5, _url, 3, false);

              _altText = new Entry();
              table.AttachAligned(0, 1, _("Alt_ernative text:"), 0.0, 0.5, _altText, 3,
              false);

              _target = new Entry();
              table.AttachAligned(0, 2, _("_Target:"), 0.0, 0.5, _target, 3, false);

              var hbox = new HBox(false, 12);
              vbox.Add(hbox);

              table = new GimpTable(3, 4, false)
            {ColumnSpacing = 6, RowSpacing = 6};
              hbox.PackStart(table, false, false, 0);

              _left = new Label("    ");
              table.AttachAligned(0, 0, _("Left:"), 0.0, 0.5, _left, 1, false);

              _right = new Label("    ");
              table.AttachAligned(0, 1, _("Right:"), 0.0, 0.5, _right, 1, false);

              _top = new Label("    ");
              table.AttachAligned(2, 0, _("Top:"), 0.0, 0.5, _top, 1, false);

              _bottom = new Label("    ");
              table.AttachAligned(2, 1, _("Bottom:"), 0.0, 0.5, _bottom, 1, false);

              _include = new CheckButton(_("_Include cell in table")) {Active = true};
              table.Attach(_include, 0, 3, 2, 3);

              rectangles.SelectedRectangleChanged += (sender, args) =>
            {
              SetRectangleData(args.OldSelected);
              GetRectangleData(args.NewSelected);
            };
        }
示例#21
0
        protected Tab InsertButton(int index, string label, BaseViewContent viewContent)
        {
            CheckCreateSubViewToolbar();
            updating = true;

            var addedContent = (index == 0 || subViewToolbar.TabCount == 0) && IdeApp.Workbench.ActiveDocument == Document;
            var widgetBox    = new Gtk.VBox();
            var tab          = new Tab(subViewToolbar, label)
            {
                Tag = viewContent
            };

            if (tab.Accessible != null)
            {
                tab.Accessible.Help = viewContent.TabAccessibilityDescription;
            }

            // If this is the current displayed document we need to add the control immediately as the tab is already active.
            if (addedContent)
            {
                widgetBox.Add(viewContent.Control);
                widgetBox.Show();
            }

            subViewToolbar.InsertTab(index, tab);
            subViewNotebook.InsertPage(widgetBox, new Gtk.Label(), index);
            tab.Activated += (sender, e) => {
                if (!addedContent)
                {
                    widgetBox.Add(viewContent.Control);
                    widgetBox.Show();
                    addedContent = true;
                }

                int page = viewContents.IndexOf((BaseViewContent)tab.Tag);
                SetCurrentView(page);
                QueueDraw();
            };

            EnsureToolbarBoxSeparator();
            updating = false;

            if (index == 0)
            {
                ShowPage(0);
            }

            return(tab);
        }
示例#22
0
 private void Build()
 {
     global::Stetic.Gui.Initialize(this);
     this.Name = "Client.Forms.MicroChat";
     this.Title = "Micro chat";
     this.Icon = global::Gdk.Pixbuf.LoadFromResource("Client.Resources.pigeon_clip_art_hight.ico");
     this.WindowPosition = Gtk.WindowPosition.Center;
     vbox = new VBox();
     scrollback_mc = new Scrollback();
     scrollback_mc.isMicro = true;
     scrollback_mc.Create();
     this.TypeHint = Gdk.WindowTypeHint.Normal;
     this.DefaultHeight = 420;
     this.DefaultWidth = 680;
     scrollback_mc.Events = ((global::Gdk.EventMask)(256));
     scrollback_mc.Name = "scrollback1";
     this.DeleteEvent += new DeleteEventHandler(Close);
     vbox.Add(scrollback_mc);
     this.Add(vbox);
     if ((this.Child != null))
     {
         this.Child.ShowAll();
     }
     this.Hide();
 }
示例#23
0
        public BDialog(string aName, Gtk.Window aParent, string aText)
            : base(aName, aParent, Gtk.DialogFlags.NoSeparator)
        {
            // setup dialog
              this.Modal = true;
              this.BorderWidth = 6;
              this.HasSeparator = false;
              this.Resizable = false;
              this.VBox.Spacing=12;

              // graphic items
              hbox = new Gtk.HBox();
              		Gtk.VBox labelBox = new VBox();
              		label = new Gtk.Label();
              		image = new Gtk.Image();

            hbox.Spacing=12;
            hbox.BorderWidth=6;
            this.VBox.Add(hbox);

            // set-up image
            image.Yalign=0.0F;
              hbox.Add(image);

            // set-up label
            label.Yalign=0.0F;
            label.Xalign=0.0F;
            label.UseMarkup=true;
            label.Wrap=true;
            label.Markup=aText;

            // add to dialog
            labelBox.Add(label);
            hbox.Add(labelBox);
        }
示例#24
0
		public LogAgentPanelWidget ()
		{
			global::Stetic.BinContainer.Attach (this);

			var reportingLabel = GettextCatalog.GetString ("Report errors and usage information to help {0} improve my experience.", BrandingService.SuiteName);

			var value = LoggingService.ReportUsage;
			chkUsage = new CheckButton (reportingLabel);
			if (value.HasValue)
				chkUsage.Active = value.Value;
			chkUsage.Toggled += (sender, e) => reportUsage = chkUsage.Active;
			
			container = new Gtk.VBox ();
			container.PackStart (chkUsage, false, false, 0);

			var privacyStatement = BrandingService.PrivacyStatement;
			if (!string.IsNullOrEmpty (privacyStatement)) {
				var privacyLabel = new Xwt.Label { Markup = privacyStatement, Wrap = Xwt.WrapMode.Word };
				container.Add (new HBox ());
				container.PackEnd (privacyLabel.ToGtkWidget (), false, false, 30);
			}
			
			Add (container);
			ShowAll ();
		}
示例#25
0
        public EntityListView()
        {
            SizeRequested += delegate(object o, SizeRequestedArgs args) {
                if (Child != null)
                    args.Requisition = Child.SizeRequest ();
            };

            SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                if (Child != null)
                    Child.Allocation = args.Allocation;
            };

            VBox vBox = new VBox();
            ScrolledWindow scrolledWindow = new ScrolledWindow();
            scrolledWindow.ShadowType = ShadowType.In;
            treeView = new TreeView();

            scrolledWindow.Add (treeView);
            vBox.Add (scrolledWindow);
            Add (vBox);

            ShowAll ();

            actionGroup = new ActionGroup("entityListView");
        }
示例#26
0
    /// <summary>
    /// Initializes a new instance of the <see cref="MainWindow" /> class.
    /// </summary>
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        VBox panel = new VBox();

        this.waveWidget = new WaveWidget();
        panel.Add(this.waveWidget);

        Button button = new Button("I am a button");
        button.WidthRequest = 100;
        button.HeightRequest = 100;
        panel.Add(button);

        this.Add(panel);        
    }
示例#27
0
        RadioButton AddBasedOnButton(VBox vbox, RadioButton previous, int type, 
				 string description)
        {
            var button = new GimpRadioButton<int>(previous, description, type,
                        GetVariable<int>("based_on"));
              vbox.Add(button);
              return button;
        }
示例#28
0
        public Window CreateTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
        {
            //create a message string from all the results
            var results = item.Item as AbstractTooltipContent[];

            var win = new DToolTipWindow();

            // Set white background
            win.ModifyBg(StateType.Normal, new Gdk.Color(0xff, 0xff, 0xff));

            var pack = new Gtk.VBox();

            foreach (var r in results)
            {
                var titleLabel = new Label(r.Title);

                // Make left-bound
                titleLabel.SetAlignment(0, 0);

                // Set bold font
                titleLabel.ModifyFont(new Pango.FontDescription()
                {
                    Weight = Weight.Bold, AbsoluteSize = 12 * (int)Pango.Scale.PangoScale
                });

                pack.Add(titleLabel);

                if (!string.IsNullOrEmpty(r.Description))
                {
                    const int maximumDescriptionLength = 300;
                    var       descLabel = new Label(r.Description.Length > maximumDescriptionLength ? (r.Description.Substring(0, maximumDescriptionLength) + "...") : r.Description);

                    descLabel.ModifyFont(new Pango.FontDescription()
                    {
                        AbsoluteSize = 10 * (int)Pango.Scale.PangoScale
                    });
                    descLabel.SetAlignment(0, 0);

                    pack.Add(descLabel);
                }
            }

            win.Add(pack);

            return(win);
        }
示例#29
0
        RadioButton AddEncodingButton(VBox vbox, RadioButton previous,
				  int type, string description)
        {
            var button = new GimpRadioButton<int>(previous, description, type,
                        GetVariable<int>("encoding"));
              vbox.Add(button);
              return button;
        }
示例#30
0
文件: Alert.cs 项目: switsys/bless
        public Alert(string primary, string secondary, Gtk.Window parent)
            : base("", parent, Gtk.DialogFlags.DestroyWithParent)
        {
            // set-up alert
            this.Modal = true;
            //this.TypeHint=Gdk.WindowTypeHint.Utility;
            this.BorderWidth  = 6;
            this.HasSeparator = false;
            this.Resizable    = false;

            this.VBox.Spacing = 12;

            hbox             = new Gtk.HBox();
            hbox.Spacing     = 12;
            hbox.BorderWidth = 6;
            this.VBox.Add(hbox);

            // set-up image
            image        = new Gtk.Image();
            image.Yalign = 0.0F;
            hbox.Add(image);

            // set-up labels
            labelPrimary           = new Gtk.Label();
            labelPrimary.Yalign    = 0.0F;
            labelPrimary.Xalign    = 0.0F;
            labelPrimary.UseMarkup = true;
            labelPrimary.Wrap      = true;

            labelSecondary           = new Gtk.Label();
            labelSecondary.Yalign    = 0.0F;
            labelSecondary.Xalign    = 0.0F;
            labelSecondary.UseMarkup = true;
            labelSecondary.Wrap      = true;

            labelPrimary.Markup   = "<span weight=\"bold\" size=\"larger\">" + primary + "</span>";
            labelSecondary.Markup = "\n" + secondary;

            labelBox = new VBox();
            labelBox.Add(labelPrimary);
            labelBox.Add(labelSecondary);

            hbox.Add(labelBox);
        }
示例#31
0
        public override Widget ConfigurationWidget()
        {
            VBox vbox = new VBox ();

            Label info = new Label (Catalog.GetString ("Select the area that you want blacked out."));

            vbox.Add (info);

            return vbox;
        }
示例#32
0
		private void InitMainVbox ()
		{
			vBoxMain = new VBox();

			// TODO: Add menu and status bar here...

			InitContentVbox();

			vBoxMain.Add (vBoxContent);
		}
示例#33
0
        RadioButton AddErrorCorrectionButton(VBox vbox, RadioButton previous, 
					 string type, string description)
        {
            var variable = GetVariable<string>("error_correction");
              var button = new GimpRadioButton<string>(previous,
                           type + " " + _(description),
                           type, variable);
              vbox.Add(button);
              return button;
        }
示例#34
0
 public void ViewsController(string LoadView)
 {
     try { centro.Children[1].Destroy(); } catch (Exception) {};
     switch (LoadView)
     {
     case "list_view":
         view = new list_view(this);
         centro.Add(view);
         break;
     }
 }
示例#35
0
		public DemoSpinner () : base ("Spinner", null, DialogFlags.DestroyWithParent)
		{
			Resizable = false;

			VBox vbox = new VBox (false, 5);
			vbox.BorderWidth = 5;
			ContentArea.PackStart (vbox, true, true, 0);

			/* Sensitive */
			HBox hbox = new HBox (false, 5);
			spinner_sensitive = new Spinner ();
			hbox.Add (spinner_sensitive);
			hbox.Add (new Entry ());
			vbox.Add (hbox);

			/* Disabled */
			hbox = new HBox (false, 5);
			spinner_unsensitive = new Spinner ();
			spinner_unsensitive.Sensitive = false;
			hbox.Add (spinner_unsensitive);
			hbox.Add (new Entry ());
			vbox.Add (hbox);

			Button btn_play = new Button ();
			btn_play.Label = "Play";
			btn_play.Clicked += OnPlayClicked;
			vbox.Add (btn_play);

			Button btn_stop = new Button ();
			btn_stop.Label = "Stop";
			btn_stop.Clicked += OnStopClicked;
			vbox.Add (btn_stop);

			AddButton (Stock.Close, ResponseType.Close);

			OnPlayClicked (null, null);

			ShowAll ();
			Run ();
			Destroy ();
		}
示例#36
0
		public TrayPopupWindow() : base(Gtk.WindowType.Popup)
		{
			//Stetic.Gui.Build(this, typeof(giver.TrayPopupWindow));
			
			VBox test = new VBox();
			titleLabel = new Label("User X has sent Y of Z files");
			test.Add (titleLabel);
			test.ShowAll();
			this.Add(test);
			
			
		}
示例#37
0
		public static Button create_button_stock_image(String stockid,String tooltip){
			Button tb = new  Button(stockid);
			tb.Remove(tb.Child);
			VBox v = new VBox();
			v.Add(new Gtk.Image(tb.RenderIcon(stockid,IconSize.SmallToolbar,tooltip)));
			tb.Add(v);
			tb.WidthRequest = 30;
			tb.CanFocus = false;
			tb.TooltipText = tooltip;
			tb.HasTooltip = true;
			return tb;
		}
示例#38
0
        public Window CreateTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
        {
            //create a message string from all the results
            var results = item.Item as AbstractTooltipContent[];

            var win = new DToolTipWindow();

            // Set white background
            win.ModifyBg(StateType.Normal,new Gdk.Color(0xff,0xff,0xff));

            var pack = new Gtk.VBox();

            foreach (var r in results)
            {
                var titleLabel = new Label(r.Title);

                // Make left-bound
                titleLabel.SetAlignment(0, 0);

                // Set bold font
                titleLabel.ModifyFont(new Pango.FontDescription() {Weight=Weight.Bold, AbsoluteSize=12*(int)Pango.Scale.PangoScale});

                pack.Add(titleLabel);

                if (!string.IsNullOrEmpty( r.Description))
                {
                    const int maximumDescriptionLength = 300;
                    var descLabel = new Label(r.Description.Length>maximumDescriptionLength ? (r.Description.Substring(0,maximumDescriptionLength)+"...") : r.Description);

                    descLabel.ModifyFont(new Pango.FontDescription() { AbsoluteSize = 10 * (int)Pango.Scale.PangoScale });
                    descLabel.SetAlignment(0, 0);

                    pack.Add(descLabel);
                }
            }

            win.Add(pack);

            return win;
        }
示例#39
0
        protected Tab AddButton(string label, IBaseViewContent viewContent)
        {
            CheckCreateSubViewToolbar();
            updating = true;

            var addedContent = subViewToolbar.TabCount == 0 && IdeApp.Workbench.ActiveDocument == Document;
            var widgetBox    = new Gtk.VBox();
            var tab          = new Tab(subViewToolbar, label)
            {
                Tag = subViewToolbar.TabCount
            };

            // If this is the current displayed document we need to add the control immediately as the tab is already active.
            if (addedContent)
            {
                widgetBox.Add(viewContent.Control);
                widgetBox.Show();
            }

            subViewToolbar.AddTab(tab);
            subViewNotebook.AppendPage(widgetBox, new Gtk.Label());
            tab.Activated += (sender, e) => {
                if (!addedContent)
                {
                    widgetBox.Add(viewContent.Control);
                    widgetBox.Show();
                }
                addedContent = true;
                SetCurrentView((int)((Tab)sender).Tag);
                QueueDraw();
            };

            EnsureToolbarBoxSeparator();
            updating = false;
            return(tab);
        }
示例#40
0
        private void Build()
        {
            var mainVox = new Gtk.VBox();

            //List
            this.lc   = new LineChart("Weigth");
            lc.XLabel = "Day";
            lc.FixedX = true;
            lc.YLabel = "Kg";

            lc.MinXValue   = 1;
            lc.MaxXValue   = 30;
            lc.XResolution = (int)(lc.MaxXValue - 1);



            rbWeight          = new RadioButton(null, "Weight");
            group             = rbWeight.Group;
            rbWeight.Active   = true;
            rbAC              = new RadioButton(rbWeight, "Abc. Circ.");
            rbWeight.Clicked += (sender, e) => ShowWeightGraphic();
            rbAC.Clicked     += (sender, e) => ShowACGraphic();

            HBox cont = new HBox();

            cont.PackStart(rbWeight);
            cont.Add(rbAC);

            mainVox.PackStart(cont, false, false, 0);
            mainVox.Add(lc);


            //Wrap
            PackStart(mainVox, true, true, 0);

            //Update state and render
            this.OnViewBuilt();
        }
示例#41
0
        protected Tab AddButton(string label, IBaseViewContent viewContent)
        {
            CheckCreateSubViewToolbar();
            updating = true;

            Tab tab = new Tab(subViewToolbar, label);

            tab.Tag        = subViewToolbar.TabCount;
            tab.Activated += (sender, e) => { SetCurrentView((int)((Tab)sender).Tag); QueueDraw(); };
            subViewToolbar.AddTab(tab);

            Gtk.VBox widgetBox = new Gtk.VBox();
            widgetBox.Realized += delegate {
                widgetBox.Add(viewContent.Control);
            };

            subViewNotebook.AppendPage(widgetBox, new Gtk.Label());
            widgetBox.ShowAll();

            EnsureToolbarBoxSeparator();
            updating = false;
            return(tab);
        }
示例#42
0
    public static void Main()
    {
        ClutterRun.Init();
        Gtk.Application.Init();

        Gtk.Window window = new Gtk.Window(WindowType.Toplevel);
        window.DeleteEvent += HandleDelete;
        Toplevel            = window;

        Gtk.VBox vbox = new Gtk.VBox(false, 6);
        window.Add(vbox);

        Embed clutter = new Embed();

        vbox.Add(clutter);

        Stage stage = clutter.Stage as Stage;

        Gtk.Label label = new Gtk.Label("This is a label");
        vbox.PackStart(label, false, false, 0);

        Gtk.Button button = Gtk.Button.NewWithLabel("This is a button...clicky");
        button.Clicked += HandleClickity;
        vbox.PackStart(button, false, false, 0);

        button          = new Gtk.Button(Gtk.Stock.Quit);
        button.Clicked += delegate { Gtk.Application.Quit(); };

        vbox.PackEnd(button, false, false, 0);

        stage.Color = new Clutter.Color(0x61, 0x64, 0x8c, 0xff);

        uint radius = stage.Width / n_hands / 2;

        SuperOH oh = new SuperOH();

        CurrentOH = oh;
        oh.Group  = new Group();
        oh.Hands  = new Actor[n_hands];

        for (int i = 0; i < n_hands; i++)
        {
            Texture hand_text = new Texture("redhand.png");
            uint    w         = hand_text.Width;
            uint    h         = hand_text.Height;

            oh.Hands[i] = hand_text;

            int x = (int)(stage.Width / 2
                          + radius
                          * Math.Cos(i * Math.PI / (n_hands / 2))
                          - w / 2);
            int y = (int)(stage.Height / 2
                          + radius
                          * Math.Sin(i * Math.PI / (n_hands / 2))
                          - h / 2);

            oh.Hands[i].SetPosition(x, y);

            oh.Group.AddActor(oh.Hands[i]);
        }

        oh.Group.ShowAll();

        oh.FadeTimeline      = new Timeline(2000);
        oh.FadeTimeline.Loop = true;
        BehaviourOpacity behaviour = new BehaviourOpacity(new Alpha(oh.FadeTimeline, Sine.Func), 0xff, 0x00);

        behaviour.Apply(oh.Group);

        stage.AddActor(oh.Group);
        stage.ButtonPressEvent += HandleButtonPress;
        stage.KeyPressEvent    += HandleKeyPress;

        stage.ShowAll();

        timeline      = new Timeline(360, 90);
        timeline.Loop = true;

        timeline.NewFrame += HandleNewFrame;

        window.ExposeEvent += delegate { timeline.Start(); };

        window.SetDefaultSize(400, 600);
        window.ShowAll();

        Gtk.Application.Run();
    }
示例#43
0
        protected virtual void Build()
        {
            Gui.Initialize(this);
            base.Name           = "CocoStudio.ControlLib.NewFileDialog";
            base.Title          = Catalog.GetString("新建文件");
            base.WindowPosition = WindowPosition.CenterOnParent;
            base.Resizable      = false;
            base.DefaultWidth   = 450;
            base.DefaultHeight  = 240;
            Gtk.VBox vBox = base.VBox;
            vBox.Name                         = "dialog1_VBox";
            vBox.BorderWidth                  = 2u;
            this.tab_Root                     = new Gtk.Table(4u, 2u, false);
            this.tab_Root.Name                = "tab_Root";
            this.tab_Root.RowSpacing          = 12u;
            this.tab_Root.ColumnSpacing       = 18u;
            this.tab_Root.BorderWidth         = 15u;
            this.entry_FileName               = new Entry();
            this.entry_FileName.WidthRequest  = 330;
            this.entry_FileName.CanFocus      = true;
            this.entry_FileName.Name          = "entry_FileName";
            this.entry_FileName.IsEditable    = true;
            this.entry_FileName.InvisibleChar = '●';
            this.tab_Root.Add(this.entry_FileName);
            Gtk.Table.TableChild tableChild = (Gtk.Table.TableChild) this.tab_Root[this.entry_FileName];
            tableChild.LeftAttach          = 1u;
            tableChild.RightAttach         = 2u;
            tableChild.XOptions            = Gtk.AttachOptions.Fill;
            tableChild.YOptions            = Gtk.AttachOptions.Fill;
            this.hb_FileType               = new Gtk.HBox();
            this.hb_FileType.HeightRequest = 80;
            this.hb_FileType.Name          = "hb_FileType";
            this.hb_FileType.Spacing       = 6;
            this.tab_Root.Add(this.hb_FileType);
            Gtk.Table.TableChild tableChild2 = (Gtk.Table.TableChild) this.tab_Root[this.hb_FileType];
            tableChild2.TopAttach           = 1u;
            tableChild2.BottomAttach        = 2u;
            tableChild2.LeftAttach          = 1u;
            tableChild2.RightAttach         = 2u;
            tableChild2.XOptions            = Gtk.AttachOptions.Fill;
            tableChild2.YOptions            = Gtk.AttachOptions.Fill;
            this.lab_FileDescribe           = new Gtk.Label();
            this.lab_FileDescribe.Name      = "lab_FileDescribe";
            this.lab_FileDescribe.Xalign    = 1f;
            this.lab_FileDescribe.Yalign    = 0f;
            this.lab_FileDescribe.LabelProp = Catalog.GetString("描述");
            this.tab_Root.Add(this.lab_FileDescribe);
            Gtk.Table.TableChild tableChild3 = (Gtk.Table.TableChild) this.tab_Root[this.lab_FileDescribe];
            tableChild3.TopAttach        = 2u;
            tableChild3.BottomAttach     = 3u;
            tableChild3.XOptions         = Gtk.AttachOptions.Fill;
            tableChild3.YOptions         = Gtk.AttachOptions.Fill;
            this.lab_FileDescribeContent = new Gtk.Label();
            this.lab_FileDescribeContent.WidthRequest  = 330;
            this.lab_FileDescribeContent.HeightRequest = 60;
            this.lab_FileDescribeContent.Name          = "lab_FileDescribeContent";
            this.lab_FileDescribeContent.Xalign        = 0f;
            this.lab_FileDescribeContent.Yalign        = 0f;
            this.lab_FileDescribeContent.LabelProp     = Catalog.GetString("描述文件");
            this.lab_FileDescribeContent.Wrap          = true;
            this.tab_Root.Add(this.lab_FileDescribeContent);
            Gtk.Table.TableChild tableChild4 = (Gtk.Table.TableChild) this.tab_Root[this.lab_FileDescribeContent];
            tableChild4.TopAttach       = 2u;
            tableChild4.BottomAttach    = 3u;
            tableChild4.LeftAttach      = 1u;
            tableChild4.RightAttach     = 2u;
            tableChild4.YOptions        = Gtk.AttachOptions.Fill;
            this.lab_FileName           = new Gtk.Label();
            this.lab_FileName.Name      = "lab_FileName";
            this.lab_FileName.Xalign    = 1f;
            this.lab_FileName.LabelProp = Catalog.GetString("文件名称");
            this.tab_Root.Add(this.lab_FileName);
            Gtk.Table.TableChild tableChild5 = (Gtk.Table.TableChild) this.tab_Root[this.lab_FileName];
            tableChild5.XOptions        = Gtk.AttachOptions.Fill;
            tableChild5.YOptions        = Gtk.AttachOptions.Fill;
            this.lab_FileSize           = new Gtk.Label();
            this.lab_FileSize.Name      = "lab_FileSize";
            this.lab_FileSize.Xalign    = 1f;
            this.lab_FileSize.Yalign    = 0.1f;
            this.lab_FileSize.LabelProp = Catalog.GetString("大小");
            this.tab_Root.Add(this.lab_FileSize);
            Gtk.Table.TableChild tableChild6 = (Gtk.Table.TableChild) this.tab_Root[this.lab_FileSize];
            tableChild6.TopAttach       = 3u;
            tableChild6.BottomAttach    = 4u;
            tableChild6.XOptions        = Gtk.AttachOptions.Fill;
            tableChild6.YOptions        = Gtk.AttachOptions.Fill;
            this.lab_FileType           = new Gtk.Label();
            this.lab_FileType.Name      = "lab_FileType";
            this.lab_FileType.Xalign    = 1f;
            this.lab_FileType.Yalign    = 0.3f;
            this.lab_FileType.LabelProp = Catalog.GetString("类型");
            this.tab_Root.Add(this.lab_FileType);
            Gtk.Table.TableChild tableChild7 = (Gtk.Table.TableChild) this.tab_Root[this.lab_FileType];
            tableChild7.TopAttach                = 1u;
            tableChild7.BottomAttach             = 2u;
            tableChild7.XOptions                 = Gtk.AttachOptions.Fill;
            tableChild7.YOptions                 = Gtk.AttachOptions.Fill;
            this.table_widthHeight               = new Gtk.Table(2u, 4u, false);
            this.table_widthHeight.Name          = "table_widthHeight";
            this.table_widthHeight.RowSpacing    = 6u;
            this.table_widthHeight.ColumnSpacing = 6u;
            this.alignment_widthPx               = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
            this.alignment_widthPx.Name          = "alignment_widthPx";
            this.alignment_widthPx.RightPadding  = 25u;
            this.label2           = new Gtk.Label();
            this.label2.Name      = "label2";
            this.label2.LabelProp = Catalog.GetString("px");
            this.alignment_widthPx.Add(this.label2);
            this.table_widthHeight.Add(this.alignment_widthPx);
            Gtk.Table.TableChild tableChild8 = (Gtk.Table.TableChild) this.table_widthHeight[this.alignment_widthPx];
            tableChild8.LeftAttach         = 1u;
            tableChild8.RightAttach        = 2u;
            tableChild8.XOptions           = Gtk.AttachOptions.Fill;
            tableChild8.YOptions           = Gtk.AttachOptions.Fill;
            this.evtbx_height              = new EventBox();
            this.evtbx_height.WidthRequest = 100;
            this.evtbx_height.Name         = "evtbx_height";
            this.table_widthHeight.Add(this.evtbx_height);
            Gtk.Table.TableChild tableChild9 = (Gtk.Table.TableChild) this.table_widthHeight[this.evtbx_height];
            tableChild9.LeftAttach        = 2u;
            tableChild9.RightAttach       = 3u;
            tableChild9.XOptions          = Gtk.AttachOptions.Fill;
            tableChild9.YOptions          = Gtk.AttachOptions.Fill;
            this.evtbx_width              = new EventBox();
            this.evtbx_width.WidthRequest = 100;
            this.evtbx_width.Name         = "evtbx_width";
            this.table_widthHeight.Add(this.evtbx_width);
            Gtk.Table.TableChild tableChild10 = (Gtk.Table.TableChild) this.table_widthHeight[this.evtbx_width];
            tableChild10.XOptions = Gtk.AttachOptions.Fill;
            tableChild10.YOptions = Gtk.AttachOptions.Fill;
            this.label1           = new Gtk.Label();
            this.label1.Name      = "label1";
            this.label1.LabelProp = Catalog.GetString("宽");
            this.table_widthHeight.Add(this.label1);
            Gtk.Table.TableChild tableChild11 = (Gtk.Table.TableChild) this.table_widthHeight[this.label1];
            tableChild11.TopAttach    = 1u;
            tableChild11.BottomAttach = 2u;
            tableChild11.XOptions     = Gtk.AttachOptions.Fill;
            tableChild11.YOptions     = Gtk.AttachOptions.Fill;
            this.label3           = new Gtk.Label();
            this.label3.Name      = "label3";
            this.label3.LabelProp = Catalog.GetString("高");
            this.table_widthHeight.Add(this.label3);
            Gtk.Table.TableChild tableChild12 = (Gtk.Table.TableChild) this.table_widthHeight[this.label3];
            tableChild12.TopAttach    = 1u;
            tableChild12.BottomAttach = 2u;
            tableChild12.LeftAttach   = 2u;
            tableChild12.RightAttach  = 3u;
            tableChild12.XOptions     = Gtk.AttachOptions.Fill;
            tableChild12.YOptions     = Gtk.AttachOptions.Fill;
            this.label4           = new Gtk.Label();
            this.label4.Name      = "label4";
            this.label4.LabelProp = Catalog.GetString("px");
            this.table_widthHeight.Add(this.label4);
            Gtk.Table.TableChild tableChild13 = (Gtk.Table.TableChild) this.table_widthHeight[this.label4];
            tableChild13.LeftAttach  = 3u;
            tableChild13.RightAttach = 4u;
            tableChild13.XOptions    = Gtk.AttachOptions.Fill;
            tableChild13.YOptions    = Gtk.AttachOptions.Fill;
            this.tab_Root.Add(this.table_widthHeight);
            Gtk.Table.TableChild tableChild14 = (Gtk.Table.TableChild) this.tab_Root[this.table_widthHeight];
            tableChild14.TopAttach    = 3u;
            tableChild14.BottomAttach = 4u;
            tableChild14.LeftAttach   = 1u;
            tableChild14.RightAttach  = 2u;
            tableChild14.XOptions     = Gtk.AttachOptions.Fill;
            tableChild14.YOptions     = Gtk.AttachOptions.Fill;
            vBox.Add(this.tab_Root);
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild)vBox[this.tab_Root];
            boxChild.Position = 0;
            boxChild.Expand   = false;
            boxChild.Fill     = false;
            HButtonBox actionArea = base.ActionArea;

            actionArea.Name                = "dialog1_ActionArea";
            actionArea.Spacing             = 10;
            actionArea.BorderWidth         = 5u;
            actionArea.LayoutStyle         = ButtonBoxStyle.End;
            this.buttonCancel              = new Gtk.Button();
            this.buttonCancel.CanDefault   = true;
            this.buttonCancel.CanFocus     = true;
            this.buttonCancel.Name         = "buttonCancel";
            this.buttonCancel.UseUnderline = true;
            this.buttonCancel.Label        = Catalog.GetString("取消");
            base.AddActionWidget(this.buttonCancel, -6);
            ButtonBox.ButtonBoxChild buttonBoxChild = (ButtonBox.ButtonBoxChild)actionArea[this.buttonCancel];
            buttonBoxChild.Expand    = false;
            buttonBoxChild.Fill      = false;
            this.btnNew              = new Gtk.Button();
            this.btnNew.CanDefault   = true;
            this.btnNew.CanFocus     = true;
            this.btnNew.Name         = "btnNew";
            this.btnNew.UseUnderline = true;
            this.btnNew.Label        = Catalog.GetString("新建");
            base.AddActionWidget(this.btnNew, -5);
            ButtonBox.ButtonBoxChild buttonBoxChild2 = (ButtonBox.ButtonBoxChild)actionArea[this.btnNew];
            buttonBoxChild2.Position = 1;
            buttonBoxChild2.Expand   = false;
            buttonBoxChild2.Fill     = false;
            if (base.Child != null)
            {
                base.Child.ShowAll();
            }
            base.Show();
        }
示例#44
0
        private void Build()
        {
            this.Title = "Sqlite browser";

            mainVbox         = new Gtk.VBox();
            mainVbox.Spacing = 4;

            this.Add(mainVbox);

            // Main menu
            mainMenu = new MainMenu();

            mainVbox.Add(mainMenu);

            var mainMenuBox = (Gtk.Box.BoxChild)mainVbox [mainMenu];

//			mainMenuBox.Position = 0;
            mainMenuBox.Expand = false;
            mainMenuBox.Fill   = false;

            mainMenu.NewSqliteDbActivated        += OnNewSqliteDb;
            mainMenu.OpenSqliteDbActivated       += OnOpenSqliteDb;
            mainMenu.ExitActivated               += OnExit;
            mainMenu.NewSqlEditorWindowActivated += OnNewSqlTab;

            // toolbar
            toolbar = new MainToolbar();
            mainVbox.Add(toolbar);
            var toolbarBox = (Gtk.Box.BoxChild)mainVbox [toolbar];

            toolbarBox.Expand = false;

            // left paned
            leftPaned          = new Gtk.HPaned();
            leftPaned.CanFocus = true;
            mainVbox.Add(leftPaned);
            var objectBrowserScrolledWindow = new Gtk.ScrolledWindow();

            objectBrowserScrolledWindow.ShadowType   = ShadowType.EtchedIn;
            objectBrowserScrolledWindow.WidthRequest = 300;
            leftPaned.Add1(objectBrowserScrolledWindow);

            objectBrowserTreeView = new TreeView();
            objectBrowserScrolledWindow.Add(objectBrowserTreeView);

            objectBrowserTreeStore      = new TreeStore(typeof(Gdk.Pixbuf), typeof(IFeature));
            objectBrowserTreeView.Model = objectBrowserTreeStore;

            // main tabbed area
            tabbedArea = new Notebook();
            leftPaned.Add2(tabbedArea);

            // status bar
            statusBar = new Statusbar();
            mainVbox.Add(statusBar);
            var statusBarBox = (Gtk.Box.BoxChild)mainVbox [statusBar];

            statusBarBox.Expand = false;
            statusBarBox.Fill   = false;

            global::Gtk.Label currentDbLabel = new Label();
            ApplicationState.Instance.CurrentConnectionChanged += (sender, e) => currentDbLabel.Text = e.DbServerConnection.Name;
            statusBar.Add(currentDbLabel);

            this.ShowAll(  );

            this.DeleteEvent += OnExit;
        }
示例#45
0
        public void Attach(Gtk.Orientation orientation_new)
        {
            Gtk.Box.BoxChild child = null;
            Box box;

            switch (Orientation)
            {
            case Gtk.Orientation.Vertical:
                box = main_hbox;
                break;

            case Gtk.Orientation.Horizontal:
            {
                box = framework_vbox;
                break;
            }

            default:
                throw new InvalidOperationException();
            }

            bool contained = false;

            foreach (var ch in box.AllChildren)
            {
                if (ch == this)
                {
                    contained = true;
                    break;
                }
            }
            if (contained == true)
            {
                box.Remove(this);
            }

            Orientation = (Gtk.Orientation)orientation_new;

            switch (Orientation)
            {
            case Gtk.Orientation.Vertical:
                main_hbox.Add(this);
                main_hbox.ReorderChild(this, 0);
                child = ((Gtk.Box.BoxChild)(main_hbox[this]));
                break;

            case Gtk.Orientation.Horizontal:
                framework_vbox.Add(this);
                framework_vbox.ReorderChild(this, 1);
                child = ((Gtk.Box.BoxChild)(framework_vbox[this]));
                break;

            default:
                throw new InvalidOperationException();
            }

            child.Expand = false;
            child.Fill   = false;
            ShowAll();
            InitCompleted = true;
        }
    private void createTable()
    {
        int rows = listConnected.Count;

        Gtk.Label label_device_title = new Gtk.Label("<b>" + Catalog.GetString("Device") + "</b>");
        Gtk.Label label_type_title   = new Gtk.Label("<b>" + Catalog.GetString("Type") + "</b>");

        label_device_title.UseMarkup = true;
        label_type_title.UseMarkup   = true;

        label_device_title.Show();
        label_type_title.Show();

        table_main = new Gtk.Table((uint)rows + 1, 2, false);         //not homogeneous
        table_main.ColumnSpacing = 20;
        table_main.RowSpacing    = 6;

        table_main.Attach(label_device_title, (uint)1, (uint)2, 0, 1);
        table_main.Attach(label_type_title, (uint)2, (uint)3, 0, 1);

        list_buttons_left  = new List <Gtk.Button>();
        list_images        = new List <Gtk.Image>();
        list_labels_type   = new List <Gtk.Label>();
        list_buttons_right = new List <Gtk.Button>();

        for (int count = 1; count <= rows; count++)
        {
            string    deviceStr    = listConnected[count - 1].SerialNumber + "\n\n" + listConnected[count - 1].Port;
            Gtk.Label label_device = new Gtk.Label(deviceStr);
            table_main.Attach(label_device, (uint)1, (uint)2, (uint)count, (uint)count + 1);
            label_device.Show();

            Gtk.HBox hbox_type   = new Gtk.HBox(false, 6);
            Button   button_left = UtilGtk.CreateArrowButton(ArrowType.Left, ShadowType.In, 50, -1);
            button_left.Sensitive = (listConnected[count - 1].Type != TypePixList.l[0].Type);
            button_left.CanFocus  = false;
            button_left.IsFocus   = false;
            button_left.Clicked  += on_button_left_clicked;
            //hbox_type.Add(button_left);
            hbox_type.PackStart(button_left, true, false, 1);

            //create image
            Pixbuf    pixbuf = TypePixList.GetPix(listConnected[count - 1].Type);
            Gtk.Image image  = new Gtk.Image();
            image.Pixbuf = pixbuf;
            hbox_type.Add(image);
            hbox_type.PackStart(image, false, false, 1);

            Button button_right = UtilGtk.CreateArrowButton(ArrowType.Right, ShadowType.In, 50, -1);
            button_right.CanFocus  = false;
            button_right.IsFocus   = false;
            button_right.Clicked  += on_button_right_clicked;
            button_right.Sensitive = (listConnected[count - 1].Type != TypePixList.l[TypePixList.l.Count - 1].Type);
            hbox_type.PackStart(button_right, true, false, 1);

            Gtk.VBox vbox = new Gtk.VBox(false, 2);
            vbox.Add(hbox_type);
            Gtk.Label label_type = new Gtk.Label(ChronopicRegisterPort.TypePrint(listConnected[count - 1].Type));
            vbox.Add(label_type);

            table_main.Attach(vbox, (uint)2, (uint)3, (uint)count, (uint)count + 1);

            list_buttons_left.Add(button_left);
            list_images.Add(image);
            list_labels_type.Add(label_type);
            list_buttons_right.Add(button_right);
        }
        table_main.Show();
    }
示例#47
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();
        }
示例#48
0
        void InitializeComponents()
        {
            var stream = Assembly
                         .GetExecutingAssembly()
                         .GetManifestResourceStream(AppController.Instance.Config.AppWindow);

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

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

            mNew.Activated         += OnNew;
            mOpen.Activated        += OnOpen;
            mSave.Activated        += OnSave;
            mSaveAs.Activated      += OnSaveAs;
            mQuit.Activated        += OnQuit;
            mEnvironment.Activated += OnEnvironment;
            mAbout.Activated       += OnAbout;
            mExportToPng.Activated += OnExportToPng;

            rbDefault.Clicked  += OnVariableRadiobuttonCliecked;
            rbExisting.Clicked += OnVariableRadiobuttonCliecked;
            rbNew.Clicked      += OnVariableRadiobuttonCliecked;

            rbDefault1.Clicked  += OnVariableRadiobuttonCliecked1;
            rbExisting1.Clicked += OnVariableRadiobuttonCliecked1;
            rbNew1.Clicked      += OnVariableRadiobuttonCliecked1;

            rbDefault2.Clicked  += OnVariableRadiobuttonCliecked2;
            rbExisting2.Clicked += OnVariableRadiobuttonCliecked2;
            rbNew2.Clicked      += OnVariableRadiobuttonCliecked2;

            rbDefault3.Clicked  += OnVariableRadiobuttonCliecked3;
            rbExisting3.Clicked += OnVariableRadiobuttonCliecked3;
            rbNew3.Clicked      += OnVariableRadiobuttonCliecked3;

            DisableProperties();

            cbDefaultVar.Changed += OnVariableComboboxChanged;
            cbExistVar.Changed   += OnVariableComboboxChanged;
            etNewVar.Changed     += OnVariableComboboxChanged;

            cbDefaultVar1.Changed += OnVariableComboboxChanged;
            cbExistVar1.Changed   += OnVariableComboboxChanged;
            etNewVar1.Changed     += OnVariableComboboxChanged;

            cbDefaultVar2.Changed += OnVariableComboboxChanged;
            cbExistVar2.Changed   += OnVariableComboboxChanged;
            etNewVar2.Changed     += OnVariableComboboxChanged;

            cbDefaultVar3.Changed += OnVariableComboboxChanged;
            cbExistVar3.Changed   += OnVariableComboboxChanged;
            etNewVar3.Changed     += OnVariableComboboxChanged;

            cbFunction.Changed  += OnFunctionChanged;
            chbOverride.Toggled += OnOverrideToggled;

            IconList = new[] { new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), AppController.Instance.Config.Icon) };
            Icon     = IconList[0];

            var surfaces = AppController.Instance.GetPalette();

            uint count = (uint)surfaces.Sum(s => s.Segments.Count);

            table1 = new Gtk.Table(2, count / 2, true);

            int index = 0;

            for (uint i = 0; i < count / 2; i++)
            {
                for (uint j = 0; j < 2; j++)
                {
                    if (surfaces.Count() > index)
                    {
                        var surf = surfaces [index++];
                        var el   = new ElementDrawing(surf, 2, 2);
                        table1.Attach(el, i, i + 1, j, j + (uint)surf.Segments.Count());
                        el.Show();
                    }
                }
            }

            vboxPalette.Add(table1);

            table1.SetSizeRequest(300, 100);
            table1.Show();

            _grid = new ElementDrawing(AppController.Instance.Surface, 24, 24);

            scrolledwindow1.AddWithViewport(_grid);

            _grid.Show();

            var arduino = AppController.Instance.GetArduino();

            var code = new ElementDrawing(arduino[0], 2, 2);

            tblArdulino.Attach(code, 0, 1, 0, 1);
            code.CreateCode += CController.Instance.CreateCode;
            code.Show();
        }
示例#49
0
    Gtk.ListStore listStoreAll;     //stores the chronopics that have assigned a serial port: They are plugged in.

    //based on: ~/informatica/progs_meus/mono/treemodel.cs
    private void createContent(List <ChronopicRegisterPort> list)
    {
        treeview = new Gtk.TreeView();

        // Create column , cell renderer and add the cell to the serialN column
        Gtk.TreeViewColumn serialNCol = new Gtk.TreeViewColumn();
        serialNCol.Title = " " + Catalog.GetString("Serial Number") + " ";
        Gtk.CellRendererText serialNCell = new Gtk.CellRendererText();
        serialNCol.PackStart(serialNCell, true);

        // Create column , cell renderer and add the cell to the port column
        Gtk.TreeViewColumn portCol = new Gtk.TreeViewColumn();
        portCol.Title = " Port ";
        Gtk.CellRendererText portCell = new Gtk.CellRendererText();
        portCol.PackStart(portCell, true);


        //-- cell renderer toggles

        Gtk.TreeViewColumn unknownCol = new Gtk.TreeViewColumn();
        unknownCol.Title = " " + Catalog.GetString("Not configured") + " ";
        Gtk.CellRendererToggle unknownCell = new Gtk.CellRendererToggle();
        unknownCell.Activatable = true;
        unknownCell.Radio       = true;         //draw as radiobutton
        unknownCell.Toggled    += new Gtk.ToggledHandler(unknownToggled);
        unknownCol.PackStart(unknownCell, true);

        Gtk.TreeViewColumn contactsCol = new Gtk.TreeViewColumn();
        contactsCol.Title = " " + Catalog.GetString("Jumps/Races") + " ";
        Gtk.CellRendererToggle contactsCell = new Gtk.CellRendererToggle();
        contactsCell.Activatable = true;
        contactsCell.Radio       = true;        //draw as radiobutton
        contactsCell.Toggled    += new Gtk.ToggledHandler(contactsToggled);
        contactsCol.PackStart(contactsCell, true);

        Gtk.TreeViewColumn encoderCol = new Gtk.TreeViewColumn();
        encoderCol.Title = " " + Catalog.GetString("Encoder") + " ";
        Gtk.CellRendererToggle encoderCell = new Gtk.CellRendererToggle();
        encoderCell.Activatable = true;
        encoderCell.Radio       = true;         //draw as radiobutton
        encoderCell.Toggled    += new Gtk.ToggledHandler(encoderToggled);
        encoderCol.PackStart(encoderCell, true);

        //-- end of cell renderer toggles


        listStoreAll = new Gtk.ListStore(typeof(ChronopicRegisterWindowTypes));

        int connectedCount = 0;
        int unknownCount   = 0;

        foreach (ChronopicRegisterPort crp in list)
        {
            if (crp.Port != "")
            {
                listStoreAll.AppendValues(new ChronopicRegisterWindowTypes(crp));
                connectedCount++;

                if (crp.Type == ChronopicRegisterPort.Types.UNKNOWN)
                {
                    unknownCount++;
                }
            }
        }

        serialNCol.SetCellDataFunc(serialNCell, new Gtk.TreeCellDataFunc(RenderSerialN));
        portCol.SetCellDataFunc(portCell, new Gtk.TreeCellDataFunc(RenderPort));
        unknownCol.SetCellDataFunc(unknownCell, new Gtk.TreeCellDataFunc(RenderUnknown));
        contactsCol.SetCellDataFunc(contactsCell, new Gtk.TreeCellDataFunc(RenderContacts));
        encoderCol.SetCellDataFunc(encoderCell, new Gtk.TreeCellDataFunc(RenderEncoder));

        treeview.Model = listStoreAll;

        // Add the columns to the TreeView
        treeview.AppendColumn(serialNCol);
        treeview.AppendColumn(portCol);
        treeview.AppendColumn(unknownCol);
        treeview.AppendColumn(contactsCol);
        treeview.AppendColumn(encoderCol);

        Gtk.HBox hbox = new Gtk.HBox(false, 12);

        //create image
        Pixbuf pixbuf = new Pixbuf(null, Util.GetImagePath(false) + Constants.FileNameChronopic);

        Gtk.Image image = new Gtk.Image();
        image.Pixbuf = pixbuf;
        hbox.Add(image);

        //create label
        Gtk.Label label = new Gtk.Label();
        label.Text = writeLabel(connectedCount, unknownCount);
        hbox.Add(label);

        Gtk.VBox vboxTV = new Gtk.VBox(false, 12);
        vboxTV.Add(hbox);

        if (connectedCount > 0)
        {
            vboxTV.Add(treeview);
        }

        vbox_main.Add(vboxTV);
    }
示例#50
0
        protected virtual void Build()
        {
            Gui.Initialize((Widget)this);
            this.Name           = "Gtk.MessageBoxDialog";
            this.WindowPosition = WindowPosition.CenterOnParent;
            this.Resizable      = false;
            this.AllowGrow      = false;
            VBox vbox = this.VBox;

            vbox.Name                  = "dialog1_VBox";
            vbox.BorderWidth           = 2U;
            this.vbox_main             = new VBox();
            this.vbox_main.Name        = "vbox_main";
            this.vbox_main.Spacing     = 6;
            this.vbox_main.BorderWidth = 15U;
            this.vbox_top              = new VBox();
            this.vbox_top.Name         = "vbox_top";
            this.vbox_top.Spacing      = 6;
            this.vbox_main.Add((Widget)this.vbox_top);
            ((Box.BoxChild) this.vbox_main[(Widget)this.vbox_top]).Position = 0;
            this.alignment_label               = new Alignment(0.5f, 0.5f, 1f, 1f);
            this.alignment_label.Name          = "alignment_label";
            this.alignment_label.TopPadding    = 18U;
            this.alignment_label.BottomPadding = 18U;
            this.labelInfo           = new Label();
            this.labelInfo.Name      = "labelInfo";
            this.labelInfo.LabelProp = Catalog.GetString("label1");
            this.labelInfo.Wrap      = true;
            this.alignment_label.Add((Widget)this.labelInfo);
            this.vbox_main.Add((Widget)this.alignment_label);
            Box.BoxChild boxChild = (Box.BoxChild) this.vbox_main[(Widget)this.alignment_label];
            boxChild.Position        = 1;
            boxChild.Expand          = false;
            boxChild.Fill            = false;
            this.vbox_bottom         = new VBox();
            this.vbox_bottom.Name    = "vbox_bottom";
            this.vbox_bottom.Spacing = 6;
            this.vbox_main.Add((Widget)this.vbox_bottom);
            ((Box.BoxChild) this.vbox_main[(Widget)this.vbox_bottom]).Position = 2;
            vbox.Add((Widget)this.vbox_main);
            ((Box.BoxChild)vbox[(Widget)this.vbox_main]).Position = 0;
            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.buttonNo              = new Button();
            this.buttonNo.CanFocus     = true;
            this.buttonNo.Name         = "buttonNo";
            this.buttonNo.UseStock     = true;
            this.buttonNo.UseUnderline = true;
            this.buttonNo.Label        = "gtk-no";
            this.AddActionWidget((Widget)this.buttonNo, -9);
            ButtonBox.ButtonBoxChild buttonBoxChild2 = (ButtonBox.ButtonBoxChild)actionArea[(Widget)this.buttonNo];
            buttonBoxChild2.Position    = 1;
            buttonBoxChild2.Expand      = false;
            buttonBoxChild2.Fill        = false;
            this.buttonYes              = new Button();
            this.buttonYes.CanDefault   = true;
            this.buttonYes.CanFocus     = true;
            this.buttonYes.Name         = "buttonYes";
            this.buttonYes.UseStock     = true;
            this.buttonYes.UseUnderline = true;
            this.buttonYes.Label        = "gtk-yes";
            this.AddActionWidget((Widget)this.buttonYes, -8);
            ButtonBox.ButtonBoxChild buttonBoxChild3 = (ButtonBox.ButtonBoxChild)actionArea[(Widget)this.buttonYes];
            buttonBoxChild3.Position = 2;
            buttonBoxChild3.Expand   = false;
            buttonBoxChild3.Fill     = false;
            if (this.Child != null)
            {
                this.Child.ShowAll();
            }
            this.DefaultWidth  = 244;
            this.DefaultHeight = 160;
            this.Show();
        }
示例#51
0
        public DungeonEditorImplementation(PluginManager manager)
        {
            this.manager = manager;

            Box       tmpBox, tmpBox2;
            Alignment tmpAlign;
            Box       vbox = new Gtk.VBox();

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

            hbox.Spacing = 3;

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

            Alignment frame = new Alignment(0, 0, 0, 0);

            dungeonSpinButton     = new SpinButton(0, 15, 1);
            floorSpinButton       = new SpinButton(0, 15, 1);
            roomSpinButton        = new SpinButtonHexadecimal(0, 255, 1);
            roomSpinButton.Digits = 2;

            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 addFloorAboveButton = new Button("Add Floor Above");

            addFloorAboveButton.Image    = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button);
            addFloorAboveButton.Clicked += (a, b) => {
                int floorIndex = floorSpinButton.ValueAsInt + 1;
                (minimap.Map as Dungeon).InsertFloor(floorIndex);
                DungeonChanged();
                floorSpinButton.Value = floorIndex;
            };
            tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0);
            tmpAlign.Add(addFloorAboveButton);
            tmpBox.Add(tmpAlign);

            var addFloorBelowButton = new Button("Add Floor Below");

            addFloorBelowButton.Image    = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button);
            addFloorBelowButton.Clicked += (a, b) => {
                int floorIndex = floorSpinButton.ValueAsInt;
                (minimap.Map as Dungeon).InsertFloor(floorIndex);
                DungeonChanged();
            };
            tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0);
            tmpAlign.Add(addFloorBelowButton);
            tmpBox.Add(tmpAlign);

            var removeFloorButton = new Button("Remove 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,
                                                        "Really delete this floor?");
                var response = (ResponseType)d.Run();
                d.Dispose();

                if (response == Gtk.ResponseType.Yes)
                {
                    dungeon.RemoveFloor(floorSpinButton.ValueAsInt);
                    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.AddTileSelectedHandler((sender, index) => {
                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);
            };
            tmpBox2.Add(roomSpinButton);

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

            hbox.Add(tmpBox);



            Map map = manager.GetActiveMap();

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

            DungeonChanged();


            dungeonEventWrapper.Bind <DungeonRoomChangedEventArgs>("RoomChangedEvent",
                                                                   (sender, args) => RoomChanged());
            vbox.Destroyed += (a, b) => dungeonEventWrapper.UnbindAll();

            this.Add(frame);
            ShowAll();
        }