Esempio n. 1
0
        public void Initialize(EditSession session)
        {
            PropertyDescriptor prop = session.Property;

            if (!prop.PropertyType.IsEnum)
            {
                throw new ApplicationException("Flags editor does not support editing values of type " + prop.PropertyType);
            }

            Spacing  = 3;
            propType = prop.PropertyType;

            property = prop.Description;
            if (property == null || property.Length == 0)
            {
                property = prop.Name;
            }

            // For small enums, the editor is a list of checkboxes inside a frame
            // For large enums (>5), use a selector dialog.

            values = System.Enum.GetValues(prop.PropertyType);

            if (values.Length < 6)
            {
                Gtk.VBox vbox = new Gtk.VBox(true, 3);

                flags = new Hashtable();

                foreach (object value in values)
                {
                    Gtk.CheckButton check = new Gtk.CheckButton(value.ToString());
                    check.TooltipText = value.ToString();
                    ulong uintVal = Convert.ToUInt64(value);
                    flags[check]   = uintVal;
                    flags[uintVal] = check;

                    check.Toggled += FlagToggled;
                    vbox.PackStart(check, false, false, 0);
                }

                Gtk.Frame frame = new Gtk.Frame();
                frame.Add(vbox);
                frame.ShowAll();
                PackStart(frame, true, true, 0);
            }
            else
            {
                flagsLabel            = new Gtk.Entry();
                flagsLabel.IsEditable = false;
                flagsLabel.HasFrame   = false;
                flagsLabel.ShowAll();
                PackStart(flagsLabel, true, true, 0);

                Gtk.Button but = new Gtk.Button("...");
                but.Clicked += OnSelectFlags;
                but.ShowAll();
                PackStart(but, false, false, 0);
            }
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
		public LogAgentPanelWidget ()
		{
			global::Stetic.BinContainer.Attach (this);

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

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

			var privacyStatement = BrandingService.PrivacyStatement;
			if (!string.IsNullOrEmpty (privacyStatement)) {
				var privacyLabel = new Xwt.Label { Markup = privacyStatement, Wrap = Xwt.WrapMode.Word };
				container.Add (new HBox ());
				container.PackEnd (privacyLabel.ToGtkWidget (), false, false, 30);
			}
			
			Add (container);
			ShowAll ();
		}
Esempio n. 4
0
 /// <summary> Called when our field changes on any instance of same type as our Object. </summary>
 private void OnFieldChanged(object Object, FieldOrProperty field, object oldValue)
 {
     if (this.Object == Object)
     {
         if (field.Type == typeof(string) || field.Type == typeof(float) ||
             field.Type == typeof(int))
         {
             Gtk.Entry entry = (Gtk.Entry)widgetTable[fieldTable.IndexOf(field)];
             object    val   = field.GetValue(Object);
             if (val != null)
             {
                 entry.Text = val.ToString();
             }
         }
         else if (field.Type == typeof(bool))
         {
             Gtk.CheckButton checkButton = (Gtk.CheckButton)widgetTable[fieldTable.IndexOf(field)];
             checkButton.Active = (bool)field.GetValue(Object);
         }
         else if (field.Type.IsEnum)
         {
             Gtk.ComboBox comboBox = (Gtk.ComboBox)widgetTable[fieldTable.IndexOf(field)];
             // FIXME: This will break if:
             //        1) the first enum isn't 0 and/or
             //        2) the vaules are not sequential (0, 1, 3, 4 wouldn't work)
             object val = field.GetValue(Object);
             if (val != null)
             {
                 comboBox.Active = (int)val;
             }
         }
     }
 }
Esempio n. 5
0
		public static Gtk.Window Create ()
		{
			window = new Dialog ();
			window.Title = "Bi-directional flipping";
			window.SetDefaultSize (200, 100);

			label = new Label ("Label direction: <b>Left-to-right</b>");
			label.UseMarkup = true;
			label.SetPadding (3, 3);
			window.VBox.PackStart (label, true, true, 0);

			check_button = new CheckButton ("Toggle label direction");
			window.VBox.PackStart (check_button, true, true, 2);

			if (window.Direction == TextDirection.Ltr)
				check_button.Active = true;

			check_button.Toggled += new EventHandler (Toggle_Flip);
			check_button.BorderWidth = 10;

			button = new Button (Stock.Close);
			button.Clicked += new EventHandler (Close_Button);
			button.CanDefault = true;
			
			window.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			window.ShowAll ();
			return window;
		}
Esempio n. 6
0
        public EditColumnsDialog(Gtk.TreeViewColumn[] columns)
        {
            this.Build();

            Title = _("Edit columns");
            Modal = true;
            table.Homogeneous = true;

            Array.Sort <TreeViewColumn> (columns, delegate (TreeViewColumn left, TreeViewColumn right) {
                return left.Title.CompareTo (right.Title);
            });
            for (uint i = 0 ; i < columns.Length; i++) {
                TorrentTreeView.Column c = (TorrentTreeView.Column) columns [i];
                if (c.Ignore)
                    continue;

                CheckButton check = new CheckButton { Label = c.Title, Active = c.Visible  };
                check.Clicked += delegate {
                    Console.WriteLine ("Setting {0} to {1} with width {2}/", c.Title, check.Active, c.Width, c.FixedWidth);
                    c.Visible = check.Active;
                    c.FixedWidth = Math.Max (c.FixedWidth, 10);
                };
                Console.WriteLine ("Appending one");
                this.table.Attach (check, i % 2, i % 2 + 1, i / 2, i / 2 + 1);
            }
            ShowAll ();
        }
		public EnableStartupNotesPreference ()
		{
			IPropertyEditorBool enableStartupNotes_peditor;
			Gtk.CheckButton enableStartupNotesCheckbox;
			Gtk.Label enableStartupNotesLabel;

			// Enable Startup Notes option
			enableStartupNotesLabel = new Gtk.Label (Catalog.GetString ("Enable startup notes"));
			enableStartupNotesLabel.UseMarkup = true;
			enableStartupNotesLabel.Justify = Gtk.Justification.Left;
			enableStartupNotesLabel.SetAlignment (0.0f, 0.5f);
			enableStartupNotesLabel.Show ();

			enableStartupNotesCheckbox = new Gtk.CheckButton ();
			enableStartupNotesCheckbox.Add (enableStartupNotesLabel);
			enableStartupNotesCheckbox.Show ();

			enableStartupNotes_peditor =
				Services.Factory.CreatePropertyEditorToggleButton (Preferences.ENABLE_STARTUP_NOTES, enableStartupNotesCheckbox);
			Preferences.Get (enableStartupNotes_peditor.Key);
			enableStartupNotes_peditor.Setup ();

			align = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 1.0f);
			align.Show ();
			align.Add (enableStartupNotesCheckbox);
		}
Esempio n. 8
0
        public ErrorMatrixPanel(uint rows, uint cols)
            : base(4, 2, false)
        {
            divisorSpinButton = new SpinButton(1, 10000, 1);
            sourceOffsetXSpinButton = new SpinButton(1, cols, 1);
            customDivisorCheckButton = new CheckButton("Use a custom divisor?");
            customDivisorCheckButton.Toggled += delegate
            {
                divisorSpinButton.Sensitive = customDivisorCheckButton.Active;
            };

            matrixPanel = new MatrixPanel(rows, cols);
            matrixPanel.MatrixResized += delegate
            {
                sourceOffsetXSpinButton.Adjustment.Upper =
                    matrixPanel.Columns;
            };

            presets = new List<ErrorMatrix>(ErrorMatrix.Samples.listMatrices());
            var presetsNames = from preset in presets select preset.Name;
            presetComboBox = new ComboBox(presetsNames.ToArray());
            presetComboBox.Changed += delegate
            {
                int active = presetComboBox.Active;
                if (active >= 0) {
                    Matrix = presets[active];
                }
            };

            ColumnSpacing = 2;
            RowSpacing = 2;
            BorderWidth = 2;

            Attach(new Label("Preset:") { Xalign = 0.0f }, 0, 1, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            Attach(presetComboBox, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            Attach(matrixPanel, 0, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            Attach(new Label("Source offset X:") { Xalign = 0.0f },
                0, 1, 2, 3, AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            Attach(sourceOffsetXSpinButton, 1, 2, 2, 3,
                AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            Attach(customDivisorCheckButton, 0, 2, 3, 4,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            Attach(new Label("Divisor:") { Xalign = 0.0f }, 0, 1, 4, 5,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            Attach(divisorSpinButton, 1, 2, 4, 5,
                AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
        }
Esempio n. 9
0
        static PackageCellViewCheckBox()
        {
            var cb = new Gtk.CheckButton();

            indicatorSize    = (int)cb.StyleGetProperty("indicator-size");
            indicatorSpacing = (int)cb.StyleGetProperty("indicator-spacing");
        }
Esempio n. 10
0
        public MainWindow_Event()
            : base("")
        {
            SetDefaultSize(250, 200);
            SetPosition(WindowPosition.Center);

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

            Fixed fix = new Fixed();

            Button btn = new Button("Enter");
            btn.EnterNotifyEvent += OnEnter;

            _quit = new Button("Quit");
            //_quit.Clicked += OnClick;
            _quit.SetSizeRequest(80, 35);

            CheckButton cb = new CheckButton("connect");
            cb.Toggled += OnToggled;

            fix.Put(btn, 50, 20);
            fix.Put(_quit, 50, 50);
            fix.Put(cb, 120, 20);
            Add(fix);
            ShowAll();
        }
Esempio n. 11
0
        /// <summary>
        /// Creates the config widget.
        /// </summary>
        /// <returns>The config widget.</returns>
        public override Gtk.Widget CreateConfigWidget()
        {
            var container = new VBox();
            var citiesNumber = new SpinButton(2, 10000, 2);
            citiesNumber.Text = "Number of cities";
            citiesNumber.Value = m_numberOfCities;
            citiesNumber.ValueChanged += delegate
            {
                m_numberOfCities = citiesNumber.ValueAsInt - (citiesNumber.ValueAsInt % 2);
                citiesNumber.Value = m_numberOfCities;
                OnReconfigured();
            };
            container.Add(citiesNumber);

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

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

            container.Add(showIndexes);

            return container;
        }
        public void Load()
        {
            // Remove old children list
            var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren);
            for (int k = depsChildren.Count - 1; k >= 0; k--)
                vbox_ProjectDeps.Remove((Widget)depsChildren[k]);

            // Init new project dep list
            int i = 0;
            foreach(var prj in Project.ParentSolution.GetAllProjects())
            {
                if (prj == Project)
                    continue;

                var cb = new Gtk.CheckButton(prj.Name){
                    CanFocus=true,
                    DrawIndicator=true,
                    UseUnderline=false,
                    Active = Project.ProjectDependencies.Contains(prj.ItemId)
                };

                cb.Data.Add("prj", prj);

                vbox_ProjectDeps.Add(cb);

                var bc=(Box.BoxChild)vbox_ProjectDeps[cb];
                bc.Expand=false;
                bc.Fill=false;
                bc.Position=i++;
            }
            vbox_ProjectDeps.ShowAll();
        }
		public AnalysisOptionsWidget ()
		{
			enabledCheck = new CheckButton (GettextCatalog.GetString ("Enable source analysis of open files"));
			PackStart (enabledCheck, false, false, 0);
			
			ShowAll ();
		}
        public LiveAnalysisPreferences()
        {
            this.Build ();

            rendercb = new CheckButton ();
            table1.Attach (rendercb, 1, 2, 0, 1,
                AttachOptions.Shrink,
                AttachOptions.Shrink, 0, 0);
            rendercb.CanFocus = false;
            rendercb.Show ();
            rendercb.Active = App.Current.Config.AutoRenderPlaysInLive;
            rendercb.Toggled += (sender, e) => {
                App.Current.Config.AutoRenderPlaysInLive = rendercb.Active;
            };

            reviewcb = new CheckButton ();
            table1.Attach (reviewcb, 1, 2, 2, 3,
                AttachOptions.Shrink,
                AttachOptions.Shrink, 0, 0);
            reviewcb.CanFocus = false;
            reviewcb.Show ();
            reviewcb.Active = App.Current.Config.ReviewPlaysInSameWindow;
            reviewcb.Toggled += (sender, e) => {
                App.Current.Config.ReviewPlaysInSameWindow = reviewcb.Active;
            };

            mediafilechooser1.FileChooserMode = FileChooserMode.Directory;
            mediafilechooser1.CurrentPath = App.Current.Config.AutoRenderDir;
            mediafilechooser1.ChangedEvent += HandleChangedEvent;
        }
Esempio n. 15
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Login Dialog
        public Login()
        {
            SetDefaultSize(240, 355);
            DefaultIcon = StockIcons.GetPixbuf("NyFolderIcon");

            // Initialize Dialog Options
            Title = Info.Name + " Login";
            Logo = StockIcons.GetPixbuf("NyFolderLogo", 240, 140);

            // Remember Password (CheckButton)
            checkRememberPassword.Image = new Gtk.Image(Stock.Save, IconSize.Button);

            // Secure Authentication (CheckButton)
            checkSecureAuth = new CheckButton("Use Secure Authentication");
            checkSecureAuth.Active = true;
            checkSecureAuth.Image = StockIcons.GetImage("Lock", 22);
            checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);
            VBox.PackStart(checkSecureAuth, false, false, 2);

            // Initialize MenuBar
            this.menuBar = new Gtk.MenuBar();
            VBox.PackStart(this.menuBar, false, false, 0);
            this.VBox.ReorderChild(this.menuBar, 0);
            InitializeMenuBar();

            // Initialize Dialog Buttons
            AddButton(Gtk.Stock.Ok, ResponseType.Ok);
            AddButton(Gtk.Stock.Quit, ResponseType.Close);

            ShowAll();
        }
Esempio n. 16
0
		public static Gtk.Window Create ()
		{
			HBox options = new HBox (false, 0);
			CheckButton check_button = null;

			window = new ColorSelectionDialog ("Color selection dialog");
			window.ColorSelection.HasOpacityControl = true;
			window.ColorSelection.HasPalette = true;

			window.SetDefaultSize (250, 200);
			window.VBox.PackStart (options, false, false, 0);
			window.VBox.BorderWidth = 10;

			check_button = new CheckButton("Show Opacity");
			check_button.Active = true;
			options.PackStart (check_button, false, false, 0);
			check_button.Toggled += new EventHandler (Opacity_Callback);

			check_button = new CheckButton("Show Palette");
			check_button.Active = true;
			options.PackEnd (check_button, false, false, 0);
			check_button.Toggled += new EventHandler (Palette_Callback);

			window.ColorSelection.ColorChanged += new EventHandler (Color_Changed);
			window.OkButton.Clicked += new EventHandler (Color_Selection_OK);
			window.CancelButton.Clicked += new EventHandler (Color_Selection_Cancel); 

			options.ShowAll ();

			return window;
		}
		void Build ()
		{
			Stetic.Gui.Initialize (this);
			Stetic.BinContainer.Attach (this);

			var vbox = new VBox ();
			vbox.Spacing = 6;

			packOnBuildButton = new CheckButton ();
			packOnBuildButton.Label = GettextCatalog.GetString ("Create a NuGet Package when building the project.");

			vbox.PackStart (packOnBuildButton, false, false, 10);

			missingMetadataLabel = new Label ();
			missingMetadataLabel.LineWrapMode = Pango.WrapMode.Word;
			missingMetadataLabel.Wrap = true;
			missingMetadataLabel.Xalign = 0;
			missingMetadataLabel.Yalign = 0;
			missingMetadataLabel.Xpad = 20;
			missingMetadataLabel.WidthRequest = 600;
			missingMetadataLabel.Text = GettextCatalog.GetString ("The project does not have NuGet package metadata so a NuGet package will not be created. NuGet package metadata can be specified in the Metadata section in Project Options");

			vbox.PackStart (missingMetadataLabel);

			Add (vbox);

			ShowAll ();
		}
        public EnableStartupNotesPreference()
        {
            IPropertyEditorBool enableStartupNotes_peditor;

            Gtk.CheckButton enableStartupNotesCheckbox;
            Gtk.Label       enableStartupNotesLabel;

            // Enable Startup Notes option
            enableStartupNotesLabel           = new Gtk.Label(Catalog.GetString("Enable startup notes"));
            enableStartupNotesLabel.UseMarkup = true;
            enableStartupNotesLabel.Justify   = Gtk.Justification.Left;
            enableStartupNotesLabel.SetAlignment(0.0f, 0.5f);
            enableStartupNotesLabel.Show();

            enableStartupNotesCheckbox = new Gtk.CheckButton();
            enableStartupNotesCheckbox.Add(enableStartupNotesLabel);
            enableStartupNotesCheckbox.Show();

            enableStartupNotes_peditor =
                Services.Factory.CreatePropertyEditorToggleButton(Preferences.ENABLE_STARTUP_NOTES, enableStartupNotesCheckbox);
            Preferences.Get(enableStartupNotes_peditor.Key);
            enableStartupNotes_peditor.Setup();

            align = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 1.0f);
            align.Show();
            align.Add(enableStartupNotesCheckbox);
        }
Esempio n. 19
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Login Dialog
        public Login()
        {
            SetDefaultSize(240, 355);
            DefaultIcon = StockIcons.GetPixbuf("NyFolderIcon");

            // Initialize Dialog Options
            Title = Info.Name + " Login";
            Logo  = StockIcons.GetPixbuf("NyFolderLogo", 240, 140);

            // Remember Password (CheckButton)
            checkRememberPassword.Image = new Gtk.Image(Stock.Save, IconSize.Button);

            // Secure Authentication (CheckButton)
            checkSecureAuth          = new CheckButton("Use Secure Authentication");
            checkSecureAuth.Active   = true;
            checkSecureAuth.Image    = StockIcons.GetImage("Lock", 22);
            checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);
            VBox.PackStart(checkSecureAuth, false, false, 2);

            // Initialize MenuBar
            this.menuBar = new Gtk.MenuBar();
            VBox.PackStart(this.menuBar, false, false, 0);
            this.VBox.ReorderChild(this.menuBar, 0);
            InitializeMenuBar();

            // Initialize Dialog Buttons
            AddButton(Gtk.Stock.Ok, ResponseType.Ok);
            AddButton(Gtk.Stock.Quit, ResponseType.Close);

            ShowAll();
        }
Esempio n. 20
0
		public static new CheckButton NewWithLabel(string label)
		{
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			CheckButton result = new CheckButton (gtk_check_button_new_with_label(native_label));
			GLib.Marshaller.Free (native_label);
			return result;
		}
Esempio n. 21
0
        /// <summary>
        /// server gui stuff:
        /// server path
        /// server username + password
        /// check server ssl certificate yes/no
        /// </summary>
        /// <param name="insertTo"></param>
        /// <param name="defaultSpacing"></param>
        void SetupGuiServerRelated(Gtk.Box insertTo, int defaultSpacing)
        {
            Gtk.Table customBox = new Gtk.Table(3, 2, false);

            // somehow you can't change the default spacing or set it for all rows
            for (int i = 0; i < 3; i++)
            {
                customBox.SetRowSpacing((uint)i, (uint)defaultSpacing);
            }

            // insert the labels
            customBox.Attach(new Gtk.Label(Catalog.GetString("Server path:")), 0, 1, 0, 1);
            customBox.Attach(new Gtk.Label(Catalog.GetString("Username:"******"Password:"******"SaveConfiguration" is called
            //IPropertyEditor serverEditor = Services.Factory.CreatePropertyEditorEntry(
            //	AddinPreferences.SYNC_PRIVATENOTES_SERVERPATH, server_path);
            //serverEditor.Setup();

            server_user = new Gtk.Entry();
            customBox.Attach(server_user, 1, 2, 1, 2);
            string serverUser = Preferences.Get(AddinPreferences.SYNC_PRIVATENOTES_SERVERUSER) as String;

            server_user.Text = serverUser;
            // NO EDITOR! because we only save when "SaveConfiguration" is called
            //IPropertyEditor userEditor = Services.Factory.CreatePropertyEditorEntry(
            // AddinPreferences.SYNC_PRIVATENOTES_SERVERUSER, server_user);
            //userEditor.Setup();

            server_pass = new Gtk.Entry();
            server_pass.InvisibleChar = '*';
            server_pass.Visibility    = false;
            customBox.Attach(server_pass, 1, 2, 2, 3);
            string serverpass = Preferences.Get(AddinPreferences.SYNC_PRIVATENOTES_SERVERPASS) as String;

            server_pass.Text = serverpass;
            // NO EDITOR! because we only save when "SaveConfiguration" is called
            //IPropertyEditor passEditor = Services.Factory.CreatePropertyEditorEntry(
            // AddinPreferences.SYNC_PRIVATENOTES_SERVERPASS, server_pass);
            //passEditor.Setup();

            check_ssl = new Gtk.CheckButton(Catalog.GetString("Check servers SSL certificate"));
            insertTo.PackStart(check_ssl);

            // set up check-ssl certificate stuff
            object value = Preferences.Get(AddinPreferences.SYNC_PRIVATENOTES_SERVERCHECKSSLCERT);

            if (value == null || value.Equals(true))
            {
                check_ssl.Active = true;
            }
        }
Esempio n. 22
0
        public void Initialize(PropertyDescriptor prop)
        {
            if (!prop.PropertyType.IsEnum)
            {
                throw new ApplicationException("Flags editor does not support editing values of type " + prop.PropertyType);
            }

            property = prop.Label;
            Spacing  = 3;

            // For small enums, the editor is a list of checkboxes inside a frame
            // For large enums (>5), use a selector dialog.

            enm = Registry.LookupEnum(prop.PropertyType.FullName);

            if (enm.Values.Length < 6)
            {
                Gtk.VBox vbox = new Gtk.VBox(true, 3);

                tips  = new Gtk.Tooltips();
                flags = new Hashtable();

                foreach (Enum value in enm.Values)
                {
                    EnumValue eval = enm[value];
                    if (eval.Label == "")
                    {
                        continue;
                    }

                    Gtk.CheckButton check = new Gtk.CheckButton(eval.Label);
                    tips.SetTip(check, eval.Description, eval.Description);
                    uint uintVal = (uint)(int)eval.Value;
                    flags[check]   = uintVal;
                    flags[uintVal] = check;

                    check.Toggled += FlagToggled;
                    vbox.PackStart(check, false, false, 0);
                }

                Gtk.Frame frame = new Gtk.Frame();
                frame.Add(vbox);
                frame.ShowAll();
                PackStart(frame, true, true, 0);
            }
            else
            {
                flagsLabel            = new Gtk.Entry();
                flagsLabel.IsEditable = false;
                flagsLabel.HasFrame   = false;
                flagsLabel.ShowAll();
                PackStart(flagsLabel, true, true, 0);

                Gtk.Button but = new Gtk.Button("...");
                but.Clicked += OnSelectFlags;
                but.ShowAll();
                PackStart(but, false, false, 0);
            }
        }
Esempio n. 23
0
		public CredentialsDialog (URIish uri, IEnumerable<CredentialItem> credentials)
		{
			this.Build ();
			this.credentials = credentials;
			
			labelTop.Text = string.Format (labelTop.Text, uri.ToString ());
			
			Gtk.Table table = new Gtk.Table (0, 0, false);
			table.ColumnSpacing = 6;
			vbox.PackStart (table, true, true, 0);
			
			uint r = 0;
			Widget firstEditor = null;
			foreach (CredentialItem c in credentials) {
				Label lab = new Label (c.GetPromptText () + ":");
				lab.Xalign = 0;
				table.Attach (lab, 0, 1, r, r + 1);
				Table.TableChild tc = (Table.TableChild) table [lab];
				tc.XOptions = AttachOptions.Shrink;
				
				Widget editor = null;
				
				if (c is CredentialItem.YesNoType) {
					CredentialItem.YesNoType cred = (CredentialItem.YesNoType) c;
					CheckButton btn = new CheckButton ();
					editor = btn;
					btn.Toggled += delegate {
						cred.SetValue (btn.Active);
					};
				}
				else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType) {
					CredentialItem cred = c;
					Entry e = new Entry ();
					editor = e;
					e.ActivatesDefault = true;
					if (cred.IsValueSecure ())
						e.Visibility = false;
					e.Changed += delegate {
						if (cred is CredentialItem.StringType)
							((CredentialItem.StringType)cred).SetValue (e.Text);
						else
							((CredentialItem.CharArrayType)cred).SetValue (e.Text.ToCharArray ());
					};
				}
				if (editor != null) {
					table.Attach (editor, 1, 2, r, r + 1);
					tc = (Table.TableChild) table [lab];
					tc.XOptions = AttachOptions.Fill;
					if (firstEditor == null)
						firstEditor = editor;
				}
				
				r++;
			}
			table.ShowAll ();
			Focus = firstEditor;
			Default = buttonOk;
		}
Esempio n. 24
0
        public PreferencesDialog(Settings set, Window parent,
				 string argsOver)
        {
            settings = set;
            argsOverride = argsOver;

            dialog = new Dialog("Preferences", parent,
            DialogFlags.Modal | DialogFlags.DestroyWithParent,
            new object[]{Gtk.Stock.Close, -1});

            var table = new Table(4, 3, false);

            sUseBundledDebugger = new CheckButton("Use bundled MSPDebug");
            sUseBundledDebugger.Clicked += OnBundledState;
            table.Attach(sUseBundledDebugger, 0, 3, 0, 1,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);

            Label lbl;

            lbl = new Label("MSPDebug path:");
            lbl.SetAlignment(0.0f, 0.5f);
            table.Attach(lbl, 0, 1, 1, 2, AttachOptions.Fill, 0, 4, 4);
            sMSPDebugPath = new Entry();
            table.Attach(sMSPDebugPath, 1, 2, 1, 2,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);
            chooseMSPDebug = new Button("Choose...");
            chooseMSPDebug.Clicked += OnChoose;
            table.Attach(chooseMSPDebug, 2, 3, 1, 2,
             AttachOptions.Fill, 0, 4, 4);

            lbl = new Label("MSPDebug arguments:");
            lbl.SetAlignment(0.0f, 0.5f);
            table.Attach(lbl, 0, 1, 2, 3, AttachOptions.Fill, 0, 4, 4);
            sMSPDebugArgs = new Entry();
            sMSPDebugArgs.Sensitive = (argsOverride == null);
            table.Attach(sMSPDebugArgs, 1, 3, 2, 3,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);

            lbl = new Label("Console font:");
            lbl.SetAlignment(0.0f, 0.5f);
            table.Attach(lbl, 0, 1, 3, 4, AttachOptions.Fill, 0, 4, 4);
            sConsoleFont = new FontButton();
            table.Attach(sConsoleFont, 1, 3, 3, 4,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);

            table.ShowAll();
            ((Container)dialog.Child).Add(table);

            chooseDialog = new FileChooserDialog("Choose MSPDebug binary",
            dialog, FileChooserAction.Open,
            new object[]{Stock.Cancel, ResponseType.Cancel,
                 Stock.Ok, ResponseType.Ok});
            chooseDialog.DefaultResponse = ResponseType.Ok;
        }
Esempio n. 25
0
    public static void ColorsCheckOnlyPrelight(Gtk.CheckButton c)
    {
        //c.ModifyBg(StateType.Normal, WHITE);
        //c.ModifyBg(StateType.Active, WHITE);
        //c.ModifyBg(StateType.Prelight, BLUE_CLEAR);

        //c.ModifyBg(StateType.Active, c.Style.Background(StateType.Selected));
        //c.ModifyBg(StateType.Prelight, c.Style.Background(StateType.Selected));
    }
		public BooleanEditor(object @object, PropertyInfo info) : base(@object, info) {
			this.mCheck = new CheckButton();
			this.mCheck.Show();
			this.Add(this.mCheck);
			
			this.Revert();
			
			this.mCheck.Toggled += this.OnCheckToggled;
		}
Esempio n. 27
0
		public AnalysisOptionsWidget ()
		{
			enabledCheck = new CheckButton (GettextCatalog.GetString ("Enable source analysis of open files"));
			PackStart (enabledCheck, false, false, 0);
			enabledTest = new CheckButton (GettextCatalog.GetString ("Enable text editor unit test integration"));
			PackStart (enabledTest, false, false, 0);

			ShowAll ();
		}
Esempio n. 28
0
        public override Gtk.Widget GetEditWidget()
        {
            CheckButton check = new CheckButton ();
            check.Active = (bool) parentRow.PropertyValue;
            check.Label = check.Active.ToString ();
            check.Toggled += new EventHandler (check_Toggled);

            return check;
        }
			public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6)
			{
				this.project = project as DotNetProject;

				Gtk.HBox box = new Gtk.HBox (false, 3);
				Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:"));
				box.PackStart (lbl, false, false, 0);
				comboVersions = ComboBox.NewText ();
				ReferenceManager refmgr = new ReferenceManager (project as DotNetProject);
				foreach (string v in refmgr.SupportedGtkVersions)
					comboVersions.AppendText (v);
				comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion);
				refmgr.Dispose ();
				box.PackStart (comboVersions, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				HSeparator sep = new HSeparator ();
				sep.Show ();
				PackStart (sep, false, false, 0);
				
				if (!GtkDesignInfo.HasDesignedObjects (project))
					return;

				GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project);
				checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support"));
				checkGettext.Active = designInfo.GenerateGettext;
				checkGettext.Show ();
				PackStart (checkGettext, false, false, 0);
				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0);
				entryGettext = new Gtk.Entry ();
				entryGettext.Text = designInfo.GettextClass;
				entryGettext.Sensitive = checkGettext.Active;
				box.PackStart (entryGettext, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);
				
				sep= new HSeparator ();
				sep.Show ();
				PackStart (sep, false, false, 0);
				
				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Stetic folder name :")), false, false, 0);
				entryFolderName = new Gtk.Entry ();
				entryFolderName.Text = designInfo.SteticFolderName;
				entryFolderName.Sensitive = false;
				box.PackStart (entryFolderName, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);
				
				checkHideFiles = new CheckButton (GettextCatalog.GetString ("Hide designer files"));
				checkHideFiles.Active = designInfo.HideGtkxFiles;
				checkHideFiles.Show ();
				PackStart (checkHideFiles, false, false, 0);
			}
Esempio n. 30
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);
        }
Esempio n. 31
0
        public SingleBooleanViewer(IBroadcaster hub, string caption,
			string propertyName)
        {
            _hub = hub;
            _propertyName = propertyName;
            base.PackStart(new Gtk.Label(caption), false, false, 2);
            _checkButton = new Gtk.CheckButton();
            _checkButton.Toggled += new EventHandler(ToggledHandler);
            base.PackStart(_checkButton);
        }
        public FileSelectorDialog(string title, Gtk.FileChooserAction action) : base(title, action)
        {
            LocalOnly = true;

            // Add the text encoding selector
            Table table = new Table(2, 2, false);

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

            encodingLabel        = new Label(GettextCatalog.GetString("_Character Coding:"));
            encodingLabel.Xalign = 0;
            table.Attach(encodingLabel, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            encodingMenu = new Gtk.OptionMenu();
            FillEncodings();
            encodingMenu.SetHistory(0);
            table.Attach(encodingMenu, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            encodingMenu.Changed += EncodingChanged;

            // Add the viewer selector
            viewerLabel        = new Label(GettextCatalog.GetString("Open With:"));
            viewerLabel.Xalign = 0;
            table.Attach(viewerLabel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            Gtk.HBox box = new HBox(false, 6);
            viewerSelector = Gtk.ComboBox.NewText();
            box.PackStart(viewerSelector, true, true, 0);
            closeWorkspaceCheck        = new CheckButton(GettextCatalog.GetString("Close current workspace"));
            closeWorkspaceCheck.Active = true;
            box.PackStart(closeWorkspaceCheck, false, false, 0);
            table.Attach(box, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);
            FillViewers();
            viewerSelector.Changed += OnViewerChanged;

            table.ShowAll();
            this.ExtraWidget = table;

            // Give back the height that the extra widgets take
            int w, h;

            GetSize(out w, out h);
            Resize(w, h + table.SizeRequest().Height);

            if (action == Gtk.FileChooserAction.SelectFolder)
            {
                ShowEncodingSelector = false;
            }

            if (action != Gtk.FileChooserAction.Open)
            {
                closeWorkspaceCheck.Visible = ShowViewerSelector = false;
            }
        }
Esempio n. 33
0
		public FormDatabasePreferences() : base(7, 3, false)
		{	
			typeLabel = new Gtk.Label("Type :");
			serverLabel = new Gtk.Label("Server :");
			portLabel = new Gtk.Label("Port :");
			userLabel = new Gtk.Label("Username :"******"Password :"******"Database :");
			mediaLabel = new Gtk.Label("Medias path :");
			typeCombo = ComboBox.NewText();
			serverEntry = new Entry();
			portSpinButton = new SpinButton(0f,65536f,1f);
			userEntry = new Entry();
			passEntry = new Entry();
			dbEntry = new Entry();
			passCheck = new CheckButton("Save password");
			dbButton= new Button(Stock.Open);
			mediaButton= new FileChooserButton("Choose the media directory", FileChooserAction.SelectFolder);
						
			typeLabel.SetAlignment(0, (float)0.5);
			serverLabel.SetAlignment(0, (float)0.5);
			portLabel.SetAlignment(0, (float)0.5);
			userLabel.SetAlignment(0, (float)0.5);
			passLabel.SetAlignment(0, (float)0.5);
			dbLabel.SetAlignment(0, (float)0.5);
			mediaLabel.SetAlignment(0, (float)0.5);
			
			typeCombo.AppendText("SQLite");
			typeCombo.AppendText("PostgreSQL");
			typeCombo.Changed += OnTypeComboChanged;
			
			passEntry.Visibility = false;
			dbButton.Clicked += OnDbButton; 
			
			this.Attach(typeLabel, 0, 1, 0, 1);
			this.Attach(serverLabel, 0, 1, 1, 2);
			this.Attach(portLabel, 0, 1, 2, 3);
			this.Attach(userLabel, 0, 1, 3, 4);
			this.Attach(passLabel, 0, 1, 4, 5);
			this.Attach(dbLabel, 0, 1, 5, 6);
			this.Attach(mediaLabel, 0, 1, 6, 7);
			
			this.Attach(typeCombo, 1, 3, 0, 1);
			
			this.Attach(serverEntry, 1, 3, 1, 2);
			this.Attach(portSpinButton, 1, 3, 2, 3);
			this.Attach(userEntry, 1, 3, 3, 4);
			this.Attach(passEntry, 1, 2, 4, 5);
			this.Attach(dbEntry, 1, 2, 5, 6);
			
			this.Attach(passCheck, 2, 3, 4, 5);			
			this.Attach(dbButton, 2, 3, 5, 6);		
			this.Attach(mediaButton, 1, 3, 6, 7);
			
		}
Esempio n. 34
0
     public iFolderAccessDialog(Gtk.Window parent, string userName,
 string rights, bool enableOwner)
         : base()
     {
         if(parent != null)
         this.TransientFor = parent;
            if(userName == null)
         this.Title = Util.GS("Access Rights for Multiple Users");
            else
         this.Title = string.Format(Util.GS("Access Rights for {0}"), userName);
            this.HasSeparator = false;
            this.Resizable = false;
            this.Modal = true;
            this.DefaultResponse = ResponseType.Ok;
            this.VBox.Spacing = 10;
            VBox accSectionBox = new VBox();
            this.VBox.PackStart(accSectionBox, false, true, 0);
            accSectionBox.BorderWidth = 10;
            Label accSectionLabel = new Label("<span weight=\"bold\">" +
         Util.GS("Access Rights") +
         "</span>");
            accSectionLabel.UseMarkup = true;
            accSectionLabel.Xalign = 0;
            accSectionBox.PackStart(accSectionLabel, false, true, 0);
            HBox accSpacerBox = new HBox();
            accSectionBox.PackStart(accSpacerBox, false, true, 0);
            Label accSpaceLabel = new Label("    ");
            accSpacerBox.PackStart(accSpaceLabel, false, true, 0);
            VBox accWidgetBox = new VBox();
            accSpacerBox.PackStart(accWidgetBox, false, true, 0);
            FCButton = new RadioButton(Util.GS("Full Control"));
            accWidgetBox.PackStart(FCButton, false, true, 0);
            RWButton = new RadioButton(FCButton, Util.GS("Read/Write"));
            accWidgetBox.PackStart(RWButton, false, true, 0);
            ROButton = new RadioButton(FCButton, Util.GS("Read Only"));
            accWidgetBox.PackStart(ROButton, false, true, 0);
            VBox ownerSectionBox = new VBox();
            this.VBox.PackStart(ownerSectionBox, false, true, 0);
            ownerSectionBox.BorderWidth = 10;
            OwnerButton = new CheckButton(Util.GS("Make this user the owner of the iFolder."));
            ownerSectionBox.PackStart(OwnerButton, false, true, 0);
            if(!enableOwner)
         OwnerButton.Sensitive = false;
            OwnerButton.Toggled += new EventHandler(OwnerButtonToggled);
            this.VBox.ShowAll();
            this.AddButton(Stock.Cancel, ResponseType.Cancel);
            this.AddButton(Stock.Ok, ResponseType.Ok);
            if(rights == "Admin")
         FCButton.Active = true;
            else if(rights == "ReadOnly")
         ROButton.Active = true;
            else
         RWButton.Active = true;
     }
			public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6)
			{
				this.project = project as DotNetProject;

				Gtk.HBox box = new Gtk.HBox (false, 3);
				Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:"));
				box.PackStart (lbl, false, false, 0);
				comboVersions = ComboBox.NewText ();
				ReferenceManager refmgr = new ReferenceManager (project as DotNetProject);
				foreach (string v in refmgr.SupportedGtkVersions)
					comboVersions.AppendText (v);
				comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion);
				refmgr.Dispose ();
				box.PackStart (comboVersions, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				HSeparator sep = new HSeparator ();
				sep.Show ();
				PackStart (sep, false, false, 0);
				
				if (!GtkDesignInfo.HasDesignedObjects (project))
					return;

				GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project);
				checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support"));
				checkGettext.Active = designInfo.GenerateGettext;
				checkGettext.Show ();
				PackStart (checkGettext, false, false, 0);

				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0);
				entryGettext = new Gtk.Entry ();
				entryGettext.Text = designInfo.GettextClass;
				entryGettext.Sensitive = checkGettext.Active;
				box.PackStart (entryGettext, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				box = new Gtk.HBox (false, 3);
				box.PackStart (new Label (GettextCatalog.GetString ("Resource loader class:")), false, false, 0);
				entryResourceLoader = new Gtk.Entry ();
				entryResourceLoader.Text = designInfo.ImageResourceLoaderClass;
				entryResourceLoader.Sensitive = checkGettext.Active;
				box.PackStart (entryResourceLoader, false, false, 0);
				box.ShowAll ();
				PackStart (box, false, false, 0);

				checkGettext.Clicked += delegate {
					box.Sensitive = checkGettext.Active;
					if (checkGettext.Active)
						entryGettext.Text = "Mono.Unix.Catalog";
				};
			}
            public WidgetBuilderOptionPanelWidget(Project project) : base(false, 6)
            {
                this.project = project as DotNetProject;

                Gtk.HBox  box = new Gtk.HBox(false, 3);
                Gtk.Label lbl = new Gtk.Label(GettextCatalog.GetString("Target Gtk# version:"));
                box.PackStart(lbl, false, false, 0);
                comboVersions = ComboBox.NewText();
                ReferenceManager refmgr = new ReferenceManager(project as DotNetProject);

                foreach (string v in refmgr.SupportedGtkVersions)
                {
                    comboVersions.AppendText(v);
                }
                comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf(refmgr.GtkPackageVersion);
                refmgr.Dispose();
                box.PackStart(comboVersions, false, false, 0);
                box.ShowAll();
                PackStart(box, false, false, 0);

                HSeparator sep = new HSeparator();

                sep.Show();
                PackStart(sep, false, false, 0);

                if (!GtkDesignInfo.HasDesignedObjects(project))
                {
                    return;
                }

                GtkDesignInfo designInfo = GtkDesignInfo.FromProject(project);

                checkGettext        = new CheckButton(GettextCatalog.GetString("Enable gettext support"));
                checkGettext.Active = designInfo.GenerateGettext;
                checkGettext.Show();
                PackStart(checkGettext, false, false, 0);
                box = new Gtk.HBox(false, 3);
                box.PackStart(new Label(GettextCatalog.GetString("Gettext class:")), false, false, 0);
                entryGettext           = new Gtk.Entry();
                entryGettext.Text      = designInfo.GettextClass;
                entryGettext.Sensitive = checkGettext.Active;
                box.PackStart(entryGettext, false, false, 0);
                box.ShowAll();
                PackStart(box, false, false, 0);

                checkGettext.Clicked += delegate
                {
                    box.Sensitive = checkGettext.Active;
                    if (checkGettext.Active)
                    {
                        entryGettext.Text = "Mono.Unix.Catalog";
                    }
                };
            }
Esempio n. 37
0
		public void Initialize (PropertyDescriptor prop)
		{
			if (!prop.PropertyType.IsEnum)
				throw new ApplicationException ("Flags editor does not support editing values of type " + prop.PropertyType);
				
			property = prop.Label;
			Spacing = 3;

			// For small enums, the editor is a list of checkboxes inside a frame
			// For large enums (>5), use a selector dialog.

			enm = Registry.LookupEnum (prop.PropertyType.FullName);
			
			if (enm.Values.Length < 6) 
			{
				Gtk.VBox vbox = new Gtk.VBox (true, 3);

				flags = new Hashtable ();

				foreach (Enum value in enm.Values) {
					EnumValue eval = enm[value];
					if (eval.Label == "")
						continue;

					Gtk.CheckButton check = new Gtk.CheckButton (eval.Label);
					check.TooltipText = eval.Description;
					uint uintVal = (uint) Convert.ToInt32 (eval.Value);
					flags[check] = uintVal;
					flags[uintVal] = check;
					
					check.Toggled += FlagToggled;
					vbox.PackStart (check, false, false, 0);
				}

				Gtk.Frame frame = new Gtk.Frame ();
				frame.Add (vbox);
				frame.ShowAll ();
				PackStart (frame, true, true, 0);
			} 
			else 
			{
				flagsLabel = new Gtk.Entry ();
				flagsLabel.IsEditable = false;
				flagsLabel.HasFrame = false;
				flagsLabel.ShowAll ();
				PackStart (flagsLabel, true, true, 0);
				
				Gtk.Button but = new Gtk.Button ("...");
				but.Clicked += OnSelectFlags;
				but.ShowAll ();
				PackStart (but, false, false, 0);
			}
		}
Esempio n. 38
0
        protected override void OnStyleSet (Style previous_style)
        {
            base.OnStyleSet (previous_style);

            CheckButton check = new CheckButton ();
            check.EnsureStyle ();

            interior_focus = GtkUtilities.StyleGetProperty<bool> (check, "interior-focus", false);
            focus_width = GtkUtilities.StyleGetProperty<int> (check, "focus-line-width", -1);
            focus_padding = GtkUtilities.StyleGetProperty<int> (check, "focus-padding", -1);
            padding = interior_focus ? focus_width + focus_padding : 0;
        }
Esempio n. 39
0
 public void AddCheckButton(string key, string label, string tooltip = "", bool active = false)
 {
     Gtk.CheckButton CheckBox = new CheckButton();
     CheckBox.Label = label;
     if(tooltip != "")
         CheckBox.TooltipText = tooltip;
     CheckBox.Active = active;
     CheckBox.Clicked += OnCheckClicked;
     CheckButtons.Add (key, CheckBox);
     this.PackStart (CheckBox, false, false, 0);
     this.ShowAll();
 }
Esempio n. 40
0
		public static Gtk.Window Create ()
		{
			window = new Dialog ();
			window.Title = "Sized groups";
			window.Resizable = false;
			
			VBox vbox = new VBox (false, 5);
			window.VBox.PackStart (vbox, true, true, 0);
			vbox.BorderWidth = 5;

			size_group = new SizeGroup (SizeGroupMode.Horizontal);

			Frame frame = new Frame ("Color Options");
			vbox.PackStart (frame, true, true, 0);

			Table table = new Table (2, 2, false);
			table.BorderWidth = 5;
			table.RowSpacing = 5;
			table.ColumnSpacing = 10;
			frame.Add (table);

			string [] colors = {"Red", "Green", "Blue", };
			string [] dashes = {"Solid", "Dashed", "Dotted", };
			string [] ends = {"Square", "Round", "Arrow", };

			Add_Row (table, 0, size_group, "_Foreground", colors);
			Add_Row (table, 1, size_group, "_Background", colors);

			frame = new Frame ("Line Options");
			vbox.PackStart (frame, false, false, 0);

			table = new Table (2, 2, false);
			table.BorderWidth = 5;
			table.RowSpacing = 5;
			table.ColumnSpacing = 10;
			frame.Add (table);

			Add_Row (table, 0, size_group, "_Dashing", dashes);
			Add_Row (table, 1, size_group, "_Line ends", ends);

			CheckButton check_button = new CheckButton ("_Enable grouping");
			vbox.PackStart (check_button, false, false, 0);
			check_button.Active = true;
			check_button.Toggled += new EventHandler (Button_Toggle_Cb);

			Button close_button = new Button (Stock.Close);
			close_button.Clicked += new EventHandler (Close_Button);
			window.ActionArea.PackStart (close_button, false, false, 0);
			
			window.ShowAll ();
			return window;
		}
Esempio n. 41
0
        void FlagToggled(object o, EventArgs args)
        {
            Gtk.CheckButton check = (Gtk.CheckButton)o;
            ulong           val   = (ulong)flags[o];

            if (check.Active)
            {
                UIntValue |= val;
            }
            else
            {
                UIntValue &= ~val;
            }
        }
Esempio n. 42
0
 public static Gtk.Widget CreateCellRenderer(ApplicationContext actx, CellView view)
 {
     if (view is TextCellView)
     {
         Gtk.Label lab = new Gtk.Label();
         lab.Xalign = 0;
         lab.Text   = ((TextCellView)view).Text;
         return(lab);
     }
     if (view is CheckBoxCellView)
     {
         var chkBox = new Gtk.CheckButton();
         chkBox.Clicked += (s, e) => ((CheckBoxCellView)view).RaiseToggled();
         return(chkBox);
     }
     throw new NotImplementedException();
 }
Esempio n. 43
0
        static void DrawIndicator_cb(IntPtr inst, IntPtr cr)
        {
            Cairo.Context mycr = null;

            try {
                CheckButton __obj = GLib.Object.GetObject(inst, false) as CheckButton;
                mycr = new Cairo.Context(cr, false);
                __obj.OnDrawIndicator(mycr);
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException(e, false);
            } finally {
                var disposable_cr = mycr as IDisposable;
                if (disposable_cr != null)
                {
                    disposable_cr.Dispose();
                }
            }
        }
Esempio n. 44
0
        private static bool ConfirmUnmap(IUnmapableSource source)
        {
            string key        = "no_confirm_unmap_" + source.GetType().Name.ToLower();
            bool   do_not_ask = ConfigurationClient.Get <bool> ("sources", key, false);

            if (do_not_ask)
            {
                return(true);
            }

            Hyena.Widgets.HigMessageDialog dialog = new Hyena.Widgets.HigMessageDialog(
                ServiceManager.Get <GtkElementsService> ().PrimaryWindow,
                Gtk.DialogFlags.Modal,
                Gtk.MessageType.Question,
                Gtk.ButtonsType.Cancel,
                String.Format(Catalog.GetString("Are you sure you want to delete this {0}?"),
                              source.GenericName.ToLower()),
                source.Name);

            dialog.AddButton(Gtk.Stock.Delete, Gtk.ResponseType.Ok, false);

            Gtk.Alignment alignment = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 0.0f);
            alignment.TopPadding = 10;
            Gtk.CheckButton confirm_button = new Gtk.CheckButton(String.Format(Catalog.GetString(
                                                                                   "Do not ask me this again"), source.GenericName.ToLower()));
            confirm_button.Toggled += delegate {
                do_not_ask = confirm_button.Active;
            };
            alignment.Add(confirm_button);
            alignment.ShowAll();
            dialog.LabelVBox.PackStart(alignment, false, false, 0);

            try {
                if (dialog.Run() == (int)Gtk.ResponseType.Ok)
                {
                    ConfigurationClient.Set <bool> ("sources", key, do_not_ask);
                    return(true);
                }

                return(false);
            } finally {
                dialog.Destroy();
            }
        }
        public void Load()
        {
            // Remove old children list
            var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren);

            for (int k = depsChildren.Count - 1; k >= 0; k--)
            {
                vbox_ProjectDeps.Remove((Widget)depsChildren[k]);
            }

            // Init new project dep list
            int i     = 0;
            var refs_ = Project.References.ReferencedProjectIds;
            var refs  = refs_ as IList <string> ?? new List <string>(refs_);

            foreach (var prj in Project.ParentSolution.GetAllProjects())
            {
                if (prj == Project)
                {
                    continue;
                }

                var cb = new Gtk.CheckButton(prj.Name)
                {
                    CanFocus      = true,
                    DrawIndicator = true,
                    UseUnderline  = false,
                    Active        = refs.Contains(prj.ItemId)
                };

                cb.Data.Add("prj", prj);

                vbox_ProjectDeps.Add(cb);

                var bc = (Box.BoxChild)vbox_ProjectDeps[cb];
                bc.Expand   = false;
                bc.Fill     = false;
                bc.Position = i++;
            }
            vbox_ProjectDeps.ShowAll();
        }
Esempio n. 46
0
 private void OnCheckButtonToggled(object o, EventArgs args)
 {
     try {
         Gtk.CheckButton checkButton = (Gtk.CheckButton)o;
         FieldOrProperty field       = fieldTable[widgetTable.IndexOf(checkButton)];
         bool            oldValue    = (bool)field.GetValue(Object);
         bool            newValue    = checkButton.Active;
         if (oldValue != newValue)                   //no change => no Undo action
         {
             PropertyChangeCommand command = new PropertyChangeCommand(
                 "Changed value of " + field.Name,
                 field,
                 Object,
                 newValue);
             command.Do();
             UndoManager.AddCommand(command);
         }
     } catch (Exception e) {
         ErrorDialog.Exception(e);
     }
 }
Esempio n. 47
0
        /// <summary>
        /// Set up the widgets
        /// </summary>
        /// <returns>
        /// Widget to display
        /// </returns>
        private void InitializeWidgets()
        {
            this.Spacing     = Util.SectionSpacing;
            this.BorderWidth = Util.DefaultBorderWidth;

            //------------------------------
            // Application Settings
            //------------------------------
            // create a section box
            VBox appSectionBox = new VBox();

            appSectionBox.Spacing = Util.SectionTitleSpacing;
            this.PackStart(appSectionBox, false, true, 0);
            Label appSectionLabel = new Label("<span weight=\"bold\">" +
                                              Util.GS("Application") +
                                              "</span>");

            appSectionLabel.UseMarkup = true;
            appSectionLabel.Xalign    = 0;
            appSectionBox.PackStart(appSectionLabel, false, true, 0);

            // create a hbox to provide spacing
            HBox appSpacerBox = new HBox();

            appSectionBox.PackStart(appSpacerBox, false, true, 0);
            Label appSpaceLabel = new Label("    ");             // four spaces

            appSpacerBox.PackStart(appSpaceLabel, false, true, 0);

            // create a vbox to actually place the widgets in for section
            VBox appWidgetBox = new VBox();

            appSpacerBox.PackStart(appWidgetBox, false, true, 0);
            appWidgetBox.Spacing = Util.SectionTitleSpacing;


            ShowConfirmationButton =
                new CheckButton(Util.GS(
                                    "_Display confirmation dialog on successful creation of iFolder"));
            appWidgetBox.PackStart(ShowConfirmationButton, false, true, 0);
            ShowConfirmationButton.Toggled +=
                new EventHandler(OnShowConfButton);


/*			ShowNetworkstatusButton =
 *                              new CheckButton(Util.GS(
 *                                      "Show _Network Events  messages when iFolder is started"));
 *                      appWidgetBox.PackStart(ShowNetworkstatusButton, false, true, 0);
 *                      ShowNetworkstatusButton.Toggled +=
 *                                              new EventHandler(OnShowNetworkButton); */


            Label strtlabel = new Label("<span style=\"italic\">" + Util.GS("To start up iFolder at login, leave iFolder running when you log out and save your current setup.") + "</span>");

            strtlabel.UseMarkup = true;
            strtlabel.LineWrap  = true;
            appWidgetBox.PackStart(strtlabel, false, true, 0);

            HideMainWindowButton =
                new CheckButton(Util.GS("Hide ifolder _main window at startup"));
            appWidgetBox.PackStart(HideMainWindowButton, false, true, 0);
            HideMainWindowButton.Toggled +=
                new EventHandler(OnHideMainWindowButton);

            HideSyncLogButton =
                new CheckButton(Util.GS("Display synchronization _logs"));
            appWidgetBox.PackStart(HideSyncLogButton, false, true, 0);

            HideSyncLogButton.Toggled +=
                new EventHandler(OnHideSyncLogButton);


            //------------------------------
            // Notifications
            //------------------------------
            // create a section box
            VBox notifySectionBox = new VBox();

            notifySectionBox.Spacing = Util.SectionTitleSpacing;
            this.PackStart(notifySectionBox, true, true, 0);
            Label notifySectionLabel = new Label("<span weight=\"bold\">" +
                                                 Util.GS("Notification") +
                                                 "</span>");

            notifySectionLabel.UseMarkup = true;
            notifySectionLabel.Xalign    = 0;
            notifySectionBox.PackStart(notifySectionLabel, false, true, 0);

            // create a hbox to provide spacing
            HBox notifySpacerBox = new HBox();

            notifySectionBox.PackStart(notifySpacerBox, true, true, 0);
            Label notifySpaceLabel = new Label("    ");             // four spaces

            notifySpacerBox.PackStart(notifySpaceLabel, false, true, 0);

            // create a vbox to actually place the widgets in for section
            VBox notifyWidgetBox = new VBox();

            notifySpacerBox.PackStart(notifyWidgetBox, true, true, 0);
            notifyWidgetBox.Spacing = 5;

            VBox notificationPreferences = new NotificationPrefsBox(this.topLevelWindow);

            notifyWidgetBox.PackStart(notificationPreferences, true, true, 0);

            //------------------------------
            // Sync Settings
            //------------------------------
            // create a section box
            VBox syncSectionBox = new VBox();

            syncSectionBox.Spacing = Util.SectionTitleSpacing;
            this.PackStart(syncSectionBox, false, true, 0);
            Label syncSectionLabel = new Label("<span weight=\"bold\">" +
                                               Util.GS("Synchronization") +
                                               "</span>");

            syncSectionLabel.UseMarkup = true;
            syncSectionLabel.Xalign    = 0;
            syncSectionBox.PackStart(syncSectionLabel, false, true, 0);

            // create a hbox to provide spacing
            HBox syncSpacerBox = new HBox();

            syncSectionBox.PackStart(syncSpacerBox, false, true, 0);
            Label syncSpaceLabel = new Label("    ");             // four spaces

            syncSpacerBox.PackStart(syncSpaceLabel, false, true, 0);

            // create a vbox to actually place the widgets in for section
            VBox syncWidgetBox = new VBox();

            syncSpacerBox.PackStart(syncWidgetBox, false, true, 0);
            syncWidgetBox.Spacing = 10;

            HBox syncHBox0 = new HBox();

            syncWidgetBox.PackStart(syncHBox0, false, true, 0);
            syncHBox0.Spacing   = 10;
            AutoSyncCheckButton =
                new CheckButton(Util.GS("Automatically S_ynchronize iFolders"));
            syncHBox0.PackStart(AutoSyncCheckButton, false, false, 0);

            HBox syncHBox = new HBox();

            syncHBox.Spacing = 10;
            syncWidgetBox.PackStart(syncHBox, true, true, 0);

            Label spacerLabel = new Label("  ");

            syncHBox.PackStart(spacerLabel, true, true, 0);

            Label syncEveryLabel = new Label(Util.GS("Synchronize iFolders Every"));

            syncEveryLabel.Xalign = 1;
            syncHBox.PackStart(syncEveryLabel, false, false, 0);

            SyncSpinButton = new SpinButton(1, Int32.MaxValue, 1);

            syncHBox.PackStart(SyncSpinButton, false, false, 0);

            SyncUnitsComboBox = ComboBox.NewText();
            syncHBox.PackStart(SyncUnitsComboBox, false, false, 0);

            SyncUnitsComboBox.AppendText(Util.GS("seconds"));
            SyncUnitsComboBox.AppendText(Util.GS("minutes"));
            SyncUnitsComboBox.AppendText(Util.GS("hours"));
            SyncUnitsComboBox.AppendText(Util.GS("days"));

            SyncUnitsComboBox.Active = (int)SyncUnit.Minutes;
            currentSyncUnit          = SyncUnit.Minutes;
        }
Esempio n. 48
0
 public static void ColorsCheckbox(Gtk.Viewport v, Gtk.CheckButton c)
 {
     c.ModifyBg(StateType.Active, v.Style.Background(StateType.Selected));
     c.ModifyBg(StateType.Prelight, v.Style.Background(StateType.Selected));
 }
Esempio n. 49
0
    private void CreatePropertyWidgets(string title, object NewObject)
    {
        //NOTE: we need to remove all the old widgets before we empty the widget and field tables, because the
        //      focus out event handlers which may be called during this step need them.
        Foreach(Remove);

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

        titleLabel        = new Gtk.Label();
        titleLabel.Xalign = 0;
        titleLabel.Xpad   = 12;
        titleLabel.Ypad   = 6;
        titleLabel.Markup = "<b>" + title + "</b>";
        box.PackStart(titleLabel, true, false, 0);

        Type type = NewObject.GetType();

        // Dispose all former custom editor widgets
        foreach (IDisposable disposable in customWidgets)
        {
            disposable.Dispose();
        }

        // Unregister our event handler from self-managed fields
        foreach (FieldOrProperty field in fieldTable)
        {
            field.Changed -= OnFieldChanged;
        }

        widgetTable.Clear();
        fieldTable.Clear();
        editWidgets.Clear();
        customWidgets.Clear();

        // iterate over all fields and properties
        foreach (FieldOrProperty field in FieldOrProperty.GetFieldsAndProperties(type))
        {
            CustomSettingsWidgetAttribute customSettings = (CustomSettingsWidgetAttribute)
                                                           field.GetCustomAttribute(typeof(CustomSettingsWidgetAttribute));
            if (customSettings != null)
            {
                Type customType = customSettings.Type;
                ICustomSettingsWidget customWidget = (ICustomSettingsWidget)CreateObject(customType);
                customWidgets.Add(customWidget);
                editWidgets.Add(customWidget.Create(this, NewObject, field));
                continue;
            }

            LispChildAttribute ChildAttrib = (LispChildAttribute)
                                             field.GetCustomAttribute(typeof(LispChildAttribute));
            if (ChildAttrib == null)
            {
                continue;
            }

            PropertyPropertiesAttribute propertyProperties = (PropertyPropertiesAttribute)
                                                             field.GetCustomAttribute(typeof(PropertyPropertiesAttribute));

            if ((propertyProperties != null) && (propertyProperties.Hidden))
            {
                continue;
            }

            if (field.Type == typeof(string) || field.Type == typeof(float) ||
                field.Type == typeof(int))
            {
                Gtk.Entry entry = new Gtk.Entry();
                entry.Name = field.Name;
                object val = field.GetValue(NewObject);
                if (val != null)
                {
                    entry.Text = val.ToString();
                }
                widgetTable.Add(entry);
                fieldTable.Add(field);
                entry.Changed       += OnEntryChanged;
                entry.FocusOutEvent += OnEntryChangeDone;
                editWidgets.Add(entry);
                AddTooltip(propertyProperties, entry);
            }
            else if (field.Type == typeof(bool))
            {
                Gtk.CheckButton checkButton = new Gtk.CheckButton(field.Name);
                checkButton.Name   = field.Name;
                checkButton.Active = (bool)field.GetValue(NewObject);
                widgetTable.Add(checkButton);
                fieldTable.Add(field);
                checkButton.Toggled += OnCheckButtonToggled;
                editWidgets.Add(checkButton);
                AddTooltip(propertyProperties, checkButton);
            }
            else if (field.Type.IsEnum)
            {
                // Create a combobox containing all the names of enum values.
                Gtk.ComboBox comboBox = new Gtk.ComboBox(Enum.GetNames(field.Type));
                // Set the name of the box.
                comboBox.Name = field.Name;
                // FIXME: This will break if:
                //        1) the first enum isn't 0 and/or
                //        2) the vaules are not sequential (0, 1, 3, 4 wouldn't work)
                object val = field.GetValue(NewObject);
                if (val != null)
                {
                    comboBox.Active = (int)val;
                }
                widgetTable.Add(comboBox);
                fieldTable.Add(field);
                comboBox.Changed += OnComboBoxChanged;
                editWidgets.Add(comboBox);
                AddTooltip(propertyProperties, comboBox);
            }
        }

        // Register our event handler for self-managed fields
        foreach (FieldOrProperty field in fieldTable)
        {
            field.Changed += OnFieldChanged;
        }

        Gtk.Table table = new Gtk.Table((uint)editWidgets.Count, 2, false);
        table.ColumnSpacing = 6;
        table.RowSpacing    = 6;
        table.BorderWidth   = 12;
        for (uint i = 0; i < editWidgets.Count; ++i)
        {
            Gtk.Widget widget = editWidgets[(int)i];
            if (widget is Gtk.CheckButton)
            {
                table.Attach(widget, 0, 2, i, i + 1,
                             Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, Gtk.AttachOptions.Shrink, 0, 0);
            }
            else
            {
                Gtk.Label label = new Gtk.Label(widget.Name + ":");
                label.SetAlignment(0, 1);
                table.Attach(label, 0, 1, i, i + 1,
                             Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
                table.Attach(widget, 1, 2, i, i + 1,
                             Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, Gtk.AttachOptions.Shrink, 0, 0);
            }
        }
        box.PackStart(table, true, true, 0);

        // TODO add a (!) image in front of the label (and hide/show it depending
        // if there was an error)
        errorLabel        = new Gtk.Label(String.Empty);
        errorLabel.Xalign = 0;
        errorLabel.Xpad   = 12;
        box.PackStart(errorLabel, true, false, 0);

        box.ShowAll();

        AddWithViewport(box);
    }
Esempio n. 50
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();
            }
Esempio n. 51
0
        /// <summary>Crea las hojas de las opciones, la parte central
        /// del diálogo.</summary>
        /// <returns>El notebook de las opciones.</returns>

        private Gtk.Widget CrearNotebook()
        {
            Gtk.Notebook notebook = new Gtk.Notebook();
            notebook.BorderWidth = 10;

            // Panel de configuración del ensamblador.

            cbAdvertencias = new Gtk.CheckButton(
                Ventana.GetText("D_Conf_MostrarAdv"));

            Gtk.Frame frmEnsamblador =
                new Gtk.Frame(Ventana.GetText("D_Conf_Ensamblador"));
            VBox panelEnsamblador = new VBox(false, 5);

            panelEnsamblador.PackStart(cbAdvertencias);
            frmEnsamblador.Add(panelEnsamblador);

            // Panel de Memoria de control.

            rbMemoriaDef = new RadioButton(null,
                                           Ventana.GetText("D_Conf_MemDef"));
            rbMemoriaUsu = new RadioButton(rbMemoriaDef,
                                           Ventana.GetText("D_Conf_MemUsu"));

            rbMemoriaDef.Toggled   += new EventHandler(rbToggled1);
            rbMemoriaUsu.Toggled   += new EventHandler(rbToggled2);
            lblMemoriaAlt           = new Gtk.Entry("");
            lblMemoriaAlt.Sensitive = false;
            btnFichero          = new Gtk.Button(Ventana.GetText("D_Conf_Explorar"));
            btnFichero.Clicked += new EventHandler(btnFicheroClicked);

            Gtk.Frame frmMemoria =
                new Gtk.Frame(Ventana.GetText("D_Conf_Memoria"));
            VBox panelMemoria = new Gtk.VBox(false, 5);

            panelMemoria.PackStart(rbMemoriaDef);
            panelMemoria.PackStart(rbMemoriaUsu);
            panelMemoria.PackStart(lblMemoriaAlt);
            panelMemoria.PackStart(btnFichero);
            frmMemoria.Add(panelMemoria);


            // Panel del simulador.

            Gtk.Frame frmSimulador =
                new Gtk.Frame(Ventana.GetText("D_Conf_Simulador"));
            VBox panelSimulador = new VBox(false, 5);

            panelSimulador.PackStart(
                new Gtk.Label(Ventana.GetText("D_Conf_Tiempo")));

            sbTiempo = new Gtk.SpinButton(
                new Adjustment(1000.0, 50.0, 5000.0, 10.0, 100.0, 1.0),
                1.0,
                0);
            sbTiempo.Numeric = true;

            panelSimulador.PackStart(sbTiempo);
            frmSimulador.Add(panelSimulador);


            //  ----

            notebook.AppendPage(
                frmSimulador,
                new Gtk.Label(Ventana.GetText("D_Conf_Simulador")));

            notebook.AppendPage(
                frmEnsamblador,
                new Gtk.Label(Ventana.GetText("D_Conf_Ensamblador")));

            notebook.AppendPage(
                frmMemoria,
                new Gtk.Label(Ventana.GetText("D_Conf_Memoria")));

            return(notebook);
        }
Esempio n. 52
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;
                }
            };
        }
        protected virtual void Build()
        {
            Stetic.Gui.Initialize(this);
            Stetic.BinContainer.Attach(this);

            this.Name = "DocumentationPanelWidget";

            // Create Boxes
            this.boxPreferences         = new Gtk.VBox();
            this.boxPreferences.Name    = "boxPreferences";
            this.boxPreferences.Spacing = 6;

            this.boxDocumentationPreference         = new Gtk.HBox();
            this.boxDocumentationPreference.Name    = "boxDocumentationPreference";
            this.boxDocumentationPreference.Spacing = 6;

            this.boxInstall         = new Gtk.HBox();
            this.boxInstall.Name    = "boxInstall";
            this.boxInstall.Spacing = 6;

            // Documentation Preference
            this.labelDocumentationPreference           = new Gtk.Label();
            this.labelDocumentationPreference.Name      = "labelDocumentationPreference";
            this.labelDocumentationPreference.Xalign    = 0F;
            this.labelDocumentationPreference.Yalign    = 0F;
            this.labelDocumentationPreference.LabelProp = GettextCatalog.GetString("Documentation Preference");
            this.boxPreferences.Add(this.labelDocumentationPreference);

            Gtk.Box.BoxChild setupLabelDocumentationPreference = ((Gtk.Box.BoxChild)(this.boxPreferences[this.labelDocumentationPreference]));
            setupLabelDocumentationPreference.Position = 0;
            setupLabelDocumentationPreference.Expand   = false;
            setupLabelDocumentationPreference.Fill     = false;

            this.comboDocumentationPreference      = Gtk.ComboBox.NewText();
            this.comboDocumentationPreference.Name = "comboDocumentationPreference";
            this.comboDocumentationPreference.AppendText(GettextCatalog.GetString("Unity"));
            if (PropertyService.Get <string>("Unity.iPhone.Path", "") != "")
            {
                this.comboDocumentationPreference.AppendText(GettextCatalog.GetString("Unity iPhone"));
                if (PropertyService.Get <string>("Unity.DocumentationPreference", "Unity") == "Unity")
                {
                    this.comboDocumentationPreference.Active = 0;
                }
                else
                {
                    this.comboDocumentationPreference.Active = 1;
                }
            }
            else
            {
                this.comboDocumentationPreference.Sensitive = false;
            }
            this.boxDocumentationPreference.Add(this.comboDocumentationPreference);

            Gtk.Box.BoxChild setupComboDocumentation = ((Gtk.Box.BoxChild)(this.boxDocumentationPreference[this.comboDocumentationPreference]));
            setupComboDocumentation.Position = 0;
            setupComboDocumentation.Expand   = false;
            setupComboDocumentation.Fill     = false;

            this.boxPreferences.Add(this.boxDocumentationPreference);

            Gtk.Box.BoxChild setupBoxDocumentationPreference = ((Gtk.Box.BoxChild)(this.boxPreferences[this.boxDocumentationPreference]));
            setupBoxDocumentationPreference.Position = 1;
            setupBoxDocumentationPreference.Expand   = false;
            setupBoxDocumentationPreference.Fill     = false;


            // Force Local Content
            this.checkForceLocal               = new Gtk.CheckButton();
            this.checkForceLocal.Label         = GettextCatalog.GetString("Force Local Content Only (Offline Mode)");
            this.checkForceLocal.Active        = PropertyService.Get <bool>("Unity.Base.Documentation.ForceLocal", false);
            this.checkForceLocal.CanFocus      = true;
            this.checkForceLocal.Name          = "checkForceLocal";
            this.checkForceLocal.DrawIndicator = true;
            this.checkForceLocal.UseUnderline  = true;
            this.boxPreferences.Add(this.checkForceLocal);

            Gtk.Box.BoxChild setupCheckForceLocal = ((Gtk.Box.BoxChild)(this.boxPreferences[this.checkForceLocal]));
            setupCheckForceLocal.Position = 2;
            setupCheckForceLocal.Expand   = false;
            setupCheckForceLocal.Fill     = false;

            this.checkOpenInBrowser = new Gtk.CheckButton();

            if (!MonoDevelop.Core.Gui.WebBrowserService.CanGetWebBrowser)
            {
                this.checkOpenInBrowser.Sensitive = false;
            }

            this.checkOpenInBrowser.CanFocus      = true;
            this.checkOpenInBrowser.Name          = "checkOpenInBrowser";
            this.checkOpenInBrowser.Label         = GettextCatalog.GetString("Open Documentation in a Web Browser");
            this.checkOpenInBrowser.Active        = PropertyService.Get <bool>("Unity.Base.Documentation.OpenInBrowser", true);
            this.checkOpenInBrowser.DrawIndicator = true;
            this.checkOpenInBrowser.UseUnderline  = true;
            this.boxPreferences.Add(this.checkOpenInBrowser);

            Gtk.Box.BoxChild setupCheckOpenInBrowser = ((Gtk.Box.BoxChild)(this.boxPreferences[this.checkOpenInBrowser]));
            setupCheckOpenInBrowser.Position = 3;
            setupCheckOpenInBrowser.Expand   = false;
            setupCheckOpenInBrowser.Fill     = false;

            this.Add(this.boxPreferences);



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

            this.Show();
        }
Esempio n. 54
0
        private Gtk.Widget MakeGeneralPage()
        {
            VBox vbox = new VBox(false, 6);

            vbox.BorderWidth = 10;

            //
            // ITask Management System
            //
            VBox  sectionVBox = new VBox(false, 4);
            Label l           = new Label();

            l.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>",
                                     Catalog.GetString("Task Management System"));
            l.UseUnderline = false;
            l.UseMarkup    = true;
            l.Wrap         = false;
            l.Xalign       = 0;

            l.Show();
            sectionVBox.PackStart(l, false, false, 0);

            backendComboBox = ComboBox.NewText();
            backendComboMap = new Dictionary <int, string> ();
            // Fill out the ComboBox
            int i = 0;

            selectedBackend = -1;
            foreach (var backend in application.BackendManager.AvailableBackends)
            {
                backendComboBox.AppendText(backend.Value);
                backendComboMap [i] = backend.Key;
                if (backend.Key == application.BackendManager.CurrentBackend)
                {
                    selectedBackend = i;
                }
                i++;
            }
            if (selectedBackend >= 0)
            {
                backendComboBox.Active = selectedBackend;
            }
            backendComboBox.Changed += OnBackendComboBoxChanged;
            backendComboBox.Show();

            HBox hbox = new HBox(false, 6);

            l = new Label(string.Empty);              // spacer
            l.Show();
            hbox.PackStart(l, false, false, 0);
            hbox.PackStart(backendComboBox, false, false, 0);
            hbox.Show();
            sectionVBox.PackStart(hbox, false, false, 0);
            sectionVBox.Show();
            vbox.PackStart(sectionVBox, false, false, 0);

            //
            // ITask Filtering
            //
            sectionVBox = new VBox(false, 4);
            l           = new Label();
            l.Markup    = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>",
                                        Catalog.GetString("Task Filtering"));
            l.UseUnderline = false;
            l.UseMarkup    = true;
            l.Wrap         = false;
            l.Xalign       = 0;

            l.Show();
            sectionVBox.PackStart(l, false, false, 0);

            HBox sectionHBox = new HBox(false, 6);

            l = new Label(string.Empty);              // spacer
            l.Show();
            sectionHBox.PackStart(l, false, false, 0);
            VBox innerSectionVBox = new VBox(false, 6);

            hbox = new HBox(false, 6);

            bool showCompletedTasks = application.Preferences.GetBool(
                PreferencesKeys.ShowCompletedTasksKey);

            showCompletedTasksCheckButton =
                new CheckButton(Catalog.GetString("Sh_ow completed tasks"));
            showCompletedTasksCheckButton.UseUnderline = true;
            showCompletedTasksCheckButton.Active       = showCompletedTasks;
            showCompletedTasksCheckButton.Show();
            hbox.PackStart(showCompletedTasksCheckButton, true, true, 0);
            hbox.Show();
            innerSectionVBox.PackStart(hbox, false, false, 0);

            // TaskLists TreeView
            l = new Label(Catalog.GetString("Only _show these lists when \"All\" is selected:"));
            l.UseUnderline = true;
            l.Xalign       = 0;
            l.Show();
            innerSectionVBox.PackStart(l, false, false, 0);

            ScrolledWindow sw = new ScrolledWindow();

            sw.HscrollbarPolicy = PolicyType.Automatic;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.EtchedIn;

            taskListsTree = new TreeView();
            taskListsTree.Selection.Mode = SelectionMode.None;
            taskListsTree.RulesHint      = false;
            taskListsTree.HeadersVisible = false;
            l.MnemonicWidget             = taskListsTree;

            Gtk.TreeViewColumn column = new Gtk.TreeViewColumn();
            column.Title     = Catalog.GetString("Task List");
            column.Sizing    = Gtk.TreeViewColumnSizing.Autosize;
            column.Resizable = false;

            Gtk.CellRendererToggle toggleCr = new CellRendererToggle();
            toggleCr.Toggled += OnTaskListToggled;
            column.PackStart(toggleCr, false);
            column.SetCellDataFunc(toggleCr,
                                   new Gtk.TreeCellDataFunc(ToggleCellDataFunc));

            Gtk.CellRendererText textCr = new CellRendererText();
            column.PackStart(textCr, true);
            column.SetCellDataFunc(textCr,
                                   new Gtk.TreeCellDataFunc(TextCellDataFunc));

            taskListsTree.AppendColumn(column);

            taskListsTree.Show();
            sw.Add(taskListsTree);
            sw.Show();
            innerSectionVBox.PackStart(sw, true, true, 0);
            innerSectionVBox.Show();

            sectionHBox.PackStart(innerSectionVBox, true, true, 0);
            sectionHBox.Show();
            sectionVBox.PackStart(sectionHBox, true, true, 0);
            sectionVBox.Show();
            vbox.PackStart(sectionVBox, true, true, 0);

            return(vbox);
        }
 public PreferencesWidget()
 {
     enableHighlightCheckButton = new Gtk.CheckButton("Highlight matches of selection pattern");
     this.PackStart(enableHighlightCheckButton, false, false, 6);
     this.ShowAll();
 }
Esempio n. 56
0
        public MainWindow() : base(Gtk.WindowType.Toplevel)
        {
            /* Set up ghostscript calls for progress update */
            m_ghostscript = new ghostsharp();
            m_ghostscript.gsUpdateMain     += new ghostsharp.gsCallBackMain(gsProgress);
            m_ghostscript.gsIOUpdateMain   += new ghostsharp.gsIOCallBackMain(gsIO);
            m_ghostscript.gsDLLProblemMain += new ghostsharp.gsDLLProblem(gsDLL);

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

            m_currpage = 0;
            m_gsoutput = new gsOutput();
            m_gsoutput.Activate();
            m_tempfiles       = new List <TempFile>();
            m_thumbnails      = new List <DocPage>();
            m_docPages        = new Pages();
            m_page_sizes      = new List <pagesizes_t>();
            m_page_scroll_pos = new List <int>();
            m_file_open       = false;
            m_doczoom         = 1.0;
            m_init_done       = false;
            m_busy_render     = true;
            m_firstime        = true;
            m_aa                   = true;
            m_aa_change            = false;
            m_zoom_txt             = "100";
            m_page_txt             = "1";
            m_ignore_scroll_change = false;

            /* Set up Vbox in main window */
            this.SetDefaultSize(500, 700);
            this.Title    = "GhostPDL Mono GTK Demo";
            m_GtkvBoxMain = new VBox(false, 0);
            this.Add(m_GtkvBoxMain);

            /* Add Menu Bar to vBox */
            Gtk.MenuBar menu_bar = new MenuBar();
            Menu        filemenu = new Menu();
            MenuItem    file     = new MenuItem("File");

            file.Submenu = filemenu;

            AccelGroup agr = new AccelGroup();

            AddAccelGroup(agr);

            ImageMenuItem openi = new ImageMenuItem(Stock.Open, agr);

            openi.AddAccelerator("activate", agr, new AccelKey(
                                     Gdk.Key.o, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            openi.Activated += OnOpen;
            filemenu.Append(openi);

            ImageMenuItem closei = new ImageMenuItem(Stock.Close, agr);

            closei.AddAccelerator("activate", agr, new AccelKey(
                                      Gdk.Key.w, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            closei.Activated += OnClose;
            filemenu.Append(closei);

            MenuItem messagesi = new MenuItem("Show Messages");

            messagesi.Activated += OnShowMessages;
            filemenu.Append(messagesi);

            MenuItem about = new MenuItem("About");

            about.Activated += OnAboutClicked;
            filemenu.Append(about);

            SeparatorMenuItem sep = new SeparatorMenuItem();

            filemenu.Append(sep);

            ImageMenuItem quiti = new ImageMenuItem(Stock.Quit, agr);

            quiti.AddAccelerator("activate", agr, new AccelKey(
                                     Gdk.Key.q, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            filemenu.Append(quiti);
            quiti.Activated += OnQuit;

            menu_bar.Append(file);

            m_GtkvBoxMain.PackStart(menu_bar, false, false, 0);

            /* Add a hbox with the page information, zoom control, and aa to vbox */
            HBox pageBox = new HBox(false, 0);

            m_GtkpageEntry            = new Entry();
            m_GtkpageEntry.Activated += PageChanged;
            m_GtkpageEntry.WidthChars = 4;
            m_GtkpageTotal            = new Label("/0");
            pageBox.PackStart(m_GtkpageEntry, false, false, 0);
            pageBox.PackStart(m_GtkpageTotal, false, false, 0);

            HBox zoomBox = new HBox(false, 0);

            m_GtkZoomPlus             = new Button();
            m_GtkZoomPlus.Label       = "+";
            m_GtkZoomPlus.Clicked    += ZoomIn;
            m_GtkZoomMinus            = new Button();
            m_GtkZoomMinus.Label      = "–";
            m_GtkZoomMinus.Clicked   += ZoomOut;
            m_GtkzoomEntry            = new Entry();
            m_GtkzoomEntry.WidthChars = 3;
            m_GtkzoomEntry.Activated += ZoomChanged;
            Label precentLabel = new Label("%");

            zoomBox.PackStart(m_GtkZoomPlus, false, false, 0);
            zoomBox.PackStart(m_GtkZoomMinus, false, false, 0);
            zoomBox.PackStart(m_GtkzoomEntry, false, false, 0);
            zoomBox.PackStart(precentLabel, false, false, 0);

            HBox hBoxControls = new HBox(false, 0);

            m_GtkaaCheck          = new CheckButton("Enable Antialias:");
            m_GtkaaCheck.Active   = true;
            m_GtkaaCheck.Clicked += AaCheck_Clicked;
            hBoxControls.PackStart(pageBox, false, false, 0);
            hBoxControls.PackStart(zoomBox, false, false, 20);
            hBoxControls.PackStart(m_GtkaaCheck, false, false, 0);

            m_GtkvBoxMain.PackStart(hBoxControls, false, false, 0);

            /* Tree view containing thumbnail and main images */
            HBox hBoxPages = new HBox(false, 0);

            /* Must be scrollable */
            m_GtkthumbScroll             = new ScrolledWindow();
            m_GtkthumbScroll.BorderWidth = 5;
            m_GtkthumbScroll.ShadowType  = ShadowType.In;

            m_GtkmainScroll             = new ScrolledWindow();
            m_GtkmainScroll.BorderWidth = 5;
            m_GtkmainScroll.ShadowType  = ShadowType.In;
            m_GtkmainScroll.Vadjustment.ValueChanged += Vadjustment_Changed;

            m_GtkTreeThumb = new Gtk.TreeView();
            m_GtkTreeThumb.HeadersVisible = false;
            m_GtkimageStoreThumb          = new Gtk.ListStore(typeof(Gdk.Pixbuf));
            m_GtkTreeThumb.AppendColumn("Thumb", new Gtk.CellRendererPixbuf(), "pixbuf", 0);
            m_GtkTreeThumb.Style.YThickness = 100;
            m_GtkthumbScroll.Add(m_GtkTreeThumb);
            m_GtkTreeThumb.RowActivated += M_GtkTreeThumb_RowActivated;

            m_GtkTreeMain = new Gtk.TreeView();
            m_GtkTreeMain.HeadersVisible = false;
            m_GtkTreeMain.RulesHint      = false;

            m_GtkimageStoreMain = new Gtk.ListStore(typeof(Gdk.Pixbuf));
            m_GtkTreeMain.AppendColumn("Main", new Gtk.CellRendererPixbuf(), "pixbuf", 0);
            m_GtkmainScroll.Add(m_GtkTreeMain);

            // Separate with gridlines
            m_GtkTreeMain.EnableGridLines = TreeViewGridLines.Horizontal;

            //To disable selections, set the selection mode to None:
            m_GtkTreeMain.Selection.Mode = SelectionMode.None;

            hBoxPages.PackStart(m_GtkthumbScroll, false, false, 0);
            hBoxPages.PackStart(m_GtkmainScroll, true, true, 0);

            m_GtkTreeThumb.Model = m_GtkimageStoreThumb;
            m_GtkTreeMain.Model  = m_GtkimageStoreMain;

            m_GtkvBoxMain.PackStart(hBoxPages, true, true, 0);

            /* For case of opening another file */
            string[] arguments = Environment.GetCommandLineArgs();
            if (arguments.Length > 1)
            {
                m_currfile = arguments[1];
                ProcessFile();
            }
        }
Esempio n. 57
0
        public void Load(DProject proj, DProjectConfiguration config)
        {
            project       = proj;
            configuration = config;

            cbUseDefaultCompiler.Active       = proj.UseDefaultCompilerVendor;
            cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild;

            OnUseDefaultCompilerChanged();
            Gtk.TreeIter iter;
            if (cmbCompiler.Model.GetIterFirst(out iter))
            {
                do
                {
                    if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string)
                    {
                        cmbCompiler.SetActiveIter(iter);
                        break;
                    }
                } while (cmbCompiler.Model.IterNext(ref iter));
            }

            extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments;
            extraLinkerTextView.Buffer.Text   = config.ExtraLinkerArguments;

            text_BinDirectory.Text     = config.OutputDirectory;
            text_TargetFile.Text       = config.Output;
            text_ObjectsDirectory.Text = config.ObjectDirectory;
            text_DDocDir.Text          = config.DDocDirectory;

            if (config.CustomDebugIdentifiers == null)
            {
                text_debugConstants.Text = "";
            }
            else
            {
                text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers);
            }
            if (config.CustomVersionIdentifiers == null)
            {
                text_versionConstants.Text = "";
            }
            else
            {
                text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers);
            }
            spin_debugLevel.Value = (double)config.DebugLevel;

            // Disable debug-specific fields on non-debug configurations
            text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode;

            if (model_compileTarget.GetIterFirst(out iter))
            {
                do
                {
                    if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1))
                    {
                        combo_ProjectType.SetActiveIter(iter);
                        break;
                    }
                } while (model_compileTarget.IterNext(ref iter));
            }

            text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries);
            text_Includes.Buffer.Text  = string.Join("\n", proj.LocalIncludeCache.ParsedDirectories);

            // Remove old children list
            var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren);

            for (int k = depsChildren.Count - 1; k >= 0; k--)
            {
                vbox_ProjectDeps.Remove((Widget)depsChildren[k]);
            }

            // Init new project dep list
            int i = 0;

            foreach (var prj in proj.ParentSolution.GetAllProjects())
            {
                if (prj == proj)
                {
                    continue;
                }

                var cb = new Gtk.CheckButton(prj.Name)
                {
                    CanFocus      = true,
                    DrawIndicator = true,
                    UseUnderline  = false,
                    Active        = proj.ProjectDependencies.Contains(prj.ItemId)
                };

                cb.Data.Add("prj", prj);

                vbox_ProjectDeps.Add(cb);

                var bc = (Box.BoxChild)vbox_ProjectDeps[cb];
                bc.Expand   = false;
                bc.Fill     = false;
                bc.Position = i++;
            }
            vbox_ProjectDeps.ShowAll();
        }
Esempio n. 58
0
        public GtkAlertDialog(ApplicationContext actx, MessageDescription message)
        {
            this.actx = actx;
            Init();
            this.buttons = message.Buttons.ToArray();

            string primaryText   = String.Empty;
            string secondaryText = String.Empty;

            if (string.IsNullOrEmpty(message.Text))
            {
                if (!string.IsNullOrEmpty(message.SecondaryText))
                {
                    primaryText = message.SecondaryText;
                }
            }
            else
            {
                primaryText   = message.Text;
                secondaryText = message.SecondaryText;
            }

            if (message.Icon == StockIcons.Information)
            {
                base.MessageType = MessageType.Info;
            }
            else if (message.Icon == StockIcons.Question)
            {
                base.MessageType = MessageType.Question;
            }
            else if (message.Icon == StockIcons.Warning)
            {
                base.MessageType = MessageType.Warning;
            }
            else if (message.Icon == StockIcons.Error)
            {
                base.MessageType = MessageType.Error;
            }
            else
            {
                var icon = message.Icon.ToImageDescription(actx);
                image.Image = icon.WithDefaultSize(Gtk.IconSize.Dialog);
                base.Image  = image;
            }

            StringBuilder markup = new StringBuilder(@"<span weight=""bold"" size=""larger"">");

            markup.Append(GLib.Markup.EscapeText(primaryText));
            markup.Append("</span>");

            base.Markup = markup.ToString();
            if (!String.IsNullOrEmpty(secondaryText))
            {
                base.SecondaryText      = GLib.Markup.EscapeText(secondaryText);
                base.SecondaryUseMarkup = true;
            }

            foreach (Command button in message.Buttons)
            {
                Gtk.Button newButton = (Gtk.Button)base.AddButton(button.Label, button.ToResponseType());
                newButton.UseUnderline = true;
                newButton.UseStock     = button.IsStockButton;
                if (button.Icon != null)
                {
                    var icon = button.Icon.ToImageDescription(actx);
                    newButton.Image = new ImageBox(actx, icon.WithDefaultSize(Gtk.IconSize.Button));
                }
                newButton.Clicked += ButtonClicked;
            }

            foreach (var op in message.Options)
            {
                Gtk.CheckButton check = new Gtk.CheckButton(op.Text);
                check.Active = op.Value;
                this.AddContent(check, false, false, 0);
                check.Toggled += delegate {
                    message.SetOptionValue(op.Id, check.Active);
                };
            }

            if (message.AllowApplyToAll)
            {
                Gtk.CheckButton check = new Gtk.CheckButton(Xwt.Application.TranslationCatalog.GetString("Apply to all"));
                this.AddContent(check, false, false, 0);
                check.Toggled += delegate {
                    ApplyToAll = check.Active;
                };
            }

            //don't show this yet, let the consumer decide when
            this.Child.ShowAll();
        }
Esempio n. 59
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();
        }
Esempio n. 60
0
        public ProgressBarSample()
        {
            Gtk.HSeparator  separator;
            Gtk.Table       table;
            Gtk.Button      button;
            Gtk.CheckButton check;
            Gtk.VBox        vbox;

            //Application.Init ();

            /* Allocate memory for the data that is passed to the callbacks*/
            pdata = new ProgressData();
            pdata.activity_mode    = false;
            pdata.window           = new Gtk.Window(Gtk.WindowType.Toplevel);
            pdata.window.Resizable = true;

            pdata.window.DeleteEvent += destroy_progress;
            pdata.window.Title        = "GtkProgressBar";
            pdata.window.BorderWidth  = 0;

            vbox             = new Gtk.VBox(false, 5);
            vbox.BorderWidth = 10;
            pdata.window.Add(vbox);
            vbox.Show();

            /* Create a centering alignment object */
            Gtk.Alignment align = new Gtk.Alignment(1, 1, 0, 0);
            vbox.PackStart(align, false, false, 5);
            align.Show();

            /* Create the GtkProgressBar */
            pdata.pbar      = new Gtk.ProgressBar();
            pdata.pbar.Text = "";
            align.Add(pdata.pbar);
            pdata.pbar.Show();

            /* Add a timer callback to update the value of the progress bar*/
            pdata.timer = GLib.Timeout.Add(10000, new GLib.TimeoutHandler(progress_timeout));


            separator = new Gtk.HSeparator();
            vbox.PackStart(separator, false, false, 0);
            separator.Show();

            /* rows, columns, homogeneous */
            table = new Gtk.Table(2, 3, false);
            vbox.PackStart(table, false, true, 0);
            table.Show();

            /* Add a check button to select displaying of the trough text*/
            check = new Gtk.CheckButton("Query cada 1 minuto");
            table.Attach(check, 0, 1, 0, 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_show_text;
            check.Show();

            /* Add a check button to toggle activity mode */
            check = new Gtk.CheckButton("Activity mode");
            table.Attach(check, 0, 1, 1, 2,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_activity_mode;
            check.Active   = true;
            check.Show();

            /* Add a check button to toggle orientation */
            check = new Gtk.CheckButton("Right to Left");
            table.Attach(check, 0, 1, 2, 3,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_orientation;
            check.Show();

            /* Add a button to exit the program */
            button          = new Gtk.Button("close");
            button.Clicked += button_click;
            vbox.PackStart(button, false, false, 0);

            /* This makes it so the button is the default. */
            button.CanDefault = true;

            /* This grabs this button to be the default button. Simply hitting
             * the "Enter" key will cause this button to activate. */
            button.GrabDefault();
            button.Show();

            pdata.window.ShowAll();

            //Application.Run ();
        }