Exemple #1
0
        public GtkWindow()
        {
            vbox = new Gtk.VBox();

            menuBox       = new Gtk.HBox();
            topToolbarBox = new Gtk.VBox();

            containerBox         = new Gtk.VBox();
            containerBox.Visible = true;

            bottomToolbarBox = new Gtk.VBox();
        }
Exemple #2
0
        protected GtkWindow()
        {
            vbox       = new Gtk.VBox();
            actionvbox = new Gtk.VBox();

            menuBox       = new Gtk.HBox();
            topToolbarBox = new Gtk.VBox();

            containerBox         = new Gtk.VBox();
            containerBox.Visible = true;

            bottomToolbarBox = new Gtk.VBox();
        }
Exemple #3
0
        void SetContent()
        {
            if (mode == CalendarMode.Single)
            {
                if (box != null)
                {
                    box.Remove(Control);
                }
                align.Remove(box);
                align.Child = Control;
            }
            else
            {
                align.Remove(Control);
                suppressRangeChanged++;
                if (endCalendar == null)
                {
                    endCalendar = new Gtk.Calendar();
                    endCalendar.Show();
                    if (Control.Day == 0)
                    {
                        endCalendar.Day = 0;
                    }
                    else
                    {
                        endCalendar.Date = Control.Date;
                    }
                    endCalendar.DaySelected += Connector.HandleEndDaySelected;
                }
                if (Control.Day == 0)
                {
                    endCalendar.Day = 0;
                }
                suppressRangeChanged--;

                if (box == null)
                {
                    box = new Gtk.HBox();
                }
                else
                {
                    box.Remove(endCalendar);
                }
                box.PackStart(Control, true, true, 0);
                box.PackStart(endCalendar, true, true, 0);
                box.Show();
                align.Child = box;
            }
        }
Exemple #4
0
        protected GtkWindow()
        {
            vbox       = new Gtk.VBox();
            actionvbox = new Gtk.VBox();

            menuBox       = new Gtk.HBox();
            topToolbarBox = new Gtk.VBox();

            containerBox         = new GtkShrinkableVBox();
            containerBox.Visible = true;

            bottomToolbarBox = new Gtk.VBox();

            actionvbox.PackStart(menuBox, false, false, 0);
            actionvbox.PackStart(topToolbarBox, false, false, 0);
            vbox.PackStart(containerBox, true, true, 0);
            vbox.PackStart(bottomToolbarBox, false, false, 0);
        }
Exemple #5
0
        protected override void Initialize()
        {
            base.Initialize();
            Control.KeyPressEvent += Connector.Control_KeyPressEvent;

            var vbox = new EtoVBox {
                Handler = this
            };

            vbox.PackStart(WindowActionControl, false, true, 0);
            vbox.PackStart(WindowContentControl, true, true, 0);

#pragma warning disable 612
            actionarea = Control.ActionArea;
#pragma warning restore 612

#if GTK2
            var content = Control.VBox;
            btcontainer = Control.ActionArea;
#else
            var content = Control.ContentArea;

            actionarea.NoShowAll = true;
            actionarea.Hide();

#if GTKCORE
            if (Helper.UseHeaderBar)
            {
                btcontainer = new Gtk.HeaderBar();

                var title = Control.Title;
                Control.Titlebar = btcontainer;
                Control.Title    = title;
            }
            else
#endif
            btcontainer = actionarea;
#endif

            content.PackStart(vbox, true, true, 0);
        }
Exemple #6
0
        /// <summary>
        /// initialize the widegt
        /// </summary>
        private void init()
        {
            this.Expand = true;
            SetSizeRequest(400, 200);
            NoDateButton = false;
            VBox         = new Gtk.Box(Gtk.Orientation.Vertical, 0);
            HBox         = new Gtk.Box(Gtk.Orientation.Horizontal, 0);

            Calc = new Gtk.Calendar();
            //Calc.DisplayOptions = Gtk.CalendarDisplayOptions.ShowDetails;
            //Calc.SelectionNotifyEvent += HandleSelectionNotifyEvent;
            Calc.ShowAll();
            //Calc.StateChanged += HandleStateChanged;
            HBox.PackStart(Calc, true, true, 0);
            VBox.PackEnd(HBox, true, true, 0);

            Calc.DaySelectedDoubleClick += HandleDaySelectedDoubleClick;

            VBox.ShowAll();
            this.Add(VBox);
        }
Exemple #7
0
		public MainWindow () : base (Catalog.GetString ("Mono Visual Profiler"))
		{
			history = History.Load ();
			history.LogFiles.Changed += UpdateRecentLogs;
			history.Configs.Changed += UpdateRepeatSessions;
			DefaultSize = new Gdk.Size (800, 600);
			Gtk.Box box = new Gtk.VBox (false, 0);
			Gtk.UIManager uim = BuildUIManager ();
 			box.PackStart (uim.GetWidget ("/Menubar"), false, false, 0);
 			box.PackStart (uim.GetWidget ("/Toolbar"), false, false, 0);
			UpdateRecentLogs (null, null);
			UpdateRepeatSessions (null, null);
			content_area = new Gtk.VBox (false, 0);
			content_area.Show ();
			box.PackStart (content_area, true, true, 0);
			StartPage start_page = new StartPage (history);
			start_page.Activated += OnStartPageActivated;
			start_page.Show ();
			View = start_page;
			box.ShowAll ();
			Add (box);
		}
        public MainWindow() : base(Catalog.GetString("Mono Visual Profiler"))
        {
            history = History.Load();
            history.LogFiles.Changed += UpdateRecentLogs;
            history.Configs.Changed  += UpdateRepeatSessions;
            DefaultSize = new Gdk.Size(800, 600);
            Gtk.Box       box = new Gtk.VBox(false, 0);
            Gtk.UIManager uim = BuildUIManager();
            box.PackStart(uim.GetWidget("/Menubar"), false, false, 0);
            box.PackStart(uim.GetWidget("/Toolbar"), false, false, 0);
            UpdateRecentLogs(null, null);
            UpdateRepeatSessions(null, null);
            content_area = new Gtk.VBox(false, 0);
            content_area.Show();
            box.PackStart(content_area, true, true, 0);
            StartPage start_page = new StartPage(history);

            start_page.Activated += OnStartPageActivated;
            start_page.Show();
            View = start_page;
            box.ShowAll();
            Add(box);
        }
Exemple #9
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Control.Destroy();
         if (menuBox != null)
         {
             menuBox.Dispose();
             menuBox = null;
         }
         if (vbox != null)
         {
             vbox.Dispose();
             vbox = null;
         }
         if (containerBox != null)
         {
             containerBox.Dispose();
             containerBox = null;
         }
     }
     base.Dispose(disposing);
 }
Exemple #10
0
        public void SetContent(string label, bool useMnemonic, ImageDescription image, ContentPosition position)
        {
            Widget.UseUnderline = useMnemonic;
            this.image          = image;

            if (label != null && label.Length == 0)
            {
                label = null;
            }

            Button b = (Button)Frontend;

            if (label != null && image.Backend == null && b.Type == ButtonType.Normal)
            {
                Widget.Label = label;
                return;
            }

            if (b.Type == ButtonType.Disclosure)
            {
                Widget.Label = null;
                Widget.Image = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                Widget.Image.ShowAll();
                return;
            }

            Gtk.Widget contentWidget = null;

            Gtk.Widget imageWidget = null;
            if (image.Backend != null)
            {
                imageWidget = new ImageBox(ApplicationContext, image.WithDefaultSize(Gtk.IconSize.Button));
            }

            labelWidget = null;

            if (label != null && imageWidget == null)
            {
                contentWidget = labelWidget = new Gtk.Label(label);
            }
            else if (label == null && imageWidget != null)
            {
                contentWidget = imageWidget;
            }
            else if (label != null && imageWidget != null)
            {
                Gtk.Box box = position == ContentPosition.Left || position == ContentPosition.Right ? (Gtk.Box) new Gtk.HBox(false, 3) : (Gtk.Box) new Gtk.VBox(false, 3);
                labelWidget = new Gtk.Label(label)
                {
                    UseUnderline = useMnemonic
                };

                if (position == ContentPosition.Left || position == ContentPosition.Top)
                {
                    box.PackStart(imageWidget, false, false, 0);
                    box.PackStart(labelWidget, false, false, 0);
                }
                else
                {
                    box.PackStart(labelWidget, false, false, 0);
                    box.PackStart(imageWidget, false, false, 0);
                }

                contentWidget = box;
            }
            var expandButtonContent = false;

            if (b.Type == ButtonType.DropDown)
            {
                if (contentWidget != null)
                {
                    Gtk.HBox box = new Gtk.HBox(false, 3);
                    box.PackStart(contentWidget, true, true, 3);
                    box.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), false, false, 0);
                    contentWidget       = box;
                    expandButtonContent = true;
                }
                else
                {
                    contentWidget = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                }
            }
            if (contentWidget != null)
            {
                contentWidget.ShowAll();
                Widget.Label = null;
                Widget.Image = contentWidget;
                var alignment = Widget.Child as Gtk.Alignment;
                if (alignment != null)
                {
                    if (expandButtonContent)
                    {
                        var box = alignment.Child as Gtk.Box;
                        if (box != null)
                        {
                            alignment.Xscale = 1;
                            box.SetChildPacking(box.Children [0], true, true, 0, Gtk.PackType.Start);
                            if (labelWidget != null)
                            {
                                labelWidget.Xalign = 0;
                            }
                        }
                    }
                    else if (position == ContentPosition.Left && (contentWidget is Gtk.Box))
                    {
                        // in case the button is wider than its natural size and has text and an image on the left,
                        // optimize its alignment to make the text more centered.
                        // FIXME: more sophisticated size calculation
                        alignment.Xalign = 0.475f;
                    }
                }
                if (labelWidget != null)
                {
                    labelWidget.UseUnderline = useMnemonic;
                    if (customFont != null)
                    {
                        labelWidget.ModifyFont(customFont);
                    }
                    if (customLabelColor.HasValue)
                    {
                        labelWidget.SetForegroundColor(customLabelColor.Value);
                        labelWidget.SetForegroundColor(Gtk.StateType.Prelight, customLabelColor.Value);
                    }
                }
            }
            else
            {
                Widget.Label = null;
            }
        }
Exemple #11
0
        public void SetContent(string label, object imageBackend, ContentPosition position)
        {
            if (label != null && label.Length == 0)
            {
                label = null;
            }

            Button b = (Button)Frontend;

            if (label != null && imageBackend == null && b.Type == ButtonType.Normal)
            {
                Widget.Label = label;
                return;
            }

            if (b.Type == ButtonType.Disclosure)
            {
                Widget.Label = null;
                Widget.Image = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                Widget.Image.ShowAll();
                return;
            }

            Gtk.Widget contentWidget = null;

            Gtk.Widget imageWidget = null;
            if (imageBackend != null)
            {
                imageWidget = new Gtk.Image((Gdk.Pixbuf)imageBackend);
            }

            if (label != null && imageWidget == null)
            {
                contentWidget = new Gtk.Label(label);
            }
            else if (label == null && imageWidget != null)
            {
                contentWidget = imageWidget;
            }
            else if (label != null && imageWidget != null)
            {
                Gtk.Box box = position == ContentPosition.Left || position == ContentPosition.Right ? (Gtk.Box) new Gtk.HBox(false, 3) : (Gtk.Box) new Gtk.VBox(false, 3);
                var     lab = new Gtk.Label(label);

                if (position == ContentPosition.Left || position == ContentPosition.Top)
                {
                    box.PackStart(imageWidget, false, false, 0);
                    box.PackStart(lab, false, false, 0);
                }
                else
                {
                    box.PackStart(lab, false, false, 0);
                    box.PackStart(imageWidget, false, false, 0);
                }

                contentWidget = box;
            }
            if (b.Type == ButtonType.DropDown)
            {
                if (contentWidget != null)
                {
                    Gtk.HBox box = new Gtk.HBox(false, 3);
                    box.PackStart(contentWidget, true, true, 3);
                    box.PackStart(new Gtk.VSeparator(), true, true, 0);
                    box.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), false, false, 0);
                    contentWidget = box;
                }
                else
                {
                    contentWidget = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                }
            }
            if (contentWidget != null)
            {
                contentWidget.ShowAll();
                Widget.Label = null;
                Widget.Image = contentWidget;
            }
            else
            {
                Widget.Label = null;
            }
        }
Exemple #12
0
        public virtual void Initialize(PropertyDescriptor prop)
        {
            CheckType(prop);

            this.prop = prop;

            mainHBox = new Gtk.HBox(false, 6);
            PackStart(mainHBox, false, false, 0);

            if (!prop.Translatable)
            {
                return;
            }

            button = new Gtk.Button();
            try {
                globe     = Gdk.Pixbuf.LoadFromResource("globe.png");
                globe_not = Gdk.Pixbuf.LoadFromResource("globe-not.png");
            } catch (Exception e) {
                Console.WriteLine("Error while loading pixbuf: " + e);
            }
            image = new Gtk.Image(globe);
            button.Add(image);
            button.ButtonPressEvent += ButtonPressed;
            mainHBox.PackEnd(button, false, false, 0);
            mainHBox.ShowAll();

            menu = new Gtk.Menu();

            markItem          = new Gtk.CheckMenuItem("Mark for Translation");
            markItem.Toggled += ToggleMark;
            markItem.Show();
            menu.Add(markItem);

            addContextItem            = new Gtk.MenuItem("Add Translation Context Hint");
            addContextItem.Activated += AddContext;
            menu.Add(addContextItem);
            remContextItem            = new Gtk.MenuItem("Remove Translation Context Hint");
            remContextItem.Activated += RemoveContext;
            menu.Add(remContextItem);

            addCommentItem            = new Gtk.MenuItem("Add Comment for Translators");
            addCommentItem.Activated += AddComment;
            menu.Add(addCommentItem);
            remCommentItem            = new Gtk.MenuItem("Remove Comment for Translators");
            remCommentItem.Activated += RemoveComment;
            menu.Add(remCommentItem);

            contextBox = new Gtk.HBox(false, 6);
            Gtk.Label contextLabel = new Gtk.Label("Translation context");
            contextLabel.Xalign = 0.0f;
            contextBox.PackStart(contextLabel, false, false, 0);
            contextEntry            = new Gtk.Entry();
            contextEntry.WidthChars = 8;
            contextBox.PackStart(contextEntry, true, true, 0);
            contextBox.ShowAll();
            contextEntry.Changed += ContextChanged;

            commentBox = new Gtk.VBox(false, 3);
            Gtk.Label commentLabel = new Gtk.Label("Comment for Translators:");
            commentLabel.Xalign = 0.0f;
            commentBox.PackStart(commentLabel, false, false, 0);
            commentText = new TextBox(3);
            commentBox.PackStart(commentText, false, false, 0);
            commentBox.ShowAll();
            commentText.Changed += CommentChanged;
        }
        public void SetContent(string label, bool useMnemonic, ImageDescription image, ContentPosition position)
        {
            Widget.UseUnderline = useMnemonic;
            this.image          = image;

            if (label != null && label.Length == 0)
            {
                label = null;
            }

            Button b = (Button)Frontend;

            if (label != null && image.Backend == null && b.Type == ButtonType.Normal)
            {
                Widget.Label = label;
                return;
            }

            if (b.Type == ButtonType.Disclosure)
            {
                Widget.Label = null;
                Widget.Image = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                Widget.Image.ShowAll();
                return;
            }

            Gtk.Widget contentWidget = null;

            Gtk.Widget imageWidget = null;
            if (image.Backend != null)
            {
                imageWidget = new ImageBox(ApplicationContext, image.WithDefaultSize(Gtk.IconSize.Button));
            }

            Gtk.Label labelWidget = null;

            if (label != null && imageWidget == null)
            {
                contentWidget = labelWidget = new Gtk.Label(label);
            }
            else if (label == null && imageWidget != null)
            {
                contentWidget = imageWidget;
            }
            else if (label != null && imageWidget != null)
            {
                Gtk.Box box = position == ContentPosition.Left || position == ContentPosition.Right ? (Gtk.Box) new Gtk.HBox(false, 3) : (Gtk.Box) new Gtk.VBox(false, 3);
                labelWidget = new Gtk.Label(label)
                {
                    UseUnderline = useMnemonic
                };

                if (position == ContentPosition.Left || position == ContentPosition.Top)
                {
                    box.PackStart(imageWidget, false, false, 0);
                    box.PackStart(labelWidget, false, false, 0);
                }
                else
                {
                    box.PackStart(labelWidget, false, false, 0);
                    box.PackStart(imageWidget, false, false, 0);
                }

                contentWidget = box;
            }
            var expandButtonContent = false;

            if (b.Type == ButtonType.DropDown)
            {
                if (contentWidget != null)
                {
                    Gtk.HBox box = new Gtk.HBox(false, 3);
                    box.PackStart(contentWidget, true, true, 3);
                    box.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), false, false, 0);
                    contentWidget       = box;
                    expandButtonContent = true;
                }
                else
                {
                    contentWidget = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                }
            }
            if (contentWidget != null)
            {
                contentWidget.ShowAll();
                Widget.Label = null;
                Widget.Image = contentWidget;
                if (expandButtonContent)
                {
                    var alignment = Widget.Child as Gtk.Alignment;
                    if (alignment != null)
                    {
                        var box = alignment.Child as Gtk.Box;
                        if (box != null)
                        {
                            alignment.Xscale = 1;
                            box.SetChildPacking(box.Children [0], true, true, 0, Gtk.PackType.Start);
                            if (labelWidget != null)
                            {
                                labelWidget.Xalign = 0;
                            }
                        }
                    }
                }
                if (labelWidget != null)
                {
                    labelWidget.UseUnderline = useMnemonic;
                    if (customFont != null)
                    {
                        labelWidget.ModifyFont(customFont);
                    }
                }
            }
            else
            {
                Widget.Label = null;
            }
        }
Exemple #14
0
        public void SetContent(string label, bool useMnemonic, ImageDescription image, ContentPosition position)
        {
            Widget.UseUnderline = useMnemonic;
            this.image          = image;

            if (label != null && label.Length == 0)
            {
                label = null;
            }

            Button b = (Button)Frontend;

            if (label != null && image.Backend == null && b.Type == ButtonType.Normal)
            {
                Widget.Label = label;
                return;
            }

            if (b.Type == ButtonType.Disclosure)
            {
                Widget.Label = null;
                Widget.Image = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                Widget.Image.ShowAll();
                return;
            }

            Gtk.Widget contentWidget = null;

            Gtk.Widget imageWidget = null;
            if (image.Backend != null)
            {
                imageWidget = new ImageBox(ApplicationContext, image.WithDefaultSize(Gtk.IconSize.Button));
            }

            if (label != null && imageWidget == null)
            {
                contentWidget = new Gtk.Label(label)
                {
                    UseUnderline = useMnemonic
                };
            }
            else if (label == null && imageWidget != null)
            {
                contentWidget = imageWidget;
            }
            else if (label != null && imageWidget != null)
            {
                Gtk.Box box = position == ContentPosition.Left || position == ContentPosition.Right ? (Gtk.Box) new Gtk.HBox(false, 3) : (Gtk.Box) new Gtk.VBox(false, 3);
                var     lab = new Gtk.Label(label)
                {
                    UseUnderline = useMnemonic
                };

                if (position == ContentPosition.Left || position == ContentPosition.Top)
                {
                    box.PackStart(imageWidget, false, false, 0);
                    box.PackStart(lab, false, false, 0);
                }
                else
                {
                    box.PackStart(lab, false, false, 0);
                    box.PackStart(imageWidget, false, false, 0);
                }

                contentWidget = box;
            }
            if (b.Type == ButtonType.DropDown)
            {
                if (contentWidget != null)
                {
                    Gtk.HBox box = new Gtk.HBox(false, 3);
                    box.PackStart(contentWidget, true, true, 3);
                    box.PackStart(new Gtk.VSeparator(), true, true, 0);
                    box.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), false, false, 0);
                    contentWidget = box;
                }
                else
                {
                    contentWidget = new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out);
                }
            }
            if (contentWidget != null)
            {
                contentWidget.ShowAll();
                Widget.Label = null;
                Widget.Image = contentWidget;
            }
            else
            {
                Widget.Label = null;
            }
        }
Exemple #15
0
        /// <summary>
        /// initialize the widegt
        /// </summary>
        private void init()
        {
            this.Expand = true;
            SetSizeRequest(400,200);
            NoDateButton = false;
            VBox = new Gtk.Box(Gtk.Orientation.Vertical,0);
            HBox = new Gtk.Box(Gtk.Orientation.Horizontal,0);

            Calc = new Gtk.Calendar();
            //Calc.DisplayOptions = Gtk.CalendarDisplayOptions.ShowDetails;
            //Calc.SelectionNotifyEvent += HandleSelectionNotifyEvent;
            Calc.ShowAll();
            //Calc.StateChanged += HandleStateChanged;
            HBox.PackStart(Calc,true,true,0);
            VBox.PackEnd(HBox,true,true,0);

            Calc.DaySelectedDoubleClick += HandleDaySelectedDoubleClick;

            VBox.ShowAll();
            this.Add(VBox);
        }
Exemple #16
0
		public virtual void Initialize (PropertyDescriptor prop)
		{
			CheckType (prop);
			
			this.prop = prop;

			mainHBox = new Gtk.HBox (false, 6);
			PackStart (mainHBox, false, false, 0);

			if (!prop.Translatable)
				return;

			button = new Gtk.Button ();
			try {
				globe = Gdk.Pixbuf.LoadFromResource ("globe.png");
				globe_not = Gdk.Pixbuf.LoadFromResource ("globe-not.png");
			} catch (Exception e) {
				Console.WriteLine ("Error while loading pixbuf: " + e);
			}
			image = new Gtk.Image (globe);
			button.Add (image);
			button.ButtonPressEvent += ButtonPressed;
			mainHBox.PackEnd (button, false, false, 0);
			mainHBox.ShowAll ();
			
			menu = new Gtk.Menu ();

			markItem = new Gtk.CheckMenuItem ("Mark for Translation");
			markItem.Toggled += ToggleMark;
			markItem.Show ();
			menu.Add (markItem);
			
			addContextItem = new Gtk.MenuItem ("Add Translation Context Hint");
			addContextItem.Activated += AddContext;
			menu.Add (addContextItem);
			remContextItem = new Gtk.MenuItem ("Remove Translation Context Hint");
			remContextItem.Activated += RemoveContext;
			menu.Add (remContextItem);
			
			addCommentItem = new Gtk.MenuItem ("Add Comment for Translators");
			addCommentItem.Activated += AddComment;
			menu.Add (addCommentItem);
			remCommentItem = new Gtk.MenuItem ("Remove Comment for Translators");
			remCommentItem.Activated += RemoveComment;
			menu.Add (remCommentItem);
			
			contextBox = new Gtk.HBox (false, 6);
			Gtk.Label contextLabel = new Gtk.Label ("Translation context");
			contextLabel.Xalign = 0.0f;
			contextBox.PackStart (contextLabel, false, false, 0);
			contextEntry = new Gtk.Entry ();
			contextEntry.WidthChars = 8;
			contextBox.PackStart (contextEntry, true, true, 0);
			contextBox.ShowAll ();
			contextEntry.Changed += ContextChanged;

			commentBox = new Gtk.VBox (false, 3);
			Gtk.Label commentLabel = new Gtk.Label ("Comment for Translators:");
			commentLabel.Xalign = 0.0f;
			commentBox.PackStart (commentLabel, false, false, 0);
			commentText = new TextBox (3);
			commentBox.PackStart (commentText, false, false, 0);
			commentBox.ShowAll ();
			commentText.Changed += CommentChanged;
		}