コード例 #1
0
		public void Add (string key, string control_name, Type enum_type, int[] enum_values)
		{
			PropertyEditor editor;
			Gtk.Widget control = gxml[control_name];

			if (control == null)
				throw new InvalidGladeKeyException (control_name);

			//if (control is Gnome.ColorPicker)
				//editor = new PropertyEditorColorPicker (key, (Gnome.ColorPicker) control);
			else if (control is Gnome.FileEntry)
				editor = new PropertyEditorFileEntry (key, (Gnome.FileEntry) control);
			else if (control is Gtk.SpinButton)
				editor = new PropertyEditorSpinButton (key, (Gtk.SpinButton) control);
			else if (control is Gtk.RadioButton)
				editor = new PropertyEditorRadioButton (key, (Gtk.RadioButton) control, enum_type, enum_values);
			else if (control is Gtk.ToggleButton)
				editor = new PropertyEditorToggleButton (key, (Gtk.ToggleButton) control);
			else if (control is Gtk.Entry)
				editor = new PropertyEditorEntry (key, (Gtk.Entry) control);
			/*else if (control is Gtk.OptionMenu)
				editor = new PropertyEditorOptionMenu (key, (Gtk.OptionMenu) control, enum_type, enum_values);*/
			else
				throw new EditorNotSupportedException ();

			by_key.Add (key, editor);
			Add (editor);
		}
コード例 #2
0
        public void Add(string key, string control_name, Type enum_type, int[] enum_values)
        {
            PropertyEditor editor;

            Gtk.Widget control = gxml[control_name];

            if (control == null)
            {
                throw new InvalidGladeKeyException(control_name);
            }

            //if (control is Gnome.ColorPicker)
            //editor = new PropertyEditorColorPicker (key, (Gnome.ColorPicker) control);
            else if (control is Gnome.FileEntry)
            {
                editor = new PropertyEditorFileEntry(key, (Gnome.FileEntry)control);
            }
            else if (control is Gtk.SpinButton)
            {
                editor = new PropertyEditorSpinButton(key, (Gtk.SpinButton)control);
            }
            else if (control is Gtk.RadioButton)
            {
                editor = new PropertyEditorRadioButton(key, (Gtk.RadioButton)control, enum_type, enum_values);
            }
            else if (control is Gtk.ToggleButton)
            {
                editor = new PropertyEditorToggleButton(key, (Gtk.ToggleButton)control);
            }
            else if (control is Gtk.Entry)
            {
                editor = new PropertyEditorEntry(key, (Gtk.Entry)control);
            }

            /*else if (control is Gtk.OptionMenu)
             *      editor = new PropertyEditorOptionMenu (key, (Gtk.OptionMenu) control, enum_type, enum_values);*/
            else
            {
                throw new EditorNotSupportedException();
            }

            by_key.Add(key, editor);
            Add(editor);
        }
コード例 #3
0
ファイル: PreferencesDialog.cs プロジェクト: GNOME/banter
        private Widget MakeGoogleTalkPreferences()
        {
            PropertyEditor peditor;

            VBox vbox = new VBox (false, 4);

            Label label = MakeLabel (
                    string.Format (
                        "<span size=\"larger\" weight=\"bold\">{0}</span>",
                        Catalog.GetString ("GoogleTalk Account Settings")));
            label.Xalign = 0;
            vbox.PackStart (label, false, false, 0);
            label = MakeLabel (
                    string.Format (
                        "<span size=\"smaller\">{0}</span>",
                        Catalog.GetString (
                            "In this alpha-phase of the project, this is the " +
                            "only IM account type we support (so stop your worryin'!).")));
            label.Xalign = 0;
            label.Wrap = true;
            vbox.PackStart (label, false, true, 0);

            Table table = new Table (4, 2, false);
            table.BorderWidth = 8;
            table.RowSpacing = 4;
            table.ColumnSpacing = 8;
            vbox.PackStart (table, true, true, 0);

            // Server address
            label = MakeLabel (Catalog.GetString ("Server Address:"));
            label.Xalign = 1;
            label.Yalign = 0;
            table.Attach (label, 0, 1, 0, 1, AttachOptions.Fill, 0, 0, 0);

            serverAddressEntry = new Entry ();
            label.MnemonicWidget = serverAddressEntry;
            serverAddressEntry.Show ();
            peditor = new PropertyEditorEntry (
                    Preferences.GoogleTalkServer, serverAddressEntry);
            SetupPropertyEditor (peditor);
            table.Attach (serverAddressEntry, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);

            // Server port
            label = MakeLabel (Catalog.GetString ("Server Port:"));
            label.Xalign = 1;
            label.Yalign = 0;
            table.Attach (label, 0, 1, 1, 2, AttachOptions.Fill, 0, 0, 0);

            serverPortEntry = new Entry ();
            label.MnemonicWidget = serverPortEntry;
            serverPortEntry.Show ();
            peditor = new PropertyEditorEntry (
                    Preferences.GoogleTalkPort, serverPortEntry);
            SetupPropertyEditor (peditor);
            table.Attach (serverPortEntry, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);

            // Username
            label = MakeLabel (Catalog.GetString ("Username:"******"Password:"));
            label.Xalign = 1;
            label.Yalign = 0;
            table.Attach (label, 0, 1, 3, 4, AttachOptions.Fill, 0, 0, 0);

            passwordEntry = new Entry ();
            label.MnemonicWidget = passwordEntry;
            passwordEntry.Visibility = false; // password field
            passwordEntry.Show ();
            table.Attach (passwordEntry, 1, 2, 3, 4, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);

            vbox.Show ();

            return vbox;
        }