public static Gtk.Window Create ()
		{
			window = new Window ("GtkComboBox");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			ComboBoxText combo = ComboBoxText.NewWithEntry ();
			combo.AppendText ("Foo");
			combo.AppendText ("Bar");
			combo.Changed += new EventHandler (OnComboActivated);
			combo.Entry.Changed += new EventHandler (OnComboEntryChanged);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
		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;
		}
Exemple #3
0
		public static Gtk.Window Create ()
		{
			window = new Dialog ();
			window.Response += new ResponseHandler (Print_Response);
			window.SetDefaultSize (200, 100);

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

			ToggleButton toggle_button = new ToggleButton ("Toggle Label");
			toggle_button.Clicked += new EventHandler (Label_Toggle);
			window.ActionArea.PackStart (toggle_button, true, true, 0);

			toggle_button = new ToggleButton ("Toggle Separator");
			toggle_button.Clicked += new EventHandler (Separator_Toggle);
			window.ActionArea.PackStart (toggle_button, true, true, 0);

			window.ShowAll ();

			return window;
		}
Exemple #4
0
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCombo");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			combo = new Gtk.Combo ();
			string[] pop = {"Foo", "Bar"};
			combo.PopdownStrings = pop;
			combo.Entry.Activated += new EventHandler (OnComboActivated);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkRadioButton");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			radio_button = new RadioButton ("Button 1");
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 2");
			radio_button.Active = true;
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 3");
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Inconsistent");
			radio_button.Inconsistent = true;
			box2.PackStart (radio_button, true, true, 0);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);
			
			radio_button = new RadioButton ("Button 4");
			radio_button.Mode = false;
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 5");
			radio_button.Active = true;
			radio_button.Mode = false;
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 6");
			radio_button.Mode = false;
			box2.PackStart (radio_button, true, true, 0);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

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

			return window;
		}
Exemple #6
0
		public void CreateGui() 
		{
			dialog = new Dialog ();
			dialog.Title = "Login";
			dialog.BorderWidth = 3;
			dialog.VBox.BorderWidth = 5;
			dialog.HasSeparator = false;

			Frame frame = new Frame ("Connection");
			string image = Stock.DialogInfo;
			
			HBox hbox = new HBox (false, 2);
			hbox.BorderWidth = 5;
			hbox.PackStart (new Gtk.Image (image, IconSize.Dialog), true, true, 0);
		
			Table table = new Table (2, 3, false);
			hbox.PackStart (table);
			table.ColumnSpacing = 4;
			table.RowSpacing = 4;
			Label label = null;

			label = Label.NewWithMnemonic ("_Provider");
			table.Attach (label, 0, 1, 0, 1);
			providerOptionMenu = CreateProviderOptionMenu();
			table.Attach (providerOptionMenu, 1, 2, 0, 1);
			
			label = Label.NewWithMnemonic ("_Connection String");
			table.Attach (label, 0, 1, 1, 2);
			connection_entry = new Entry ();
			table.Attach (connection_entry, 1, 2, 1, 2);

			frame.Add (hbox);

			dialog.VBox.PackStart (frame, true, true, 0);

			Button button = null;
			button = new Button(Stock.Ok);
			button.Clicked += new EventHandler (Connect_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			button = new Button(Stock.Cancel);
			button.Clicked += new EventHandler (Dialog_Cancel);
			dialog.ActionArea.PackStart (button, true, true, 0);
			dialog.Modal = true;

			dialog.ShowAll ();
		}
Exemple #7
0
		public void CreateGui() 
		{
			dialog = new Dialog ();
			
			dialog.AllowGrow = true;
			dialog.Title = "About";
			dialog.BorderWidth = 3;
			dialog.VBox.BorderWidth = 5;
			dialog.HasSeparator = false;
		
			Table table = new Table (4, 1, false);
			table.ColumnSpacing = 4;
			table.RowSpacing = 4;
			Label label = null;
			
			label = new Label ("About Mono SQL# For GTK#");
			table.Attach (label, 0, 1, 0, 1);

			label = new Label ("sqlsharpgtk");
			table.Attach (label, 0, 1, 1, 2);

			label = new Label (VERSION);
			table.Attach (label, 0, 1, 2, 3);

			label = new Label ("(C) Copyright 2002-2006 Daniel Morgan");
			table.Attach (label, 0, 1, 3, 4);

			table.Show();

			dialog.VBox.PackStart (table, false, false, 10);

			Button button = null;
			button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Ok_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			dialog.Modal = true;

			dialog.ShowAll ();
		}
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCheckButton");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			checked_button = new CheckButton ("_button1");
			box2.PackStart (checked_button, true, true, 0);

 			checked_button = new CheckButton ("button2");
 			box2.PackStart (checked_button, true, true, 0);

			checked_button = new CheckButton ("button3");
			box2.PackStart (checked_button, true, true, 0);

			checked_button = new CheckButton ("Inconsistent");
			checked_button.Inconsistent = true;
			box2.PackStart (checked_button, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
		public static Gtk.Window Create ()
		{
			window = new Window ("Statusbar");
			window.SetDefaultSize (150, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			statusbar = new Statusbar ();
			box1.PackEnd (statusbar, true, true, 0);
			statusbar.TextPopped += new TextPoppedHandler (statusbar_popped);

			Button button = new Button ("push");
			box2.PackStart (button, false, false, 0);
			button.Clicked += new EventHandler (statusbar_pushed);

			button = new Button ("pop");
			box2.PackStart (button, false, false, 0);
			button.Clicked += new EventHandler (pop_clicked);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button close_button = new Button (Stock.Close);
			close_button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (close_button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();
			
			window.ShowAll ();
			return window;
		}
Exemple #10
0
		public DemoMenus () : base ("Menus")
		{
			AccelGroup accel_group = new AccelGroup ();
			AddAccelGroup (accel_group);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			MenuBar menubar = new MenuBar ();
			box1.PackStart (menubar, false, true, 0);

			MenuItem menuitem = new MenuItem ("test\nline2");
			menuitem.Submenu = CreateMenu (2, true);
			menubar.Append (menuitem);

 			MenuItem menuitem1 = new MenuItem ("foo");
 			menuitem1.Submenu = CreateMenu (3, true);
 			menubar.Append (menuitem1);

			menuitem = new MenuItem ("bar");
			menuitem.Submenu = CreateMenu (4, true);
			menuitem.RightJustified = true;
			menubar.Append (menuitem);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button close = new Button ("close");
			close.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (close, true, true, 0);

			close.CanDefault = true;
			close.GrabDefault ();

			ShowAll ();
		}
		static void Display_Result (Gdk.Color color)
		{
			dialog = new Dialog ();
			dialog.Title = "Selected Color: " + HexFormat (color);
			dialog.HasSeparator = true;

			DrawingArea da = new DrawingArea ();

			da.ModifyBg (StateType.Normal, color);

			dialog.VBox.BorderWidth = 10;
			dialog.VBox.PackStart (da, true, true, 10);
			dialog.SetDefaultSize (200, 200);

			Button button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Dialog_Ok);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			dialog.ShowAll ();
		}
Exemple #12
0
        /// <summary>
        /// Create the UI
        /// </summary>
        private void CreateEdit()
        {
            this.Header = CmisSync.Properties_Resources.EditTitle;

            VBox layout_vertical   = new VBox(false, 12);

            Button cancel_button = new Button(CmisSync.Properties_Resources.Cancel);
            cancel_button.Clicked += delegate {
                this.Close();
            };

            Button finish_button = new Button(CmisSync.Properties_Resources.SaveChanges);
            finish_button.Sensitive = false;
            finish_button.Clicked += delegate {
                this.Controller.SaveFolder();
                this.Close();
            };

            layout_vertical.PackStart(new Label(string.Empty), false, false, 0);
            Notebook tab_view = new Notebook();
            //tab_view.AppendPage(layout_vertical, new Label("Edit Folders"));
            var credentialsWidget = new CredentialsWidget();
            credentialsWidget.Password = this.Credentials.Password.ToString();
            credentialsWidget.Address = this.Credentials.Address.ToString();
            credentialsWidget.UserName = this.Credentials.UserName;
            credentialsWidget.Changed += (object sender, EventArgs e) => finish_button.Sensitive = true;
            tab_view.AppendPage(credentialsWidget, new Label(Properties_Resources.Credentials));
            this.Add(tab_view);
            this.AddButton(cancel_button);
            this.AddButton(finish_button);

            finish_button.GrabDefault();

            this.ShowAll();
        }
Exemple #13
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 ();
        }
Exemple #14
0
		public void CreateGui() 
		{
			dialog = new Dialog ();
			
			dialog.AllowGrow = true;
			dialog.Title = "Login";
			dialog.BorderWidth = 2;
			dialog.VBox.BorderWidth = 2;
			dialog.HasSeparator = false;

			Frame frame = new Frame ("Connection");
			frame.BorderWidth = 2;
		
			Table table = new Table (7, 2, false);
			table.ColumnSpacing = 2;
			table.RowSpacing = 2;
			Label label = null;

			label = new Label ("_Provider");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			LoadProviderCombo();
			if (providerCombo.Model.IterNChildren() > 0)
				providerCombo.Active = 0;
			providerSelected = providerCombo.Active;
			table.Attach (providerCombo, 1, 8, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 10, 1);
						
			label = new Label ("_Connection String");
			label.Xpad = 2;
			label.Ypad = 8;
			label.Xalign = 1.0f;
			table.Attach (label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			connection_entry = new Entry ();
			connection_entry.Changed += new EventHandler (OnConnectionEntryChanged);
			table.Attach (connection_entry, 1, 8, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 10, 1);
			
			label = new Label ("_Server");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			server_entry = new Entry ();
			server_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (server_entry, 1, 8, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_Database");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			database_entry = new Entry ();
			database_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (database_entry, 1, 8, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_User ID");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			userid_entry = new Entry ();
			userid_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (userid_entry, 1, 8, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_Password");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			password_entry = new Entry ();
			password_entry.Visibility = false;
			password_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (password_entry, 1, 8, 5, 6, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_Other");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 6, 7, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			other_entry = new Entry ();
			other_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (other_entry, 1, 8, 6, 7, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			table.Show();
			frame.Add (table);

			dialog.VBox.PackStart (frame, false, false, 5);
			
			Frame appSettingFrame = new Frame ("App Settings");
			appSettingFrame.Add (grid);
			dialog.VBox.PackStart (appSettingFrame, true, true, 10);

			Button button = null;
			button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Connect_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			button = new Button (Stock.Cancel);
			button.Clicked += new EventHandler (Dialog_Cancel);
			dialog.ActionArea.PackStart (button, true, true, 0);
			dialog.Modal = true;
			dialog.SetDefaultSize (500, 500);

			statusBar = new Statusbar ();
			statusBar.HasResizeGrip = false;
			dialog.VBox.PackEnd (statusBar, false, false, 0);

			SetStatusBarText ("Ready!");

			dialog.ShowAll ();
		}
Exemple #15
0
        private void ShowAdd1Page()
        {
            this.Present();
            Header = CmisSync.Properties_Resources.Where;

            VBox layout_vertical   = new VBox (false, 12);
            HBox layout_fields     = new HBox (true, 12);
            VBox layout_address    = new VBox (true, 0);
            HBox layout_address_help = new HBox(false, 3);
            VBox layout_user       = new VBox (true, 0);
            VBox layout_password   = new VBox (true, 0);

            // Address
            Label address_label = new Label()
            {
                UseMarkup = true,
                          Xalign = 0,
                          Markup = "<b>" + 
                              CmisSync.Properties_Resources.EnterWebAddress +
                              "</b>"
            };

            Entry address_entry = new Entry () {
                Text = (Controller.PreviousAddress == null || String.IsNullOrEmpty(Controller.PreviousAddress.ToString()))?"https://":Controller.PreviousAddress.ToString(),
                     ActivatesDefault = false
            };

            Label address_help_label = new Label()
            {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<span foreground=\"#808080\" size=\"small\">" +
                           CmisSync.Properties_Resources.Help + ": " +
                           "</span>"
            };
            EventBox address_help_urlbox = new EventBox();
            Label address_help_urllabel = new Label()
            {
                Xalign = 0,
                       UseMarkup = true,
                       Markup = "<span foreground=\"blue\" underline=\"single\" size=\"small\">" +
                           CmisSync.Properties_Resources.WhereToFind +
                           "</span>"
            };
            address_help_urlbox.Add(address_help_urllabel);
            address_help_urlbox.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                Process process = new Process();
                process.StartInfo.FileName  = "xdg-open";
                process.StartInfo.Arguments = "https://github.com/aegif/CmisSync/wiki/What-address";
                process.Start ();
            };
            address_help_urlbox.EnterNotifyEvent += delegate(object o, EnterNotifyEventArgs args) {
                address_help_urlbox.GdkWindow.Cursor = hand_cursor;
            };

            Label address_error_label = new Label()
            {
                Xalign = 0,
                UseMarkup = true,
                Markup = ""
            };
            address_error_label.Hide();

            // User
            Entry user_entry = new Entry () {
                Text = Controller.PreviousPath,
                     ActivatesDefault = false
            };

            if(String.IsNullOrEmpty(Controller.saved_user))
            {
                user_entry.Text = Environment.UserName;
            }
            else
            {
                user_entry.Text = Controller.saved_user;
            }

            // Password
            Entry password_entry = new Entry () {
                Visibility = false,
                ActivatesDefault = true
            };

            Controller.ChangeAddressFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        address_entry.Text      = text;
                        });
            };

            Controller.ChangeUserFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        user_entry.Text      = text;
                        });
            };

            Controller.ChangePasswordFieldEvent += delegate (string text,
                    string example_text) {

                Application.Invoke (delegate {
                        password_entry.Text      = text;
                        });
            };

            address_entry.Changed += delegate {
                string error = Controller.CheckAddPage(address_entry.Text);
                if (!String.IsNullOrEmpty(error)) {
                    address_error_label.Markup = "<span foreground=\"red\">" + CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) + "</span>";
                    address_error_label.Show();
                } else {
                    address_error_label.Hide();
                }
            };

            // Address
            layout_address_help.PackStart(address_help_label, false, false, 0);
            layout_address_help.PackStart(address_help_urlbox, false, false, 0);
            layout_address.PackStart (address_label, true, true, 0);
            layout_address.PackStart (address_entry, true, true, 0);
            layout_address.PackStart (layout_address_help, true, true, 0);
//            layout_address.PackStart (address_error_label, true, true, 0);

            // User
            layout_user.PackStart (new Label () {
                    Markup = "<b>" + CmisSync.Properties_Resources.User + ":</b>",
                    Xalign = 0
                    }, true, true, 0);
            layout_user.PackStart (user_entry, false, false, 0);

            // Password
            layout_password.PackStart (new Label () {
                    Markup = "<b>" + CmisSync.Properties_Resources.Password + ":</b>",
                    Xalign = 0
                    }, true, true, 0);
            layout_password.PackStart (password_entry, false, false, 0);

            layout_fields.PackStart (layout_user);
            layout_fields.PackStart (layout_password);

//            layout_vertical.PackStart (new Label (""), false, false, 0);
            layout_vertical.PackStart (layout_address, false, false, 0);
            layout_vertical.PackStart (layout_fields, false, false, 0);
            layout_vertical.PackStart (address_error_label, true, true, 0);

            Add (layout_vertical);

            // Cancel button
            Button cancel_button = new Button (cancelText);

            cancel_button.Clicked += delegate {
                Controller.PageCancelled ();
            };

            // Continue button
            Button continue_button = new Button (continueText) {
                Sensitive = String.IsNullOrEmpty( Controller.CheckAddPage (address_entry.Text))
            };

            continue_button.Clicked += delegate {
                // Show wait cursor
                this.GdkWindow.Cursor = wait_cursor;

                // Try to find the CMIS server (asynchronous using a delegate)
                GetRepositoriesFuzzyDelegate dlgt =
                    new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy);
                ServerCredentials credentials = new ServerCredentials() {
                    UserName = user_entry.Text,
                    Password = password_entry.Text,
                    Address = new Uri(address_entry.Text)
                };
                IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
                while (!ar.AsyncWaitHandle.WaitOne(100)) {
                    while (Application.EventsPending()) {
                        Application.RunIteration();
                    }
                }
                Tuple<CmisServer, Exception> result = dlgt.EndInvoke(ar);
                CmisServer cmisServer = result.Item1;
                if(cmisServer != null)
                {
                    Controller.repositories = cmisServer.Repositories;
                    address_entry.Text = cmisServer.Url.ToString();
                }
                else
                {
                    Controller.repositories = null;
                }
                // Hide wait cursor
                this.GdkWindow.Cursor = default_cursor;

                if (Controller.repositories == null)
                {
                    // Show warning
                    string warning = "";
                    string message = result.Item2.Message;
                    Exception e = result.Item2;
                    if (e is CmisPermissionDeniedException)
                    {
                        warning = Properties_Resources.LoginFailedForbidden;
                    }
//                    else if (e is CmisServerNotFoundException)
//                    {
//                        warning = Properties_Resources.ConnectFailure;
//                    }
                    else if (e.Message == "SendFailure" && cmisServer.Url.Scheme.StartsWith("https"))
                    {
                        warning = Properties_Resources.SendFailureHttps;
                    }
                    else if (e.Message == "TrustFailure")
                    {
                        warning = Properties_Resources.TrustFailure;
                    }
                    else
                    {
                        warning = message + Environment.NewLine + Properties_Resources.Sorry;
                    }
                    address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
                    address_error_label.Show();
                }
                else
                {
                    // Continue to folder selection
                    Controller.Add1PageCompleted(
                            new Uri(address_entry.Text), user_entry.Text, password_entry.Text);
                }
            };

            Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
                Application.Invoke (delegate {
                    continue_button.Sensitive = button_enabled;
                    if(button_enabled) {
                        continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
                        continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
                        continue_button.GrabDefault();
                    }
                });
            };

            AddButton (cancel_button);
            AddButton (continue_button);

            Controller.CheckAddPage (address_entry.Text);
            address_entry.GrabFocus ();
        }
Exemple #16
0
        private void ShowAdd2Page()
        {
            CmisTreeStore cmisStore = new CmisTreeStore ();
            Gtk.TreeView treeView = new Gtk.TreeView (cmisStore.CmisStore);

            bool firstRepo = true;
            List<RootFolder> repositories = new List<RootFolder>();
            Dictionary<string,AsyncNodeLoader> loader = new Dictionary<string, AsyncNodeLoader> ();
            foreach (KeyValuePair<String, String> repository in Controller.repositories)
            {
                RootFolder root = new RootFolder () {
                    Name = repository.Value,
                    Id = repository.Key,
                    Address = Controller.saved_address.ToString()
                };
                if (firstRepo)
                {
                    root.Selected = true;
                    firstRepo = false;
                }
                else
                {
                    root.Selected = false;
                }
                repositories.Add (root);
                CmisRepoCredentials cred = new CmisRepoCredentials () {
                    UserName = Controller.saved_user,
                    Password = Controller.saved_password,
                    Address = Controller.saved_address,
                    RepoId = repository.Key
                };
                AsyncNodeLoader asyncLoader = new AsyncNodeLoader (root, cred, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
                asyncLoader.UpdateNodeEvent += delegate {
                    cmisStore.UpdateCmisTree(root);
                };
                cmisStore.UpdateCmisTree (root);
                asyncLoader.Load (root);
                loader.Add (root.Id, asyncLoader);
            }

            Header = CmisSync.Properties_Resources.Which;

            VBox layout_vertical   = new VBox (false, 12);

            Button cancel_button = new Button (cancelText);
            cancel_button.Clicked += delegate {
                foreach (AsyncNodeLoader task in loader.Values)
                    task.Cancel();
                Controller.PageCancelled ();
            };

            Button continue_button = new Button (continueText)
            {
                Sensitive = (repositories.Count > 0)
            };

            continue_button.Clicked += delegate {
                RootFolder root = repositories.Find (x => (x.Selected != false));
                if (root != null)
                {
                    foreach (AsyncNodeLoader task in loader.Values)
                        task.Cancel();
                    Controller.saved_repository = root.Id;
                    List<string> ignored = NodeModelUtils.GetIgnoredFolder(root);
                    List<string> selected = NodeModelUtils.GetSelectedFolder(root);
                    Controller.Add2PageCompleted (root.Id, root.Path, ignored.ToArray(), selected.ToArray());
                }
            };

            Button back_button = new Button (backText)
            {
                Sensitive = true
            };

            back_button.Clicked += delegate {
                foreach (AsyncNodeLoader task in loader.Values)
                    task.Cancel();
                Controller.BackToPage1();
            };

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn ();
            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle ();
            column.PackStart (renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute (renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute (renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute (renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate (object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (! cmisStore.CmisStore.GetIterFromString (out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled,(int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                RootFolder selectedRoot = repositories.Find (x => (x.Selected != false));
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                if (root != selectedRoot)
                {
                    selectedRoot.Selected = false;
                    cmisStore.UpdateCmisTree(selectedRoot);
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText ();
            column.PackStart (renderText, false);
            column.SetAttributes (renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn (column);

            treeView.AppendColumn ("Status", new StatusCellRenderer (), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate (object o, RowExpandedArgs args) {
                Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                loader[root.Id].Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow() {
                ShadowType = Gtk.ShadowType.In
            };
            sw.Add(treeView);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (sw, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(cancel_button);
            AddButton(continue_button);

            if (repositories.Count > 0)
            {
                continue_button.GrabDefault ();
                continue_button.GrabFocus ();
            }
            else
            {
                back_button.GrabDefault ();
                back_button.GrabFocus ();
            }
        }
		static void Display_Result (Gdk.RGBA color)
		{
			dialog = new Dialog ();
			dialog.Title = "Selected Color: " + HexFormat (color);
			
			DrawingArea da = new DrawingArea ();

			da.OverrideBackgroundColor (StateFlags.Normal, color);

			dialog.ContentArea.BorderWidth = 10;
			dialog.ContentArea.PackStart (da, true, true, 10);
			dialog.SetDefaultSize (200, 200);

			Button button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Dialog_Ok);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			dialog.ShowAll ();
		}
		void ShowReplaceUI ()
		{
			if (replaceMode)
				return;
			
			labelReplace = new Label { Text = GettextCatalog.GetString ("_Replace:"), Xalign = 0f, UseUnderline = true };
			comboboxentryReplace = new ComboBoxEntry ();
			LoadHistory ("MonoDevelop.FindReplaceDialogs.ReplaceHistory", comboboxentryReplace);
			comboboxentryReplace.Show ();
			labelReplace.Show ();
			
			TableAddRow (tableFindAndReplace, 1, labelReplace, comboboxentryReplace);
			
			buttonReplace = new Button () {
				Label = "gtk-find-and-replace",
				UseUnderline = true,
				CanDefault = true,
				UseStock = true,
			};
			// Note: We override the stock label text instead of using SetButtonIcon() because the
			// theme may override whether or not the icons are shown. Using SetButtonIcon() would
			// break the theme by forcing icons even if the theme says "no".
			OverrideStockLabel (buttonReplace, GettextCatalog.GetString ("R_eplace"));
			buttonReplace.Clicked += HandleReplaceClicked;
			buttonReplace.Show ();
			
			AddActionWidget (buttonReplace, 0);
			buttonReplace.GrabDefault ();
			
			replaceMode = true;
			
			Requisition req = SizeRequest ();
			Resize (req.Width, req.Height);
		}
Exemple #19
0
		public static Gtk.Window Create ()
		{
			window = new Window ("GtkRange");
			window.SetDefaultSize (250, 200);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 0);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			Adjustment adjustment = new Adjustment (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);

			HScale hscale = new HScale (adjustment);
			hscale.SetSizeRequest (150, -1);

			hscale.Digits = 1;
			hscale.DrawValue = true;
			box2.PackStart (hscale, true, true, 0);

			HScrollbar hscrollbar = new HScrollbar (adjustment);
			box2.PackStart (hscrollbar, true, true, 0);

			hscale = new HScale (adjustment);
			hscale.DrawValue = true;
			hscale.FormatValue += new FormatValueHandler (reformat_value);

			box2.PackStart (hscale, true, true, 0);

			HBox hbox = new HBox (false, 0);
			VScale vscale = new VScale (adjustment);
			vscale.SetSizeRequest (-1, 200);
			vscale.Digits = 2;
			vscale.DrawValue = true;
			hbox.PackStart (vscale, true, true, 0);
			
			vscale = new VScale (adjustment);
			vscale.SetSizeRequest (-1, 200);
			vscale.Digits = 2;
			vscale.DrawValue = true;
			((Range) vscale).Inverted = true;
			hbox.PackStart (vscale, true, true, 0);

			vscale = new VScale (adjustment);
			vscale.DrawValue = true;
			vscale.FormatValue += new FormatValueHandler (reformat_value);
			hbox.PackStart (vscale, true, true, 0);

			box2.PackStart (hbox, true, true, 0);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();
			
			window.ShowAll ();
			return window;
		}
Exemple #20
0
        private void ShowAdd1Page() {
            this.Present();
            this.Header = Properties_Resources.Where;

            VBox layout_vertical   = new VBox(false, 12);
            HBox layout_fields     = new HBox(true, 12);
            VBox layout_address    = new VBox(true, 0);
            HBox layout_address_help = new HBox(false, 3);
            VBox layout_user       = new VBox(true, 0);
            VBox layout_password   = new VBox(true, 0);

            // Address
            Label address_label = new Label() {
                UseMarkup = true,
                Xalign = 0,
                Markup = "<b>" +
                Properties_Resources.EnterWebAddress +
                "</b>"
            };

            Entry address_entry = new Entry() {
                Text = (this.controller.PreviousAddress == null || string.IsNullOrEmpty(this.controller.PreviousAddress.ToString())) ? DefaultEntries.Defaults.Url : this.controller.PreviousAddress.ToString(),
                IsEditable = DefaultEntries.Defaults.CanModifyUrl,
                ActivatesDefault = false
            };

            Label address_help_label = new Label() {
                Xalign = 0,
                UseMarkup = true,
                Markup = "<span foreground=\"#808080\" size=\"small\">" +
                Properties_Resources.Help + ": " +
                "</span>"
            };
            EventBox address_help_urlbox = new EventBox();
            Label address_help_urllabel = new Label() {
                Xalign = 0,
                UseMarkup = true,
                Markup = "<span foreground=\"blue\" underline=\"single\" size=\"small\">" +
                Properties_Resources.WhereToFind +
                "</span>"
            };
            address_help_urlbox.Add(address_help_urllabel);
            address_help_urlbox.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) {
                Process process = new Process();
                process.StartInfo.FileName  = "xdg-open";
                process.StartInfo.Arguments = "https://github.com/nicolas-raoul/CmisSync/wiki/What-address";
                process.Start();
            };
            address_help_urlbox.EnterNotifyEvent += delegate(object o, EnterNotifyEventArgs args) {
                address_help_urlbox.GdkWindow.Cursor = handCursor;
            };

            Label address_error_label = new Label() {
                Xalign = 0,
                UseMarkup = true,
                Markup = string.Empty
            };
            address_error_label.Hide();

            // User
            Entry user_entry = new Entry() {
                Text = this.controller.PreviousPath,
                ActivatesDefault = false
            };

            if (string.IsNullOrEmpty(this.controller.saved_user)) {
                user_entry.Text = DefaultEntries.Defaults.Name;
            } else {
                user_entry.Text = this.controller.saved_user;
            }

            // Password
            Entry password_entry = new Entry() {
                Visibility = false,
                ActivatesDefault = true
            };

            this.controller.ChangeAddressFieldEvent += delegate(string text, string example_text) {
                Application.Invoke(delegate {
                    address_entry.Text = text;
                });
            };

            this.controller.ChangeUserFieldEvent += delegate(string text, string example_text) {
                Application.Invoke(delegate {
                    user_entry.Text = text;
                });
            };

            this.controller.ChangePasswordFieldEvent += delegate(string text, string example_text) {
                Application.Invoke(delegate {
                    password_entry.Text = text;
                });
            };

            address_entry.Changed += delegate {
                string error = this.controller.CheckAddPage(address_entry.Text);
                if (!string.IsNullOrEmpty(error)) {
                    address_error_label.Markup = "<span foreground=\"red\">" + Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) + "</span>";
                    address_error_label.Show();
                } else {
                    address_error_label.Hide();
                }
            };

            // Address
            layout_address_help.PackStart(address_help_label, false, false, 0);
            layout_address_help.PackStart(address_help_urlbox, false, false, 0);
            layout_address.PackStart(address_label, true, true, 0);
            layout_address.PackStart(address_entry, true, true, 0);
            layout_address.PackStart(layout_address_help, true, true, 0);

            // User
            layout_user.PackStart(
                new Label() {
                Markup = "<b>" + Properties_Resources.User + ":</b>",
                Xalign = 0
            },
            true,
            true,
            0);
            layout_user.PackStart(user_entry, false, false, 0);

            // Password
            layout_password.PackStart(
                new Label() {
                Markup = "<b>" + Properties_Resources.Password + ":</b>",
                Xalign = 0
            },
            true,
            true,
            0);
            layout_password.PackStart(password_entry, false, false, 0);
            layout_fields.PackStart(layout_user);
            layout_fields.PackStart(layout_password);
            layout_vertical.PackStart(layout_address, false, false, 0);
            layout_vertical.PackStart(layout_fields, false, false, 0);
            layout_vertical.PackStart(address_error_label, true, true, 0);
            this.Add(layout_vertical);

            // Cancel button
            Button cancel_button = new Button(this.cancelText);

            cancel_button.Clicked += delegate {
                this.controller.PageCancelled();
            };

            // Continue button
            Button continue_button = new Button(this.continueText) {
                Sensitive = string.IsNullOrEmpty(this.controller.CheckAddPage(address_entry.Text))
            };

            continue_button.Clicked += delegate {
                // Show wait cursor
                this.GdkWindow.Cursor = waitCursor;

                // Try to find the CMIS server (asynchronous using a delegate)
                GetRepositoriesDelegate dlgt =
                    new GetRepositoriesDelegate(SetupController.GetRepositories);
                ServerCredentials credentials = new ServerCredentials() {
                    UserName = user_entry.Text,
                    Password = password_entry.Text,
                    Address = new Uri(address_entry.Text),
                    Binding = this.controller.saved_binding ?? ServerCredentials.BindingBrowser
                };
                IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
                while (!ar.AsyncWaitHandle.WaitOne(100)) {
                    while (Application.EventsPending()) {
                        Application.RunIteration();
                    }
                }

                var result = dlgt.EndInvoke(ar);
                if (result.Repositories != null) {
                    this.controller.repositories = result.Repositories.WithoutHiddenOnce();
                    address_entry.Text = result.Credentials.Address.ToString();
                } else {
                    this.controller.repositories = null;

                    // Show best found Url
                    address_entry.Text = result.Credentials.Address.ToString();

                    // Show warning
                    string warning = this.controller.GetConnectionsProblemWarning(result.FailedException);
                    address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
                    address_error_label.Show();
                }

                // Hide wait cursor
                this.GdkWindow.Cursor = defaultCursor;

                if (this.controller.repositories != null) {
                    // Continue to folder selection
                    this.controller.Add1PageCompleted(
                        new Uri(address_entry.Text), result.Credentials.Binding, user_entry.Text, password_entry.Text);
                }
            };

            this.controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                Application.Invoke(delegate {
                    continue_button.Sensitive = button_enabled;
                    if (button_enabled) {
                        continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
                        continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
                        continue_button.GrabDefault();
                    }
                });
            };

            this.AddButton(cancel_button);
            this.AddButton(continue_button);

            this.controller.CheckAddPage(address_entry.Text);
            address_entry.GrabFocus();
        }
Exemple #21
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
		public DemoUIManager () : base ("UI Manager")
		{
			ActionEntry[] entries = new ActionEntry[] {
				new ActionEntry ("FileMenu", null, "_File", null, null, null),
				new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
				new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
				new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
				new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
				new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
				new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
				new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
				new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
				new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
				new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
			};

			ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
				new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
			};


			RadioActionEntry[] colorEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
				new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
				new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
			};

			RadioActionEntry[] shapeEntries = new RadioActionEntry[] {
				new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
				new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
				new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
			};

			ActionGroup actions = new ActionGroup ("group");
			actions.Add (entries);
			actions.Add (toggleEntries);
			actions.Add (colorEntries, (int)Color.Red, new ChangedHandler (RadioActionActivated));
			actions.Add (shapeEntries, (int)Shape.Oval, new ChangedHandler (RadioActionActivated));

			UIManager uim = new UIManager ();
			uim.InsertActionGroup (actions, 0);
			AddAccelGroup (uim.AccelGroup);
			uim.AddUiFromString (uiInfo);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			box1.PackStart (uim.GetWidget ("/MenuBar"), false, false, 0);

			Label label = new Label ("Type\n<alt>\nto start");
			label.SetSizeRequest (200, 200);
			label.SetAlignment (0.5f, 0.5f);
			box1.PackStart (label, true, true, 0);

			HSeparator separator = new HSeparator ();
			box1.PackStart (separator, false, true, 0);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button ("close");
			button.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();

			ShowAll ();
		}
Exemple #23
0
        public static Gtk.Window Create()
        {
            window = new Window ("Menus");

            AccelGroup accel_group = new AccelGroup ();
            window.AddAccelGroup (accel_group);

            VBox box1 = new VBox (false, 0);
            window.Add (box1);

            MenuBar menubar = new MenuBar ();
            box1.PackStart (menubar, false, false, 0);

            Menu menu = Create_Menu (2, true);
            MenuItem menuitem = new MenuItem ("foo");
            menuitem.Submenu = menu;
            menubar.Append (menuitem);

            menuitem = new MenuItem ("bar");
            menuitem.Submenu = Create_Menu (3, true);
            menubar.Append (menuitem);

            Image image = new Image (Stock.Help, IconSize.Menu);

            menuitem = new ImageMenuItem ("Help");
            ((ImageMenuItem) menuitem).Image = image;
            menuitem.Submenu = Create_Menu (4, true);
            menuitem.RightJustified = true;
            menubar.Append (menuitem);

            menubar = new MenuBar ();
            box1.PackStart (menubar, false, true, 0);

            menu = Create_Menu (2, true);

            menuitem = new MenuItem ("Second menu bar");
            menuitem.Submenu = menu;
            menubar.Append (menuitem);

            VBox box2 = new VBox (false, 10);
            box2.BorderWidth = 10;
            box1.PackStart (box2, true, true, 0);

            menu = Create_Menu (1, false);
            menu.AccelGroup = accel_group;

            menu.Append (new SeparatorMenuItem ());

            menuitem = new CheckMenuItem ("Accelerate Me");
            menu.Append (menuitem);
            menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible);

            menuitem = new CheckMenuItem ("Accelerator locked");
            menu.Append (menuitem);
            menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked);

            menuitem = new CheckMenuItem ("Accelerator Frozen");
            menu.Append (menuitem);
            menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible);
            menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible);

            OptionMenu option_menu = new OptionMenu ();
            option_menu.Menu = menu;
            option_menu.SetHistory (3);
            box2.PackStart (option_menu, true, true, 0);

            box1.PackStart (new HSeparator (), false, false, 0);

            box2 = new VBox (false, 10);
            box2.BorderWidth = 10;
            box1.PackStart (box2, false, true, 0);

            Button close_button = new Button (Stock.Close);
            close_button.Clicked += new EventHandler (Close_Button);
            box2.PackStart (close_button, true, true, 0);

            close_button.CanDefault = true;
            close_button.GrabDefault ();

            window.ShowAll ();
            return window;
        }
Exemple #24
0
        /// <summary>
        /// Create the UI
        /// </summary>
        private void CreateEdit()
        {
            CmisTreeStore cmisStore = new CmisTreeStore ();
            Gtk.TreeView treeView = new Gtk.TreeView (cmisStore.CmisStore);

            RootFolder root = new RootFolder () {
                Name = this.Name,
                Id = credentials.RepoId,
                Address = credentials.Address.ToString()
            };
            IgnoredFolderLoader.AddIgnoredFolderToRootNode(root, Ignores);
            LocalFolderLoader.AddLocalFolderToRootNode(root, localPath);

            AsyncNodeLoader asyncLoader = new AsyncNodeLoader (root, credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
            asyncLoader.UpdateNodeEvent += delegate {
                cmisStore.UpdateCmisTree(root);
            };
            cmisStore.UpdateCmisTree (root);
            asyncLoader.Load (root);

            Header = CmisSync.Properties_Resources.EditTitle;

            VBox layout_vertical   = new VBox (false, 12);

            Controller.CloseWindowEvent += delegate
            {
                asyncLoader.Cancel();
            };

            Button cancel_button = new Button (CmisSync.Properties_Resources.Cancel);
            cancel_button.Clicked += delegate {
                Close();
            };

            Button finish_button = new Button (CmisSync.Properties_Resources.SaveChanges);
            finish_button.Clicked += delegate {
                Ignores = NodeModelUtils.GetIgnoredFolder(root);
                Controller.SaveFolder();
                Close();
            };

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn ();
            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle ();
            column.PackStart (renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute (renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute (renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute (renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate (object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (! cmisStore.CmisStore.GetIterFromString (out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled,(int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText ();
            column.PackStart (renderText, false);
            column.SetAttributes (renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn (column);

            treeView.AppendColumn ("Status", new StatusCellRenderer (), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate (object o, RowExpandedArgs args) {
                Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                asyncLoader.Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow() {
                ShadowType = Gtk.ShadowType.In
            };
            sw.Add(treeView);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (sw, true, true, 0);
            Add(layout_vertical);
            AddButton(cancel_button);
            AddButton(finish_button);

            finish_button.GrabDefault ();

            this.ShowAll();
        }