예제 #1
1
        public PlayerScoreController(GUILauncher launcher)
            : base(launcher)
        {
            hBox = new HBox();

            mySpinButtons = new List<SpinButton>();
            GameState state = launcher.OurGameApp.GameState;

            for (int i = 0; i < state.NumPlayers; i++ )
            {
                Label player = new Label("Score joueur " + (i+1).ToString() + ":");
                hBox.Add(player);

                SpinButton playerSpinButton = new SpinButton(0, 9999999d, 1);
                mySpinButtons.Add(playerSpinButton);

                playerSpinButton.ValueChanged += this.OnPlayerScoreEntryChanged;

                playerSpinButton.Digits = 0;
                playerSpinButton.Numeric = true;
                playerSpinButton.Wrap = true;
                playerSpinButton.SnapToTicks = true;
                hBox.Add(playerSpinButton);
            }

            this.Add(hBox);
            this.ShowAll();
        }
예제 #2
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();
        }
예제 #3
0
    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);
        }
    }
예제 #4
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);
        }
예제 #5
0
        public Dialog(VariableSet variables)
            : base("Splitter", variables)
        {
            var vbox = new VBox(false, 12) {BorderWidth = 12};
              VBox.PackStart(vbox, true, true, 0);

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

              var hbox = new HBox(false, 6);
              table.Attach(hbox, 0, 2, 0, 1);

              hbox.Add(new Label("f(x, y):"));
              hbox.Add(new GimpEntry(GetVariable<string>("formula")));
              hbox.Add(new Label("= 0"));

              table.Attach(CreateLayerFrame("Layer 1", "translate_1_x", "translate_1_y",
                    "rotate_1"), 0, 1, 1, 2);

              table.Attach(CreateLayerFrame("Layer 2", "translate_2_x", "translate_2_y",
                    "rotate_2"), 1, 2, 1, 2);

              table.Attach(new GimpCheckButton(_("_Merge visible layers"),
                       GetVariable<bool>("merge")), 0, 1, 3, 4);

              table.Attach(CreateAdvancedOptions(), 1, 2, 3, 4);

              var keep = new GimpComboBox(GetVariable<int>("keep_layer"),
                  new string[]{_("Both Layers"),
                           _("Layer 1"), _("Layer 2")});
              table.AttachAligned(0, 5, _("Keep:"), 0.0, 0.5, keep, 1, true);
        }
예제 #6
0
	static void Main ()
	{
		Application.Init ();
		Gtk.Window w = new Gtk.Window ("System.Drawing and Gtk#");

		// Custom widget sample
		a = new PrettyGraphic ();

		// Event-based drawing
		b = new DrawingArea ();
		b.ExposeEvent += new ExposeEventHandler (ExposeHandler);
		b.SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);

		Button c = new Button ("Quit");
		c.Clicked += new EventHandler (quit);

		MovingText m = new MovingText ();
		
		Box box = new HBox (true, 0);
		box.Add (a);
		box.Add (b);
		box.Add (m);
		box.Add (c);
		w.Add (box);
		
		w.ShowAll ();
		Application.Run ();
	}
예제 #7
0
        public MainWindow_2()
            : base("Allignment")
        {
            SetDefaultSize(260, 150);
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate { Application.Quit(); };

            VBox vbox = new VBox(false, 5);
            HBox hbox = new HBox(true, 3);

            Alignment valign = new Alignment(0, 0.5f, 0, 0);
            vbox.PackStart(valign);

            Button ok = new Button("OK");
            ok.SetSizeRequest(70, 30);
            Button close = new Button("Close");

            hbox.Add(ok);
            hbox.Add(close);

            Alignment halign = new Alignment(0.5f, 0, 0, 0);
            halign.Add(hbox);

            vbox.PackStart(halign, false, false, 3);

            Add(vbox);

            ShowAll();
        }
예제 #8
0
        public NotebookTabLabel(string title)
        {
            Button button = new Button ();
            button.Image = new Gtk.Image (Stock.Close, IconSize.Menu);
            button.TooltipText = "Close Tab";
            button.Relief = ReliefStyle.None;

            RcStyle rcStyle = new RcStyle ();
            rcStyle.Xthickness = 0;
            rcStyle.Ythickness = 0;
            button.ModifyStyle (rcStyle);

            button.FocusOnClick = false;
            button.Clicked += OnCloseClicked;
            button.Show ();

            Label label = new Label (title);
            label.UseMarkup = false;
            label.UseUnderline = false;
            label.Show ();

            HBox hbox = new HBox (false, 0);
            hbox.Spacing = 0;
            hbox.Add (label);
            hbox.Add (button);
            hbox.Show ();

            this.Add (hbox);
        }
예제 #9
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;
        }
예제 #10
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);
        }
예제 #11
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;
        }
예제 #12
0
파일: MainWindow.cs 프로젝트: bwn13/ad
		private void addPage (Widget widget, string label) {
		HBox hBox = new HBox ();
		hBox.Add(new Label (label));
		Button button = new Button (new Image (Stock.Cancel, IconSize.Button ));
		hBox.Add (button);
		hBox.ShowAll();
		notebook1.AppendPage (widget, new Label(label));

		button.Clicked += delegate {
			widget.Destroy ();
		};

		}
예제 #13
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;
        }
예제 #14
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");
        }
예제 #15
0
 public TypeKindChooserDialog()
     : base(GettextCatalog.GetString ("Choose a type"))
 {
     Gtk.HBox hbox = new Gtk.HBox();
     base.VBox.Add (hbox);
     Gtk.VBox vbox;
     // box 1
     vbox = new Gtk.VBox ();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("Activity"), SetActivity);
     _selection = "Activity";
     AddButton (vbox, GettextCatalog.GetString ("Actor"), SetActor);
     AddButton (vbox, GettextCatalog.GetString ("Artifact"), SetArtifact);
     AddButton (vbox, GettextCatalog.GetString ("Association"), SetAssociation);
     AddButton (vbox, GettextCatalog.GetString ("AssociationClass"), SetAssociationClass);
     AddButton (vbox, GettextCatalog.GetString ("Class"), SetClass);
     AddButton (vbox, GettextCatalog.GetString ("Collaboration"), SetCollaboration);
     vbox.Show ();
     // box 2
     vbox = new Gtk.VBox();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("CommunicationPath"), SetCommunicationPath);
     AddButton (vbox, GettextCatalog.GetString ("Component"), SetComponent);
     AddButton (vbox, GettextCatalog.GetString ("DataType"), SetDataType);
     AddButton (vbox, GettextCatalog.GetString ("DeploymentSpecification"), SetDeploymentSpecification);
     AddButton (vbox, GettextCatalog.GetString ("Device"), SetDevice);
     AddButton (vbox, GettextCatalog.GetString ("Enumeration"), SetEnumeration);
     AddButton (vbox, GettextCatalog.GetString ("ExecutionEnvironment"), SetExecutionEnvironment);
     vbox.Show ();
     // box 3
     vbox = new Gtk.VBox ();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("Extension"), SetExtension);
     AddButton (vbox, GettextCatalog.GetString ("InformationItem"), SetInformationItem);
     AddButton (vbox, GettextCatalog.GetString ("Interaction"), SetInteraction);
     AddButton (vbox, GettextCatalog.GetString ("Interface"), SetInterface);
     AddButton (vbox, GettextCatalog.GetString ("Node"), SetNode);
     AddButton (vbox, GettextCatalog.GetString ("PrimitiveType"), SetPrimitiveType);
     AddButton (vbox, GettextCatalog.GetString ("ProtocolStateMachine"), SetProtocolStateMachine);
     vbox.Show ();
     // box 4
     vbox = new Gtk.VBox ();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("Signal"), SetSignal);
     AddButton (vbox, GettextCatalog.GetString ("StateMachine"), SetStateMachine);
     AddButton (vbox, GettextCatalog.GetString ("Stereotype"), SetStereotype);
     AddButton (vbox, GettextCatalog.GetString ("UseCase"), SetUseCase);
     vbox.Show ();
     hbox.Show ();
 }
예제 #16
0
        void CreateColorAndOpacityWidget()
        {
            var hbox = new HBox(false, 12);

              _color = new GimpColorButton("", 16, 16, new RGB(0, 0, 0),
                   ColorAreaType.Flat);
              _color.Update = true;
              hbox.Add(_color);

              _opacity = new SpinButton(0, 100, 1);
              hbox.Add(new Label(_("Opacity:")));
              hbox.Add(_opacity);
              hbox.Add(new Label("%"));
              AttachAligned(0, 3, _("Color:"), 0.0, 0.5, hbox, 1, true);
        }
예제 #17
0
        public Dialog(Drawable drawable, VariableSet variables = null)
            : base("CountTool", variables)
        {
            var hbox = new HBox(false, 12) {BorderWidth = 12};
              VBox.PackStart(hbox, true, true, 0);

              var preview = new Preview(drawable, _coordinates);
              hbox.PackStart(preview, true, true, 0);

              var sw = new ScrolledWindow();
              hbox.Add(sw);

              var store = new TreeStore(typeof(Coordinate<int>));
              for (int i = 0; i < 10; i++)
            {
              var coordinate = new Coordinate<int>(10 * i, 10 * i);
              _coordinates.Add(coordinate);
              store.AppendValues(coordinate);
            }

              var view = new TreeView(store);
              sw.Add(view);

              var textRenderer = new CellRendererText();
              view.AppendColumn("X", textRenderer, new TreeCellDataFunc(RenderX));
              view.AppendColumn("Y", textRenderer, new TreeCellDataFunc(RenderY));
        }
예제 #18
0
        public SourceFrame(Variable<ProviderFactory> loader)
            : base(3, 2, "Source")
        {
            _loader = loader;

              Table.ColumnSpacing = 12;

              var imageButton = CreateImageButton();
              Attach(imageButton, 0, 1, 0, 1);

              var hbox = new HBox();
              Attach(hbox, 1, 2, 0, 1);

              _imageBox = CreateImageComboBox();
              hbox.Add(_imageBox);
              _refresh = CreateRefreshButton();
              hbox.PackEnd(_refresh, false, false, 0);

              var fileButton = CreateFileButton(imageButton);
              Attach(fileButton, 0, 1, 1, 2);

              var folderButton = CreateFolderButton(fileButton);
              Attach(folderButton, 0, 1, 2, 3);

              _include = CreateIncludeToggleButton();
              Attach(_include, 1, 2, 2, 3);

              SetFileEntry(false);
              _choose.Sensitive = false;
        }
예제 #19
0
        void CreateCombo(string defaultGroup)
        {
            if (primaryGroupComboBox != null)
            {
                primaryGroupComboBox.Destroy();
                primaryGroupComboBox = null;
            }

            primaryGroupComboBox = ComboBox.NewText();
            primaryGroupComboBox.AppendText(defaultGroup);

            LdapEntry[] grps = conn.Data.SearchByClass("posixGroup");
            foreach (LdapEntry e in grps)
            {
                LdapAttribute nameAttr = e.getAttribute("cn");
                if (nameAttr.StringValue.ToLower() == defaultGroup.ToLower())
                {
                    continue;
                }

                primaryGroupComboBox.AppendText(nameAttr.StringValue);
            }

            primaryGroupComboBox.Active = 0;
            primaryGroupComboBox.Show();

            hbox417.Add(primaryGroupComboBox);
        }
예제 #20
0
        public NewsMenuItem()
        {
            HBox box = new HBox (false, 0);

            menuLabel = new Label ();
            box.Add (menuLabel);

            newsicon = new Image (Gdk.Pixbuf.LoadFromResource ("QSSupportLib.icons.internet-news-reader.png"));
            newsicon.TooltipText = "Нет непрочитанных новостей.";
            newsicon.Show ();
            box.Add (newsicon);

            this.Add (box);
            this.RightJustified = true;
            this.ShowAll ();
            menuLabel.Visible = false;
        }
예제 #21
0
        public HmPreferencesWidget()
            : base()
        {
            HmBackend.LoadCredentials (out this.username, out this.password);

            //Fixme Please ! I look UGLY!
            VBox mainVBox = new VBox(false, 12);
            mainVBox.BorderWidth = 10;
            mainVBox.Show();
            Add(mainVBox);

            HBox usernameBox = new HBox(false, 12);
            Gtk.Label emailLabel = new Label ("Email Address");
            usernameBox.Add (emailLabel);
            emailEntry = new Entry(username);
            usernameBox.Add (emailEntry);
            usernameBox.ShowAll();
            mainVBox.PackStart (usernameBox, false, false, 0);

            HBox passwordBox = new HBox(false, 12);
            Gtk.Label passwordLabel = new Label ("Password");
            passwordBox.Add (passwordLabel);
            passwordEntry = new Entry(password);
            passwordBox.Add (passwordEntry);
            passwordBox.ShowAll();
            mainVBox.PackStart (passwordBox, false, false, 0);

            // Status message label
            statusLabel = new Label();
            statusLabel.Justify = Gtk.Justification.Center;
            statusLabel.Wrap = true;
            statusLabel.LineWrap = true;
            statusLabel.Show();
            statusLabel.UseMarkup = true;
            statusLabel.UseUnderline = false;

            mainVBox.PackStart(statusLabel, false, false, 0);

            authButton = new LinkButton("Click Here to Connect");
            authButton.Show();
            mainVBox.PackStart(authButton, false, false, 0);
            mainVBox.ShowAll();

            authButton.Clicked += OnAuthButtonClicked;
        }
예제 #22
0
        public WebNavigationBox()
        {
            var hbox = new HBox(false, 1);

            _goBackButton = CreateButton("Back", Stock.GoBack, OnGoBack);
            hbox.Add(_goBackButton);
            ((Box.BoxChild)hbox[_goBackButton]).Expand = false;

            _goForwardButton = CreateButton("Forward", Stock.GoForward, OnGoForward);
            hbox.Add(_goForwardButton);
            ((Box.BoxChild)hbox[_goForwardButton]).Expand = false;

            _stopButton = CreateButton("Stop", Stock.Stop, OnStop);
            hbox.Add(_stopButton);
            ((Box.BoxChild)hbox[_stopButton]).Expand = false;

            _refreshButton = CreateButton("Refresh", Stock.Refresh, OnRefresh);
            hbox.Add(_refreshButton);
            ((Box.BoxChild)hbox[_refreshButton]).Expand = false;

            _homeButton = CreateButton("Home", Stock.Home, OnHome);
            hbox.Add(_homeButton);
            ((Box.BoxChild)hbox[_homeButton]).Expand = false;

            _addressEntry = new Entry();
            _addressEntry.CanFocus = true;
            hbox.Add(_addressEntry);
            ((Box.BoxChild)hbox[_addressEntry]).Expand = true;

            _goButton = CreateButton("Go", Stock.Ok, OnGo);
            hbox.Add(_goButton);
            ((Box.BoxChild)hbox[_goButton]).Expand = false;

            Add(hbox);
        }
예제 #23
0
        public BrowseFile(HBox parent, string file, bool browse_file)
        {
            this.browse_file = browse_file;
            filename = new Entry ();
            browse = new Button (Catalog.GetString ("Browse..."));
            Filename = file;

            browse.Clicked += new EventHandler (OnBrowse);

            parent.Add (filename);
            parent.Add (browse);

            Gtk.Box.BoxChild box = (Gtk.Box.BoxChild) parent[browse];
            box.Expand = false;
            box.Fill = false;

            parent.ShowAll ();
        }
예제 #24
0
파일: GtkForm.cs 프로젝트: ABEMBARKA/monoUI
 private void AddTextBoxClicked(object o, EventArgs args)
 {
     if (textBoxExtra != null)
     {
         throw new Exception("Adding more than one TextBox not supported");
     }
     textBoxExtra = new Gtk.Entry();
     hboxPanel.Add(textBoxExtra);
 }
예제 #25
0
 public MainWindow()
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
     this.KeyPressEvent += OnKeyPressed;
     HBox vBox = new HBox ();
     m_TreeView = CreateTreeView ();
     vBox.Add (m_TreeView);
     HBox actionButtons = new HBox ();
     actionButtons.Add (createActionButton ("LiveTV"));
     actionButtons.Add (createActionButton ("Video"));
     actionButtons.Add (createActionButton ("Recordings"));
     actionButtons.Add (createActionButton ("Music"));
     actionButtons.Add(createActionButton("ReConn"));
     vBox.Add (actionButtons);
     this.Add (vBox);
     this.ShowAll ();
 }
예제 #26
0
        private void BindToWidget()
        {
            foreach (var p in GetObjectProperties(m_objectType))
            {
                var hbox = new HBox();

                var label = new Label(p.Name);
                hbox.Add(label);
                var value = p.GetValue(ObjectInstance, null);
                Widget input = null;

                if (p.PropertyType == typeof(int))
                {
                    var spinButton = new SpinButton(0, int.MaxValue, 1);
                    spinButton.Value = Convert.ToDouble(value);
                    input = spinButton;
                }

                if (p.PropertyType == typeof(bool))
                {
                    var toggle = new ToggleButton();
                    toggle.Active = Convert.ToBoolean(value);
                    input = toggle;
                }
                else if (p.PropertyType == typeof(float) || p.PropertyType == typeof(double))
                {
                    var horizontalScale = new HScale(0, 1, 0.05);

                    if (ObjectInstance != null)
                    {
                        horizontalScale.Value = Convert.ToDouble(value);
                    }

                    input = horizontalScale;
                }
                else if (p.PropertyType == typeof(TimeSpan))
                {
                    var secondsHBox = new HBox();
                    var seconds = new SpinButton(0, int.MaxValue, 1);
                    seconds.Value = ((TimeSpan)value).TotalSeconds;
                    secondsHBox.Add(seconds);

                    var secondsLabel = new Label("seconds");
                    secondsHBox.Add(secondsLabel);

                    input = secondsHBox;
                }

                if (input != null)
                {
                    m_widgetMap.Add(p, input);
                    hbox.Add(input);
                }

                VBox.Add(hbox);
            }
        }
예제 #27
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);
        }
예제 #28
0
        public FullscreeModeController( GUILauncher launcher )
            : base(launcher)
        {
            hBox = new HBox();
            Add(hBox);

            fBtn = new CheckButton("Mode plein écran");
            fBtn.Toggled += this.OnToggle;
            hBox.Add(fBtn);
        }
예제 #29
0
 private HBox AddItemToRow(HBox hboxRow, int j, IGridWidgetItem item, string rowId) {
     this.Log.Debug("AddItemToRow");
     Box.BoxChild hboxChild;
     if (item != null) {
         var itemWidget = new PhotoWidget();
         itemWidget.Name = string.Format("{0}Image{1}", rowId, j);
         itemWidget.WidgetItem = item;
         itemWidget.SelectionChanged += OnSelectionChangedInternal;
         hboxRow.Add(itemWidget);
         hboxChild = ((Box.BoxChild) (hboxRow[itemWidget]));
     } else {
         var dummyImage = new Image();
         dummyImage.Name = string.Format("{0}Image{1}", rowId, j);
         hboxRow.Add(dummyImage);
         hboxChild = ((Box.BoxChild) (hboxRow[dummyImage]));
     }
     hboxRow.Homogeneous = true;
     hboxChild.Position = j;
     return hboxRow;
 }
예제 #30
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 ();
		}
예제 #31
0
		static void SetButtonIcon (Button button, string stockIcon)
		{
			Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
			Label label = new Label (button.Label);
			HBox hbox = new HBox (false, 2);
			Image image = new Image ();
			
			image.Pixbuf = Stetic.IconLoader.LoadIcon (button, stockIcon, IconSize.Button);
			image.Show ();
			hbox.Add (image);
			
			label.Show ();
			hbox.Add (label);
			
			hbox.Show ();
			alignment.Add (hbox);
			
			button.Child.Destroy ();
			
			alignment.Show ();
			button.Add (alignment);
		}
		static void SetButtonIcon (Button button, string stockIcon)
		{
			Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
			Label label = new Label (button.Label);
			HBox hbox = new HBox (false, 2);
			ImageView image = new ImageView ();
			
			image.Image = ImageService.GetIcon (stockIcon, IconSize.Menu);
			image.Show ();
			hbox.Add (image);
			
			label.Show ();
			hbox.Add (label);
			
			hbox.Show ();
			alignment.Add (hbox);
			
			button.Child.Destroy ();
			
			alignment.Show ();
			button.Add (alignment);
		}
예제 #33
0
    private void populate()
    {
        using(StreamReader sr = new StreamReader(".history"))
        {
            while(!sr.EndOfStream)
            {
                //Column 0: lr node published to
                //Column 1: docId
                //Column 2: publish date
                string[] items = sr.ReadLine().Split(' ');
                string url = String.Format("{0}/obtain?by_doc_ID=true&request_id={1}", items[0], items[1]);
                string dateString = DateTime.Parse(items[2]).ToShortDateString();

                Gtk.LinkButton lb = new Gtk.LinkButton(url, "View record in browser");
                lb.Clicked += (sender, e) => System.Diagnostics.Process.Start(url);
                Gtk.HBox row = new Gtk.HBox();
                row.Add(new Gtk.Label(dateString));
                row.Add(new Gtk.Label(items[1]));
                row.Add(lb);

                HistoryTable.Add(row);
            }
        }
    }
예제 #34
0
    public Vidmot()
    {
        Application.Init();

        gluggi = new Window("Slembitalnaleikur");
        hbox1 = new HBox();
        vbox1 = new VBox();
        vbox2 = new VBox();
        button1 = new Button("Hætta");
        button2 = new Button("Giska");
        button3 = new Button("Nýr leikur");
        label1 = new Label(tilraunir + " tilraunir búnar");
        label2 = new Label("Ég segi til um hvernig þér gengur með töluna.");

        entry1 = new Entry("Giskaðu á mig, ég er milli 0 og 9!");
        logik = new Logik();

        gluggi.Add(hbox1);
        hbox1.Add(vbox1);
        hbox1.Add(vbox2);
        vbox1.Add(label1);
        vbox1.Add(entry1);
        vbox1.Add(button1);
        vbox2.Add(label2);
        vbox2.Add(button2);
        vbox2.Add(button3);

        gluggi.Hidden += onWindowHide;
        button1.Clicked += onWindowHide;
        button2.Clicked += onButton2Clicked;
        button3.Clicked += onButton3Clicked;

        gluggi.ShowAll();

        Application.Run();
    }
예제 #35
0
파일: arc.cs 프로젝트: nlhepler/mono
	static void Main ()
	{		
		Application.Init ();
		Gtk.Window w = new Gtk.Window ("Mono.Cairo Circles demo");

		a = new CairoGraphic ();	
		
		Box box = new HBox (true, 0);
		box.Add (a);
		w.Add (box);
		w.Resize (500,500);		
		w.ShowAll ();		
		
		Application.Run ();
	}
예제 #36
0
파일: Gui.cs 프로젝트: Gilaad-Elstein/mlEco
        private void InitGui()
        {
            guiContainer.LayoutStyle = ButtonBoxStyle.Start;
            guiContainer.Spacing     = 2;
            ToggleButton buttonFastForward = new ToggleButton("FastForward");
            ToggleButton buttonKeepBest    = new ToggleButton("Keep best");


            mainContainer.Add(drawingArea);
            //mainContainer.Add(guiContainer);
            guiContainer.Add(buttonFastForward);
            guiContainer.Add(buttonKeepBest);
            SetButtonBoxSize();

            Add(mainContainer);
        }
예제 #37
0
        public void ShowDialog()
        {
            Glade.XML xml = new Glade.XML(null, "MetaPixel.glade", "metapixel_dialog", "f-spot");
            xml.Autoconnect(this);
            metapixel_dialog.Modal        = false;
            metapixel_dialog.TransientFor = null;

            miniatures_tags = new FSpot.Widgets.TagEntry(App.Instance.Database.Tags, false);
            miniatures_tags.UpdateFromTagNames(new string [] {});
            tagentry_box.Add(miniatures_tags);

            metapixel_dialog.Response += on_dialog_response;
            current_radio.Active       = true;
            tags_radio.Toggled        += HandleTagsRadioToggled;
            HandleTagsRadioToggled(null, null);
            metapixel_dialog.ShowAll();
        }
예제 #38
0
        private void createCombo()
        {
            primaryGroupComboBox = ComboBox.NewText();

            foreach (string n in groupList)
            {
                primaryGroupComboBox.AppendText(n);
            }

            primaryGroupComboBox.Active = 0;
            primaryGroupComboBox.Show();

            // FIXME: primary group
            primaryGroupComboBox.Sensitive = false;

            comboHbox.Add(primaryGroupComboBox);
        }
예제 #39
0
        void createCombo()
        {
            if (primaryGroupComboBox != null)
            {
                primaryGroupComboBox.Changed -= OnPrimaryGroupChanged;
                primaryGroupComboBox.Destroy();
                primaryGroupComboBox = null;
            }

            primaryGroupComboBox = ComboBox.NewText();

            string defaultGroup = "None";

            if (defaultValues != null && defaultValues.ContainsKey("defaultGroup"))
            {
                defaultGroup = defaultValues["defaultGroup"];
                primaryGroupComboBox.AppendText(defaultGroup);
            }

            foreach (string key in _allGroups.Keys)
            {
                if (key.ToLower() == defaultGroup.ToLower())
                {
                    continue;
                }

                primaryGroupComboBox.AppendText(key);
            }

            primaryGroupComboBox.AppendText("Create new group...");

            primaryGroupComboBox.Active   = 0;
            primaryGroupComboBox.Changed += OnPrimaryGroupChanged;
            primaryGroupComboBox.Show();

            comboHbox.Add(primaryGroupComboBox);
        }
예제 #40
0
        private void Build()
        {
            box = new HBox(false, 0);
            box.SetSizeRequest(40, 40);
            box.BorderWidth = 2;

            button          = new Button();
            button.Clicked += CyclePoint;

            lblpoints = new Label();
            Pango.FontDescription desc = Pango.FontDescription.FromString("Bebas Neue 14");
            lblpoints.ModifyFont(desc);
            lblpoints.Text = points[10];


            button.Add(lblpoints);
            button.ShowAll();

            box.Add(this.button);
            box.ShowAll();

            // This damn this call is anoyingly needed otherwise it shant build
            this.Add(box);
        }
예제 #41
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;
        }
예제 #42
0
    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();
    }
예제 #43
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();
        }
예제 #44
0
        public override void Clicked()
        {
            Treasure.Project = Project;
            Chest.Project    = Project;

            Gtk.Window win = new Window(WindowType.Toplevel);
            Alignment  warningsContainer = new Alignment(0.1f, 0.1f, 0f, 0f);

            VBox vbox = new VBox();

            var chestGui = new ChestEditorGui(manager);

            chestGui.SetRoom(manager.GetActiveRoom().Index);
            chestGui.Destroyed += (sender2, e2) => win.Destroy();

            Frame chestFrame = new Frame();

            chestFrame.Label = "Chest Data";
            chestFrame.Add(chestGui);

            var   treasureGui   = new TreasureEditorGui(manager);
            Frame treasureFrame = new Frame();

            treasureFrame.Label = "Treasure Data";
            treasureFrame.Add(treasureGui);

            System.Action UpdateWarnings = () => {
                VBox warningBox = new VBox();
                warningBox.Spacing = 4;

                System.Action <string> AddWarning = (s) => {
                    Image img = new Image(Stock.DialogWarning, IconSize.Button);
                    HBox  hb  = new HBox();
                    hb.Spacing = 10;
                    hb.Add(img);
                    Gtk.Label l = new Gtk.Label(s);
                    l.LineWrap = true;
                    hb.Add(l);
                    Alignment a = new  Alignment(0, 0, 0, 0);
                    a.Add(hb);
                    warningBox.Add(a);
                };

                foreach (var c in warningsContainer.Children)
                {
                    warningsContainer.Remove(c);
                }

                int index = chestGui.GetTreasureIndex();
                if (index < 0)
                {
                    return;
                }

                if (!Treasure.IndexExists(index))
                {
                    AddWarning("Treasure " + Wla.ToWord(index) + " does not exist.");
                }
                else
                {
                    if (index != treasureGui.Index)
                    {
                        AddWarning("Your treasure index is different\nfrom the chest you're editing.");
                    }

                    int spawnMode = (Treasure.GetTreasureByte(index, 0) >> 4) & 7;

                    if (spawnMode != 3)
                    {
                        AddWarning("Treasure " + Wla.ToWord(index) + " doesn't have spawn\nmode $3 (needed for chests).");
                    }

                    int  yx = Chest.GetChestByte(chestGui.RoomIndex, 0);
                    int  x  = yx & 0xf;
                    int  y  = yx >> 4;
                    Room r  = Project.GetIndexedDataType <Room>(chestGui.RoomIndex);
                    if (x >= r.Width || y >= r.Height || r.GetTile(x, y) != 0xf1)
                    {
                        AddWarning("There is no chest at coordinates (" + x + "," + y + ").");
                    }
                }

                warningsContainer.Add(warningBox);

                win.ShowAll();
            };

            chestGui.SetTreasureEditor(treasureGui);
            chestGui.ChestChangedEvent += () => {
                UpdateWarnings();
            };
            treasureGui.TreasureChangedEvent += () => {
                UpdateWarnings();
            };

            HBox hbox = new Gtk.HBox();

            hbox.Spacing = 6;
            hbox.Add(chestFrame);
            hbox.Add(treasureFrame);

            Button okButton = new Gtk.Button();

            okButton.UseStock = true;
            okButton.Label    = "gtk-ok";
            okButton.Clicked += (a, b) => {
                win.Destroy();
            };

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

            buttonAlign.Add(okButton);

            vbox.Add(hbox);
            vbox.Add(warningsContainer);
            vbox.Add(buttonAlign);

            win.Add(vbox);

            UpdateWarnings();
            win.ShowAll();
        }
예제 #45
0
        public static void CheckWordDialog(object sender, EventArgs e)
        {
            var lab = new Gtk.Label("Zadejte slovo: ");
            var ent = new Gtk.Entry();
            var but = new Gtk.Button("OK");
            var div = new Gtk.HBox(false, 1);

            div.PackStart(lab);
            div.Add(ent);
            div.PackEnd(but);
            var checkWin = new Gtk.Window(Gtk.WindowType.Popup);

            checkWin.Add(div);
            checkWin.BorderWidth = 0;
            checkWin.Modal       = true;
            checkWin.CanFocus    = true;
            checkWin.SetPosition(WindowPosition.Mouse);
            checkWin.ShowAll();
            ent.Activated += delegate {
                but.Click();
            };
            but.Clicked += delegate {
                checkWin.HideAll();

                if (game.dictionary.Content(ent.Text))
                {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                        game.Window,
                        DialogFlags.DestroyWithParent,
                        MessageType.Info,
                        ButtonsType.Close,
                        "Slovo \"" + ent.Text + "\" <b>je</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                else
                {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                        game.Window,
                        DialogFlags.DestroyWithParent,
                        MessageType.Info,
                        ButtonsType.Close,
                        "Slovo \"" + ent.Text + "\" <b>není</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                checkWin.Dispose();
                checkWin.Destroy();
            };

            checkWin.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch (args.Event.Key)
                {
                case Gdk.Key.Escape:
                    checkWin.HideAll();
                    checkWin.Dispose();
                    checkWin.Destroy();
                    break;

                case Gdk.Key.ISO_Enter:
                    but.Click();
                    break;
                }
            };
        }
예제 #46
0
        private void PushButton(object sender, EventArgs e)
        {
            Gtk.CheckButton check  = new Gtk.CheckButton("Down");
            Gtk.Entry       input  = new Gtk.Entry(15);
            Gtk.HBox        divide = new Gtk.HBox(false, 0);
            Gtk.Button      but    = new Gtk.Button("OK");

            input.Activated += delegate {
                but.Click();
            };

            divide.PackStart(input);
            divide.Add(check);
            divide.PackEnd(but);

            Gtk.Window w = new Gtk.Window(Gtk.WindowType.Popup);
            w.SetPosition(WindowPosition.Mouse);

            w.Add(divide);

            w.BorderWidth = 0;
            w.Modal       = true;
            w.CanFocus    = true;
            w.ShowAll();

            but.Clicked += delegate {
                if (input.Text == "")
                {
                    return;
                }
                int      i, j;
                string[] name = ((Gtk.Button)sender).Name.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                i = int.Parse(name [1]);
                j = int.Parse(name [2]);

                w.HideAll();


                if (this.game.GetActualPlayer().DoMove(
                        new Lexicon.Move(new System.Drawing.Point(i - 1, j - 1), input.Text.ToUpperInvariant(), check.Active))
                    )
                {
                    w.Destroy();
                    if (!Scrabble.Game.InitialConfig.client)
                    {
                        this.game.changePlayer();
                    }
                }
            };

            w.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch (args.Event.Key)
                {
                case Gdk.Key.Escape:
                    w.HideAll();
                    w.Dispose();
                    w.Destroy();
                    break;
                }
            };
        }
    public int ImportFromFile(PhotoStore store, string path)
    {
        this.store = store;
        this.CreateDialog("import_dialog");

        this.Dialog.TransientFor   = main_window;
        this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;
        this.Dialog.Response      += HandleDialogResponse;

        AllowFinish = false;

        this.Dialog.DefaultResponse = ResponseType.Ok;

        //import_folder_entry.Activated += HandleEntryActivate;
        recurse_check.Toggled += HandleRecurseToggled;
        copy_check.Toggled    += HandleRecurseToggled;

        menu = new SourceMenu(this);
        source_option_menu.Menu = menu;

        collection              = new FSpot.PhotoList(new Photo [0]);
        tray                    = new FSpot.ScalingIconView(collection);
        tray.Selection.Changed += HandleTraySelectionChanged;
        icon_scrolled.SetSizeRequest(200, 200);
        icon_scrolled.Add(tray);
        //icon_scrolled.Visible = false;
        tray.DisplayTags = false;
        tray.Show();

        photo_view = new FSpot.PhotoImageView(collection);
        photo_scrolled.Add(photo_view);
        photo_scrolled.SetSizeRequest(200, 200);
        photo_view.Show();

        //FSpot.Global.ModifyColors (frame_eventbox);
        FSpot.Global.ModifyColors(photo_scrolled);
        FSpot.Global.ModifyColors(photo_view);

        photo_view.Pixbuf = PixbufUtils.LoadFromAssembly("f-spot-48.png");
        photo_view.Fit    = true;

        tag_entry = new FSpot.Widgets.TagEntry(MainWindow.Toplevel.Database.Tags, false);
        tag_entry.UpdateFromTagNames(new string [] {});
        tagentry_box.Add(tag_entry);

        tag_entry.Show();

        this.Dialog.Show();
        //source_option_menu.Changed += HandleSourceChanged;
        if (path != null)
        {
            SetImportPath(path);
            int i = menu.FindItemPosition(path);

            if (i > 0)
            {
                source_option_menu.SetHistory((uint)i);
            }
            else if (Directory.Exists(path))
            {
                SourceItem path_item = new SourceItem(new VfsSource(path));
                menu.Prepend(path_item);
                path_item.ShowAll();
                SetImportPath(path);
                source_option_menu.SetHistory(0);
            }
            idle_start.Start();
        }

        ResponseType response = (ResponseType)this.Dialog.Run();

        while (response == ResponseType.Ok)
        {
            try {
                if (Directory.Exists(this.ImportPath))
                {
                    break;
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
                break;
            }

            HigMessageDialog md = new HigMessageDialog(this.Dialog,
                                                       DialogFlags.DestroyWithParent,
                                                       MessageType.Error,
                                                       ButtonsType.Ok,
                                                       Catalog.GetString("Directory does not exist."),
                                                       String.Format(Catalog.GetString("The directory you selected \"{0}\" does not exist.  " +
                                                                                       "Please choose a different directory"), this.ImportPath));

            md.Run();
            md.Destroy();

            response = (Gtk.ResponseType) this.Dialog.Run();
        }

        if (response == ResponseType.Ok)
        {
            this.UpdateTagStore(tag_entry.GetTypedTagNames());
            this.Finish();

            if (tags_selected != null && tags_selected.Count > 0)
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    Photo p = collection [i] as Photo;

                    if (p == null)
                    {
                        continue;
                    }

                    p.AddTag((Tag [])tags_selected.ToArray(typeof(Tag)));
                    store.Commit(p);
                }
            }

            this.Dialog.Destroy();
            return(collection.Count);
        }
        else
        {
            this.Cancel();
            //this.Dialog.Destroy();
            return(0);
        }
    }
예제 #48
0
        void ReloadObjectBoxes()
        {
            objectBoxDict.Clear();
            objectBoxContainer.Foreach((c) => c.Dispose());

            Gtk.Grid grid = new Gtk.Grid();
            grid.ColumnSpacing = 6;
            grid.RowSpacing    = 6;

            int left = 0, top = 0;

            foreach (ObjectGroup group in topObjectGroup.GetAllGroups())
            {
                var objectBox = new ObjectBox(group);

                Gtk.Box box = new Gtk.HBox();

                objectBox.AddTileSelectedHandler(delegate(object sender, int index) {
                    if (!disableBoxCallback)
                    {
                        SelectObject(objectBox.ObjectGroup, index);
                    }
                });

                objectBox.Halign = Gtk.Align.Center;
                objectBoxDict.Add(group, objectBox);

                Gtk.Frame frame = new Gtk.Frame();
                frame.Label  = GetGroupName(group);
                frame.Halign = Gtk.Align.Center;
                frame.Add(objectBox);

                if (group.GetGroupType() == ObjectGroupType.Shared)
                {
                    box.Add(frame);
                    Gtk.Button button = new Button(new Gtk.Image(Stock.Remove, IconSize.Button));
                    button.Halign = Gtk.Align.Center;
                    button.Valign = Gtk.Align.Center;

                    button.Clicked += (sender, args) => {
                        if (selectedObjectGroup == group)
                        {
                            selectedObjectGroup = null;
                            activeObject        = null;
                            selectedIndex       = -1;
                        }
                        topObjectGroup.RemoveGroup(group);
                        ReloadObjectBoxes();
                    };

                    box.Add(button);
                }
                else
                {
                    box.Add(frame);
                }
                grid.Attach(box, left, top, 1, 1);
                left++;
                if (left == 2)
                {
                    left = 0;
                    top++;
                }
            }

            objectBoxContainer.Add(grid);
            SelectObject(TopObjectGroup, -1);
            this.ShowAll();
        }
예제 #49
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.StartWindow"/> class.
        /// </summary>
        public StartWindow() : base(Gtk.WindowType.Toplevel)
        {
            #region Basic window properties
            // Basic window properties
            this.Title        = "Scrabble - Základní nastavení";
            this.Name         = "ConfigWindow";
            this.DeleteEvent += OnDeleteEvent;
            this.SetPosition(WindowPosition.Center);
            this.DefaultWidth  = 410;
            this.DefaultHeight = 280;
            this.Icon          = Scrabble.Game.InitialConfig.icon;
            #endregion

            this.numberOfPlayers = 2;

            // Own thread for loading dictionary
            this.statusb = new Gtk.Statusbar();
            this.statusb.Push(statusb.GetContextId("Slovník"), "Načítám slovník");
            this.tdic = new Thread(LoadDictionary);
            this.tdic.Start();

            // infoText (top)
            this.infoText = new Gtk.Label("Základní nastavení hry.\n" +
                                          "Nastavte prosím počet hráčů, jejich jména a určete zda za ně bude hrát umělá inteligence. " +
                                          "Také můžete nastavit, kteří hráči se připojují vzdáleně.");
            this.infoText.Wrap = true;

            // First config line (number of players, client)
            this.upperHbox = new HBox(false, 5);
            this.l1        = new Label("Počet hráčů");
            this.upperHbox.PackStart(l1);
            this.l2                = new Label(", nebo:");
            this.entryNum          = new SpinButton(2, 5, 1);
            this.entryNum.Changed += OnNumberOfPlayerChange;
            client             = new CheckButton();
            client.Clicked    += IamClient;
            client.Label       = "připojit se ke vzdálené hře";
            client.TooltipText = "Pokud zaškrnete, tak se program bude chovat pouze jako client a připojí se k hře vedené na jiném PC.";
            upperHbox.Add(entryNum);
            upperHbox.Add(l2);
            upperHbox.PackEnd(client);
            upperHbox.BorderWidth  = 10;
            upperHbox.WidthRequest = 20;

            // Table with config for each player (dynamic size)
            table = new Gtk.Table(5, 7, false);
            table.Attach(new Gtk.Label("Jméno hráče:"), 1, 2, 0, 1);
            table.Attach(new Gtk.Label("CPU"), 2, 3, 0, 1);
            table.Attach(new Gtk.Label("Network"), 3, 4, 0, 1);
            ipLabel = new Gtk.Label("IP");
            table.Attach(ipLabel, 4, 5, 0, 1);

            labels    = new Gtk.Label[5];
            entryes   = new Gtk.Entry[5];
            CPUchecks = new Gtk.CheckButton[5];
            MPchecks  = new Gtk.CheckButton[5];
            IPs       = new Gtk.Entry[5];
            for (int i = 0; i < 5; i++)
            {
                labels [i]      = new Gtk.Label((i + 1).ToString());
                labels [i].Name = string.Format("l {0}", i);
                table.Attach(labels [i], 0, 1, (uint)i + 1, (uint)i + 2);
                entryes [i]             = new Gtk.Entry(12);
                entryes [i].Text        = "Hráč " + (i + 1).ToString();
                entryes [i].TooltipText = "Vložte jméno hráče.";
                table.Attach(entryes [i], 1, 2, (uint)i + 1, (uint)i + 2);
                CPUchecks [i]             = new Gtk.CheckButton();
                CPUchecks [i].Name        = string.Format("c {0}", i);
                CPUchecks [i].TooltipText = "Pokud je zaškrtnuto, tak za hráče bude hrát počítač.";
                ((Gtk.CheckButton)CPUchecks [i]).Clicked += OnCpuChange;
                table.Attach(CPUchecks [i], 2, 3, (uint)i + 1, (uint)i + 2);
                MPchecks [i]             = new Gtk.CheckButton();
                MPchecks [i].Name        = string.Format("n {0}", i);
                MPchecks [i].TooltipText = "Pokud je zaškrtnuto, tak se počítá s tím, že se tento hráč připojí vzdáleně. ";
                ((Gtk.CheckButton)MPchecks [i]).Clicked += OnNetChange;
                table.Attach(MPchecks [i], 3, 4, (uint)i + 1, (uint)i + 2);
                IPs [i]            = new Gtk.Entry(15);
                IPs [i].Text       = "192.168.0.X";
                IPs [i].WidthChars = 15;
                IPs [i].Sensitive  = false;
                table.Attach(IPs [i], 4, 5, (uint)i + 1, (uint)i + 2);
            }
            this.CPUchecks[0].Hide();

            ok             = new Button("Hotovo");
            ok.Clicked    += Done;
            ok.BorderWidth = 5;
            ok.TooltipText = "Potvrzením začne hra. Může se stát, že program bude ještě chvíli načítat slovník.";
            table.Attach(ok, 0, 5, 6, 7);

            // Main vbox (where all is)
            this.mainVbox = new Gtk.VBox(false, 5);

            this.mainVbox.PackStart(infoText);
            this.mainVbox.Add(upperHbox);
            this.mainVbox.Spacing = 5;
            this.mainVbox.Add(table);
            this.mainVbox.PackEnd(statusb);

            this.mainVbox.BorderWidth = 9;
            this.Add(mainVbox);
            this.mainVbox.ShowAll();

            for (int i = 2; i < numberOfPlayers + 3; i++)
            {
                labels [i].Hide();
                entryes [i].Hide();
                CPUchecks [i].Hide();
                MPchecks [i].Hide();
                IPs [i].Hide();
            }
            ipLabel.Hide();

            foreach (Gtk.Entry e in IPs)
            {
                e.Hide();
            }

            this.CPUchecks[0].Hide();
            this.MPchecks[0].Hide();
        }
예제 #50
0
        // TODO: pass in a label which it will update with the name from the combobox?
        public ComboBoxFromConstants(bool showHelp = true, bool vertical = false, bool showSpin = true)
        {
            this.Name = "LynnaLab.ComboBoxFromConstants";

            Gtk.Box box2 = new Gtk.HBox();
            box2.Spacing = 6;

            // Container child LynnaLab.ComboBoxFromConstants.Gtk.Container+ContainerChild
            if (vertical)
            {
                this.box1 = new Gtk.VBox();
            }
            else
            {
                this.box1 = new Gtk.HBox();
            }
            // Container child box1.Gtk.Box+BoxChild
            this.spinButton                          = new LynnaLab.SpinButtonHexadecimal();
            this.spinButton.CanFocus                 = true;
            this.spinButton.Name                     = "spinButton";
            this.spinButton.Adjustment.Upper         = 255D;
            this.spinButton.Adjustment.PageIncrement = 16D;
            this.spinButton.Adjustment.StepIncrement = 1D;
            this.spinButton.ClimbRate                = 1D;
            this.spinButton.Digits                   = 2;
            this.spinButton.Numeric                  = true;
            if (showSpin)
            {
                box2.Add(spinButton);
                box2.SetChildPacking(spinButton, expand: false, fill: false, padding: 0, pack_type: Gtk.PackType.Start);
                box1.Add(box2);
            }

            // Container child box1.Gtk.Box+BoxChild
            this.combobox1      = new Gtk.ComboBoxText();
            this.combobox1.Name = "combobox1";
            this.box1.Add(this.combobox1);
            box1.SetChildPacking(this.combobox1, false, false, 0, Gtk.PackType.Start);

            this.spinButton.ValueChanged += new System.EventHandler(this.OnSpinButtonValueChanged);
            this.combobox1.Changed       += new System.EventHandler(this.OnCombobox1Changed);

            if (showHelp)
            {
                // When clicking the "help" button, create a popup with documentation for
                // possible values. (It checks for a "@values" field in the documentation.)
                Gtk.Button helpButton = new Gtk.Button("?");
                helpButton.CanFocus = false;
                helpButton.Clicked += delegate(object sender, EventArgs e) {
                    if (DefaultDocumentation == null)
                    {
                        return;
                    }

                    DocumentationDialog d = new DocumentationDialog(DefaultDocumentation);
                    d.Run();
                    d.Dispose();
                };

                box2.PackStart(helpButton, false, false, 0);
            }

            Gtk.Frame frame = new Gtk.Frame();
            frame.Add(box1);
            this.Add(frame);
        }
예제 #51
0
파일: GtkForm.cs 프로젝트: ABEMBARKA/monoUI
        public DemoMain()
        {
            window = new Gtk.Window("TestForm1");
            Gtk.HBox hbox = new Gtk.HBox(false, 0);
            hbox1 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox2 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox3 = new Gtk.HBox(false, 0);
            hbox.Add(hbox1);
            window.SetDefaultSize(600, 400);
            window.DeleteEvent += new DeleteEventHandler(WindowDelete);

            button1          = new Gtk.Button("button1");
            button1.Clicked += Button1Clicked;
            button2          = new Gtk.Button("button2");
            button3          = new Gtk.Button("button3");
            Gtk.Button button4 = new Gtk.Button("button4");
            button4.Clicked += Button4Clicked;
            Gtk.Button button5 = new Gtk.Button("button5");
            Gtk.Button button6 = new Gtk.Button("button6");
            Gtk.Button button7 = new Gtk.Button("button7");
            button7.Sensitive = false;

            scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]);

            hbox1.Add(hbox3);
            hbox1.Add(hbox2);
            hbox1.Add(button3);
            hbox1.Add(button2);

            button3.Accessible.Description = "help text 3";
            button3.Sensitive = false;

            label1 = new Gtk.Label("label1");

            textBox1 = new Gtk.Entry();
            Gtk.Entry textBox2 = new Gtk.Entry();
            textBox2.Visibility = false;
            textBox2.Sensitive  = false;
            textBox2.IsEditable = false;
            textBox3            = new Gtk.TextView();
            // TODO: scrollbars
            Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1");
            Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2");
            checkbox2.Sensitive = false;

            Gtk.TreeStore   store = new Gtk.TreeStore(typeof(string), typeof(string));
            Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 1", "item 1 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 1a", "item 1a (2)");
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 2", "item 2 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2a", "item 2a (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2b", "item 2b (2)");
            treeView1 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView1, 0, "column 1");
            treeView1.CollapseAll();

            treeView2 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView2, 0, "column 1");
            AddTreeViewColumn(treeView2, 1, "column 2");
            treeView2.CollapseAll();
            treeView2.Accessible.Name = "treeView2";

            tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iters [0]  = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "False", "Alice", "24", "");
            iters [0] = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "True", "Bob", "28", "");
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            AddTreeViewColumn(dataGridView1, 0, "Gender");
            AddTreeViewColumn(dataGridView1, 1, "Name");
            AddTreeViewColumn(dataGridView1, 2, "Age");
            dataGridView1.Accessible.Name = "dataGridView1";

            hboxPanel = new Gtk.HBox();
            Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove");
            btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
            Gtk.Button btnAddTextBox = new Gtk.Button("Add");
            btnAddTextBox.Clicked     += AddTextBoxClicked;
            txtCommand                 = new Gtk.Entry();
            txtCommand.Accessible.Name = "txtCommand";
            Gtk.Button btnRun = new Gtk.Button("Run");
            btnRun.Clicked += btnRunClicked;
            hboxPanel.Add(btnRemoveTextBox);
            hboxPanel.Add(btnAddTextBox);

            Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string));
            Gtk.TreeIter  iter      = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 0");
            iter = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 1");
            listView1 = new Gtk.TreeView(treeStore);
            AddTreeViewColumn(listView1, 0, "items");
            listView1.Accessible.Name = "listView1";
            listView1.ExpandAll();

            hbox2.Add(button5);
            hbox2.Add(checkbox1);
            hbox2.Add(checkbox2);
            hbox2.Add(button4);
            hbox2.Accessible.Name = "groupBox2";

            hbox3.Add(button7);
            hbox3.Add(button6);
            hbox3.Sensitive       = false;
            hbox3.Accessible.Name = "groupBox3";

            hbox.Add(textBox3);
            hbox.Add(textBox2);
            hbox.Add(textBox1);
            hbox.Add(label1);
            hbox.Add(button1);
            hbox.Add(treeView1);
            hbox.Add(treeView2);
            hbox.Add(listView1);
            hbox.Add(dataGridView1);
            hbox.Add(txtCommand);
            hbox.Add(btnRun);
            hbox.Add(hboxPanel);
            hbox.Add(scaleButton1);

            Gtk.Menu file = new Gtk.Menu();
            file.Append(new Gtk.MenuItem("_New"));
            file.Append(new Gtk.MenuItem("_Open"));
            file.Append(new Gtk.CheckMenuItem("Check"));
            Gtk.MenuItem fileItem = new Gtk.MenuItem("File");
            fileItem.Submenu = file;
            Gtk.Menu edit = new Gtk.Menu();
            edit.Append(new Gtk.MenuItem("_Undo"));
            edit.Append(new Gtk.SeparatorMenuItem());
            edit.Append(new Gtk.MenuItem("_Cut"));
            edit.Append(new Gtk.MenuItem("Copy"));
            edit.Append(new Gtk.MenuItem("_Paste"));
            Gtk.MenuItem editItem = new Gtk.MenuItem("Edit");
            editItem.Submenu = edit;
            Gtk.MenuBar menuBar = new Gtk.MenuBar();
            menuBar.Append(fileItem);
            menuBar.Append(editItem);
            hbox.Add(menuBar);

            hbox.Add(new Gtk.SpinButton(0, 100, 1));
            hbox.Add(new Gtk.ToggleButton("ToggleButton"));
            Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100,
                                                    1, 10, 10);
            hbox.Add(new Gtk.VScrollbar(adj));

            window.Add(hbox);
            window.ShowAll();
        }
예제 #52
0
            public SubTileEditor(TilesetEditor tilesetEditor) : base(0, 0, 0, 0)
            {
                this.tilesetEditor = tilesetEditor;

                Gtk.Box tmpBox;

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

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

                subTileViewer = new SubTileViewer();

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

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

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

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

                vbox.Add(hAlign);

                // Next row: collision value

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

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

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

                // Next rows: subtile properties

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

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

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

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

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

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

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

                uint y = 0;

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

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

                ShowAll();

                PullEverything();
            }
예제 #53
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);
    }
예제 #54
0
        // Load the i'th warp in the current map.
        void SetWarpIndex(int i)
        {
            List <WarpSourceData> sourceDataList = sourceGroup.GetMapWarpSourceData(map);

            indexSpinButton.Adjustment.Lower = -1;
            indexSpinButton.Adjustment.Upper = sourceDataList.Count - 1;

            if (i > indexSpinButton.Adjustment.Upper)
            {
                i = (int)indexSpinButton.Adjustment.Upper;
            }

            indexSpinButton.Value = i;

            valueEditorContainer.Remove(valueEditorContainer.Child);

            if (i == -1)
            {
                SetDestIndex(-1, -1);
                return;
            }

            Gtk.HBox hbox = new Gtk.HBox();

            WarpSourceData warpSourceData = sourceDataList[i];

            if (warpSourceData.WarpSourceType == WarpSourceType.StandardWarp)
            {
                SetDestIndex(warpSourceData.DestGroup, warpSourceData.DestIndex);
            }

            sourceEditor = new ValueReferenceEditor(Project,
                                                    warpSourceData);

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

            a.Add(sourceEditor);
            hbox.Add(a);

            if (warpSourceData.WarpSourceType == WarpSourceType.PointerWarp)
            {
                Table table = new Table(1, 1, false);
                table.ColumnSpacing = 6;
                table.RowSpacing    = 6;

                SpinButton pointerSpinButton = new SpinButton(0, 10, 1);

                EventHandler valueChangedHandler = delegate(object sender, EventArgs e) {
                    WarpSourceData pointedData = warpSourceData.GetPointedWarp();

                    pointerSpinButton.Adjustment.Lower = 0;
                    pointerSpinButton.Adjustment.Upper = warpSourceData.GetPointedChainLength() - 1;

                    if (pointerSpinButton.ValueAsInt > pointerSpinButton.Adjustment.Upper)
                    {
                        pointerSpinButton.Value = pointerSpinButton.Adjustment.Upper;
                    }
                    int index = pointerSpinButton.ValueAsInt;

                    while (index > 0)
                    {
                        pointedData = pointedData.GetNextWarp();
                        index--;
                    }

                    table.Remove(destEditor);

                    destEditor = new ValueReferenceEditor(Project, pointedData);

                    destEditor.AddDataModifiedHandler(delegate() {
                        SetDestIndex(pointedData.DestGroup, pointedData.DestIndex);
                    });

                    table.Attach(destEditor, 0, 2, 1, 2);

                    SetDestIndex(pointedData.DestGroup, pointedData.DestIndex);
                };

                pointerSpinButton.ValueChanged += valueChangedHandler;

                // Button which, when clicked, adds a new PointedData to the
                // "chain".
                Gtk.Button addPointedWarpButton =
                    new Gtk.Button(new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button));

                addPointedWarpButton.Clicked += delegate(object sender, EventArgs e) {
                    WarpSourceData pointedData = warpSourceData.GetPointedWarp();

                    while (pointedData.GetNextWarp() != null)
                    {
                        pointedData = pointedData.GetNextWarp();
                    }

                    WarpSourceData nextData = new WarpSourceData(Project,
                                                                 WarpSourceData.WarpCommands[(int)WarpSourceType.PointedWarp],
                                                                 WarpSourceData.DefaultValues[(int)WarpSourceType.PointedWarp],
                                                                 pointedData.FileParser,
                                                                 new List <int> {
                        -1
                    });
                    pointedData.SetNextWarp(nextData);

                    pointerSpinButton.Adjustment.Upper++;
                    pointerSpinButton.Value = warpSourceData.GetPointedChainLength() - 1;
                    valueChangedHandler(null, null);
                };

                // Button which removes a PointedData from the "chain", unless
                // there is only one remaining.
                Gtk.Button removePointedWarpButton =
                    new Gtk.Button(new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Button));

                removePointedWarpButton.Clicked += delegate(object sender, EventArgs e) {
                    int            index       = pointerSpinButton.ValueAsInt;
                    WarpSourceData pointedData = warpSourceData.GetPointedWarp();

                    if (pointedData.GetPointedChainLength() <= 1) // Don't delete the last one
                    {
                        return;
                    }

                    while (index > 0)
                    {
                        pointedData = pointedData.GetNextWarp();
                        index--;
                    }

                    pointedData.FileParser.RemoveFileComponent(pointedData);

                    valueChangedHandler(null, null);
                };

                table.Attach(new Gtk.Label("Pointer index"), 0, 1, 0, 1);
                table.Attach(pointerSpinButton, 1, 2, 0, 1);
                table.Attach(addPointedWarpButton, 2, 3, 0, 1);
                table.Attach(removePointedWarpButton, 3, 4, 0, 1);

                // Invoke handler
                valueChangedHandler(pointerSpinButton, null);

                Frame frame = new Frame(warpSourceData.PointerString);
                frame.Add(table);

                hbox.Add(frame);
            }
            else   // Not pointerWarp
            {
                sourceEditor.AddDataModifiedHandler(delegate() {
                    SetDestIndex(warpSourceData.DestGroup, warpSourceData.DestIndex);
                });
            }

            valueEditorContainer.Add(hbox);
            valueEditorContainer.ShowAll();
        }
예제 #55
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();
        }