当前位置: 首页>>代码示例>>C#>>正文


C# Gdk类代码示例

本文整理汇总了C#中Gdk的典型用法代码示例。如果您正苦于以下问题:C# Gdk类的具体用法?C# Gdk怎么用?C# Gdk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Gdk类属于命名空间,在下文中一共展示了Gdk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildNode

		public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
		{
			label = AddinCatalog.GetString ("Types");
			icon = Context.GetIcon ("md-db-tables");
			
			BaseNode node = (BaseNode) dataObject;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:TypesNodeBuilder.cs

示例2: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            base.OnExposeEvent(ev);
            using(Cairo.Context cr = Gdk.CairoHelper.Create(ev.Window))
            {
                if(bgTile == null)
                {
                    cr.Rectangle(ev.Area.X, ev.Area.Y, ev.Area.Width, ev.Area.Height);
                    cr.Color = new Cairo.Color(2, 114, 43);
                    cr.Fill();
                }
                else
                {
                    int pw = bgTile.Width;
                    int ph = bgTile.Height;

                    int xStart = ev.Area.Left / pw;
                    int xEnd = ev.Area.Right / pw + (ev.Area.Right % pw != 0 ? 1 : 0);
                    int yStart = ev.Area.Top / ph;
                    int yEnd = ev.Area.Bottom / ph + (ev.Area.Bottom % ph != 0 ? 1 : 0);

                    for(int x = xStart; x < xEnd; x++)
                        for(int y = yStart; y < yEnd; y++)
                            ev.Window.DrawPixbuf(Style.BaseGC(Gtk.StateType.Normal), bgTile, 0, 0, x * pw, y * ph, pw, ph, Gdk.RgbDither.Normal, 0, 0);
                }
                root.RootExpose(cr, new Rectangle(ev.Area.X, ev.Area.Y, ev.Area.Width, ev.Area.Height));
            }
            return true;
        }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:29,代码来源:GameBoardWidget.cs

示例3: ColorGetHex

 /// <summary>
 /// This returns the hexadecimal value of an GDK color.
 /// </summary>
 /// <param name="color">
 /// The color to convert to a hex string.
 /// </param>
 public static string ColorGetHex(Gdk.Color color)
 {
     return String.Format ("#{0:x2}{1:x2}{2:x2}",
                           (byte)(color.Red >> 8),
                           (byte)(color.Green >> 8),
                           (byte)(color.Blue >> 8));
 }
开发者ID:nolith,项目名称:tasque,代码行数:13,代码来源:Utilities.cs

示例4: BuildNode

		public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
		{
			var compilationUnit = (AssemblyLoader)dataObject;
			
			label = Path.GetFileNameWithoutExtension (compilationUnit.FileName);
			icon = Context.GetIcon (Stock.Reference);
		}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:7,代码来源:AssemblyNodeBuilder.cs

示例5: BuildNode

		public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
		{
			UnknownSolutionItem entry = (UnknownSolutionItem) dataObject;

			if (entry.UnloadedEntry) {
				icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project);
				Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade");
				if (gicon == null) {
					gicon = ImageService.MakeTransparent (icon, 0.5);
					Context.CacheComposedIcon (icon, "fade", gicon);
				}
				icon = gicon;
				label = GettextCatalog.GetString ("<span foreground='grey'>{0} <span size='small'>(Unavailable)</span></span>", GLib.Markup.EscapeText (entry.Name));
			}
			else if (entry.LoadError.Length > 0) {
				icon = Context.GetIcon (Gtk.Stock.DialogError);
				label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Load failed)</span>", GLib.Markup.EscapeText (entry.Name));
			} else {
				icon = Context.GetIcon (MonoDevelop.Ide.Gui.Stock.Project);
				Gdk.Pixbuf gicon = Context.GetComposedIcon (icon, "fade");
				if (gicon == null) {
					gicon = ImageService.MakeTransparent (icon, 0.5);
					Context.CacheComposedIcon (icon, "fade", gicon);
				}
				icon = gicon;
				label = GLib.Markup.EscapeText (entry.Name);
			}
		}
开发者ID:fedorw,项目名称:monodevelop,代码行数:28,代码来源:UnknownEntryNodeBuilder.cs

示例6: PostProcessKeyEvent

		public static void PostProcessKeyEvent (ICompletionWidget widget, Gdk.Key key, Gdk.ModifierType modifier)
		{
			// Called after the key has been processed by the editor
		
			if (methods.Count == 0)
				return;
				
			for (int n=0; n<methods.Count; n++) {
				// If the cursor is outside of any of the methods parameter list, discard the
				// information window for that method.
				
				MethodData md = methods [n];
				int pos = md.MethodProvider.GetCurrentParameterIndex (widget, md.CompletionContext);
				if (pos == -1) {
					methods.RemoveAt (n);
					n--;
				}
			}
			// If the user enters more parameters than the current overload has,
			// look for another overload with more parameters.
			UpdateOverload (widget);
			
			// Refresh.
			UpdateWindow (widget);
		}
开发者ID:Shanto,项目名称:monodevelop,代码行数:25,代码来源:ParameterInformationWindowManager.cs

示例7: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            base.OnExposeEvent (evnt);

            using (var g = Gdk.CairoHelper.Create (evnt.Window)) {
                UseStandardLineDrawing (g);
                DrawVerticalReferenceLines (g, evnt.Area, XSize, XTranslation);
                DrawHorizontalReferenceLines (g, evnt.Area, YSize);
                DrawRightsideHorisontalNumbers (g, evnt.Area, SecondaryYSize);

                DrawTitle (g, ChartName);
                int i;
                for (i = 0; i < Lines.Count; i++) {
                    DrawLineInfo (g, Lines [i], i);
                }
                for (int j = 0; j < secondaryLines.Count; j++) {
                    DrawLineInfo (g, secondaryLines [j], i);
                    i++;
                }

                TransformForLineDrawing (g, evnt.Area);
                DrawLines (g, evnt.Area, Lines, XSize, YSize);
                DrawLines (g, evnt.Area, secondaryLines, XSize, SecondaryYSize);
            }

            return true;
        }
开发者ID:haved,项目名称:MyPrograms,代码行数:27,代码来源:HDoubleChart.cs

示例8: StartEditing

 public override CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
 {
     if (Changed != null)
         Changed (this, new FlagArgs () { Path = path });
     this.StopEditing (true);
     return null;
 }
开发者ID:chergert,项目名称:adroit,代码行数:7,代码来源:CellRendererFlag.cs

示例9: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            Cairo.Context cr = Gdk.CairoHelper.Create(GdkWindow);
            var wrapper = new GraphicsContextWrapper(cr, Allocation.Width, Allocation.Height);
            _control.Render(wrapper);

//            int width, height;
//            width = Allocation.Width;
//            height = Allocation.Height;
//
//            cr.SetSourceRGB(0.7, 0.2, 0.0);
//            cr.Rectangle(0, 0, width, height);
//            //cr.Clip();
//            cr.Fill();

//            cr.LineWidth = 9;
//            cr.SetSourceRGB(0.7, 0.2, 0.0);
//
//            cr.Translate(width/2, height/2);
//            cr.Arc(0, 0, (width < height ? width : height) / 2 - 10, 0, 2*Math.PI);
//            cr.StrokePreserve();
//
//            cr.SetSourceRGB(0.3, 0.4, 0.6);
//            cr.Fill();

            ((IDisposable) cr.GetTarget()).Dispose();                                      
            ((IDisposable) cr).Dispose();

            return true;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:30,代码来源:OutputMeter.cs

示例10: CursorTracker

		CursorTracker (Gdk.Display display)
		{
			Enabled = true;
			this.display = display;
			resolution_senders = new List<object> ();
			ResetTimer ();
		}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:7,代码来源:CursorTracker.cs

示例11: Face

	public Face (uint id, Gdk.Rectangle r) : base (id) {
		rect = r;
		
		photo_id = 0;
		tag_id = 0;
		tag = null;
	}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:7,代码来源:FaceStore.cs

示例12: ForDisplay

		public static CursorTracker ForDisplay (Gdk.Display display)
		{
			if (!trackers.ContainsKey (display))
				trackers [display] = new CursorTracker (display);
			
			return trackers [display];
		}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:7,代码来源:CursorTracker.cs

示例13: FillValues

		private void FillValues (Gdk.Pixbuf src)
		{
			values = new int [256, 3];

			if (src.BitsPerSample != 8)
				throw new System.Exception ("Invalid bits per sample");

			unsafe {
				byte * srcb = (byte *)src.Pixels;
				byte * pixels = srcb;
				bool alpha = src.HasAlpha;
				int rowstride = src.Rowstride;
				int width = src.Width;
				int height = src.Height;

				// FIXME array bounds checks slow this down a lot
				// so we use a pointer.  It is sad but I want fastness
				fixed (int * v = &values [0,0]) {
					for (int j = 0; j < height; j++) {
						for (int i = 0; i < width; i++) {
							v [*(srcb++) * 3 + 0]++;
							v [*(srcb++) * 3 + 1]++;
							v [*(srcb++) * 3 + 2]++;

							if (alpha)
								srcb++;

						}
						srcb =  ((byte *) pixels) + j * rowstride;
					}
				}
			}
		}
开发者ID:mono,项目名称:f-spot,代码行数:33,代码来源:Histogram.cs

示例14: PaletteToString

 /// <summary> PaletteToString Method </summary>
 public static string PaletteToString(Gdk.Color[] colors)
 {
     int n_colors = colors.Length;
     IntPtr raw_ret = gtk_color_selection_palette_to_string(colors, n_colors);
     string ret = GLib.Marshaller.PtrToStringGFree (raw_ret);
     return ret;
 }
开发者ID:Gravecorp,项目名称:gtk-sharp,代码行数:8,代码来源:ColorSelection.cs

示例15: KeyPress

		}// Parser
		
		public override bool KeyPress (Gdk.Key key, char keyChar, Gdk.ModifierType modifier)
		{
			int line, column;
			Editor.GetLineColumnFromPosition (Editor.CursorPosition, out line, out column);
			string lineText = Editor.GetLineText (line);
			
			// smart formatting strategy
			if (TextEditorProperties.IndentStyle == IndentStyle.Smart) {
				if (key == Gdk.Key.Return) {
					if (lineText.TrimEnd ().EndsWith ("{")) {
						Editor.InsertText (Editor.CursorPosition, 
						    "\n" + TextEditorProperties.IndentString + GetIndent (Editor, line));
						return false;
					}
				} else if (key == Gdk.Key.braceright && AllWhiteSpace (lineText) 
				    && lineText.StartsWith (TextEditorProperties.IndentString)) {
					if (lineText.Length > 0)
						lineText = lineText.Substring (TextEditorProperties.IndentString.Length);
					Editor.ReplaceLine (line, lineText + "}");
					return false;
				}
			}
			
			return base.KeyPress (key, keyChar, modifier);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:27,代码来源:ValaTextEditorExtension.cs


注:本文中的Gdk类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。