Ejemplo n.º 1
0
            public Pair(Grid grid, string name, Widget editor, string description)
            {
                Gtk.Label l = new Label(name);
                l.UseMarkup = true;
                l.Justify   = Justification.Left;
                l.Xalign    = 0;
                l.Show();

                if (description == null)
                {
                    label = l;
                }
                else
                {
                    Gtk.EventBox ebox = new Gtk.EventBox();
                    ebox.Add(l);
                    ebox.Show();
                    ebox.TooltipText = description;
                    label            = ebox;
                }
                label.Parent = grid;

                this.editor   = editor;
                editor.Parent = grid;
                editor.Show();
            }
Ejemplo n.º 2
0
        public void ShowContact(string id)
        {
            TreeIter  iter;
            Hashtable tbl = database.Compile(id, database.EnumNamespace);

            if (ContactHolder.Child != null)
            {
                ContactHolder.Remove(ContactHolder.Child);
            }

            ContactHolder.Add(new Contact(tbl));
            MainWindow.ShowAll();

            // Update selection in the contact list as well
            if (contact_store.GetIterFirst(out iter))
            {
                do
                {
                    if (contact_store.GetValue(iter, 0) as string == id)
                    {
                        ContactList.Selection.SelectIter(iter);
                        break;
                    }
                } while (contact_store.IterNext(ref iter));
            }

            SetStatusMessage(String.Format(Catalog.GetString("Viewing {0}"),
                                           (ContactHolder.Child as Contact).GetValue("DisplayName")));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            image = new Gtk.Image();
            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            PropertiesGrid = new PropertyView(this);
            box.Pack1(((ViewBase)PropertiesGrid).MainWidget, true, false);
            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;
            image.SizeAllocated          += OnSizeAllocated;
#if NETFRAMEWORK
            image.ExposeEvent += OnImageExposed;
#else
            image.Drawn += OnImageExposed;
#endif
            container.Destroyed   += OnMainWidgetDestroyed;
            container.ScrollEvent += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Shows the tracker.
        /// </summary>
        /// <param name="data">The data.</param>
        public void ShowTracker(TrackerHitResult data)
        {
            if (this.trackerLabel == null)
            {
                // Holding the tracker label inside an EventBox allows
                // us to set the background color
                Gtk.EventBox labelHolder = new Gtk.EventBox();
                this.trackerLabel = new Gtk.Label();
                this.trackerLabel.SetPadding(3, 3);
                OxyColor bgColor = OxyColors.LightSkyBlue;
                labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
                labelHolder.Add(this.trackerLabel);
                this.Add(labelHolder);
                labelHolder.ShowAll();
            }
            this.trackerLabel.Parent.Visible = true;
            this.trackerLabel.Text           = data.ToString();
            Gtk.Requisition req  = this.trackerLabel.Parent.SizeRequest();
            int             xPos = (int)data.Position.X - req.Width / 2;
            int             yPos = (int)data.Position.Y - req.Height;

            xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
            yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
            this.Move(trackerLabel.Parent, xPos, yPos);
        }
Ejemplo n.º 5
0
        public BestTray(BestWindow bw, bool autostarted)
        {
            this.autostarted = autostarted;

            Raw = egg_tray_icon_new("Search");

            win              = bw;
            win.DeleteEvent += new DeleteEventHandler(WindowDeleteEvent);

            eventbox                   = new Gtk.EventBox();
            eventbox.CanFocus          = true;
            eventbox.ButtonPressEvent += new ButtonPressEventHandler(ButtonPress);

            Gdk.Pixbuf smalldog = Images.GetPixbuf("best.png");
            eventbox.Add(new Gtk.Image(smalldog.ScaleSimple(24, 24, Gdk.InterpType.Hyper)));

            KeyBinding binding = Conf.Searching.ShowSearchWindowBinding;

            string tooltip = String.Format("Beagle Search ({0})", binding.ToReadableString());

            tips = new Gtk.Tooltips();
            tips.SetTip(eventbox, tooltip, null);
            tips.Enable();

            Add(eventbox);
            eventbox.ShowAll();

            keybinder = new Beagle.Util.XKeybinder();
            keybinder.Bind(binding.ToString(),
                           new EventHandler(ShowBeaglePressed));
        }
Ejemplo n.º 6
0
 public void set_snippet(string snippet)
 {
     snippet_wrapper = new Gtk.EventBox();
     Gtk.Label tmp = new Gtk.Label();
     tmp.Markup = snippet;
     snippet_wrapper.Add(tmp);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            GeometryServiceProvider.Instance = new NtsGeometryServices();

            image = new Gtk.Image();
            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            Grid = new GridView(this);
            box.Pack1(((ViewBase)Grid).MainWidget, true, false);
            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;
            image.SizeAllocated          += OnSizeAllocated;
            image.ExposeEvent            += OnImageExposed;
            container.Destroyed          += OnMainWidgetDestroyed;
            container.ScrollEvent        += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
Ejemplo n.º 8
0
 private bool showHeader()
 {
     if (!doRemove)
     {
         header.Add(headerAlign);
     }
     return(false);
 }
Ejemplo n.º 9
0
        public void ShowWindow()
        {
            Application.Init();

            gxml = new Glade.XML("contactviewer.glade", "MainWindow");
            gxml.Autoconnect(this);

            ActionEntry[] entries = new ActionEntry [] {
                new ActionEntry("FileMenuAction", null, "_File", null, null, null),
                new ActionEntry("OpenAction", Gtk.Stock.Open,
                                "_Open", "<control>O", Catalog.GetString("Open..."), new EventHandler(OnOpenDatabase)),
                new ActionEntry("QuitAction", Gtk.Stock.Quit,
                                "_Quit", "<control>Q", Catalog.GetString("Quit"), new EventHandler(OnQuit)),
                new ActionEntry("HelpMenuAction", null, "_Help", null, null, null),
                new ActionEntry("AboutAction", Gnome.Stock.About,
                                "_About", null, Catalog.GetString("About"), new EventHandler(OnAbout))
            };

            ActionGroup grp = new ActionGroup("MainGroup");

            grp.Add(entries);

            ui_manager = new UIManager();
            ui_manager.InsertActionGroup(grp, 0);
            ui_manager.AddUiFromResource("menu.xml");
            MenubarHolder.Add(ui_manager.GetWidget("/MainMenu"));

            // Fix the TreeView that will contain all contacts
            contact_store = new ListStore(typeof(string), typeof(string));

            ContactList.Model     = contact_store;
            ContactList.RulesHint = true;
            ContactList.AppendColumn(Catalog.GetString("Contacts"), new CellRendererText(), "text", 1);
            ContactList.ButtonReleaseEvent += OnContactSelected;

            // This ListStore will let the user choose what to see in the contact list
            contact_show_type_store = new ListStore(typeof(string), typeof(string));
            contact_show_type_store.AppendValues("DisplayName", Catalog.GetString("Display name"));
            contact_show_type_store.AppendValues("PrimaryEmail", Catalog.GetString("Primary E-mail"));
            contact_show_type_store.AppendValues("SecondEmail", Catalog.GetString("Secondary E-mail"));
            contact_show_type_store.AppendValues("NickName", Catalog.GetString("Nickname"));

            CellRendererText cell = new CellRendererText();

            ListIdentifier.PackStart(cell, false);
            ListIdentifier.AddAttribute(cell, "text", 1);
            ListIdentifier.Model    = contact_show_type_store;
            ListIdentifier.Active   = 0;
            ListIdentifier.Changed += OnContactListTypeChanged;

            MainWindow.Icon         = Beagle.Images.GetPixbuf("contact-icon.png");
            MainWindow.DeleteEvent += OnDeleteEvent;

            LoadDatabase();
            Application.Run();
        }
Ejemplo n.º 10
0
        public VideoView()
        {
            preview_pos = PreviewPos.ButtonRight;

            VBox vbox = new VBox(false, 0);

            vbox.Show();

            Frame frame = new Frame();

            //frame.BorderWidth = 5;
            frame.Show();

            vbox.Add(frame);

            mainView = new Gtk.EventBox();
            mainView.WidthRequest  = 400;
            mainView.HeightRequest = 300;
            mainView.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(255, 255, 255));
            mainView.ModifyBg(Gtk.StateType.Active, new Gdk.Color(255, 255, 255));
            mainView.Show();

            //this.WidthRequest = 333; // 500; //250;
            //this.HeightRequest = 250; // 375; //187; 250
            preview = new Gtk.DrawingArea();
            preview.WidthRequest  = 120;            // 75; //150;
            preview.HeightRequest = 90;             // 56; //112;
            preview.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
            preview.ModifyBg(Gtk.StateType.Active, new Gdk.Color(0, 0, 0));
            preview.Show();

            fix = new Gtk.Fixed();
            fix.Put(preview, space, space);
            fix.Show();
            mainView.Add(fix);

            frame.Add(mainView);

//			Label label = new Label(Catalog.GetString("Video Chat in progress..."));

//			label.Show();
//			vbox.PackStart(label, false, true, 0);

            Button button = new Button(Catalog.GetString("End Call"));

            button.Clicked += OnCloseVideoClicked;
            button.Show();
            vbox.PackStart(button, false, false, 5);

            this.Add(vbox);
            mainView.SizeAllocated += OnSizeAllocated;
//			this.SizeRequested += OnsizeRequested;
            this.QueueResize();
            MovePreview();
        }
Ejemplo n.º 11
0
        //
        public void Initialize(EditSession session)
        {
            prop = session.Property;

            ICollection valuesCollection = prop.Converter.GetStandardValues();

            values = new TraceLab.Core.Components.EnumValue[valuesCollection.Count];
            valuesCollection.CopyTo(values, 0);

            //values = System.Enum.GetValues (prop.PropertyType);
            Hashtable names = new Hashtable();

            foreach (FieldInfo f in prop.PropertyType.GetFields())
            {
                DescriptionAttribute att = (DescriptionAttribute)Attribute.GetCustomAttribute(f, typeof(DescriptionAttribute));
                if (att != null)
                {
                    names [f.Name] = att.Description;
                }
                else
                {
                    names [f.Name] = f.Name;
                }
            }


            ebox = new Gtk.EventBox();
            ebox.Show();
            PackStart(ebox, true, true, 0);

            combo                     = Gtk.ComboBoxEntry.NewText();
            combo.Changed            += combo_Changed;
            combo.Entry.IsEditable    = false;
            combo.Entry.CanFocus      = false;
            combo.Entry.HasFrame      = false;
            combo.Entry.HeightRequest = combo.SizeRequest().Height;
            combo.Show();
            ebox.Add(combo);

            foreach (TraceLab.Core.Components.EnumValue value in values)
            {
                string str = prop.Converter.ConvertToString(value);
                if (names.Contains(str))
                {
                    str = (string)names [str];
                }
                combo.AppendText(str);
            }
        }
Ejemplo n.º 12
0
        public BindDesignDialog(string id, ArrayList validClasses, string baseFolder)
        {
            XML glade = new XML(null, "gui.glade", "BindDesignDialog", null);

            glade.Autoconnect(this);
            labelMessage.Text = GettextCatalog.GetString("The widget design {0} is not currently bound to a class.", id);

            fileEntry = new FolderEntry();
            fileEntryBox.Add(fileEntry);
            fileEntry.ShowAll();

            if (validClasses.Count > 0)
            {
                store = new ListStore(typeof(string));
                foreach (string cname in validClasses)
                {
                    store.AppendValues(cname);
                }
                comboClasses.Model = store;
                CellRendererText cr = new CellRendererText();
                comboClasses.PackStart(cr, true);
                comboClasses.AddAttribute(cr, "text", 0);
                comboClasses.Active = 0;
            }
            else
            {
                radioSelect.Sensitive = false;
                radioCreate.Active    = true;
            }

            fileEntry.Path = baseFolder;

            // Initialize the class name using the widget name
            int i = id.IndexOf('.');

            if (i != -1)
            {
                entryClassName.Text = id.Substring(i + 1);
                entryNamespace.Text = id.Substring(0, i);
            }
            else
            {
                entryClassName.Text = id;
                entryNamespace.Text = lastNamespace;
            }

            dialog.Response += new Gtk.ResponseHandler(OnResponse);
            UpdateStatus();
        }
Ejemplo n.º 13
0
 public void Append(Widget w, string description)
 {
     if ((w.WidgetFlags & WidgetFlags.NoWindow) != 0)
     {
         Gtk.EventBox ebox = new Gtk.EventBox();
         ebox.Add(w);
         ebox.Show();
         w = ebox;
     }
     w.Parent = this;
     w.Show();
     w.TooltipText = description;
     lines.Add(w);
     QueueDraw();
 }
Ejemplo n.º 14
0
Archivo: Grid.cs Proyecto: mono/stetic
        public void Append(Widget w, string description)
        {
            if ((w.WidgetFlags & WidgetFlags.NoWindow) != 0) {
                Gtk.EventBox ebox = new Gtk.EventBox ();
                ebox.Add (w);
                ebox.Show ();
                w = ebox;
            }
            w.Parent = this;
            w.Show ();

            tips.SetTip (w, description, null);

            lines.Add (w);
            QueueDraw ();
        }
Ejemplo n.º 15
0
        private void HandleThumbnailIconViewButtonPressEvent(object sender, Gtk.ButtonPressEventArgs args)
        {
            int old_item = current_item;

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

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

            captions [old_item] = caption_textview.Buffer.Text;

            string caption = captions [current_item];

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

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

            IBrowsableItem item           = items [current_item];
            string         thumbnail_path = ThumbnailGenerator.ThumbnailPath(item.DefaultVersionUri);

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

            using (ImageFile image = new ImageFile(thumbnail_path)) {
                Gdk.Pixbuf data = image.Load();
                data             = PixbufUtils.ScaleToMaxSize(data, 400, 400);
                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();
            }
        }
Ejemplo n.º 16
0
		public void Initialize (EditSession session)
		{
			values = DeployService.GetDeployDirectoryInfo ();
			ebox = new Gtk.EventBox ();
			ebox.Show ();
			PackStart (ebox, true, true, 0);

			combo = Gtk.ComboBoxEntry.NewText ();
			combo.Changed += combo_Changed;
			combo.Entry.IsEditable = false;
			combo.Entry.HasFrame = false;
			combo.Entry.HeightRequest = combo.SizeRequest ().Height;
			combo.Show ();
			ebox.Add (combo);

			foreach (DeployDirectoryInfo value in values) {
				combo.AppendText (value.Description);
			}
		}
Ejemplo n.º 17
0
    public void LoadImages(XDocument doc)
    {
        if (posts != null)
        {
            foreach (VBox post in posts.Children)
            {
                foreach (Widget obj in post.Children)
                {
                    post.Remove(obj);
                    obj.Destroy();
                }
                posts.Remove(post);
                post.Destroy();
            }
        }
        posts = new VBox();
        vbox3.PackStart(posts, true, true, 1);
        IEnumerable <XElement> posts_list = doc.XPathSelectElements("/posts/post");

        foreach (XElement elem in posts_list)
        {
            VBox   post        = new VBox();
            string title       = elem.XPathSelectElement("title").Value;
            string description = elem.XPathSelectElement("description").Value;
            post.PackStart(new Label(title), true, true, 1);
            IEnumerable <XElement> urls_list = elem.XPathSelectElements("img/url");
            foreach (XElement urls in urls_list)
            {
                Gtk.EventBox eventBox          = new Gtk.EventBox();
                string       file_img_default  = urls.XPathSelectElement("default").Value;
                string       file_img_original = urls.XPathSelectElement("original").Value;
                Gtk.Image    new_img           = new Gtk.Image(file_img_default);
                eventBox.Add(new_img);
                eventBox.ButtonPressEvent += delegate {
                    new Project.ImgWindow(title, description, file_img_original);
                };
                post.PackEnd(eventBox, true, true, 1);
            }
            posts.PackStart(post, true, true, 1);
        }
        posts_list = null;
        ShowAll();
    }
Ejemplo n.º 18
0
        public void Initialize(EditSession session)
        {
            values = DeployService.GetDeployDirectoryInfo();
            ebox   = new Gtk.EventBox();
            ebox.Show();
            PackStart(ebox, true, true, 0);

            combo                     = Gtk.ComboBoxEntry.NewText();
            combo.Changed            += combo_Changed;
            combo.Entry.IsEditable    = false;
            combo.Entry.HasFrame      = false;
            combo.Entry.HeightRequest = combo.SizeRequest().Height;
            combo.Show();
            ebox.Add(combo);

            foreach (DeployDirectoryInfo value in values)
            {
                combo.AppendText(value.Description);
            }
        }
Ejemplo n.º 19
0
        /// <summary>Crea una instancia de la clase.</summary>
        /// <param name="parent">La ventana padre de este diálogo.
        /// </param>

        private DialogoAcerca(Gtk.Window parent) :
            base("", parent, Gtk.DialogFlags.DestroyWithParent)
        {
            Title        = Ventana.GetText("DialogoAcerca_Title");
            TransientFor = parent;
            Modal        = true;
            Resizable    = false;
            DeleteEvent += new DeleteEventHandler(Ventana.OcultarVentana);
            Resize(300, 300);
            BorderWidth  = 20;
            HasSeparator = false;


            VBox vbox = new VBox(false, 5);

            vbox.PackStart(
                new Gtk.Label(Ventana.GetText("Programa_Nombre") + " " +
                              String.Format(
                                  Ventana.GetText("DialogoAcerca_Version"),
                                  Assembly.GetExecutingAssembly().GetName().Version))
                );
            vbox.PackStart(
                new Gtk.Label(Ventana.GetText("Programa_descripcion")));
            vbox.PackStart(new Gtk.Label(" "));
            vbox.PackStart(new Gtk.Label(
                               Ventana.GetText("DialogoAcerca_Autores")));
            vbox.PackStart(new Gtk.Label("Montserrat Sotomayor González"));
            vbox.PackStart(new Gtk.Label("Alberto Fernández Martínez"));

            vbox.PackStart(
                new Gtk.Image(IconManager.GetPixmap("acerca.png")));

            Gtk.EventBox eventBox = new Gtk.EventBox();

            eventBox.Add(vbox);
            eventBox.ButtonPressEvent +=
                new Gtk.ButtonPressEventHandler(CerrarClick);
            VBox.Add(eventBox);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            image = new Gtk.Image();

            image.Halign = Align.Start;
            image.Valign = Align.Start;

            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            PropertiesView = new PropertyView(this);
            box.Pack1(((ViewBase)PropertiesView).MainWidget, true, false);

            if (((ViewBase)PropertiesView).MainWidget is ScrolledWindow scroller)
            {
                scroller.VscrollbarPolicy = PolicyType.Never;
            }

            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;

            image.Drawn += OnImageExposed;

            container.Destroyed   += OnMainWidgetDestroyed;
            container.ScrollEvent += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
Ejemplo n.º 21
0
        public static Gtk.Widget AllocEventBox(this Gtk.Widget widget, bool visibleWindow = false)
        {
            // Wraps the widget with an event box. Required for some
            // widgets such as Label which doesn't have its own gdk window

            if (widget is Gtk.EventBox)
            {
                ((Gtk.EventBox)widget).VisibleWindow = true;
                return(widget);
            }

            if (widget.IsNoWindow)
            {
                var eventBox = new Gtk.EventBox();
                eventBox.Visible       = widget.Visible;
                eventBox.Sensitive     = widget.Sensitive;
                eventBox.VisibleWindow = visibleWindow;
                Xwt.GtkBackend.GtkEngine.ReplaceChild(widget, eventBox);
                eventBox.Add(widget);
                return(eventBox);
            }
            return(widget);
        }
Ejemplo n.º 22
0
			public Pair (Grid grid, string name, Widget editor, string description)
			{
				Gtk.Label l = new Label (name);
				l.UseMarkup = true;
				l.Justify = Justification.Left;
				l.Xalign = 0;
				l.Show ();

				if (description == null)
					label = l;
				else {
					Gtk.EventBox ebox = new Gtk.EventBox ();
					ebox.Add (l);
					ebox.Show ();
					ebox.TooltipText = description;
					label = ebox;
				}
				label.Parent = grid;

				this.editor = editor;
				editor.Parent = grid;
				editor.Show ();
			}
Ejemplo n.º 23
0
 public void LoadImages(XDocument doc)
 {
     if (posts != null) {
         foreach(VBox post in posts.Children){
             foreach (Widget obj in post.Children) {
                 post.Remove (obj);
                 obj.Destroy ();
             }
             posts.Remove (post);
             post.Destroy ();
         }
     }
     posts = new VBox ();
     vbox3.PackStart (posts,true,true,1);
     IEnumerable<XElement> posts_list = doc.XPathSelectElements("/posts/post");
     foreach (XElement elem in posts_list) {
         VBox post = new VBox ();
         string title = elem.XPathSelectElement ("title").Value;
         string description = elem.XPathSelectElement ("description").Value;
         post.PackStart (new Label (title), true, true, 1);
         IEnumerable<XElement> urls_list = elem.XPathSelectElements ("img/url");
         foreach (XElement urls in urls_list) {
             Gtk.EventBox eventBox = new Gtk.EventBox();
             string file_img_default = urls.XPathSelectElement ("default").Value;
             string file_img_original = urls.XPathSelectElement ("original").Value;
             Gtk.Image new_img = new Gtk.Image (	file_img_default);
             eventBox.Add (new_img);
             eventBox.ButtonPressEvent += delegate {
                 new Project.ImgWindow (title, description, file_img_original);
             };
             post.PackEnd (eventBox, true, true, 1);
         }
         posts.PackStart (post, true, true, 1);
     }
     posts_list = null;
     ShowAll ();
 }
Ejemplo n.º 24
0
        private void add_link(string text, CalendarDriver.View view, System.DateTime item_modified_date, Gtk.HBox links)
        {
            Gtk.EventBox link_wrapper = new Gtk.EventBox();
            Gtk.Label link = new Gtk.Label();
            link.Markup = "<u><small>" + text + "</small></u>";

            GtkCommon.show_hand_and_tooltip(link_wrapper, text);

            link_wrapper.Add(link);
            link_wrapper.ButtonPressEvent += delegate(object sender, Gtk.ButtonPressEventArgs args) {
                set_view_callback(view, item_modified_date);
            };

            GtkCommon.set_background_color(link_wrapper, "white");
            links.PackStart(link_wrapper, false, false, 5);
        }
Ejemplo n.º 25
0
        private void add_page_link(string text, Gtk.HBox page_navigation, int offset, int current_page)
        {
            Gtk.EventBox link_wrapper = new Gtk.EventBox();
            Gtk.Label link = new Gtk.Label();
            link.Markup = "<u><small>" + text + "</small></u>";

            GtkCommon.show_hand_and_tooltip(link_wrapper, text);

            System.Console.WriteLine("adding a page link: {0} with offset on click {1}", text, offset);

            link_wrapper.Add(link);
            link_wrapper.ButtonPressEvent += delegate {
                if (current_page != -1) { // next
                    sizes_of_last_pages.Push(current_page);
                    this.offset = offset + current_page;
                } else {
                    int last_page = sizes_of_last_pages.Pop();
                    this.offset = offset - last_page;
                }
                add_elements();
            };

            GtkCommon.set_background_color(link_wrapper, "white");
            page_navigation.PackStart(link_wrapper, false, false, 5);
        }
Ejemplo n.º 26
0
    public static void Main(string[] args)
    {
        Application.Init();

        Gtk.Window w = new Gtk.Window("Encodroyd");
        HBox mainHBox = new HBox();
        HBox dropHBox = new HBox();
        HBox spinVideoHBox = new HBox();
        HBox spinAudioHBox = new HBox();
        HBox statusButtonHBox = new HBox();
        VBox mainVBox = new VBox();
        VBox leftVBox = new VBox();
        VBox rightVBox = new VBox();
        VBox prefVBox = new VBox();
        VBox statusVBox = new VBox();
        MenuBar mb = new MenuBar ();
        //Gtk.Frame dndFrame = new Gtk.Frame();
        Gtk.Frame prefFrame = new Gtk.Frame("Preferences");
        Gtk.Frame statusFrame = new Gtk.Frame("Status");
        icon = new Pixbuf(null, "encodroyd.png");
        Gtk.EventBox image = new Gtk.EventBox();
        Gtk.Label dropLabel = new Gtk.Label("Drop videos here\nto convert");

        highQualityRadio = new RadioButton(null, "High Quality (H.264)");
        prefVBox.PackStart(highQualityRadio, true, true, 0);
        lowQualityRadio = new RadioButton(highQualityRadio, "Low Quality (MPEG4)");
        lowQualityRadio.Active = true;
        prefVBox.PackStart(lowQualityRadio, true, true, 0);

        statusLabel = new Gtk.Label("Idle");
        pBar = new ProgressBar();
        skipCurrentButton = new Gtk.Button();

        Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow();
        Gtk.TreeView tree = new TreeView();
        listStore = new ListStore(typeof (String));

        // set properties
        w.Icon = icon;

        // transparence
        //if (w.Screen.RgbaColormap != null)
        //  Gtk.Widget.DefaultColormap = w.Screen.RgbaColormap;

        mainHBox.BorderWidth = 6;
        mainHBox.Spacing = 6;
        dropHBox.BorderWidth = 6;
        dropHBox.Spacing = 6;
        spinVideoHBox.BorderWidth = 6;
        spinVideoHBox.Spacing = 6;
        spinAudioHBox.BorderWidth = 6;
        spinAudioHBox.Spacing = 6;
        statusButtonHBox.BorderWidth = 0;
        statusButtonHBox.Spacing = 6;
        leftVBox.BorderWidth = 6;
        leftVBox.Spacing = 6;
        rightVBox.BorderWidth = 6;
        rightVBox.Spacing = 6;
        prefVBox.BorderWidth = 6;
        prefVBox.Spacing = 6;
        statusVBox.BorderWidth = 6;
        statusVBox.Spacing = 6;
        statusLabel.Ellipsize = Pango.EllipsizeMode.Middle;
        scrollWin.ShadowType = ShadowType.In;
        statusLabel.SetSizeRequest(120,-1);
        skipCurrentButton.Sensitive = false;
        skipCurrentButton.Label = "Skip";

        // first hbox
        image.Add(new Gtk.Image(icon));
        dropHBox.Add(image);
        dropHBox.Add(dropLabel);

        // preferences frame
        prefFrame.Add(prefVBox);
        prefVBox.Add(spinVideoHBox);
        prefVBox.Add(spinAudioHBox);

        // status frame
        statusFrame.Add(statusVBox);
        statusVBox.Add(statusButtonHBox);
        statusVBox.Add(pBar);
        statusButtonHBox.Add(statusLabel);
        statusButtonHBox.Add(skipCurrentButton);

        // leftvbox
        leftVBox.Add(dropHBox);
        leftVBox.Add(prefFrame);
        leftVBox.Add(statusFrame);

        // right
        tree.Model = listStore;
        tree.HeadersVisible = true;
        tree.AppendColumn ("Queue", new CellRendererText (), "text", 0);

        // scrolledwindow
        scrollWin.Add(tree);

        // rightvbox
        rightVBox.Add(scrollWin);
        rightVBox.SetSizeRequest(200,-1);

        // menubar
        Menu fileMenu = new Menu ();
        MenuItem exitItem = new MenuItem("Exit");
        exitItem.Activated += new EventHandler (OnExitItemActivate);
        fileMenu.Append (exitItem);
        MenuItem fileItem = new MenuItem("File");
        fileItem.Submenu = fileMenu;
        mb.Append (fileItem);
        Menu helpMenu = new Menu ();
        MenuItem aboutItem = new MenuItem("About");
        aboutItem.Activated += new EventHandler (OnAboutItemActivate);
        helpMenu.Append (aboutItem);
        MenuItem helpItem = new MenuItem("Help");
        helpItem.Submenu = helpMenu;
        mb.Append (helpItem);

        // mainHBox
        mainVBox.Add(mb);
        mainVBox.Add(mainHBox);
        mainHBox.Add(leftVBox);
        mainHBox.Add(rightVBox);

        // window
        w.Add(mainVBox);
        w.ShowAll();

        // events
        Gtk.Drag.DestSet(dropHBox, DestDefaults.All, targetTable, Gdk.DragAction.Copy);
        dropHBox.DragDataReceived += DataReceived;
        skipCurrentButton.Clicked += new EventHandler(OnSkipOneButtonClicked);
        w.DeleteEvent += OnWindowDelete;

        Application.Run();
    }
Ejemplo n.º 27
0
		public DockItemContainer (DockFrame frame, DockItem item)
		{
			this.frame = frame;
			this.item = item;
			
			ResizeMode = Gtk.ResizeMode.Queue;
			Spacing = 0;
			
			title = new Gtk.Label ();
			title.Xalign = 0;
			title.Xpad = 3;
			title.UseMarkup = true;
			title.Ellipsize = Pango.EllipsizeMode.End;
			
			btnDock = new Button (new Gtk.Image (pixAutoHide));
			btnDock.Relief = ReliefStyle.None;
			btnDock.CanFocus = false;
			btnDock.WidthRequest = btnDock.HeightRequest = 17;
			btnDock.Clicked += OnClickDock;
			
			btnClose = new Button (new Gtk.Image (pixClose));
			btnClose.TooltipText = Catalog.GetString ("Hide");
			btnClose.Relief = ReliefStyle.None;
			btnClose.CanFocus = false;
			btnClose.WidthRequest = btnClose.HeightRequest = 17;
			btnClose.Clicked += delegate {
				item.Visible = false;
			};
			
			HBox box = new HBox (false, 0);
			box.PackStart (title, true, true, 0);
			box.PackEnd (btnClose, false, false, 0);
			box.PackEnd (btnDock, false, false, 0);
			
			headerAlign = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
			headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1;
			headerAlign.Add (box);
			
			header = new EventBox ();
			header.Events |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
			header.ButtonPressEvent += HeaderButtonPress;
			header.ButtonReleaseEvent += HeaderButtonRelease;
			header.MotionNotifyEvent += HeaderMotion;
			header.KeyPressEvent += HeaderKeyPress;
			header.KeyReleaseEvent += HeaderKeyRelease;
			header.Add (headerAlign);
			header.ExposeEvent += HeaderExpose;
			header.Realized += delegate {
				header.GdkWindow.Cursor = handCursor;
			};
			
			foreach (Widget w in new Widget [] { header, btnDock, btnClose }) {
				w.EnterNotifyEvent += HeaderEnterNotify;
				w.LeaveNotifyEvent += HeaderLeaveNotify;
			}
			
			PackStart (header, false, false, 0);
			ShowAll ();
			
			PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0);
			
			HBox hbox = new HBox ();
			hbox.Show ();
			hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0);
			
			contentBox = new HBox ();
			contentBox.Show ();
			hbox.PackStart (contentBox, true, true, 0);
			
			hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0);
			
			PackStart (hbox, true, true, 0);
			
			PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0);
			
			UpdateBehavior ();
		}
Ejemplo n.º 28
0
		public BestTray (BestWindow bw, bool autostarted)
		{
			this.autostarted = autostarted;

			Raw = egg_tray_icon_new ("Search");

			win = bw;
			win.DeleteEvent += new DeleteEventHandler (WindowDeleteEvent);
						
			eventbox = new Gtk.EventBox ();
			eventbox.CanFocus = true;
			eventbox.ButtonPressEvent += new ButtonPressEventHandler (ButtonPress);
			
			Gdk.Pixbuf smalldog = Images.GetPixbuf ("best.png");
			eventbox.Add (new Gtk.Image (smalldog.ScaleSimple (24, 24, Gdk.InterpType.Hyper)));

			KeyBinding binding = Conf.Searching.ShowSearchWindowBinding;

			string tooltip = String.Format ("Beagle Search ({0})", binding.ToReadableString ());
			tips = new Gtk.Tooltips ();
			tips.SetTip (eventbox, tooltip, null);
			tips.Enable ();
			
			Add (eventbox);
			eventbox.ShowAll ();

			keybinder = new Beagle.Util.XKeybinder ();
			keybinder.Bind (binding.ToString (),
					new EventHandler (ShowBeaglePressed));
		}
Ejemplo n.º 29
0
 /// <summary>
 /// Shows the tracker.
 /// </summary>
 /// <param name="data">The data.</param>
 public void ShowTracker(TrackerHitResult data)
 {
     if (this.trackerLabel == null)
     {
         // Holding the tracker label inside an EventBox allows
         // us to set the background color
         Gtk.EventBox labelHolder = new Gtk.EventBox();
         this.trackerLabel = new Gtk.Label();
         this.trackerLabel.SetPadding(3, 3);
         OxyColor bgColor = OxyColors.LightSkyBlue;
         labelHolder.ModifyBg(StateType.Normal, new Gdk.Color(bgColor.R, bgColor.G, bgColor.B));
         labelHolder.Add(this.trackerLabel);
         this.Add(labelHolder);
         labelHolder.ShowAll();
     }
     this.trackerLabel.Parent.Visible = true;
     this.trackerLabel.Text = data.ToString();
     Gtk.Requisition req = this.trackerLabel.Parent.SizeRequest();
     int xPos = (int)data.Position.X - req.Width / 2;
     int yPos = (int)data.Position.Y - req.Height;
     xPos = Math.Max(0, Math.Min(xPos, this.Allocation.Width - req.Width));
     yPos = Math.Max(0, Math.Min(yPos, this.Allocation.Height - req.Height));
     this.Move(trackerLabel.Parent, xPos, yPos);
 }
Ejemplo n.º 30
0
 public iFolderApplication(string[] args)
     : base("ifolder", "1.0", Modules.UI, args)
 {
     Util.InitCatalog();
        Util.SetQuitiFolderDelegate(new QuitiFolderDelegate(QuitiFolder));
        tIcon = new TrayIcon("iFolder");
        bCollectionIsSynchronizing = false;
        currentIconAnimationDirection = 0;
        eBox = new EventBox();
        eBox.ButtonPressEvent +=
     new ButtonPressEventHandler(trayapp_clicked);
        RunningPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder24.png"));
        StartingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-startup.png"));
        StoppingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-shutdown.png"));
        DownloadingPixbuf =
      new Gdk.PixbufAnimation(Util.ImagesPath("ifolder24.gif"));
        UploadingPixbuf =
      new Gdk.PixbufAnimation(Util.ImagesPath("ifolder24-upload.gif"));
        gAppIcon = new Gtk.Image(RunningPixbuf);
        eBox.Add(gAppIcon);
        tIcon.Add(eBox);
        tIcon.ShowAll();
        LoginDialog = null;
        collectionSynchronizing = null;
        synchronizationErrors = new Hashtable();
        iFolderStateChanged = new Gtk.ThreadNotify(
        new Gtk.ReadyEvent(OniFolderStateChanged));
        simiasManager = Util.CreateSimiasManager(args);
 }
Ejemplo n.º 31
0
        public DockItemContainer(DockFrame dockframe, Widget widget)
        {
            this.Expand = true;
            this.FadeOutHeader = true;
            //initIcons();

            frame = dockframe;
            CurrentContainer = null;

            ResizeMode = Gtk.ResizeMode.Queue;
            Spacing = 0;

            title = new Gtk.Label();
            title.Justify = Justification.Left;

            Gtk.Image img1 = new Gtk.Image("gtk-zoom-out",IconSize.Menu);
            btnDock = new Button(img1);
            btnDock.Relief = ReliefStyle.None;
            btnDock.Clicked += HandleBtnDockClicked;
            btnDock.EnterNotifyEvent += HandleButtonEnterNotifyEvent;

            Gtk.Image img = new Gtk.Image("gtk-close",IconSize.SmallToolbar);
            btnClose = new Button(img);
            btnClose.Visible = true;
            btnClose.Clicked += HandleBtnCloseClicked;
            btnClose.Relief = ReliefStyle.None;
            btnClose.EnterNotifyEvent += HandleButtonEnterNotifyEvent;

            HeaderBox = new HBox (false, 0);
            HeaderBox.PackStart (title, true, false, 0);
            HeaderBox.PackEnd (btnClose, false, false, 0);
            HeaderBox.PackEnd (btnDock, false, false, 0);

            headerAlign = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 0;
            headerAlign.Add (HeaderBox);

            header = new EventBox ();
            header.Events |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
            header.ButtonPressEvent += HeaderButtonPress;
            header.ButtonReleaseEvent += HeaderButtonRelease;

            //			header.MotionNotifyEvent += HeaderMotion;
            //			header.KeyPressEvent += HeaderKeyPress;
            //			header.KeyReleaseEvent += HeaderKeyRelease;
            header.Add (headerAlign);
            //header.Drawn += HandleHeaderDrawn;

            //header.Add(new Gtk.Button("gtk-close"));

            header.Realized += delegate {
                header.Window.Cursor = handCursor;
            };

            foreach (Widget w in new Widget [] { header, btnDock, btnClose }) {
                w.EnterNotifyEvent += HeaderEnterNotify;
                w.LeaveNotifyEvent += HeaderLeaveNotify;
            }

            PackStart (header, false, false, 0);
            ShowAll ();

            if (widget != null)
            {
                CurrentWidget = widget;
                widget.Visible = true;
                PackEnd(widget,true,true,0);

                if (widget is CustomWidget)
                {
                    title.Text = (widget as DockableWidget).Title;
                }
            }

            doRemove = true;
            GLib.Timeout.Add(5000,new GLib.TimeoutHandler(removeHeader));
        }
Ejemplo n.º 32
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;
            string[] UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse = new ReverseXmlList(original);

            foreach (XmlNode C in reverse) {
                if (C.Name == "Object") {
                    cIndex++;
                    if (C.Attributes[0].Name == "type") {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            PB.Name = V.InnerText;
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                            PB.Children[0].ModifyFg(StateType.Active, FColor);
                                            PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                            PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                            break;
                                        case "Caption":
                                        case "Text":
                                            PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                            break;
                                        case "BackColor":
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            PB.ModifyBg(StateType.Normal, BColor);
                                            PB.ModifyBg(StateType.Active, BColor);
                                            PB.ModifyBg(StateType.Insensitive, BColor);
                                            PB.ModifyBg(StateType.Prelight, BColor);
                                            PB.ModifyBg(StateType.Selected, BColor);
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                            break;
                                        case "Image":
                                            if (V.HasChildNodes) {
                                                string IMGData = V.FirstChild.InnerText;
                                                byte[] B = System.Convert.FromBase64String(IMGData);
                                                Pixbuf P = new Pixbuf(B);
                                                P=P.ScaleSimple(PB.WidthRequest-10, PB.HeightRequest, InterpType.Bilinear);
                                                PB.Image = new Gtk.Image(P);
                                            }
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap = true;
                            CC.Wrap = true;
                            CC.Justify = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            } else {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes["name"].Value) {
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "Name":
                                            CC.Name = V.InnerText;
                                            break;
                                        case "Font":
                                            string VC = V.InnerText;
                                            UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                            string VCFName = UFont[0];
                                            float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                            float Z = (float)(VCSize * App.ScaleFactorY);
                                            CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                            break;
                                        case "ForeColor":
                                            var FColor = V.InnerText.GetXColor().ToNative();
                                            CC.ModifyFg(StateType.Normal, FColor);
                                            CC.ModifyFg(StateType.Active, FColor);
                                            CC.ModifyFg(StateType.Insensitive, FColor);
                                            CC.ModifyFg(StateType.Prelight,FColor);
                                            CC.ModifyFg(StateType.Selected, FColor);
                                            CE.ModifyFg(StateType.Normal, FColor);
                                            CE.ModifyFg(StateType.Active, FColor);
                                            CE.ModifyFg(StateType.Insensitive, FColor);
                                            CE.ModifyFg(StateType.Prelight, FColor);
                                            CE.ModifyFg(StateType.Selected, FColor);
                                            CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                            break;
                                        case "Caption":
                                        case "Text":
                                            CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                            break;
                                        case "BackColor":
                                            if (V.InnerText != "Transparent") {
                                                var BColor = V.InnerText.GetXColor().ToNative();
                                                CE.ModifyBg(StateType.Normal, BColor);
                                                CE.ModifyBg(StateType.Active, BColor);
                                                CE.ModifyBg(StateType.Insensitive, BColor);
                                                CE.ModifyBg(StateType.Prelight, BColor);
                                                CE.ModifyBg(StateType.Selected, BColor);
                                            } else {
                                                CE.Visible = false;
                                                CE.VisibleWindow = false;
                                            }
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "TextAlign":
                                            CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                            break;
                                        case "Size":
                                            CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    var TZJE = new Fixed();

                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox")) {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry ();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC= new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add (CC);
                                foreach (XmlNode V in C.ChildNodes) {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                                case "Name":
                                                    CC.Name = V.InnerText;
                                                    break;
                                                case "Text":
                                                    {
                                                        if (V.InnerText.Contains ("%")) {
                                                            CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText);
                                                            CC.Position = CC.Text.Length;
                                                        }
                                                        break;
                                                    }
                                                case "Location":
                                                    PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                                    PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                                    break;
                                                case "Size":
                                                    CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                                    break;
                                                case "PasswordChar":
                                                    CC.InvisibleChar = '*';
                                                    CC.Visibility = false;
                                                    break;
                                                case "Font":
                                                    string VC = V.InnerText;
                                                    UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
                                                    string VCFName = UFont[0];
                                                    float VCSize = float.Parse(UFont[1].Replace("pt", ""));
                                                    float Z = (float)(VCSize * App.ScaleFactorY);
                                                    CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString()));
                                                    System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString());
                                                    break;
                                            }
                                        }
                                    }
                                }
                            }
                        } else if (C.Attributes ["type"].Value.StartsWith ("System.Windows.Forms.Panel")) {
                            var CP = new Gtk.Fixed ();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add (CP);
                            foreach (XmlNode V in C.ChildNodes) {
                                if (V.Name == "Property") {
                                    switch (V.Attributes ["name"].Value) {
                                        case "Name":
                                            CP.Name = V.InnerText;
                                            break;
                                        case "BorderStyle":
                                            if (V.InnerText == "Solid") {
                                                //PB.ModifierStyle =
                                            }
                                            break;
                                        case "ForeColor":

                                            CP.Children [0].ModifyFg (StateType.Normal, V.InnerText.GetXColor ().ToNative ());
                                            break;
                                        case "BackColor":
                                            CP.ModifyBg (StateType.Normal, V.InnerText.GetXColor().ToNative ());
                                            break;
                                        case "SizeMode":
                                            //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                            break;
                                        case "Location":
                                            PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))  * App.ScaleFactorX);
                                            PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY);
                                            break;
                                        case "Size":
                                            CP.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY));
                                            break;
                                    }
                                } else if (V.Name == "Object") {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        } else {
                            System.Diagnostics.Debug.WriteLine (C.Attributes ["type"].Value);

                        }
                    }
                }

            }
            Parent.ShowAll();
        }
Ejemplo n.º 33
0
        private void InitComponents()
        {
            CloseButton = new Gtk.Button (Gtk.Stock.Close);
            FileEntry = new Gtk.Entry ();
            BrowseButton = new Gtk.Button (Catalog.GetString ("Browse..."));
            ActionButton = CreateActionButton ();
            Progress = new CustomProgressBar ();
            CheckOutputDir = new Gtk.CheckButton ();
            LabelOutputDir = new Gtk.EventBox();
            LabelOutputDir.Add(new Gtk.Label(Catalog.GetString ("Output directory")));
            LabelOutputDir.ButtonPressEvent += HandleLabelOutputDirClicked;

            FileOutputDirEntry = new Gtk.Entry ();
            CloseButton.Clicked += new EventHandler (this.CloseButtonClicked);
            ActionButton.Clicked += new EventHandler (this.ActionButtonClicked);
            BrowseButton.Clicked += new EventHandler (this.BrowseButtonClicked);
            // Targets
            TargetEntry [] te = new TargetEntry [] {
                new TargetEntry ("STRING", 0, 1),
            };
            Gtk.Drag.DestSet (this, DestDefaults.All, te, Gdk.DragAction.Copy | Gdk.DragAction.Move );

            FileEntry.DragDataReceived += new DragDataReceivedHandler(DropHandler);
            FileOutputDirEntry.DragDataReceived += new DragDataReceivedHandler(DropHandler2);
            FileOutputDirEntry.Sensitive = false;
            this.DragDataReceived += new DragDataReceivedHandler (DropHandler);
            CheckOutputDir.Toggled += HandleCheckOutputDirToggled;
        }
Ejemplo n.º 34
0
        // 
		public void Initialize (EditSession session)
		{
            prop = session.Property;
           
            ICollection valuesCollection = prop.Converter.GetStandardValues();
            values = new TraceLab.Core.Components.EnumValue[valuesCollection.Count];
            valuesCollection.CopyTo(values, 0);

			//values = System.Enum.GetValues (prop.PropertyType);
			Hashtable names = new Hashtable ();
			foreach (FieldInfo f in prop.PropertyType.GetFields ()) {
				DescriptionAttribute att = (DescriptionAttribute) Attribute.GetCustomAttribute (f, typeof(DescriptionAttribute));
				if (att != null)
					names [f.Name] = att.Description;
				else
					names [f.Name] = f.Name;
			}
				       
			
			ebox = new Gtk.EventBox ();
			ebox.Show ();
			PackStart (ebox, true, true, 0);

			combo = Gtk.ComboBoxEntry.NewText ();
			combo.Changed += combo_Changed;
			combo.Entry.IsEditable = false;
			combo.Entry.CanFocus = false;
			combo.Entry.HasFrame = false;
			combo.Entry.HeightRequest = combo.SizeRequest ().Height;
			combo.Show ();
			ebox.Add (combo);

            foreach (TraceLab.Core.Components.EnumValue value in values) {
				string str = prop.Converter.ConvertToString (value);
				if (names.Contains (str))
					str = (string) names [str];
				combo.AppendText (str);
			}
		}
Ejemplo n.º 35
0
        protected void create_representation(List<KeyValuePair<string, string>> new_fields)
        {
            box = new VBox();

            set_picture_path();

            try {
                if (item.file.starred)
                picture = CairoDrawing.create_big_starred_image(pic_path);
                else
                picture = CairoDrawing.create_image_with_border(pic_path);
            } catch (Exception e) {
                System.Console.WriteLine("failed to generate thumbnail, error: {0}", e.Message);
            }

            Gtk.Table picture_resizer = new Table(1,1, true); // for size
            picture_wrapper = new EventBox(); // for events
            GtkCommon.set_background_color(picture_wrapper, "white");
            picture_wrapper.Add(picture);
            picture_resizer.Attach(picture_wrapper, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            Gtk.Alignment picture_alignment = new Gtk.Alignment(0.5f, 0.5f, 0, 0);

            picture_alignment.Add(picture_resizer);

            GtkCommon.show_hand_and_tooltip(picture_wrapper, Mono.Unix.Catalog.GetString("Open"));

            box.PackStart(picture_alignment, true, true, 3);

            string image = Singleton<Types>.Instance.get_type((int)item.file.type.category).icon;
            if (!String.IsNullOrEmpty(image))
            {
                Gtk.HBox tmp = new Gtk.HBox();

                Gtk.Alignment img_alignment = new Gtk.Alignment(1F, 0.5F, 0F, 0.5F);
                img_alignment.RightPadding = 5;
                Gtk.Image img = new Gtk.Image(null, image);
                img_alignment.Add(img);

                tmp.PackStart(img_alignment, true, true, 0);

                Gtk.Alignment label_alignment = new Gtk.Alignment(0F, 0.5F, 0F, 0.5F);
                Gtk.Label tmp_label = new Gtk.Label();
                tmp_label.Markup = "<b>" + item.name(35) + "</b>";
                tmp_label.UseUnderline = false;
                label_alignment.Add(tmp_label);
                tmp.PackStart(label_alignment, true, true, 0);

                box.PackStart(tmp, false, true, 3);

            } else {

                Gtk.Label title = new Gtk.Label();
                title.Markup = "<b>" + item.name(35) + "</b>";

                box.PackStart(title, true, true, 3);
            }

            Gtk.Alignment labels_alignment = new Gtk.Alignment(0.5f, 0.5f, 0f, 0f);

            labels = new Gtk.HBox();

            create_labels();

            labels_alignment.Add(labels);

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

            extra_info = new Gtk.Table((uint)(3 + new_fields.Count), 2, false);

            row = 0;

            foreach (KeyValuePair<string, string> kvp in new_fields)
                add_line(kvp.Key, kvp.Value);

            string path = item.path;

            string homedir = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

            if (path.StartsWith(homedir))
                path = path.Replace(homedir, "~");

            int index = -1;
            if ((index = path.LastIndexOf('/')) != -1)
                if (index > 27) {
                    path = path.Substring(0, 25);
                    path += "...";
                } else
                    path = path.Substring(0, index+1);

            add_line(Mono.Unix.Catalog.GetString("Path:"), path);
            add_line(Mono.Unix.Catalog.GetString("Size:"), item.size);
            add_line(Mono.Unix.Catalog.GetString("Last modified:"), item.accessed);
            add_line(Mono.Unix.Catalog.GetString("Last accessed:"), item.modify);

            box.PackStart(extra_info, false, false, 3);

            Gtk.Alignment box_alignment = new Alignment(0.5f, 1f, 0, 0);
            box_alignment.BottomPadding = 12;
            box_alignment.TopPadding = 12;
            box_alignment.LeftPadding = 12;
            box_alignment.RightPadding = 12;

            box_alignment.Add(box);

            box_wrapper = new EventBox(); // for bg color
            box_wrapper.Add(box_alignment);
            GtkCommon.set_background_color(box_wrapper, "white");

            box_wrapper.ButtonPressEvent += GtkCommon.ButtonPressEventWrapper(item);

            representation = new Frame();
            representation.Add(box_wrapper);

            representation.ShowAll();
        }
Ejemplo n.º 36
0
 public iFolderApplication(string[] args)
     : base("ifolder", "1.0", Modules.UI, args)
 {
     Util.InitCatalog();
        Util.SetQuitiFolderDelegate(new QuitiFolderDelegate(QuitiFolder));
        tIcon = new Egg.TrayIcon("iFolder");
        currentIconAnimationDirection = 0;
        this.ClientUpgradeStatus = null;
        this.NewClientVersion = null;
        this.NewClientDomainID = null;
        eBox = new EventBox();
        eBox.ButtonPressEvent +=
     new ButtonPressEventHandler(trayapp_clicked);
                 quitDlg = new iFolderMsgDialog(
                 null,
                 iFolderMsgDialog.DialogType.Question,
                 iFolderMsgDialog.ButtonSet.YesNo,
                 Util.GS("Exit Novell iFolder"),
                  Util.GS("If you exit the Novell iFolder application, changes in your iFolder will no longer be tracked.\nThe next time you login, Novell iFolder will reconcile any differences between your iFolder and Server.\n\nAre you sure you want to exit the Application ?"),
                 " ");
                  quitDlg.Response += new ResponseHandler(YesNo_Clicked);
        RunningPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder16.png"));
        StartingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-waiting16.png"));
        StoppingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-waiting16.png"));
        DownloadingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-download16.png"));
        UploadingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-upload16.png"));
        gAppIcon = new Gtk.Image(RunningPixbuf);
        eBox.Add(gAppIcon);
        tIcon.Add(eBox);
        tIcon.ShowAll();
        LoginDialog = null;
        collectionSynchronizing = null;
        synchronizationErrors = new Hashtable();
        iFolderAppStateChanged = new Gtk.ThreadNotify(
        new Gtk.ReadyEvent(OniFolderAppStateChanged));
        simiasManager = Util.CreateSimiasManager(args);
        startingUpNotifyWindow = null;
        shuttingDownNotifyWindow = null;
        forceShutdown = false;
        ClientUpgradeDialog = null;
 }
Ejemplo n.º 37
0
        public void Run()
        {
            Gtk.Application.Init();
            SetupTheme();

            ApiExtensibility.Register(typeof(Windows.UI.Core.ICoreWindowExtension), o => new GtkCoreWindowExtension(o));
            ApiExtensibility.Register <Windows.UI.Xaml.Application>(typeof(Uno.UI.Xaml.IApplicationExtension), o => new GtkApplicationExtension(o));
            ApiExtensibility.Register(typeof(Windows.UI.ViewManagement.IApplicationViewExtension), o => new GtkApplicationViewExtension(o));
            ApiExtensibility.Register(typeof(ISystemThemeHelperExtension), o => new GtkSystemThemeHelperExtension(o));
            ApiExtensibility.Register(typeof(Windows.Graphics.Display.IDisplayInformationExtension), o => _displayInformationExtension ??= new GtkDisplayInformationExtension(o, _window));
            ApiExtensibility.Register <TextBoxView>(typeof(ITextBoxViewExtension), o => new TextBoxViewExtension(o, _window));
            ApiExtensibility.Register(typeof(ILauncherExtension), o => new LauncherExtension(o));
            ApiExtensibility.Register <FileOpenPicker>(typeof(IFileOpenPickerExtension), o => new FileOpenPickerExtension(o));
            ApiExtensibility.Register <FolderPicker>(typeof(IFolderPickerExtension), o => new FolderPickerExtension(o));
            ApiExtensibility.Register(typeof(IClipboardExtension), o => new ClipboardExtensions(o));
            ApiExtensibility.Register <FileSavePicker>(typeof(IFileSavePickerExtension), o => new FileSavePickerExtension(o));

            _isDispatcherThread = true;
            _window             = new Gtk.Window("Uno Host");
            Size preferredWindowSize = ApplicationView.PreferredLaunchViewSize;

            if (preferredWindowSize != Size.Empty)
            {
                _window.SetDefaultSize((int)preferredWindowSize.Width, (int)preferredWindowSize.Height);
            }
            else
            {
                _window.SetDefaultSize(1024, 800);
            }
            _window.SetPosition(Gtk.WindowPosition.Center);

            _window.Realized += (s, e) =>
            {
                // Load the correct cursors before the window is shown
                // but after the window has been initialized.
                Cursors.Reload();
            };

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

            bool EnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback)
            {
                Dispatch(() => callback());

                return(true);
            }

            Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative;

            void Dispatch(System.Action d)
            {
                if (Gtk.Application.EventsPending())
                {
                    Gtk.Application.RunIteration(false);
                }

                GLib.Idle.Add(delegate
                {
                    if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace))
                    {
                        this.Log().Trace($"Iteration");
                    }

                    try
                    {
                        d();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }

                    return(false);
                });
            }

            Windows.UI.Core.CoreDispatcher.DispatchOverride        = Dispatch;
            Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride = () => _isDispatcherThread;

            _window.Realized += (s, e) =>
            {
                WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(_window.AllocatedWidth, _window.AllocatedHeight));
            };

            _window.SizeAllocated += (s, e) =>
            {
                WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(e.Allocation.Width, e.Allocation.Height));
            };

            _window.WindowStateEvent += OnWindowStateChanged;

            var overlay = new Overlay();

            _eventBox = new EventBox();
            _area     = new UnoDrawingArea();
            _fix      = new Fixed();
            overlay.Add(_area);
            overlay.AddOverlay(_fix);
            _eventBox.Add(overlay);
            _window.Add(_eventBox);

            /* avoids double invokes at window level */
            _area.AddEvents((int)GtkCoreWindowExtension.RequestedEvents);

            _window.ShowAll();

            void CreateApp(ApplicationInitializationCallbackParams _)
            {
                var app = _appBuilder();

                app.Host = this;
            }

            WUX.Application.Start(CreateApp, _args);

            UpdateWindowPropertiesFromPackage();

            Gtk.Application.Run();
        }
Ejemplo n.º 38
0
        private void create_window(string search_text, int x, int y)
        {
            System.Console.WriteLine("creating search window");

            if (popup == null) {
                popup = new Gtk.Window(Gtk.WindowType.Popup);
                elements = new VBox();
            } else {
                foreach (Widget w in popup.Children)
                    w.Destroy();
            }

            Gtk.Alignment alignment = new Gtk.Alignment(1F, 0.5F, 0F, 0F);
            Gtk.EventBox image_wrapper = new EventBox();
            Gtk.Image close_image = new Gtk.Image(null, "close.png");
            image_wrapper.Add(close_image);

            if (String.IsNullOrEmpty(name))
                throw new Exception("name for an overlay cannot be empty");

            image_wrapper.ButtonPressEvent += delegate {
                Singleton<OverlayTracker>.Instance.hide_and_die(name);
            };
            GtkCommon.set_background_color(image_wrapper, "white");
            alignment.Add(image_wrapper);
            elements.PackStart(alignment, false, false, 0);

            Gtk.Label header = new Gtk.Label();
            header.Markup = "<big>" + String.Format(Mono.Unix.Catalog.GetString("Search results for: {0}"),  "<b>" + search_text + "</b></big>");

            elements.PackStart(header, false, false, 0);
            elements.PackStart(new Gtk.HSeparator(), false, false, 0);

            Gtk.EventBox border_wrapper = new Gtk.EventBox();

            Gtk.Frame border = new Gtk.Frame();

            Gtk.Alignment border_alignment = new Gtk.Alignment(1, 1, 1, 1);
            border_alignment.BottomPadding = 5;
            border_alignment.TopPadding = 5;
            border_alignment.LeftPadding = 5;
            border_alignment.RightPadding = 5;

            border_alignment.Add(elements);

            border.Add(border_alignment);

            border_wrapper.Add(border);

            GtkCommon.set_background_color(border_wrapper, "white");

            popup.Add(border_wrapper);
        }
Ejemplo n.º 39
0
        public DockItemContainer(DockFrame frame, DockItem item)
        {
            this.frame = frame;
            this.item  = item;

            ResizeMode = Gtk.ResizeMode.Queue;
            Spacing    = 0;

            title           = new Gtk.Label();
            title.Xalign    = 0;
            title.Xpad      = 3;
            title.UseMarkup = true;
            title.Ellipsize = Pango.EllipsizeMode.End;

            btnDock              = new Button(new Gtk.Image(pixAutoHide));
            btnDock.Relief       = ReliefStyle.None;
            btnDock.CanFocus     = false;
            btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked     += OnClickDock;

            btnClose              = new Button(new Gtk.Image(pixClose));
            btnClose.TooltipText  = Catalog.GetString("Hide");
            btnClose.Relief       = ReliefStyle.None;
            btnClose.CanFocus     = false;
            btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };

            HBox box = new HBox(false, 0);

            box.PackStart(title, true, true, 0);
            box.PackEnd(btnClose, false, false, 0);
            box.PackEnd(btnDock, false, false, 0);

            headerAlign            = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1;
            headerAlign.Add(box);

            header                     = new EventBox();
            header.Events             |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
            header.ButtonPressEvent   += HeaderButtonPress;
            header.ButtonReleaseEvent += HeaderButtonRelease;
            header.MotionNotifyEvent  += HeaderMotion;
            header.KeyPressEvent      += HeaderKeyPress;
            header.KeyReleaseEvent    += HeaderKeyRelease;
            header.Add(headerAlign);
            header.ExposeEvent += HeaderExpose;
            header.Realized    += delegate {
                header.GdkWindow.Cursor = handCursor;
            };

            foreach (Widget w in new Widget [] { header, btnDock, btnClose })
            {
                w.EnterNotifyEvent += HeaderEnterNotify;
                w.LeaveNotifyEvent += HeaderLeaveNotify;
            }

            PackStart(header, false, false, 0);
            ShowAll();

            PackStart(item.GetToolbar(PositionType.Top).Container, false, false, 0);

            HBox hbox = new HBox();

            hbox.Show();
            hbox.PackStart(item.GetToolbar(PositionType.Left).Container, false, false, 0);

            contentBox = new HBox();
            contentBox.Show();
            hbox.PackStart(contentBox, true, true, 0);

            hbox.PackStart(item.GetToolbar(PositionType.Right).Container, false, false, 0);

            PackStart(hbox, true, true, 0);

            PackStart(item.GetToolbar(PositionType.Bottom).Container, false, false, 0);

            UpdateBehavior();
        }
Ejemplo n.º 40
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;

            string[]    UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse  = new ReverseXmlList(original);

            foreach (XmlNode C in reverse)
            {
                if (C.Name == "Object")
                {
                    cIndex++;
                    if (C.Attributes[0].Name == "type")
                    {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button"))
                        {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        PB.Name = V.InnerText;
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                        PB.Children[0].ModifyFg(StateType.Active, FColor);
                                        PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                        PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                        break;

                                    case "Caption":
                                    case "Text":
                                        PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                        break;

                                    case "BackColor":
                                        var BColor = V.InnerText.GetXColor().ToNative();
                                        PB.ModifyBg(StateType.Normal, BColor);
                                        PB.ModifyBg(StateType.Active, BColor);
                                        PB.ModifyBg(StateType.Insensitive, BColor);
                                        PB.ModifyBg(StateType.Prelight, BColor);
                                        PB.ModifyBg(StateType.Selected, BColor);
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                        break;

                                    case "Image":
                                        if (V.HasChildNodes)
                                        {
                                            string IMGData = V.FirstChild.InnerText;
                                            byte[] B       = System.Convert.FromBase64String(IMGData);
                                            Pixbuf P       = new Pixbuf(B);
                                            P        = P.ScaleSimple(PB.WidthRequest - 10, PB.HeightRequest, InterpType.Bilinear);
                                            PB.Image = new Gtk.Image(P);
                                        }
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label"))
                        {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap     = true;
                            CC.Wrap         = true;
                            CC.Justify      = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild")
                            {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            }
                            else
                            {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        CC.Name = V.InnerText;
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        CC.ModifyFg(StateType.Normal, FColor);
                                        CC.ModifyFg(StateType.Active, FColor);
                                        CC.ModifyFg(StateType.Insensitive, FColor);
                                        CC.ModifyFg(StateType.Prelight, FColor);
                                        CC.ModifyFg(StateType.Selected, FColor);
                                        CE.ModifyFg(StateType.Normal, FColor);
                                        CE.ModifyFg(StateType.Active, FColor);
                                        CE.ModifyFg(StateType.Insensitive, FColor);
                                        CE.ModifyFg(StateType.Prelight, FColor);
                                        CE.ModifyFg(StateType.Selected, FColor);
                                        CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                        break;

                                    case "Caption":
                                    case "Text":
                                        CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                        break;

                                    case "BackColor":
                                        if (V.InnerText != "Transparent")
                                        {
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            CE.ModifyBg(StateType.Normal, BColor);
                                            CE.ModifyBg(StateType.Active, BColor);
                                            CE.ModifyBg(StateType.Insensitive, BColor);
                                            CE.ModifyBg(StateType.Prelight, BColor);
                                            CE.ModifyBg(StateType.Selected, BColor);
                                        }
                                        else
                                        {
                                            CE.Visible       = false;
                                            CE.VisibleWindow = false;
                                        }
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "TextAlign":
                                        CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                        break;

                                    case "Size":
                                        CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    var TZJE = new Fixed();
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox"))
                        {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "PasswordChar":
                                                CC.InvisibleChar = '*';
                                                CC.Visibility    = false;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.Panel"))
                        {
                            var CP = new Gtk.Fixed();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add(CP);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes ["name"].Value)
                                    {
                                    case "Name":
                                        CP.Name = V.InnerText;
                                        break;

                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "ForeColor":

                                        CP.Children [0].ModifyFg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "BackColor":
                                        CP.ModifyBg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        CP.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(C.Attributes ["type"].Value);
                        }
                    }
                }
            }
            Parent.ShowAll();
        }
Ejemplo n.º 41
0
        public VideoView()
        {
            preview_pos = PreviewPos.ButtonRight;

            VBox vbox = new VBox(false, 0);
            vbox.Show();

            Frame frame = new Frame();
            //frame.BorderWidth = 5;
            frame.Show();

            vbox.Add(frame);

            mainView = new Gtk.EventBox();
            mainView.WidthRequest = 400;
            mainView.HeightRequest = 300;
            mainView.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255,255,255));
            mainView.ModifyBg (Gtk.StateType.Active, new Gdk.Color (255,255,255));
            mainView.Show();

            //this.WidthRequest = 333; // 500; //250;
            //this.HeightRequest = 250; // 375; //187; 250
            preview = new Gtk.DrawingArea ();
            preview.WidthRequest = 120; // 75; //150;
            preview.HeightRequest = 90; // 56; //112;
            preview.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0,0,0));
            preview.ModifyBg (Gtk.StateType.Active, new Gdk.Color (0,0,0));
            preview.Show();

            fix = new Gtk.Fixed ();
            fix.Put (preview, space, space);
            fix.Show();
            mainView.Add(fix);

            frame.Add(mainView);

            //			Label label = new Label(Catalog.GetString("Video Chat in progress..."));

            //			label.Show();
            //			vbox.PackStart(label, false, true, 0);

            Button button = new Button(Catalog.GetString("End Call"));
            button.Clicked += OnCloseVideoClicked;
            button.Show();
            vbox.PackStart(button, false, false, 5);

            this.Add(vbox);
            mainView.SizeAllocated += OnSizeAllocated;
            //			this.SizeRequested += OnsizeRequested;
            this.QueueResize ();
            MovePreview ();
        }
Ejemplo n.º 42
0
        private Gtk.HBox create_element(Item item, string search_text, string snippet_text, VoidFunction update)
        {
            Gtk.HBox element = new Gtk.HBox();
            Gtk.VBox lines = new Gtk.VBox();
            Gtk.HBox title_date = new Gtk.HBox();

            Gtk.EventBox title_wrapper = new Gtk.EventBox();
            Gtk.Label title = new Gtk.Label();

            string str_title = item.name(40);

            string capitalized = search_text.Substring(0, 1).ToUpper() + search_text.Substring(1);

            if (str_title.Contains(search_text)) {
                int index = str_title.IndexOf(search_text);
                str_title = str_title.Substring(0, index) + "<b>" + search_text + "</b>" + str_title.Substring(index+search_text.Length);
            } else if (str_title.Contains(capitalized)) {
                int index = str_title.IndexOf(capitalized);
                str_title = str_title.Substring(0, index) + "<b>" + capitalized + "</b>" + str_title.Substring(index+capitalized.Length);
            }

            title.Markup = "<big>" + str_title + "</big>";
            title.UseUnderline = false;
            title.SetAlignment(0, 0); // left aligned
            title_wrapper.ButtonPressEvent += delegate(object sender, Gtk.ButtonPressEventArgs args) {
                if (args.Event.Button == 1)
                    item.open();
            };
            title_wrapper.Add(title);
            GtkCommon.set_background_color(title_wrapper, "white");

            GtkCommon.show_hand_and_tooltip(title_wrapper, String.Format(Mono.Unix.Catalog.GetString("Open: {0}"), item.long_name));

            GtkCommon.create_preview(item, lines, title_wrapper);

            title_date.PackStart(title_wrapper, true, true, 0);

            Gtk.Alignment date_alignment = new Gtk.Alignment(1, 0, 0, 0);
            Gtk.Label date = new Gtk.Label();
            date.Markup = "<big>" + String.Format("{0:dd/MM/yy}", item.last_modify) + "</big>";
            date_alignment.Add(date);
            date_alignment.LeftPadding = 10;
            title_date.PackStart(date_alignment, true, true, 0);

            lines.PackStart(title_date, true, true, 0);

            try {
                DocumentItem doc_item = item as DocumentItem;

                if (doc_item != null) {
                    doc_item.on_snippet_callback = delegate (string snippet) {
                        if (!String.IsNullOrEmpty(snippet)) {

                            System.Console.WriteLine("got snippet: {0}", snippet);

                            Gtk.Label snippet_label = new Gtk.Label();
                            snippet_label.SetAlignment(0, 0); // left aligned
                            snippet_label.Markup = snippet;
                            lines.PackStart(snippet_label, true, true, 2);
                            lines.ReorderChild(snippet_label, 1);

                            update();
                        }
                    };
                    if (!String.IsNullOrEmpty(doc_item.snippet))
                        doc_item.on_snippet_callback(doc_item.snippet);
                }
            } catch (Exception) { // not document item
            }

            Gtk.HBox label_links = new Gtk.HBox();

            Gtk.HBox bubbles = new Gtk.HBox();

            foreach (UserLabel label in item.labels)
                bubbles.Add(label.dot());

            label_links.PackStart(bubbles, false, false, 0);

            item.on_labels_callback = delegate() {
                foreach (Widget w in bubbles)
                    w.Destroy();

                foreach (UserLabel label in item.labels)
                    bubbles.Add(label.dot());

                element.ShowAll();
            };

            Gtk.Alignment links_alignment = new Gtk.Alignment(1,1,0,0);
            Gtk.HBox links = new Gtk.HBox();

            add_link(Mono.Unix.Catalog.GetString("Go to week"), CalendarDriver.View.Week, item.last_modify, links);
            add_link(Mono.Unix.Catalog.GetString("Go to month"), CalendarDriver.View.Month, item.last_modify, links);
            add_link(Mono.Unix.Catalog.GetString("Go to year"), CalendarDriver.View.Year, item.last_modify, links);

            links_alignment.Add(links);

            label_links.PackStart(links_alignment, true, true, 0);

            lines.PackStart(label_links, true, true, 2);

            string image = String.Empty;

            if (item.file != null)
                image = Singleton<Types>.Instance.get_type((int)item.file.type.category).icon;

            Gtk.Alignment img_alignment = new Gtk.Alignment(0, (float)0.05, 0,0);

            if (!String.IsNullOrEmpty(image))
            {
                Gtk.Image img;

                if (item.file.starred)
                    img = CairoDrawing.create_small_starred_image(image);
                else
                    img = new Gtk.Image(null, image);

                item.register_small_starred_change(delegate(bool starred) {
                    foreach (Widget w in img_alignment)
                        w.Destroy();
                    if (starred)
                        img = CairoDrawing.create_small_starred_image(image);
                    else
                        img = new Gtk.Image(null, image);
                    img_alignment.Add(img);
                    img_alignment.ShowAll();
                });

                img_alignment.Add(img);
                img_alignment.ShowAll();
            }

            element.PackStart(img_alignment, false, false, 5);

            element.PackStart(lines, true, true, 0);

            return element;
        }
Ejemplo n.º 43
0
        private Gtk.EventBox create_category_button(Category cat)
        {
            Gtk.EventBox header_wrapper = new Gtk.EventBox();
            Gtk.Alignment header_alignment = new Gtk.Alignment(0, 0, 0, 0);

            Gtk.HBox header = new Gtk.HBox();
            header.Add(CairoDrawing.create_empty_image(22, 16));
            header.Add(new Gtk.Label(" " + cat.metalabel.label));

            header_alignment.Add(header);
            header_wrapper.Name = cat.metalabel.label;
            header_wrapper.Add(header_alignment);
            header_wrapper.ButtonPressEvent += delegate (object sender, ButtonPressEventArgs args) {
                header_click(args, cat);
            };
            return header_wrapper;
        }
Ejemplo n.º 44
0
        public DockItemContainer(DockFrame dockframe, Widget widget)
        {
            this.Expand        = true;
            this.FadeOutHeader = true;
            //initIcons();

            frame            = dockframe;
            CurrentContainer = null;

            ResizeMode = Gtk.ResizeMode.Queue;
            Spacing    = 0;

            title         = new Gtk.Label();
            title.Justify = Justification.Left;

            Gtk.Image img1 = new Gtk.Image("gtk-zoom-out", IconSize.Menu);
            btnDock                   = new Button(img1);
            btnDock.Relief            = ReliefStyle.None;
            btnDock.Clicked          += HandleBtnDockClicked;
            btnDock.EnterNotifyEvent += HandleButtonEnterNotifyEvent;

            Gtk.Image img = new Gtk.Image("gtk-close", IconSize.SmallToolbar);
            btnClose                   = new Button(img);
            btnClose.Visible           = true;
            btnClose.Clicked          += HandleBtnCloseClicked;
            btnClose.Relief            = ReliefStyle.None;
            btnClose.EnterNotifyEvent += HandleButtonEnterNotifyEvent;

            HeaderBox = new HBox(false, 0);
            HeaderBox.PackStart(title, true, false, 0);
            HeaderBox.PackEnd(btnClose, false, false, 0);
            HeaderBox.PackEnd(btnDock, false, false, 0);

            headerAlign            = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
            headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 0;
            headerAlign.Add(HeaderBox);

            header                     = new EventBox();
            header.Events             |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
            header.ButtonPressEvent   += HeaderButtonPress;
            header.ButtonReleaseEvent += HeaderButtonRelease;


//			header.MotionNotifyEvent += HeaderMotion;
//			header.KeyPressEvent += HeaderKeyPress;
//			header.KeyReleaseEvent += HeaderKeyRelease;
            header.Add(headerAlign);
            //header.Drawn += HandleHeaderDrawn;

            //header.Add(new Gtk.Button("gtk-close"));

            header.Realized += delegate {
                header.Window.Cursor = handCursor;
            };

            foreach (Widget w in new Widget [] { header, btnDock, btnClose })
            {
                w.EnterNotifyEvent += HeaderEnterNotify;
                w.LeaveNotifyEvent += HeaderLeaveNotify;
            }

            PackStart(header, false, false, 0);
            ShowAll();

            if (widget != null)
            {
                CurrentWidget  = widget;
                widget.Visible = true;
                PackEnd(widget, true, true, 0);

                if (widget is CustomWidget)
                {
                    title.Text = (widget as DockableWidget).Title;
                }
            }

            doRemove = true;
            GLib.Timeout.Add(5000, new GLib.TimeoutHandler(removeHeader));
        }