• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CellRendererState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Render

		protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
		{
			base.Render (window, widget, background_area, cell_area, expose_area, flags);

			if (PackageSourceViewModel == null)
				return;
				
			using (var layout = new Pango.Layout (widget.PangoContext)) {
				layout.Alignment = Pango.Alignment.Left;
				layout.SetMarkup (GetPackageSourceNameMarkup ());
				int packageSourceNameWidth = GetLayoutWidth (layout);
				StateType state = GetState (widget, flags);

				layout.SetMarkup (GetPackageSourceDescriptionMarkup ());

				window.DrawLayout (widget.Style.TextGC (state), cell_area.X + textSpacing, cell_area.Y + textTopSpacing, layout);

				if (!PackageSourceViewModel.IsValid) {
					using (var ctx = Gdk.CairoHelper.Create (window)) {
						ctx.DrawImage (widget, warningImage, cell_area.X + textSpacing + packageSourceNameWidth + imageSpacing, cell_area.Y + textTopSpacing);
					}

					layout.SetMarkup (GetPackageSourceErrorMarkup ());
					int packageSourceErrorTextX = cell_area.X + textSpacing + packageSourceNameWidth + (int)warningImage.Width + (2 * imageSpacing);
					window.DrawLayout (widget.Style.TextGC (state), packageSourceErrorTextX, cell_area.Y + textTopSpacing, layout);
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:28,代码来源:PackageSourceCellRenderer.cs


示例2: Render

        protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState state)
        {
            if (Theme == null) {
                Theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (widget);
                Theme.Context.Radius = 3;
            }

            Context cr = Gdk.CairoHelper.Create (window);

            // Setup the drawing boundaries/positioning
            cr.Rectangle (cell_area.X, cell_area.Y, cell_area.Width, cell_area.Height);
            cr.Clip ();
            cr.Translate (cell_area.X, cell_area.Y);

            // Clear any existing drawing
            cr.Rectangle (0, 0, cell_area.Width, cell_area.Height);
            cr.Color = Theme.ViewFill;
            cr.Fill ();

            if (state == CellRendererState.Selected) {
                Theme.DrawRowSelection (cr, 0, 0, cell_area.Width, cell_area.Height, true);
            } else if (state == CellRendererState.Focused) {
                Theme.DrawRowSelection (cr, 0, 0, cell_area.Width, cell_area.Height, false);
            }

            var border = Theme.TotalBorderWidth;
            cr.Translate (border, border);
            var width = cell_area.Width - 2 * border;
            var height = cell_area.Height - 2 * border;

            Render (cr, width, height, state);

            Hyena.Gui.CairoExtensions.DisposeContext (cr);
        }
开发者ID:GNOME,项目名称:pdfmod,代码行数:34,代码来源:CairoCell.cs


示例3: OnRender

	protected override void OnRender (Cairo.Context cr, Widget widget, Rectangle background_area, Rectangle cell_area, CellRendererState flags)
	{
		int x = (int) (cell_area.X + this.Xpad);
		int y = (int) (cell_area.Y + this.Ypad);
		int width = (int) (cell_area.Width - this.Xpad * 2);
		int height = (int) (cell_area.Height - this.Ypad * 2);

		widget.StyleContext.Save ();
		widget.StyleContext.AddClass ("trough");
		widget.StyleContext.RenderBackground (cr, x, y, width, height);
		widget.StyleContext.RenderFrame (cr, x, y, width, height);
		
		Border padding = widget.StyleContext.GetPadding (StateFlags.Normal);
		x += padding.Left;
		y += padding.Top;
		width -= padding.Left + padding.Right;
		height -= padding.Top + padding.Bottom;

		widget.StyleContext.Restore ();
		
		widget.StyleContext.Save ();
		widget.StyleContext.AddClass ("progressbar");
		widget.StyleContext.RenderActivity (cr, x, y, (int) (width * Percentage), height);
		widget.StyleContext.Restore ();
	}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:25,代码来源:CustomCellRenderer.cs


示例4: Render

	protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
	{
		int width = 0, height = 0, x_offset = 0, y_offset = 0;
		StateType state;
		GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);

		if (widget.HasFocus)
			state = StateType.Active;
		else
			state = StateType.Normal;

		width -= (int) this.Xpad * 2;
		height -= (int) this.Ypad * 2;


		//FIXME: Style.PaintBox needs some customization so that if you pass it
		//a Gdk.Rectangle.Zero it gives a clipping area big enough to draw
		//everything
		Gdk.Rectangle clipping_area = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);
		
		Style.PaintBox (widget.Style, (Gdk.Window) window, StateType.Normal, ShadowType.In, clipping_area, widget, "trough", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), width - 1, height - 1);

		Gdk.Rectangle clipping_area2 = new Gdk.Rectangle ((int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
		
		Style.PaintBox (widget.Style, (Gdk.Window) window, state, ShadowType.Out, clipping_area2, widget, "bar", (int) (cell_area.X + x_offset + this.Xpad), (int) (cell_area.Y + y_offset + this.Ypad), (int) (width * Percentage), height - 1);
	}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:26,代码来源:CustomCellRenderer.cs


示例5: Render

		protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
		{
			using (Cairo.Context gr = Gdk.CairoHelper.Create (window)) {
				gr.Rectangle (cell_area.X, cell_area.Y, cell_area.Width, cell_area.Height);
				gr.Color = (HslColor)widget.Style.Base ((flags & CellRendererState.Selected) == CellRendererState.Selected ? StateType.Selected : StateType.Normal);
				gr.Fill ();
				var size = Math.Max (0, cell_area.Width - cell_area.Width * Time / 100.0);
				var linearGradient = new LinearGradient (cell_area.X, cell_area.Y, cell_area.Right, cell_area.Bottom);
				linearGradient.AddColorStop (0, new Cairo.Color (1, 0, 0));
				linearGradient.AddColorStop (1, new Cairo.Color (1, 1, 1));
				gr.Pattern = linearGradient;
				
				gr.Rectangle (cell_area.X + size, cell_area.Y + 2, cell_area.Width - size, cell_area.Height - 4);
				gr.Fill ();
				
				var layout = gr.CreateLayout ();
				layout.FontDescription = widget.PangoContext.FontDescription;
				layout.SetText (string.Format ("{0:0.0}", Time));
				int w, h;
				layout.GetPixelSize (out w, out h);
				gr.MoveTo (cell_area.X + cell_area.Width - 2 - w, cell_area.Y + (cell_area.Height - h) / 2);
				gr.Color = new Cairo.Color (0, 0, 0);
				gr.ShowLayout (layout);
				layout.Dispose ();
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:26,代码来源:TimeCellRenderer.cs


示例6: Render

		protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
		{
			using (var cr = Gdk.CairoHelper.Create (window)) {
				cr.Rectangle (background_area.X, background_area.Y, background_area.Width, background_area.Height);
				cr.Clip ();
				OnRender (cr, widget, background_area, cell_area, flags);
			}
		}
开发者ID:m13253,项目名称:xwt,代码行数:8,代码来源:Gtk2CellRendererCustom.cs


示例7: StartEditing

     public override CellEditable StartEditing (Gdk.Event ev, Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
     {
        this.path = path;

        //combo.Combobox.Entry.Text = Text;

        return new TreeViewCellContainer (combo);
     }
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:8,代码来源:CellRendererCatalogSelector.cs


示例8: OnRender

		protected override void OnRender (Cairo.Context cr, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
		{
			if (image.IsNull)
				return;
			var pix = ((GtkImage)image.Backend);
			pix.Draw (Context, cr, Util.GetScaleFactor (widget), cell_area.X, cell_area.Y, image);

		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:8,代码来源:CustomCellRendererImage.cs


示例9: StartEditing

		public ICellEditable StartEditing (Widget widget, Gdk.Event evnt, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
		{
			IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
			IntPtr raw_ret = gtk_cell_renderer_start_editing (Handle, evnt != null ? evnt.Handle : IntPtr.Zero, widget.Handle, native, ref background_area, ref cell_area, (int) flags);
			GLib.Marshaller.Free (native);
			var ret = (ICellEditable) GLib.Object.GetObject (raw_ret);
			return ret;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:8,代码来源:CellRenderer.cs


示例10: GetState

		StateType GetState (Widget widget, CellRendererState flags)
		{
			if (flags.HasFlag (CellRendererState.Selected)) {
				if (widget.IsFocus) {
					return StateType.Selected;
				}
				return StateType.Active;
			}
			return StateType.Normal;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:10,代码来源:PackageSourceCellRenderer.cs


示例11: DrawItemEventArgs

 public DrawItemEventArgs( int ItemIndex, Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags )
 {
     this.itemIndex  = ItemIndex;
     this.drawable   = window;
     this.widget     = widget;
     this.backgroundArea = background_area;
     this.cellArea   = cell_area;
     this.exposeArea = expose_area;
     this.cellFlags  = flags;
 }
开发者ID:tizianomanni,项目名称:holly-gtk-widgets,代码行数:10,代码来源:DrawItemEventArgs.cs


示例12: OnRender

		protected override void OnRender (Cairo.Context cr, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
		{
			if (image.IsNull)
				return;
			var pix = ((GtkImage)image.Backend);
			int x_offset, y_offset, width, height;
			OnGetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
			pix.Draw (Context, cr, Util.GetScaleFactor (widget), cell_area.X + x_offset, cell_area.Y + y_offset, image);

		}
开发者ID:m13253,项目名称:xwt,代码行数:10,代码来源:CustomCellRendererImage.cs


示例13: StartEditing

        public override CellEditable StartEditing(Gdk.Event evnt, Widget widget, 
		                                           string path, Gdk.Rectangle background_area, 
		                                           Gdk.Rectangle cell_area, CellRendererState flags)
        {
            try {
                if (evnt.Type == Gdk.EventType.ButtonPress)
                    OnClicked (EventArgs.Empty);
            } catch (Exception ex) {
                GLib.ExceptionManager.RaiseUnhandledException (ex, false);
            }
            return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
        }
开发者ID:mono-soc-2012,项目名称:ressource-md-addin,代码行数:12,代码来源:CellRendererButton.cs


示例14: StartEditing

		public override CellEditable StartEditing (Gdk.Event ev, Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
		{
			this.path = path;

			Gtk.ComboBox combo = Gtk.ComboBox.NewText ();
			foreach (string s in values)
				combo.AppendText (s);
			
			combo.Active = Array.IndexOf (values, Text);
			combo.Changed += new EventHandler (SelectionChanged);
			return new TreeViewCellContainer (combo);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:12,代码来源:CellRendererComboBox.cs


示例15: GetState

		static StateType GetState (Widget widget, CellRendererState flags)
		{
			StateType stateType = StateType.Normal;
			if ((flags & CellRendererState.Prelit) != 0)
				stateType = StateType.Prelight;
			if ((flags & CellRendererState.Focused) != 0)
				stateType = StateType.Normal;
			if ((flags & CellRendererState.Insensitive) != 0)
				stateType = StateType.Insensitive;
			if ((flags & CellRendererState.Selected) != 0)
				stateType = widget.HasFocus ? StateType.Selected : StateType.Active;
			return stateType;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:13,代码来源:GtkTemplateCategoryCellRenderer.cs


示例16: Render

		protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle backgroundArea, Gdk.Rectangle cellArea, Gdk.Rectangle exposeArea, CellRendererState flags)
		{
			int x, y, width, height;
			
			GetSize (widget, ref cellArea, out x, out y, out width, out height);

			using (var g = Gdk.CairoHelper.Create (window)) {
				g.Save ();
				g.Translate (x, y);
				RenderCell (g, width, height);
				g.Restore ();
			}
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:13,代码来源:CellRendererSurface.cs


示例17: Render

		protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
		{
			int iconTextPadding = iconTextXPadding;
			int textYOffset = 0;
			Rectangle iconRect = GetIconRect (cell_area);

			if (CategoryIcon != null) {
				iconRect = DrawIcon (window, widget, cell_area, flags);
				iconTextPadding = topLevelIconTextXPadding;
				textYOffset = topLevelTemplateHeadingYOffset;
			}

			DrawTemplateCategoryText (window, widget, cell_area, iconRect, iconTextPadding, textYOffset, flags);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:14,代码来源:GtkTemplateCategoryCellRenderer.cs


示例18: Render

        protected override void Render(Drawable window, Widget widget, Rectangle backgroundArea,
		                                Rectangle cellArea, Rectangle exposeArea, CellRendererState flags)
        {
            CellState state = (CellState)flags;

            using (IContext context = new CairoContext (window)) {
                Area bkg = new Area (new Point (backgroundArea.X, backgroundArea.Y),
                               backgroundArea.Width, backgroundArea.Height);
                Area cell = new Area (new Point (cellArea.X, cellArea.Y),
                                cellArea.Width, cellArea.Height);
                PlayslistCellRenderer.Render (Item, Project, Count, IsExpanded, App.Current.DrawingToolkit,
                    context, bkg, cell, state);
            }
        }
开发者ID:LongoMatch,项目名称:longomatch,代码行数:14,代码来源:PlaysCellRenderer.cs


示例19: Render

        protected override void Render(Gdk.Drawable window, Widget widget, Gdk.Rectangle background, Gdk.Rectangle cell, Gdk.Rectangle expose, CellRendererState flags)
        {
            Cairo.Context cr = Gdk.CairoHelper.Create (window);
            TreeView parent = (TreeView) widget;

            surface = (DataImageSurface) parent.Model.GetValue (iter, SlideShowImageView.COL_CAIROIMAGE);

            if (surface == null)
                request_thumbnail (this, new RequestThumbnailEventArgs (iter));

            cr.Rectangle (cell.X, cell.Y, cell.Width, cell.Height);
            cr.SetSourceSurface (surface != null ? surface : default_surface, cell.X, cell.Y);
            cr.Paint ();
            (cr as System.IDisposable).Dispose ();
        }
开发者ID:GNOME,项目名称:mistelix,代码行数:15,代码来源:CairoImageCellRenderer.cs


示例20: Render

		protected override void Render (Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
		{
			try{
				Gdk.Rectangle text_area1 = new Gdk.Rectangle();
			Gdk.Rectangle text_area2 = new Gdk.Rectangle();
			Gdk.Rectangle text_area3 = new Gdk.Rectangle();
				text_area1.Y= cell_area.Y;
				text_area2.Y= cell_area.Y+33;

				text_area3.X = cell_area.Width-20;
				text_area3.Y= cell_area.Y+33;
				text_area3.Width = 75;

				Pango.Layout text_l1 = new Pango.Layout(widget.PangoContext);
				text_l1.FontDescription = Pango.FontDescription.FromString ("Meiryo,Arial 10.5");
				text_l1.SetText(text1);

				Pango.Layout text_l2 = new Pango.Layout(widget.PangoContext);
				text_l2.FontDescription = Pango.FontDescription.FromString ("Meiryo,MS Gothic,Arial 8");
				text_l2.SetText(text2);
				text_l2.Alignment = Pango.Alignment.Right;


				Pango.Layout text_l3 = new Pango.Layout(widget.PangoContext);
				text_l3.Width = Pango.Units.FromPixels(text_area3.Width);
				text_l3.FontDescription = Pango.FontDescription.FromString ("Meiryo,MS Gothic,Arial 8");
				text_l3.Alignment = Pango.Alignment.Right;
				text_l3.SetText(text3);
				text_l2.Width = Pango.Units.FromPixels(cell_area.Width-text_l3.Text.Length*8-13);

				StateType state = flags.HasFlag(CellRendererState.Selected) ?
				widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal;
				text_l3.SetMarkup("<span color=" + (char)34 + "grey" + (char)34 + ">" + text_l3.Text + "</span>");;
				window.DrawLayout(widget.Style.TextGC(state), 55, text_area1.Y, text_l1);
				window.DrawLayout(widget.Style.TextGC(state), 55, text_area2.Y, text_l2);
				window.DrawLayout(widget.Style.TextGC(state), text_area3.X, text_area3.Y, text_l3);

				text_l1.Dispose ();
				text_l2.Dispose ();
				text_l3.Dispose ();

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

		}
开发者ID:takoyaki-hunter,项目名称:niconama-feeder,代码行数:46,代码来源:Program.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CellState类代码示例发布时间:2022-05-24
下一篇:
C# CellRangeAddress类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap