Esempio n. 1
0
        private void DisplayEditWidget()
        {
            if (propertyValueEventBox.Child != null)
            {
                propertyValueEventBox.Child.Destroy();
            }

            if (!editing)
            {
                editing = true;
            }

            Widget editWidget = editor.GetEditWidget();

            propertyValueEventBox.Child = editWidget;

            if (editWidget.SizeRequest().Width > 50)
            {
                editWidget.WidthRequest = 50;
                //TODO: Display tooltip of full text when truncated
            }

            propertyValueEventBox.ShowAll();
            editWidget.GrabFocus();
        }
Esempio n. 2
0
        private void AddButtonToStatusWindow(string buttonName, int buttonID)
        {
            TextIter        iter   = StatusWindow.Buffer.EndIter;
            TextChildAnchor anchor = StatusWindow.Buffer.CreateChildAnchor(ref iter);
            EventBox        box    = new EventBox();

            ApsimNG.Classes.CustomButton moreInfo = new ApsimNG.Classes.CustomButton(buttonName, buttonID);
            moreInfo.Clicked += ShowDetailedErrorMessage;
            box.Add(moreInfo);
            StatusWindow.AddChildAtAnchor(box, anchor);
            box.ShowAll();
            box.Realize();
            box.ShowAll();
            moreInfo.ParentWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Arrow);
        }
Esempio n. 3
0
        Widget CreateInnerExceptionsTree()
        {
            InnerExceptionsTreeView = new InnerExceptionsTree();
            InnerExceptionsTreeView.ModifyBase(StateType.Normal, Styles.ExceptionCaughtDialog.TreeBackgroundColor.ToGdkColor());               // background
            InnerExceptionsTreeView.ModifyBase(StateType.Selected, Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor.ToGdkColor());     // selected
            InnerExceptionsTreeView.HeadersVisible = false;
            InnerExceptionsStore = new TreeStore(typeof(ExceptionInfo));

            FillInnerExceptionsStore(InnerExceptionsStore, exception);
            InnerExceptionsTreeView.AppendColumn("Exception", new CellRendererInnerException(), new TreeCellDataFunc((tree_column, cell, tree_model, iter) => {
                var c  = (CellRendererInnerException)cell;
                c.Text = ((ExceptionInfo)tree_model.GetValue(iter, 0)).Type;
            }));
            InnerExceptionsTreeView.ShowExpanders    = false;
            InnerExceptionsTreeView.LevelIndentation = 10;
            InnerExceptionsTreeView.Model            = InnerExceptionsStore;
            InnerExceptionsTreeView.ExpandAll();
            InnerExceptionsTreeView.Selection.Changed += (sender, e) => {
                TreeIter selectedIter;
                if (InnerExceptionsTreeView.Selection.GetSelected(out selectedIter))
                {
                    UpdateSelectedException((ExceptionInfo)InnerExceptionsTreeView.Model.GetValue(selectedIter, 0));
                }
            };
            var eventBox = new EventBox();

            eventBox.ModifyBg(StateType.Normal, Styles.ExceptionCaughtDialog.TreeBackgroundColor.ToGdkColor());               // top and bottom padders
            var vbox = new VBox();

            vbox.PackStart(InnerExceptionsTreeView, true, true, 12);
            eventBox.Add(vbox);
            eventBox.ShowAll();
            return(eventBox);
        }
Esempio n. 4
0
        /// <summary>
        /// Add a tab form to the tab control. Optionally select the tab if SelectTab is true.
        /// </summary>
        public void AddTab(string TabText, string ImageResource, Widget Contents, bool SelectTab)
        {
            Label tabLabel = new Label();

            // If the tab text passed in is a filename then only show the filename (no path)
            // on the tab. The ToolTipText will still have the full path and name.
            if (TabText.Contains(Path.DirectorySeparatorChar.ToString()))
            {
                tabLabel.Text = Path.GetFileNameWithoutExtension(TabText);
            }
            else
            {
                tabLabel.Text = TabText;
            }
            HBox   headerBox = new HBox();
            Button closeBtn  = new Button();
            Image  closeImg  = new Image(new Gdk.Pixbuf(null, "ApsimNG.Resources.Close.png", 12, 12));

            closeBtn.Image    = closeImg;
            closeBtn.Relief   = ReliefStyle.None;
            closeBtn.Clicked += OnCloseBtnClick;

            headerBox.PackStart(tabLabel);
            headerBox.PackEnd(closeBtn);
            headerBox.ButtonPressEvent += on_eventbox1_button_press_event;
            //headerBox.ShowAll();

            // Wrap the whole thing inside an event box, so we can respond to a right-button click
            EventBox eventbox = new EventBox();

            eventbox.ButtonPressEvent += on_eventbox1_button_press_event;
            eventbox.Add(headerBox);
            eventbox.ShowAll();
            notebook1.CurrentPage = notebook1.AppendPageMenu(Contents, eventbox, new Label(tabLabel.Text));
        }
Esempio n. 5
0
        private ChatsPage()
        {
            base.FocusGrabbed += base_FocusGrabbed;

            closePixbuf = new Gdk.Pixbuf(null, "Meshwork.Client.GtkClient.smallclose.png");

            tabLabelPages = new Dictionary <Widget, ChatSubpageBase>();

            notebook                = new Notebook();
            notebook.TabPos         = PositionType.Bottom;
            notebook.SwitchPage    += notebook_SwitchPage;
            notebook.PageReordered += notebook_PageReordered;

            ScrolledWindow swindow = new ScrolledWindow();

            swindow.HscrollbarPolicy = PolicyType.Automatic;
            swindow.VscrollbarPolicy = PolicyType.Automatic;
            chatList = new TreeView();
            swindow.Add(chatList);

            chatTreeStore  = new NetworkGroupedTreeStore <ChatRoom>(chatList);
            chatList.Model = chatTreeStore;

            TreeViewColumn column;

            column        = chatList.AppendColumn("Room Name", new CellRendererText(), new TreeCellDataFunc(NameDataFunc));
            column.Expand = true;
            column.Sizing = TreeViewColumnSizing.Autosize;

            var pixbufCell = new CellRendererPixbuf();

            column.PackStart(pixbufCell, false);
            column.SetCellDataFunc(pixbufCell, new TreeCellDataFunc(RoomSecureDataFunc));

            column        = chatList.AppendColumn("Users", new CellRendererText(), new TreeCellDataFunc(RoomUsersDataFunc));
            column.Sizing = TreeViewColumnSizing.Autosize;

            chatList.RowActivated     += chatList_RowActivated;
            chatList.ButtonPressEvent += chatList_ButtonPressEvent;

            EventBox box = new EventBox();

            box.Add(new Label("Chatroom List"));
            box.ButtonPressEvent += HandleTabButtonPressEvent;
            box.ShowAll();
            notebook.AppendPage(swindow, box);

            this.PackStart(notebook, true, true, 0);
            notebook.ShowAll();

            foreach (Network network in Runtime.Core.Networks)
            {
                Core_NetworkAdded(network);
            }

            Runtime.Core.NetworkAdded +=
                (NetworkEventHandler)DispatchService.GuiDispatch(
                    new NetworkEventHandler(Core_NetworkAdded)
                    );
        }
Esempio n. 6
0
 private void RefreshContent(EventBox newContent)
 {
     _contentContainer.RemoveFromContainer(_content);
     _content = newContent;
     _contentContainer.Add(_content);
     _content.ShowAll();
 }
Esempio n. 7
0
        private void BuildHeader()
        {
            source_actions_align = new Gtk.Alignment(0f, .5f, 1f, 0f)
            {
                RightPadding = 0,
                LeftPadding  = 0,
                NoShowAll    = true
            };

            if (Hyena.PlatformDetection.IsMeeGo)
            {
                source_actions_align.RightPadding = 5;
                source_actions_align.TopPadding   = 5;
            }

            footer = new VBox();

            source_actions_box = new EventBox()
            {
                Visible = true
            };

            BuildSearchEntry();

            InterfaceActionService uia = ServiceManager.Get <InterfaceActionService> ();

            if (uia != null)
            {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null)
                {
                    MenuItem item = new SeparatorMenuItem();
                    item.Show();
                    search_entry.Menu.Append(item);

                    item            = new ImageMenuItem(Stock.Help, null);
                    item.Activated += delegate { action.Activate(); };
                    item.Show();
                    search_entry.Menu.Append(item);
                }
            }

            source_actions_box.ShowAll();
            source_actions_align.Add(source_actions_box);
            source_actions_align.Hide();
            search_entry.Show();


            context_pane = new Banshee.ContextPane.ContextPane();
            context_pane.ExpandHandler = b => {
                SetChildPacking(content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking(context_pane, b, b, 0, PackType.End);
            };

            // Top to bottom, their order is reverse of this:
            PackEnd(footer, false, false, 0);
            PackEnd(context_pane, false, false, 0);
            PackEnd(source_actions_align, false, false, 0);
            PackEnd(new ConnectedMessageBar(), false, true, 0);
        }
Esempio n. 8
0
        private Widget CreateTabLabel(string text)
        {
            Button closeButton = new Button(new Image(closePixbuf));

            closeButton.SetSizeRequest(17, 17);
            closeButton.FocusOnClick = false;
            closeButton.CanFocus     = false;
            closeButton.Relief       = ReliefStyle.None;
            closeButton.Clicked     += closeButton_Clicked;

            HBox labelWidget = new HBox();

            labelWidget.PackStart(new Label(text), true, true, 0);
            labelWidget.PackStart(closeButton, true, true, 0);
            labelWidget.CanFocus = false;

            EventBox box = new EventBox();

            box.Add(labelWidget);
            box.ButtonPressEvent += HandleTabButtonPressEvent;

            box.ShowAll();

            return(box);
        }
Esempio n. 9
0
        private Widget CreateDataSection()
        {
            Table tblMain = new Table(1, 1, false)
            {
                RowSpacing = 2
            };

            tblMain.Attach(new Label {
                Markup = new PangoStyle {
                    Bold = true, Text = Translator.GetString("Displayed columns")
                }
            },
                           0, 1, 0, 1,
                           AttachOptions.Expand | AttachOptions.Fill,
                           AttachOptions.Fill, 0, 2);

            tblColumns = new Table(1, 1, false)
            {
                RowSpacing = 2
            };

            Alignment algColumns = new Alignment(0, 0, 1, 1)
            {
                LeftPadding = 4, RightPadding = 4, TopPadding = 4, BottomPadding = 4
            };

            algColumns.Add(tblColumns);

            Viewport viewport = new Viewport {
                ShadowType = ShadowType.None
            };

            viewport.Add(algColumns);

            ScrolledWindow scw = new ScrolledWindow {
                VscrollbarPolicy = PolicyType.Automatic, HscrollbarPolicy = PolicyType.Never
            };

            scw.Add(viewport);

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

            Alignment alg = new Alignment(0, 0, 1, 1)
            {
                LeftPadding = 4, RightPadding = 4, TopPadding = 4, BottomPadding = 4
            };

            alg.Add(tblMain);

            EventBox evbMain = new EventBox {
                alg
            };

            evbMain.ShowAll();

            return(evbMain);
        }
Esempio n. 10
0
        public void UpdateEventLog()
        {
            if (HTML == null)               // TODO: there may be a race condition here

            {
                LogContent.Remove(LogContent.Child);
                Spinner = new SparkleSpinner(22);
                LogContent.Add(Spinner);
                LogContent.ShowAll();
            }

            Thread thread = new Thread(new ThreadStart(delegate {
                GenerateHTML();
                AddHTML();
            }));

            thread.Start();
        }
Esempio n. 11
0
        private ChatsPage()
        {
            base.FocusGrabbed += base_FocusGrabbed;

            closePixbuf = new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.smallclose.png");

            tabLabelPages = new Dictionary<Widget, ChatSubpageBase>();

            notebook = new Notebook();
            notebook.TabPos = PositionType.Bottom;
            notebook.SwitchPage += notebook_SwitchPage;
            notebook.PageReordered += notebook_PageReordered;

            ScrolledWindow swindow = new ScrolledWindow();
            swindow.HscrollbarPolicy = PolicyType.Automatic;
            swindow.VscrollbarPolicy = PolicyType.Automatic;
            chatList = new TreeView ();
            swindow.Add(chatList);

            chatTreeStore = new NetworkGroupedTreeStore<ChatRoom>(chatList);
            chatList.Model = chatTreeStore;

            TreeViewColumn column;

            column = chatList.AppendColumn("Room Name", new CellRendererText(), new TreeCellDataFunc (NameDataFunc));
            column.Expand = true;
            column.Sizing = TreeViewColumnSizing.Autosize;

            var pixbufCell = new CellRendererPixbuf();
            column.PackStart(pixbufCell, false);
            column.SetCellDataFunc(pixbufCell, new TreeCellDataFunc(RoomSecureDataFunc));

            column = chatList.AppendColumn("Users", new CellRendererText(), new TreeCellDataFunc (RoomUsersDataFunc));
            column.Sizing = TreeViewColumnSizing.Autosize;

            chatList.RowActivated += chatList_RowActivated;
            chatList.ButtonPressEvent += chatList_ButtonPressEvent;

            EventBox box = new EventBox();
            box.Add(new Label("Chatroom List"));
            box.ButtonPressEvent += HandleTabButtonPressEvent;
            box.ShowAll();
            notebook.AppendPage(swindow, box);

            this.PackStart(notebook, true, true, 0);
            notebook.ShowAll();

            foreach (Network network in Core.Networks) {
                Core_NetworkAdded (network);
            }

            Core.NetworkAdded +=
                (NetworkEventHandler)DispatchService.GuiDispatch(
                    new NetworkEventHandler(Core_NetworkAdded)
                );
        }
Esempio n. 12
0
        Widget CreateExceptionHeader()
        {
            var icon = new ImageView(WarningIconPixbuf);

            icon.Yalign = 0;

            ExceptionTypeLabel = new Label {
                Xalign = 0.0f
            };
            ExceptionMessageLabel = new Label {
                Wrap = true, Xalign = 0.0f
            };
            ExceptionTypeLabel.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 255));
            ExceptionMessageLabel.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 255));

            if (Platform.IsWindows)
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("bold 19"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("10"));
            }
            else
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("21"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("12"));
            }

            //Force rendering of background with EventBox
            var eventBox  = new EventBox();
            var hBox      = new HBox();
            var leftVBox  = new VBox();
            var rightVBox = new VBox();

            leftVBox.PackStart(icon, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate

            rightVBox.PackStart(ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2));
            rightVBox.PackStart(ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5));

            hBox.PackStart(leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate
            hBox.PackStart(rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10));

            var frame = new Frame();

            frame.Add(hBox);
            frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10);             // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment
            frame.Shadow      = ShadowType.None;
            frame.ShadowType  = ShadowType.None;

            eventBox.Add(frame);
            eventBox.ShowAll();
            eventBox.ModifyBg(StateType.Normal, new Gdk.Color(119, 130, 140));

            return(eventBox);
        }
Esempio n. 13
0
        public InformationView()
        {
            this.Build();
            this.langsPh.Add(evt);

            evt.Add(languageRepresentation);
            evt.ShowAll();

            languageRepresentation.ShowAll();
            menu = MakeMenu(LangDefinitionService.DefaultPool.Languages.Keys);
            evt.ButtonReleaseEvent += OnBtnReleaseEvent;
        }
Esempio n. 14
0
        EventBoxTooltip CreateTooltip(EventBox eventBox, string tooltipText)
        {
            Xwt.Drawing.Image image = ImageService.GetIcon("md-help");
            eventBox.ModifyBg(StateType.Normal, leftHandBackgroundColor);
            eventBox.Add(new ImageView(image));
            eventBox.ShowAll();

            return(new EventBoxTooltip(eventBox)
            {
                ToolTip = GettextCatalog.GetString(tooltipText),
                Severity = TaskSeverity.Information
            });
        }
        public ScrolledView() : base()
        {
            scroll = new ScrolledWindow(null, null);
            this.Put(scroll, 0, 0);
            scroll.Show();

            //ebox = new BlendBox ();
            ebox = new EventBox();
            this.Put(ebox, 0, 0);
            ebox.ShowAll();

            hide            = new Delay(2000, new GLib.IdleHandler(HideControls));
            this.Destroyed += HandleDestroyed;
        }
Esempio n. 16
0
        public ScrolledView() : base()
        {
            ScrolledWindow = new ScrolledWindow(null, null);
            this.Put(ScrolledWindow, 0, 0);
            ScrolledWindow.Show();

            //ebox = new BlendBox ();
            ControlBox = new EventBox();
            this.Put(ControlBox, 0, 0);
            ControlBox.ShowAll();

            //hide = new DelayedOperation (2000, new GLib.IdleHandler (HideControls));
            this.Destroyed += HandleDestroyed;
        }
Esempio n. 17
0
        EventBoxTooltip ShowErrorTooltip(EventBox eventBox, string tooltipText)
        {
            eventBox.ModifyBg(StateType.Normal, backgroundColor);
            Xwt.Drawing.Image image = ImageService.GetIcon("md-error", IconSize.Menu);

            eventBox.Add(new ImageView(image));
            eventBox.ShowAll();

            return(new EventBoxTooltip(eventBox)
            {
                ToolTip = tooltipText,
                Severity = TaskSeverity.Error
            });
        }
        public ScrolledView()
            : base()
        {
            scroll = new ScrolledWindow  (null, null);
            this.Put (scroll, 0, 0);
            scroll.Show ();

            //ebox = new BlendBox ();
            ebox = new EventBox ();
            this.Put (ebox, 0, 0);
            ebox.ShowAll ();

            hide = new Delay (2000, new GLib.IdleHandler (HideControls));
            this.Destroyed += HandleDestroyed;
        }
Esempio n. 19
0
        public ScrolledView()
            : base()
        {
            ScrolledWindow = new ScrolledWindow  (null, null);
            this.Put (ScrolledWindow, 0, 0);
            ScrolledWindow.Show ();

            //ebox = new BlendBox ();
            ControlBox = new EventBox ();
            this.Put (ControlBox, 0, 0);
            ControlBox.ShowAll ();

            hide = new DelayedOperation (2000, new GLib.IdleHandler (HideControls));
            this.Destroyed += HandleDestroyed;
        }
Esempio n. 20
0
        public X11NotificationAreaBox() : base(Catalog.GetString("Banshee"))
        {
            event_box = new EventBox();
            Add(event_box);
            icon = new Image();

            // Load a 16x16-sized icon to ensure we don't end up with a 1x1 pixel.
            panel_size = 16;
            event_box.Add(icon);

            event_box.ButtonPressEvent += OnButtonPressEvent;
            event_box.EnterNotifyEvent += OnEnterNotifyEvent;
            event_box.LeaveNotifyEvent += OnLeaveNotifyEvent;
            event_box.ScrollEvent      += OnMouseScroll;

            event_box.ShowAll();
        }
Esempio n. 21
0
        /// <summary>Add a tab form to the tab control. Optionally select the tab if SelectTab is true.</summary>
        /// <param name="text">Text for tab.</param>
        /// <param name="image">Image for tab.</param>
        /// <param name="control">Control for tab.</param>
        /// <param name="onLeftTabControl">If true a tab will be added to the left hand tab control.</param>
        public void AddTab(string text, Gtk.Image image, Widget control, bool onLeftTabControl)
        {
            Label tabLabel = new Label();

            // If the tab text passed in is a filename then only show the filename (no path)
            // on the tab. The ToolTipText will still have the full path and name.
            if (text.Contains(Path.DirectorySeparatorChar.ToString()))
            {
                tabLabel.Text = Path.GetFileNameWithoutExtension(text);
            }
            else
            {
                tabLabel.Text = text;
            }
            HBox   headerBox = new HBox();
            Button closeBtn  = new Button();
            string imageName = Utility.Configuration.Settings.DarkTheme ? "Close.dark.svg" : "Close.light.svg";

            Gtk.Image closeImg = new Gtk.Image(new Gdk.Pixbuf(null, $"ApsimNG.Resources.TreeViewImages.{imageName}", 12, 12));

            closeBtn.Image    = closeImg;
            closeBtn.Relief   = ReliefStyle.None;
            closeBtn.Clicked += OnCloseBtnClick;

            headerBox.PackStart(tabLabel, true, true, 0);
            headerBox.PackEnd(closeBtn, true, true, 0);

            // Wrap the whole thing inside an event box, so we can respond to a right-button or center-button click
            EventBox eventbox = new EventBox();

            eventbox.HasTooltip        = text.Contains(Path.DirectorySeparatorChar.ToString());
            eventbox.TooltipText       = text;
            eventbox.ButtonPressEvent += OnEventbox1ButtonPress;
            eventbox.Add(headerBox);
            Notebook notebook = onLeftTabControl ? notebook1 : notebook2;
            // Attach an icon to the context menu
            Widget iconLabel = LabelWithIcon(tabLabel.Text, null);

            notebook.CurrentPage = notebook.AppendPageMenu(control, eventbox, iconLabel);
            // For reasons that I do not understand at all, with Release builds we must delay calling ShowAll until
            // after the page has been added. This is not the case with Debug builds.
            eventbox.ShowAll();
        }
Esempio n. 22
0
        void HandleThumbnailIconViewButtonPressEvent(object sender, Gtk.ButtonPressEventArgs args)
        {
            // Store caption before switching
            StoreCaption();

            int old_item = current_item;

            current_item = tray_view.CellAtPosition((int)args.Event.X, (int)args.Event.Y);

            if (current_item < 0 || current_item >= items.Length)
            {
                current_item = old_item;
                return;
            }

            string caption = captions [current_item];

            if (caption == null)
            {
                captions [current_item] = caption = "";
            }
            caption_textview.Buffer.Text = caption;
            caption_textview.Sensitive   = true;

            tag_treeview.Model = new TagStore(account.Facebook, tags [current_item], friends);

            IPhoto item = items [current_item];

            if (tag_image_eventbox.Children.Length > 0)
            {
                tag_image_eventbox.Remove(tag_image);
                tag_image.Destroy();
            }

            using (Gdk.Pixbuf data = App.Instance.Container.Resolve <IThumbnailService> ().GetThumbnail(item.DefaultVersion.Uri, ThumbnailSize.Large)) {
                tag_image_height = data.Height;
                tag_image_width  = data.Width;
                tag_image        = new Gtk.Image(data);
                tag_image_eventbox.Add(tag_image);
                tag_image_eventbox.ShowAll();
            }
        }
Esempio n. 23
0
        public ColumnControl()
        {
            GripperWidth = 8;

            this.HasWindow    = false;
            this.ExposeEvent += new ExposeEventHandler(TheExposeEvent);

            // need an additional EventBox, because the underlaying Gtk.Fixed widget don't receive and handle some possible events
            // this is one more suspicious behaviour of GTK
            // as you can see, the mouse buttons will be received by the EventBox widget,
            // but the mouse motion received by Fixed widget enabled by the EventBox ...
            EventBox                     = new EventBox();
            EventBox.Events             |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask | Gdk.EventMask.LeaveNotifyMask;
            EventBox.ButtonPressEvent   += new ButtonPressEventHandler(TheButtonPressEvent);
            EventBox.ButtonReleaseEvent += new ButtonReleaseEventHandler(TheButtonReleaseEvent);
            EventBox.LeaveNotifyEvent   += new LeaveNotifyEventHandler(TheLeaveNotifyEvent);
            EventBox.VisibleWindow       = false; // must not drawn itself
            this.Add(EventBox);
            EventBox.ShowAll();
        }
Esempio n. 24
0
        void AddColumn(string title, int ncol, string desc)
        {
            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn();
            Gtk.Label          lab = new Gtk.Label(title);
            lab.Xalign = 1;
            EventBox bx = new EventBox();

            bx.Add(lab);
            bx.ShowAll();
            col.Widget = bx;

            CellRendererText crt = new CellRendererText();

            crt.Xalign = 1;
            col.PackStart(crt, true);
            col.AddAttribute(crt, "text", ncol);

            treeview.AppendColumn(col);
            tips.SetTip(bx, desc, desc);
        }
Esempio n. 25
0
        Widget CreateInnerExceptionsTree()
        {
            innerExceptionsTreeView = new InnerExceptionsTree();
            innerExceptionsTreeView.ModifyBase(StateType.Normal, Styles.ExceptionCaughtDialog.TreeBackgroundColor.ToGdkColor());               // background
            innerExceptionsTreeView.ModifyBase(StateType.Selected, Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor.ToGdkColor());     // selected
            innerExceptionsTreeView.HeadersVisible = false;
            innerExceptionsStore = new TreeStore(typeof(ExceptionInfo));

            FillInnerExceptionsStore(innerExceptionsStore, exception);
            innerExceptionsTreeView.AppendColumn("Exception", new CellRendererInnerException(), new TreeCellDataFunc((tree_column, cell, tree_model, iter) => {
                var c  = (CellRendererInnerException)cell;
                c.Text = ((ExceptionInfo)tree_model.GetValue(iter, 0)).Type;
            }));
            innerExceptionsTreeView.ShowExpanders    = false;
            innerExceptionsTreeView.LevelIndentation = 10;
            innerExceptionsTreeView.Model            = innerExceptionsStore;
            innerExceptionsTreeView.ExpandAll();
            innerExceptionsTreeView.Selection.Changed += (sender, e) => {
                TreeIter selectedIter;
                if (innerExceptionsTreeView.Selection.GetSelected(out selectedIter))
                {
                    UpdateSelectedException((ExceptionInfo)innerExceptionsTreeView.Model.GetValue(selectedIter, 0));
                }
            };
            innerExceptionsTreeView.SetCommonAccessibilityAttributes(
                "ExceptionCaughtDialog.InnerExceptionsTreeView",
                GettextCatalog.GetString("Inner Exceptions"),
                null);
            var eventBox = new EventBox();

            eventBox.ModifyBg(StateType.Normal, Styles.ExceptionCaughtDialog.TreeBackgroundColor.ToGdkColor());               // top and bottom padders
            var vbox   = new VBox();
            var scroll = new ScrolledWindow();

            scroll.WidthRequest = 200;
            scroll.Child        = innerExceptionsTreeView;
            vbox.PackStart(scroll, true, true, 12);
            eventBox.Add(vbox);
            eventBox.ShowAll();
            return(eventBox);
        }
        public NowPlayingContents() : base(1, 1, false)
        {
            NoShowAll = true;

            CreateVideoDisplay();

            video_event = new EventBox();
            video_event.VisibleWindow = false;
            video_event.CanFocus      = true;
            video_event.AboveChild    = true;
            video_event.Add(video_display);
            video_event.Events |= Gdk.EventMask.PointerMotionMask |
                                  Gdk.EventMask.ButtonPressMask |
                                  Gdk.EventMask.ButtonMotionMask |
                                  Gdk.EventMask.KeyPressMask |
                                  Gdk.EventMask.KeyReleaseMask;

            //TODO stop tracking mouse when no more in menu
            video_event.ButtonPressEvent   += OnButtonPress;
            video_event.ButtonReleaseEvent += OnButtonRelease;
            video_event.MotionNotifyEvent  += OnMouseMove;
            video_event.KeyPressEvent      += OnKeyPress;

            IVideoDisplay ivideo_display = video_display as IVideoDisplay;

            if (ivideo_display != null)
            {
                ivideo_display.IdleStateChanged += OnVideoDisplayIdleStateChanged;
            }

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

            track_info_display = new NowPlayingTrackInfoDisplay();
            Attach(track_info_display, 0, 1, 0, 1,
                   AttachOptions.Expand | AttachOptions.Fill,
                   AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            video_event.ShowAll();
        }
Esempio n. 27
0
        public void Open(ITrackingSpan triggerSpan, IList <CompletionItem> items, CompletionItem selectedItem, CompletionItem suggestionModeItem, bool suggestionMode, bool isSoftSelected)
        {
            Instance = this;
            textView.Properties ["RoslynCompletionPresenterSession.IsCompletionActive"] = true;
            textView.LostAggregateFocus += CloseOnTextviewLostFocus;
            box.ShowAll();
            var manager = textView.GetSpaceReservationManager("completion");

            agent = manager.CreatePopupAgent(triggerSpan, Microsoft.VisualStudio.Text.Adornments.PopupStyles.None, Xwt.Toolkit.CurrentEngine.WrapWidget(box, Xwt.NativeWidgetSizing.DefaultPreferredSize));
            //HACK...
            Theme = ((Microsoft.VisualStudio.Text.Editor.Implementation.PopupAgent.PopUpContainer)((Microsoft.VisualStudio.Text.Editor.Implementation.PopupAgent)agent)._popup)._popup.Theme;
            Theme.CornerRadius = 0;
            Theme.Padding      = 0;
            UpdateStyle();
            Ide.Gui.Styles.Changed += HandleThemeChanged;
            IdeApp.Preferences.ColorScheme.Changed += HandleThemeChanged;

            Update(triggerSpan, items, selectedItem, suggestionModeItem, suggestionMode, isSoftSelected);
            manager.AddAgent(agent);
            textView.QueueSpaceReservationStackRefresh();
        }
Esempio n. 28
0
        public static void Main(string[] args)
        {
            configpath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/";
            Application.Init();
            win = new MainWindow();
            var eventbox = new EventBox();

            //win.ExposeEvent += OnExposed;

            var chars       = "abcdefghijklmnopqrstuvwxyz0123456789";       //ABCDEFGHIJKLMNOPQRSTUVWXYZ
            var stringChars = new char[ssnamelength];
            var random      = new Random();

            for (int i = 0; i < stringChars.Length; i++)
            {
                stringChars[i] = chars[random.Next(chars.Length)];
            }
            finalString = new string(stringChars) + ".png";

            win.Hide();
            TakeScreenshot(configpath + finalString.Replace(".png", "_pre.png"));
            win.Show();
            win.Decorated = false;

            img = new Gtk.Image(configpath + finalString.Replace(".png", "_pre.png"));
            eventbox.ButtonPressEvent   += (ButtonPressHandler);
            eventbox.ButtonReleaseEvent += (ButtonReleaseHandler);

            img.Xalign = 0.5f;
            img.Yalign = 0.5f;

            eventbox.Add(img);
            eventbox.ShowAll();
            win.Add(eventbox);
            win.ShowAll();

            win.Move(0, 0);

            Application.Run();
        }
Esempio n. 29
0
            public PopupWindow()
            {
                Color bg = new Color(85, 87, 83);
                Color fg = new Color(211, 215, 207);

                EventBox box = new EventBox();

                vbox = new VBox();

                box.ButtonPressEvent += HandleButtonEvent;

                box.Add(vbox);

                win.Decorated   = false;
                win.BorderWidth = 6;

                win.SetPosition(WindowPosition.CenterAlways);

                image             = new Gtk.Image();
                label             = new Label();
                label.CanFocus    = false;
                label.Wrap        = true;
                urlLabel          = new LinkLabel();
                urlLabel.Clicked += HandleClick;

                win.Add(box);

                win.ModifyBg(StateType.Normal, bg);
                label.ModifyFg(StateType.Normal, fg);
                box.ModifyBg(StateType.Normal, bg);
                urlLabel.ModifyBg(StateType.Selected, bg);
                urlLabel.ModifyBg(StateType.Normal, bg);

                vbox.PackStart(image, true, true, 0);
                vbox.PackStart(label, false, false, 0);
                vbox.PackStart(urlLabel, false, false, 0);

                vbox.Spacing = 6;
                box.ShowAll();
            }
Esempio n. 30
0
        public static void Main(string[] args)
        {
            configpath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/";
            Application.Init();
            win = new MainWindow();
            var eventbox = new EventBox();

            //win.ExposeEvent += OnExposed;

            var chars = "abcdefghijklmnopqrstuvwxyz0123456789"; //ABCDEFGHIJKLMNOPQRSTUVWXYZ
            var stringChars = new char[ssnamelength];
            var random = new Random();
            for (int i = 0; i < stringChars.Length; i++)
            {
                stringChars[i] = chars[random.Next(chars.Length)];
            }
            finalString = new string(stringChars) + ".png";

            win.Hide();
            TakeScreenshot(configpath + finalString.Replace(".png", "_pre.png"));
            win.Show();
            win.Decorated = false;

            img = new Gtk.Image(configpath + finalString.Replace(".png", "_pre.png"));
            eventbox.ButtonPressEvent += (ButtonPressHandler);
            eventbox.ButtonReleaseEvent += (ButtonReleaseHandler);

            img.Xalign = 0.5f;
            img.Yalign = 0.5f;

            eventbox.Add(img);
            eventbox.ShowAll();
            win.Add(eventbox);
            win.ShowAll();

            win.Move(0, 0);

            Application.Run();
        }
Esempio n. 31
0
        public X11NotificationAreaBox() : base(Catalog.GetString("Banshee"))
        {
            // NOTE: this is a dummy call to ensure we're actually on X11,
            // otherwise X11 calls won't get made until we are realized,
            // at which point it is too late to fall back to xplat GTK tray
            gdk_x11_get_default_screen();

            event_box = new EventBox();
            Add(event_box);
            icon = new Image();

            // Load a 16x16-sized icon to ensure we don't end up with a 1x1 pixel.
            panel_size = 16;
            event_box.Add(icon);

            event_box.ButtonPressEvent += OnButtonPressEvent;
            event_box.EnterNotifyEvent += OnEnterNotifyEvent;
            event_box.LeaveNotifyEvent += OnLeaveNotifyEvent;
            event_box.ScrollEvent      += OnMouseScroll;

            event_box.ShowAll();
        }
        Gtk.Widget AddFeature(ISolutionItemFeature feature)
        {
            Gtk.HBox    cbox  = new Gtk.HBox();
            CheckButton check = null;

            Label fl = new Label();

            fl.Wrap         = true;
            fl.WidthRequest = 630;
            fl.Markup       = "<b>" + feature.Title + "</b>\n<small>" + feature.Description + "</small>";
            bool enabledByDefault = feature.GetSupportLevel(parentCombine, entry) == FeatureSupportLevel.Enabled;

            if (enabledByDefault)
            {
                Alignment al = new Alignment(0, 0, 0, 0);
                al.SetPadding(6, 6, 6, 6);
                al.Add(fl);
                cbox.PackStart(al, false, false, 0);
            }
            else
            {
                check       = new CheckButton();
                check.Image = fl;
                cbox.PackStart(check, false, false, 0);
                check.ModifyBg(StateType.Prelight, Style.MidColors [(int)StateType.Normal]);
                check.BorderWidth = 3;
            }
            EventBox eb = new EventBox();

            if (!enabledByDefault)
            {
                eb.Realized += delegate {
                    eb.GdkWindow.Cursor = handCursor;
                };
            }
            eb.ModifyBg(StateType.Normal, Style.MidColors[(int)StateType.Normal]);
            eb.Add(cbox);
            eb.ShowAll();
            box.PackStart(eb, false, false, 0);

            HBox fbox = new HBox();

            Gtk.Widget editor = feature.CreateFeatureEditor(parentCombine, entry);
            if (editor != null)
            {
                Label sp = new Label("");
                sp.WidthRequest = 24;
                sp.Show();
                fbox.PackStart(sp, false, false, 0);
                editor.Show();
                fbox.PackStart(editor, false, false, 0);
                box.PackStart(fbox, false, false, 0);
            }

            if (check != null)
            {
                ISolutionItemFeature f = feature;
                check.Toggled += delegate {
                    OnClickFeature(f, check, fbox, editor);
                };
            }
            else
            {
                fbox.Show();
            }
            return(editor);
        }
Esempio n. 33
0
		void AddColumn (string title, int ncol, string desc)
		{
			Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
			Gtk.Label lab = new Gtk.Label (title);
			lab.Xalign = 1;
			EventBox bx = new EventBox ();
			bx.Add (lab);
			bx.ShowAll ();
			col.Widget = bx;
			
			CellRendererText crt = new CellRendererText ();
			crt.Xalign = 1;
			col.PackStart (crt, true);
			col.AddAttribute (crt, "text", ncol);
			
			treeview.AppendColumn (col);
			tips.SetTip (bx, desc, desc);
		}
 public IStatusIcon ShowStatusIcon(Gtk.Image image)
 {
     EventBox ebox = new EventBox ();
     ebox.Child = image;
     statusBox.PackEnd (ebox, false, false, 2);
     statusBox.ReorderChild (ebox, 0);
     ebox.ShowAll ();
     return new StatusIcon (ebox);
 }
Esempio n. 35
0
        private Widget CreateTabLabel(string text)
        {
            Button closeButton = new Button(new Image(closePixbuf));
            closeButton.SetSizeRequest(17,17);
            closeButton.FocusOnClick = false;
            closeButton.CanFocus = false;
            closeButton.Relief = ReliefStyle.None;
            closeButton.Clicked += closeButton_Clicked;

            HBox labelWidget = new HBox();
            labelWidget.PackStart(new Label(text), true, true, 0);
            labelWidget.PackStart(closeButton, true, true, 0);
            labelWidget.CanFocus = false;

            EventBox box = new EventBox();
            box.Add(labelWidget);
            box.ButtonPressEvent += HandleTabButtonPressEvent;

            box.ShowAll();

            return box;
        }
Esempio n. 36
0
		Widget CreateExceptionHeader ()
		{
			var icon = new ImageView (WarningIconPixbuf);
			icon.Yalign = 0;

			ExceptionTypeLabel = new Label { Xalign = 0.0f, Selectable = true };
			ExceptionMessageLabel = new Label { Wrap = true, Xalign = 0.0f, Selectable = true };
			ExceptionTypeLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255));
			ExceptionMessageLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255));

			if (Platform.IsWindows) {
				ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("bold 19"));
				ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("10"));
			} else {
				ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("21"));
				ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("12"));
			}

			//Force rendering of background with EventBox
			var eventBox = new EventBox ();
			var hBox = new HBox ();
			var leftVBox = new VBox ();
			rightVBox = new VBox ();
			leftVBox.PackStart (icon, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate

			rightVBox.PackStart (ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2));
			rightVBox.PackStart (ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5));

			hBox.PackStart (leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate
			hBox.PackStart (rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10));

			var frame = new Frame ();
			frame.Add (hBox);
			frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10); // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment
			frame.Shadow = ShadowType.None;
			frame.ShadowType = ShadowType.None;

			eventBox.Add (frame);
			eventBox.ShowAll ();
			eventBox.ModifyBg (StateType.Normal, new Gdk.Color (119, 130, 140));

			return eventBox;
		}
Esempio n. 37
0
		Widget CreateInnerExceptionsTree ()
		{
			InnerExceptionsTreeView = new InnerExceptionsTree ();
			InnerExceptionsTreeView.ModifyBase (StateType.Normal, Styles.ExceptionCaughtDialog.TreeBackgroundColor.ToGdkColor ()); // background
			InnerExceptionsTreeView.ModifyBase (StateType.Selected, Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor.ToGdkColor ()); // selected
			InnerExceptionsTreeView.HeadersVisible = false;
			InnerExceptionsStore = new TreeStore (typeof (ExceptionInfo));

			FillInnerExceptionsStore (InnerExceptionsStore, exception);
			InnerExceptionsTreeView.AppendColumn ("Exception", new CellRendererInnerException (), new TreeCellDataFunc ((tree_column, cell, tree_model, iter) => {
				var c = (CellRendererInnerException)cell;
				c.Text = ((ExceptionInfo)tree_model.GetValue (iter, 0)).Type;
			}));
			InnerExceptionsTreeView.ShowExpanders = false;
			InnerExceptionsTreeView.LevelIndentation = 10;
			InnerExceptionsTreeView.Model = InnerExceptionsStore;
			InnerExceptionsTreeView.ExpandAll ();
			InnerExceptionsTreeView.Selection.Changed += (sender, e) => {
				TreeIter selectedIter;
				if (InnerExceptionsTreeView.Selection.GetSelected (out selectedIter)) {
					UpdateSelectedException ((ExceptionInfo)InnerExceptionsTreeView.Model.GetValue (selectedIter, 0));
				}
			};
			var eventBox = new EventBox ();
			eventBox.ModifyBg (StateType.Normal, Styles.ExceptionCaughtDialog.TreeBackgroundColor.ToGdkColor ()); // top and bottom padders
			var vbox = new VBox ();
			vbox.PackStart (InnerExceptionsTreeView, true, true, 12);
			eventBox.Add (vbox);
			eventBox.ShowAll ();
			return eventBox;
		}
		Gtk.Widget AddFeature (ISolutionItemFeature feature)
		{
			Gtk.HBox cbox = new Gtk.HBox ();
			CheckButton check = null;
			
			Label fl = new Label ();
			fl.Wrap = true;
			fl.WidthRequest = 630;
			fl.Markup = "<b>" + feature.Title + "</b>\n<small>" + feature.Description + "</small>";
			bool enabledByDefault = feature.GetSupportLevel (parentCombine, entry) == FeatureSupportLevel.Enabled;

			if (enabledByDefault) {
				Alignment al = new Alignment (0,0,0,0);
				al.SetPadding (6,6,6,6);
				al.Add (fl);
				cbox.PackStart (al, false, false, 0);
			}
			else {
				check = new CheckButton ();
				check.Image = fl;
				cbox.PackStart (check, false, false, 0);
				check.ModifyBg (StateType.Prelight, Style.MidColors [(int)StateType.Normal]);
				check.BorderWidth = 3;
			}
			EventBox eb = new EventBox ();
			if (!enabledByDefault) {
				eb.Realized += delegate {
					eb.GdkWindow.Cursor = handCursor;
				};
			}
			eb.ModifyBg (StateType.Normal, Style.MidColors[(int)StateType.Normal]);
			eb.Add (cbox);
			eb.ShowAll ();
			box.PackStart (eb, false, false, 0);
			
			HBox fbox = new HBox ();
			Gtk.Widget editor = feature.CreateFeatureEditor (parentCombine, entry);
			if (editor != null) {
				Label sp = new Label ("");
				sp.WidthRequest = 24;
				sp.Show ();
				fbox.PackStart (sp, false, false, 0);
				editor.Show ();
				fbox.PackStart (editor, false, false, 0);
				box.PackStart (fbox, false, false, 0);
			}
			
			if (check != null) {
				ISolutionItemFeature f = feature;
				check.Toggled += delegate {
					OnClickFeature (f, check, fbox, editor);
				};
			} else {
				fbox.Show ();
			}
			return editor;
		}
Esempio n. 39
0
            public PopupWindow()
            {
                Color bg = new Color (85, 87, 83);
                Color fg = new Color (211, 215, 207);

                EventBox box = new EventBox ();
                vbox = new VBox();

                box.ButtonPressEvent += HandleButtonEvent;

                box.Add (vbox);

                win.Decorated = false;
                win.BorderWidth = 6;

                win.SetPosition(WindowPosition.CenterAlways);

                image = new Gtk.Image ();
                label = new Label ();
                label.CanFocus = false;
                label.Wrap = true;
                urlLabel = new LinkLabel ();
                urlLabel.Clicked += HandleClick;

                win.Add(box);

                win.ModifyBg (StateType.Normal, bg);
                label.ModifyFg (StateType.Normal, fg);
                box.ModifyBg (StateType.Normal, bg);
                urlLabel.ModifyBg (StateType.Selected, bg);
                urlLabel.ModifyBg (StateType.Normal, bg);

                vbox.PackStart (image, true, true, 0);
                vbox.PackStart (label, false, false, 0);
                vbox.PackStart (urlLabel, false, false, 0);

                vbox.Spacing = 6;
                box.ShowAll ();
            }
Esempio n. 40
0
        private NetworkOverviewPage()
        {
            /* Build the UI */

            CreateUserList ();

            /* Create mainbar */

            Widget mapWidget = null;
            try {
                map = new ZoomableNetworkMap ();
                map.SelectedNodeChanged += map_SelectedNodeChanged;
                map.NodeDoubleClicked += map_NodeDoubleClicked;
                mapWidget = map;
            } catch (Exception ex) {
                LoggingService.LogError("Failed to load map !!!", ex);
                mapWidget = new Label("Error loading map.");
            }

            this.Pack1 (mapWidget, true, true);

            /* Create sidebar */
            sidebar = new EventBox();
            sidebar.WidthRequest = 190;

            var sidebarBox = new Gtk.VBox();
            sidebar.Add(sidebarBox);

            var headerAlign = new Banshee.Widgets.FadingAlignment();
            sidebarBox.PackStart(headerAlign, false, false, 0);

            var headerLabel = new Gtk.Label();
            headerLabel.Markup = "<b>Users</b>";
            headerLabel.Xalign = 0;
            headerLabel.Ypad = 6;
            headerLabel.Xpad = 6;
            headerAlign.Add(headerLabel);

            sidebarBox.PackStart(AddScrolledWindow(userList), true, true, 0);

            this.Pack2(sidebar, false, true);

            sidebar.ShowAll();

            foreach (Network network in Core.Networks) {
                Core_NetworkAdded (network);
            }

            Core.TransportManager.TransportError +=
                (TransportErrorEventHandler)DispatchService.GuiDispatch(
                    new TransportErrorEventHandler(Core_TransportError)
                );

            Core.NetworkAdded +=
                (NetworkEventHandler)DispatchService.GuiDispatch(
                    new NetworkEventHandler(Core_NetworkAdded)
                );

            Core.NetworkRemoved +=
                (NetworkEventHandler)DispatchService.GuiDispatch(
                    new NetworkEventHandler(Core_NetworkRemoved)
                );

            Core.AvatarManager.AvatarsChanged +=
                (EventHandler)DispatchService.GuiDispatch(
                    new EventHandler(AvatarManager_AvatarsChanged)
                );

            this.ShowAll();
        }
Esempio n. 41
0
        public Widget CreateBuildResultsWidget(Orientation orientation)
        {
            EventBox ebox = new EventBox ();

            Gtk.Box box;
            if (orientation == Orientation.Horizontal)
                box = new HBox ();
            else
                box = new VBox ();
            box.Spacing = 3;

            var errorIcon = ImageService.GetIcon (StockIcons.Error).WithSize (Xwt.IconSize.Small);
            var warningIcon = ImageService.GetIcon (StockIcons.Warning).WithSize (Xwt.IconSize.Small);

            var errorImage = new Xwt.ImageView (errorIcon);
            var warningImage = new Xwt.ImageView (warningIcon);

            box.PackStart (errorImage.ToGtkWidget (), false, false, 0);
            Label errors = new Gtk.Label ();
            box.PackStart (errors, false, false, 0);

            box.PackStart (warningImage.ToGtkWidget (), false, false, 0);
            Label warnings = new Gtk.Label ();
            box.PackStart (warnings, false, false, 0);
            box.NoShowAll = true;
            box.Show ();

            TaskEventHandler updateHandler = delegate {
                int ec=0, wc=0;

                foreach (Task t in TaskService.Errors) {
                    if (t.Severity == TaskSeverity.Error)
                        ec++;
                    else if (t.Severity == TaskSeverity.Warning)
                        wc++;
                }

                using (var font = FontService.SansFont.CopyModified (0.8d)) {
                    errors.Visible = ec > 0;
                    errors.ModifyFont (font);
                    errors.Text = ec.ToString ();
                    errorImage.Visible = ec > 0;

                    warnings.Visible = wc > 0;
                    warnings.ModifyFont (font);
                    warnings.Text = wc.ToString ();
                    warningImage.Visible = wc > 0;
                }

                ebox.Visible = ec > 0 || wc > 0;

                UpdateSeparators ();
            };

            updateHandler (null, null);

            TaskService.Errors.TasksAdded += updateHandler;
            TaskService.Errors.TasksRemoved += updateHandler;

            box.Destroyed += delegate {
                TaskService.Errors.TasksAdded -= updateHandler;
                TaskService.Errors.TasksRemoved -= updateHandler;
            };

            ebox.VisibleWindow = false;
            ebox.Add (box);
            ebox.ShowAll ();
            ebox.ButtonReleaseEvent += delegate {
                var pad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
                pad.BringToFront ();
            };

            errors.Visible = false;
            errorImage.Visible = false;
            warnings.Visible = false;
            warningImage.Visible = false;

            return ebox;
        }
Esempio n. 42
0
        public Widget CreateBuildResultsWidget(Orientation orientation)
        {
            EventBox ebox = new EventBox();

            Gtk.Box box;
            if (orientation == Orientation.Horizontal)
            {
                box = new HBox();
            }
            else
            {
                box = new VBox();
            }
            box.Spacing = 3;

            var errorIcon   = ImageService.GetIcon(StockIcons.Error).WithSize(Xwt.IconSize.Small);
            var warningIcon = ImageService.GetIcon(StockIcons.Warning).WithSize(Xwt.IconSize.Small);

            var errorImage   = new Xwt.ImageView(errorIcon);
            var warningImage = new Xwt.ImageView(warningIcon);

            box.PackStart(errorImage.ToGtkWidget(), false, false, 0);
            Label errors = new Gtk.Label();

            box.PackStart(errors, false, false, 0);

            box.PackStart(warningImage.ToGtkWidget(), false, false, 0);
            Label warnings = new Gtk.Label();

            box.PackStart(warnings, false, false, 0);
            box.NoShowAll = true;
            box.Show();

            TaskEventHandler updateHandler = delegate {
                int ec = 0, wc = 0;

                foreach (Task t in TaskService.Errors)
                {
                    if (t.Severity == TaskSeverity.Error)
                    {
                        ec++;
                    }
                    else if (t.Severity == TaskSeverity.Warning)
                    {
                        wc++;
                    }
                }


                using (var font = FontService.SansFont.CopyModified(0.8d)) {
                    errors.Visible = ec > 0;
                    errors.ModifyFont(font);
                    errors.Text        = ec.ToString();
                    errorImage.Visible = ec > 0;

                    warnings.Visible = wc > 0;
                    warnings.ModifyFont(font);
                    warnings.Text        = wc.ToString();
                    warningImage.Visible = wc > 0;
                }

                ebox.Visible = ec > 0 || wc > 0;

                UpdateSeparators();
            };

            updateHandler(null, null);

            TaskService.Errors.TasksAdded   += updateHandler;
            TaskService.Errors.TasksRemoved += updateHandler;

            box.Destroyed += delegate {
                TaskService.Errors.TasksAdded   -= updateHandler;
                TaskService.Errors.TasksRemoved -= updateHandler;
            };

            ebox.VisibleWindow = false;
            ebox.Add(box);
            ebox.ShowAll();
            ebox.ButtonReleaseEvent += delegate {
                var pad = IdeApp.Workbench.GetPad <MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
                pad.BringToFront();
            };

            errors.Visible       = false;
            errorImage.Visible   = false;
            warnings.Visible     = false;
            warningImage.Visible = false;

            return(ebox);
        }
		EventBoxTooltip CreateTooltip (EventBox eventBox, string tooltipText)
		{
			Xwt.Drawing.Image image = ImageService.GetIcon ("md-information");
			eventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor);
			eventBox.Add (new ImageView (image));
			eventBox.ShowAll ();

			return new EventBoxTooltip (eventBox) {
				ToolTip = GettextCatalog.GetString (tooltipText),
				Severity = TaskSeverity.Information
			};
		}
        public X11NotificationAreaBox () : base (Catalog.GetString ("Banshee"))
        {
            // NOTE: this is a dummy call to ensure we're actually on X11,
            // otherwise X11 calls won't get made until we are realized,
            // at which point it is too late to fall back to xplat GTK tray
            gdk_x11_get_default_screen ();

            event_box = new EventBox ();
            Add (event_box);
            icon = new Image ();

            // Load a 16x16-sized icon to ensure we don't end up with a 1x1 pixel.
            panel_size = 16;
            event_box.Add (icon);

            event_box.ButtonPressEvent += OnButtonPressEvent;
            event_box.EnterNotifyEvent += OnEnterNotifyEvent;
            event_box.LeaveNotifyEvent += OnLeaveNotifyEvent;
            event_box.ScrollEvent += OnMouseScroll;

            event_box.ShowAll ();
        }
Esempio n. 45
0
        /// <summary>Add a tab form to the tab control. Optionally select the tab if SelectTab is true.</summary>
        /// <param name="text">Text for tab.</param>
        /// <param name="image">Image for tab.</param>
        /// <param name="control">Control for tab.</param>
        /// <param name="onLeftTabControl">If true a tab will be added to the left hand tab control.</param>
        public void AddTab(string text, Gtk.Image image, Widget control, bool onLeftTabControl)
        {
            Label tabLabel = new Label();
            // If the tab text passed in is a filename then only show the filename (no path)
            // on the tab. The ToolTipText will still have the full path and name.
            if (text.Contains(Path.DirectorySeparatorChar.ToString()))
                tabLabel.Text = Path.GetFileNameWithoutExtension(text);
            else
                tabLabel.Text = text;
            HBox headerBox = new HBox();
            Button closeBtn = new Button();
            Gtk.Image closeImg = new Gtk.Image(new Gdk.Pixbuf(null, "ApsimNG.Resources.Close.png", 12, 12));

            closeBtn.Image = closeImg;
            closeBtn.Relief = ReliefStyle.None;
            closeBtn.Clicked += OnCloseBtnClick;

            headerBox.PackStart(tabLabel);
            headerBox.PackEnd(closeBtn);
            headerBox.ButtonPressEvent += on_eventbox1_button_press_event;

            // Wrap the whole thing inside an event box, so we can respond to a right-button click
            EventBox eventbox = new EventBox();
            eventbox.HasTooltip = text.Contains(Path.DirectorySeparatorChar.ToString());
            eventbox.TooltipText = text;
            eventbox.Add(headerBox);
            eventbox.ShowAll();
            Notebook notebook = onLeftTabControl ? notebook1 : notebook2;
            notebook.CurrentPage = notebook.AppendPageMenu(control, eventbox, new Label(tabLabel.Text));
        }
Esempio n. 46
0
        Widget CreateExceptionHeader()
        {
            var icon = new ImageView(WarningIconPixbuf);

            icon.Yalign = 0;

            ExceptionTypeLabel = new Label {
                Xalign = 0.0f, Selectable = true, CanFocus = false
            };
            ExceptionMessageLabel = new Label {
                Wrap = true, Xalign = 0.0f, Selectable = true, CanFocus = false
            };
            ExceptionHelpLinkLabel = new Label {
                Wrap = true, Xalign = 0.0f, Selectable = true, CanFocus = false, UseMarkup = true, LineWrapMode = Pango.WrapMode.Char
            };
            ExceptionHelpLinkLabel.Name = "exception_help_link_label";
            Gtk.Rc.ParseString(@"style ""exception-help-link-label""
{
	GtkWidget::link-color = ""#ffffff""
	GtkWidget::visited-link-color = ""#ffffff""
}
widget ""*.exception_help_link_label"" style ""exception-help-link-label""
");

            var textColor = Styles.ExceptionCaughtDialog.HeaderTextColor.ToGdkColor();

            ExceptionHelpLinkLabel.ModifyBase(StateType.Prelight, Styles.ExceptionCaughtDialog.HeaderBackgroundColor.ToGdkColor());
            ExceptionHelpLinkLabel.SetLinkHandler((str) => DesktopService.ShowUrl(str));
            ExceptionTypeLabel.ModifyFg(StateType.Normal, textColor);
            ExceptionMessageLabel.ModifyFg(StateType.Normal, textColor);
            ExceptionHelpLinkLabel.ModifyFg(StateType.Normal, textColor);

            if (Platform.IsWindows)
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("bold 19"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("10"));
                ExceptionHelpLinkLabel.ModifyFont(Pango.FontDescription.FromString("10"));
            }
            else
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("21"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("12"));
                ExceptionHelpLinkLabel.ModifyFont(Pango.FontDescription.FromString("12"));
            }

            //Force rendering of background with EventBox
            var eventBox = new EventBox();
            var hBox     = new HBox();
            var leftVBox = new VBox();

            rightVBox = new VBox();
            leftVBox.PackStart(icon, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate

            rightVBox.PackStart(ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2));
            rightVBox.PackStart(ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5));
            rightVBox.PackStart(ExceptionHelpLinkLabel, false, false, 2);

            hBox.PackStart(leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate
            hBox.PackStart(rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10));

            var frame = new Frame();

            frame.Add(hBox);
            frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10);             // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment
            frame.Shadow      = ShadowType.None;
            frame.ShadowType  = ShadowType.None;

            eventBox.Add(frame);
            eventBox.ShowAll();
            eventBox.ModifyBg(StateType.Normal, Styles.ExceptionCaughtDialog.HeaderBackgroundColor.ToGdkColor());

            return(eventBox);
        }
		EventBoxTooltip ShowErrorTooltip (EventBox eventBox, string tooltipText)
		{
			eventBox.ModifyBg (StateType.Normal, backgroundColor);
			Xwt.Drawing.Image image = ImageService.GetIcon ("md-error", IconSize.Menu);

			eventBox.Add (new ImageView (image));
			eventBox.ShowAll ();

			return new EventBoxTooltip (eventBox) {
				ToolTip = tooltipText,
				Severity = TaskSeverity.Error
			};
		}
Esempio n. 48
0
        private void BuildHeader ()
        {
            source_actions_align = new Gtk.Alignment (0f, .5f, 1f, 0f) {
                RightPadding = 0,
                LeftPadding = 0,
                NoShowAll = true
            };

            if (Hyena.PlatformDetection.IsMeeGo) {
                source_actions_align.RightPadding = 5;
                source_actions_align.TopPadding = 5;
            }

            footer = new VBox ();

            source_actions_box = new EventBox () { Visible = true };

            BuildSearchEntry ();

            InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
            if (uia != null) {
                Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
                if (action != null) {
                    MenuItem item = new SeparatorMenuItem ();
                    item.Show ();
                    search_entry.Menu.Append (item);

                    item = new ImageMenuItem (Stock.Help, null);
                    item.Activated += delegate { action.Activate (); };
                    item.Show ();
                    search_entry.Menu.Append (item);
                }
            }

            source_actions_box.ShowAll ();
            source_actions_align.Add (source_actions_box);
            source_actions_align.Hide ();
            search_entry.Show ();


            context_pane = new Banshee.ContextPane.ContextPane ();
            context_pane.ExpandHandler = b => {
                SetChildPacking (content.Widget, !b, true, 0, PackType.Start);
                SetChildPacking (context_pane, b, b, 0, PackType.End);
            };

            // Top to bottom, their order is reverse of this:
            PackEnd (footer, false, false, 0);
            PackEnd (context_pane, false, false, 0);
            PackEnd (source_actions_align, false, false, 0);
            PackEnd (new ConnectedMessageBar (), false, true, 0);
        }
Esempio n. 49
0
        public NowPlayingContents () : base (1, 1, false)
        {
            NoShowAll = true;

            CreateVideoDisplay ();

            video_event = new EventBox ();
            video_event.VisibleWindow = false;
            video_event.CanFocus = true;
            video_event.AboveChild = true;
            video_event.Add (video_display);
            video_event.Events |= Gdk.EventMask.PointerMotionMask |
                    Gdk.EventMask.ButtonPressMask |
                    Gdk.EventMask.ButtonMotionMask |
                    Gdk.EventMask.KeyPressMask |
                    Gdk.EventMask.KeyReleaseMask;

            //TODO stop tracking mouse when no more in menu
            video_event.ButtonPressEvent += OnButtonPress;
            video_event.ButtonReleaseEvent += OnButtonRelease;
            video_event.MotionNotifyEvent += OnMouseMove;
            video_event.KeyPressEvent += OnKeyPress;

            IVideoDisplay ivideo_display = video_display as IVideoDisplay;
            if (ivideo_display != null) {
                ivideo_display.IdleStateChanged += OnVideoDisplayIdleStateChanged;
            }

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

            track_info_display = new NowPlayingTrackInfoDisplay ();
            Attach (track_info_display, 0, 1, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            video_event.ShowAll ();
        }
Esempio n. 50
0
		public Widget CreateBuildResultsWidget (Orientation orientation)
		{
			EventBox ebox = new EventBox ();

			Gtk.Box box;
			if (orientation == Orientation.Horizontal)
				box = new HBox ();
			else
				box = new VBox ();
			box.Spacing = 3;
			
			Gdk.Pixbuf errorIcon = ImageService.GetPixbuf (StockIcons.Error, IconSize.Menu);
			Gdk.Pixbuf noErrorIcon = ImageService.MakeGrayscale (errorIcon); // creates a new pixbuf instance
			Gdk.Pixbuf warningIcon = ImageService.GetPixbuf (StockIcons.Warning, IconSize.Menu);
			Gdk.Pixbuf noWarningIcon = ImageService.MakeGrayscale (warningIcon); // creates a new pixbuf instance
			
			Gtk.Image errorImage = new Gtk.Image (errorIcon);
			Gtk.Image warningImage = new Gtk.Image (warningIcon);
			
			box.PackStart (errorImage, false, false, 0);
			Label errors = new Gtk.Label ();
			box.PackStart (errors, false, false, 0);
			
			box.PackStart (warningImage, false, false, 0);
			Label warnings = new Gtk.Label ();
			box.PackStart (warnings, false, false, 0);
			box.NoShowAll = true;
			box.Show ();
			
			TaskEventHandler updateHandler = delegate {
				int ec=0, wc=0;
				foreach (Task t in TaskService.Errors) {
					if (t.Severity == TaskSeverity.Error)
						ec++;
					else if (t.Severity == TaskSeverity.Warning)
						wc++;
				}
				errors.Visible = ec > 0;
				errors.Text = ec.ToString ();
				errorImage.Visible = ec > 0;

				warnings.Visible = wc > 0;
				warnings.Text = wc.ToString ();
				warningImage.Visible = wc > 0;
				ebox.Visible = ec > 0 || wc > 0;
				UpdateSeparators ();
			};
			
			updateHandler (null, null);
			
			TaskService.Errors.TasksAdded += updateHandler;
			TaskService.Errors.TasksRemoved += updateHandler;
			
			box.Destroyed += delegate {
				noErrorIcon.Dispose ();
				noWarningIcon.Dispose ();
				TaskService.Errors.TasksAdded -= updateHandler;
				TaskService.Errors.TasksRemoved -= updateHandler;
			};

			ebox.VisibleWindow = false;
			ebox.Add (box);
			ebox.ShowAll ();
			ebox.ButtonReleaseEvent += delegate {
				var pad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
				pad.BringToFront ();
			};

			errors.Visible = false;
			errorImage.Visible = false;
			warnings.Visible = false;
			warningImage.Visible = false;

			return ebox;
		}