Exemplo n.º 1
0
		public virtual Gtk.Window ShowTooltipWindow (MonoTextEditor editor, Gtk.Window tipWindow, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
		{
			int ox = 0, oy = 0;
			if (editor.GdkWindow != null)
				editor.GdkWindow.GetOrigin (out ox, out oy);
			
			int w;
			double xalign;
			GetRequiredPosition (editor, tipWindow, out w, out xalign);
			w += 10;

			int x = mouseX + ox + editor.Allocation.X;
			int y = mouseY + oy + editor.Allocation.Y;
			Gdk.Rectangle geometry = editor.Screen.GetUsableMonitorGeometry (editor.Screen.GetMonitorAtPoint (x, y));
			
			x -= (int) ((double) w * xalign);
			y += 10;
			
			if (x + w >= geometry.X + geometry.Width)
				x = geometry.X + geometry.Width - w;
			if (x < geometry.Left)
				x = geometry.Left;
			
			int h = tipWindow.SizeRequest ().Height;
			if (y + h >= geometry.Y + geometry.Height)
				y = geometry.Y + geometry.Height - h;
			if (y < geometry.Top)
				y = geometry.Top;
			
			tipWindow.Move (x, y);
			
			tipWindow.ShowAll ();

			return tipWindow;
		}
Exemplo n.º 2
0
		protected void AddCustomWidget (Gtk.Widget w)
		{
			w.ShowAll ();
			book.AppendPage (w, null);
			book.Page = book.NPages - 1;
			
			if (initialized) {
				Gtk.Widget cw = book.GetNthPage (0);
				book.RemovePage (0);
				cw.Destroy ();
			}
			else
				initialized = true;
		}
Exemplo n.º 3
0
 public static void ComboPackShowAndSensitive(Gtk.Box box, Gtk.ComboBox combo)
 {
     box.PackStart(combo, true, true, 0);
     box.ShowAll();
     combo.Sensitive = true;
 }
Exemplo n.º 4
0
 void UpdateButton(DialogButton btn, Gtk.Button b)
 {
     if (!string.IsNullOrEmpty (btn.Label) && btn.Image == null) {
         b.Label = btn.Label;
     } else if (string.IsNullOrEmpty (btn.Label) && btn.Image != null) {
         var pix = btn.Image.ToImageDescription ();
         b.Image = new ImageBox (ApplicationContext, pix);
     } else if (!string.IsNullOrEmpty (btn.Label)) {
         Gtk.Box box = new Gtk.HBox (false, 3);
         var pix = btn.Image.ToImageDescription ();
         box.PackStart (new ImageBox (ApplicationContext, pix), false, false, 0);
         box.PackStart (new Gtk.Label (btn.Label), true, true, 0);
         b.Image = box;
     }
     if (btn.Visible)
         b.ShowAll ();
     else
         b.Hide ();
     b.Sensitive = btn.Sensitive;
     UpdateActionAreaVisibility ();
 }
Exemplo n.º 5
0
 void UpdateButton(DialogButton btn, Gtk.Button b)
 {
     if (!string.IsNullOrEmpty (btn.Label) && btn.Image == null) {
         b.Label = btn.Label;
     } else if (string.IsNullOrEmpty (btn.Label) && btn.Image != null) {
         var pix = (Gdk.Pixbuf) Toolkit.GetBackend (btn.Image);
         b.Image = new Gtk.Image (pix);
     } else if (!string.IsNullOrEmpty (btn.Label)) {
         Gtk.Box box = new Gtk.HBox (false, 3);
         var pix = (Gdk.Pixbuf) Toolkit.GetBackend (btn.Image);
         box.PackStart (new Gtk.Image (pix), false, false, 0);
         box.PackStart (new Gtk.Label (btn.Label), true, true, 0);
         b.Image = box;
     }
     if (btn.Visible)
         b.ShowAll ();
     else
         b.Hide ();
     b.Sensitive = btn.Sensitive;
     UpdateActionAreaVisibility ();
 }
Exemplo n.º 6
0
 public void InitWebKit(Gtk.Box w)
 {
     wb = new WebKit.WebView();
     scrollWindow.Add(wb);
     // Hack to work around webkit bug; webkit will crash the app if a size is not provided
     // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=466360 for a related bug report
     wb.SetSizeRequest(2, 2);
     w.PackStart(scrollWindow, true, true, 0);
     w.ShowAll();
 }
Exemplo n.º 7
0
 public void InitWebKit(Gtk.Box w)
 {
     if (!appInited)
     {
         MonoMac.AppKit.NSApplication.Init();
         appInited = true;
     }
     wb = new MonoMac.WebKit.WebView(new System.Drawing.RectangleF(10, 10, 200, 200), "foo", "bar");
     scrollWindow.AddWithViewport(NSViewToGtkWidget(wb));
     w.PackStart(scrollWindow, true, true, 0);
     w.ShowAll();
     wb.ShouldCloseWithWindow = true;
 }
Exemplo n.º 8
0
		protected ToggleToolButton AddButton (string label, Gtk.Widget page)
		{
			CheckCreateSubViewToolbar ();
			updating = true;
			ToggleToolButton button = new ToggleToolButton ();
			button.Label = label;
			button.IsImportant = true;
			button.Clicked += new EventHandler (OnButtonToggled);
			button.ShowAll ();
			subViewToolbar.Insert (button, -1);
			subViewNotebook.AppendPage (page, new Gtk.Label ());
			page.ShowAll ();
			EnsureToolbarBoxSeparator ();
			updating = false;
			return button;
		}
Exemplo n.º 9
0
		void PopupContextMenuAtLocation (Gtk.Menu menu, int x, int y)
		{
			menu.ShowAll ();
			Gtk.MenuPositionFunc pos_menu_func = null;

			// Set up the funtion to position the context menu
			// if we were called by the keyboard Gdk.Key.Menu.
			if (x == 0 && y == 0)
				pos_menu_func = PositionContextMenu;

			try {
				menu.Popup (null, null,
					    pos_menu_func,
					    0,
					    Gtk.Global.CurrentEventTime);
			} catch {
				Logger.Debug ("Menu popup failed with custom MenuPositionFunc; trying again without");
				menu.Popup (null, null,
					    null,
					    0,
					    Gtk.Global.CurrentEventTime);
			}
		}
Exemplo n.º 10
0
		private void Rebuild(Gtk.Table table, uint[][][] positions, GedcomIndividualRecord activePerson, GedcomFamilyLink[] lst)
		{
			foreach (Gtk.Widget child in table.Children)
			{
				child.Destroy();
			}
			table.Resize(1,1);
			
			uint xmax = 0;
			uint ymax = 0;
			
			for (int i = 0; i < positions.Length; i ++)
			{
				uint x = positions[i][0][0] + 1;
				uint y = positions[i][0][1] + 1;
				uint w = positions[i][0][2];
				uint h = positions[i][0][3];
				
				GedcomFamilyLink famLink = (GedcomFamilyLink)lst[i];
				if (famLink == null)
				{	
					PedigreeBox pw = new PedigreeBox(null, 0, null);
					
					if (i > 0 && lst[((i+1)/2)-1] != null)
					{
						GedcomFamilyLink missingFamLink = (GedcomFamilyLink)lst[((i+1)/2)-1];
						
						// missing parent button
						pw.ForceMouseOver = true;
					}
					// FIXME: both conditions do the same thing, double checking
					// the gramps code it doesn't appear to be a mistake in porting
					if (positions[i][0][2] > 1)
					{
						table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					}
					else
					{
						table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					}
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
				}
				else
				{
					GedcomIndividualRecord indi = (GedcomIndividualRecord)_database[famLink.Indi];
					
					if (_showImages && i < ((positions.Length - 1) / 2) && positions[i][0][3] > 1)
					{
						
					}
					
					PedigreeBox pw = new PedigreeBox(indi, positions[i][0][3], null);
					pw.SelectIndividual += PedigreeBox_SelectIndividual;
					
					if (positions[i][0][3] < 7)
					{
						pw.TooltipMarkup = pw.FormatPerson(11, true);
					}
					
					if (positions[i][0][2] > 1)
					{
						table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
					}
					else
					{
						table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					}
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
				}
				
				// connection lines
				if (positions[i].Length > 1)
				{
					// separate boxes for father and mother
					x = positions[i][1][0] + 1;
					y = positions[i][1][1] + 1;
					w = 1;
					h = positions[i][1][2];
					
					Gtk.DrawingArea line = new Gtk.DrawingArea();
					line.ExposeEvent += Line_Expose;
					bool rela = false;
					if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown))
					{
						line.AddEvents((int)Gdk.EventMask.ButtonPressMask);
						rela = true;
					}
					Utility.Pair<int, bool> lineData = new Pair<int,bool>();
					lineData.First = i * 2 + 1;
					lineData.Second = rela;
					_lines[line] = lineData;
					
					table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
					
					x = positions[i][2][0] + 1;
					y = positions[i][2][1] + 1;
					w = 1;
					h = positions[i][2][2];
					
					line = new Gtk.DrawingArea();
					line.ExposeEvent += Line_Expose;
					rela = false;
					if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown))
					{
						line.AddEvents((int)Gdk.EventMask.ButtonPressMask);
						rela = true;
					}
					lineData = new Pair<int,bool>();
					lineData.First = i * 2 + 2;
					lineData.Second = rela;
					_lines[line] = lineData;
					
					table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
				}
				
				// marriage data
				if (_showMarriageData && positions[i].Length > 3)
				{
					string  text = string.Empty;
					if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown))
					{
						text = "foo";
					}
					Gtk.Label label = new Gtk.Label(text);
					label.Justify = Gtk.Justification.Left;
					label.LineWrap = true;
					label.SetAlignment(0.1F, 0.5F);
					
					x = positions[i][3][0] + 1;
					y = positions[i][3][1] + 1;
					w = positions[i][3][2];
					h = positions[i][3][3];
					
					table.Attach(label, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
				}
			}
			
			// nav arrows
			if (lst[0] != null)
			{
				Gtk.Button arrowButton = new Gtk.Button();
				arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Left, Gtk.ShadowType.In));
				
				arrowButton.Sensitive = (_dummyFam.Children.Count > 0);
				arrowButton.Clicked += ArrowButton_Click;
				if (arrowButton.Sensitive)
				{
					arrowButton.TooltipText = "Jump to child...";
				}
				
				uint ymid = (uint)Math.Floor(ymax / 2.0F);
				table.Attach(arrowButton, 0, 1, ymid, ymid + 1, 0, 0, 0, 0);
				
				// father
				arrowButton = new Gtk.Button();
				arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In));
				arrowButton.Sensitive = (lst[1] != null);
				arrowButton.Clicked += FatherButton_Click;
				if (arrowButton.Sensitive)
				{
					arrowButton.TooltipText = "Jump to father";
				}
				
				ymid = (uint)Math.Floor(ymax / 4.0F);
				table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0);
				
				// mother
				arrowButton = new Gtk.Button();
				arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In));
				arrowButton.Sensitive = (lst[2] != null);
				arrowButton.Clicked += MotherButton_Click;
				if (arrowButton.Sensitive)
				{
					arrowButton.TooltipText = "Jump to mother";
				}
				
				ymid = (uint)Math.Floor(ymax / 4.0F * 3);
				table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0);
				
				
				// dummy widgets to allow pedigree to be centred
				Gtk.Label l = new Gtk.Label(string.Empty);
				table.Attach(l, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
				l = new Gtk.Label(string.Empty);
				table.Attach(l, xmax, xmax + 1, ymax, ymax + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
	
				table.ShowAll();
			}
		}	
Exemplo n.º 11
0
        public void ShowControlBox( Gtk.VBox labels, Gtk.VBox widgets )
        {
            Label label = new Label( "Target height:" );

            heightscale = new HScale( minheight, maxheight, (maxheight - minheight) / 20 );
            heightscale.Value = lastheight;
            heightscale.ValueChanged += new EventHandler( heightscale_ValueChanged );

            labels.PackEnd( label );
            widgets.PackEnd( heightscale );
            labels.ShowAll();
            widgets.ShowAll();
        }
		private void AddMenuItems (Gtk.Menu menu)
		{
			RemoveMenuItems (menu);			

			NotebookNewNoteMenuItem item;

			Gtk.TreeModel model = NotebookManager.Notebooks;
			Gtk.TreeIter iter;
			
			// Add in the "New Notebook..." menu item
			Gtk.ImageMenuItem newNotebookMenuItem =
				new Gtk.ImageMenuItem (Catalog.GetString ("New Note_book..."));
			newNotebookMenuItem.Image = new Gtk.Image (NewNotebookIcon);
			newNotebookMenuItem.Activated += OnNewNotebookMenuItem;
			newNotebookMenuItem.ShowAll ();
			menu.Append (newNotebookMenuItem);
			
			if (model.IterNChildren () > 0) {
				Gtk.SeparatorMenuItem separator = new Gtk.SeparatorMenuItem ();
				separator.ShowAll ();
				menu.Append (separator);
				
				if (model.GetIterFirst (out iter) == true) {
					do {
						Notebook notebook = model.GetValue (iter, 0) as Notebook;
						item = new NotebookNewNoteMenuItem (notebook);
						item.ShowAll ();
						menu.Append (item);
					} while (model.IterNext (ref iter) == true);
				}
			}
#if MAC
			menu.ShowAll ();
#endif
		}
Exemplo n.º 13
0
        public void ShowControlBox( Gtk.VBox labels, Gtk.VBox widgets )
        {
            Tooltips tooltips = new Tooltips();

            coresize = new HScale( 0, 100, 5 );
            coresize.Value = coresizevalue;
            coresize.ValueChanged += new EventHandler( coresize_ValueChanged );
            tooltips.SetTip( coresize, "Radius of core.  Core has no fall-off", "Radius of core.  Inside core, brush has full effect; outside of core, brush effect falls off towards the edge." );
            tooltips.Enable();

            labels.PackEnd( new Label( "Brush core radius:" ) );
            widgets.PackEnd( coresize );
            labels.ShowAll();
            widgets.ShowAll();
        }
Exemplo n.º 14
0
 public void FillVbox(Gtk.VBox vbox, IList people) {
     foreach (Person p in people)
     {
         vbox.PackStart (new PersonAndJobRow(p, null));
     }
     vbox.ShowAll ();
 }