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


C# CellRendererState.HasFlag方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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);
            int xPos = cell_area.X;
            if(this.Pixbuf != null){
                window.DrawPixbuf(widget.Style.MidGC( StateType.Normal), this.Pixbuf, 0, 0, xPos + 1, cell_area.Y + 1, 16, 16, Gdk.RgbDither.Normal, 0, 0);
                xPos += 20;
            }
            using (var layout = new Pango.Layout(widget.PangoContext)) {
                layout.Alignment = Pango.Alignment.Left;
                layout.SetText(this.Text ?? "");

                StateType state = flags.HasFlag(CellRendererState.Selected) ?
                    widget.IsFocus ? StateType.Selected : StateType.Active : StateType.Normal;

                window.DrawLayout(widget.Style.TextGC(state), xPos, cell_area.Y + 2, layout);
            }
        }
开发者ID:revenz,项目名称:iMeta,代码行数:18,代码来源:TreeItemCellRenderer.cs

示例4: 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 cr = Gdk.CairoHelper.Create (window)) {
					cr.LineWidth = 2.0;
					double center_x = cell_area.X + Math.Round ((double) (cell_area.Width / 2d));
					double center_y = cell_area.Y + Math.Round ((double) (cell_area.Height / 2d));
					cr.Arc (center_x, center_y, 5, 0, 2 * Math.PI);
					var state = StateType.Normal;
					if (!base.Sensitive)
						state = StateType.Insensitive;
					else if (flags.HasFlag (CellRendererState.Selected)) {
						if (widget.HasFocus)
							state = StateType.Selected;
						else
							state = StateType.Active;
					}
					else if (flags.HasFlag (CellRendererState.Prelit))
						state = StateType.Prelight;
					else if (widget.State == StateType.Insensitive)
						state = StateType.Insensitive;

					cr.SetSourceColor (widget.Style.Text (state).ToCairoColor ());
					cr.Stroke ();
					if (!FirstNode) {
						cr.MoveTo (center_x, cell_area.Y - 2);
						cr.LineTo (center_x, center_y - 5);
						cr.Stroke ();
					}
					
					if (!LastNode) {
						cr.MoveTo (center_x, cell_area.Y + cell_area.Height + 2);
						cr.LineTo (center_x, center_y + 5);
						cr.Stroke ();
					}
				}
			}
开发者ID:pjcollins,项目名称:monodevelop,代码行数:36,代码来源:LogWidget.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)
        {
            m_Tree = widget as TreeView;
            m_TextXOffset = 0;

            Gdk.Rectangle pix_rect = Gdk.Rectangle.Zero;
            bool isSelected = flags.HasFlag(CellRendererState.Selected);
            m_FontDesc = widget.PangoContext.FontDescription;

            this.GetSize (widget, ref cell_area, out pix_rect.X, out pix_rect.Y, out pix_rect.Width, out pix_rect.Height);

            // Take care of padding
            pix_rect.X += cell_area.X + (int)this.Xpad;
            pix_rect.Y += cell_area.Y + (int)this.Ypad;
            // Remove left, right, top and buttom borders which were added to the returned width
            pix_rect.Width -= (int)this.Xpad * 2;
            pix_rect.Height -= (int)this.Ypad * 2;

            // Create Context
            Cairo.Context context = Gdk.CairoHelper.Create(window);
            context.SelectFontFace(m_FontDesc.Family, FontSlant.Normal, FontWeight.Normal);

            // Draw backdrop
            //if (IsHeading)
            {
                context.Save ();

                Color col = IsHeading ? m_BackdropHeadingColour : m_BackdropItemColour;

                context.Color = col;
                context.SetSourceRGB (col.R, col.G, col.B);

                context.Rectangle (background_area.X, background_area.Y, background_area.Width, background_area.Height);

                // Fill the path with pattern
                context.Fill ();

                // We "undo" the pattern setting here
                context.Restore ();
            }

            // Draw expander
            if (IsExpander)
            {
                RenderExpander(context, pix_rect);
            }
            else if (!IsHeading && RenderInfo)
            {
                context.Save();
                Gdk.Pixbuf expander = new Gdk.Pixbuf(ECM.Core.Info16PNG);
                Gdk.CairoHelper.SetSourcePixbuf(context, expander, pix_rect.Right - 16, pix_rect.Y);

                context.Paint();
                context.Restore();
            }

            RenderCell(context, pix_rect, isSelected);

            // Draw line under cell
            int bottom = background_area.Bottom;

            if (ECM.Helper.CurrentPlatform != ECM.Helper.Platform.Windows)
                bottom += 1;
            else
                bottom -= 1;

            context.Save();
            context.Antialias = Antialias.None;
            context.LineWidth = 1;
            context.Color = DarkGray;
            context.MoveTo(background_area.Left, bottom);
            context.LineTo(background_area.Right, bottom);
            context.Stroke();
            context.Restore();

            (context.Target as System.IDisposable).Dispose();
            (context as System.IDisposable).Dispose();
        }
开发者ID:SilkyPantsDan,项目名称:ECM,代码行数:78,代码来源:CellRendererEveTree.cs

示例6: GetPackageSourceErrorMarkup

		string GetPackageSourceErrorMarkup (CellRendererState flags = CellRendererState.Focused)
		{
			return MarkupString.Format (
				"<span foreground='{0}'>{1}</span>",
				Ide.Gui.Styles.ColorGetHex (flags.HasFlag (CellRendererState.Selected) ? Styles.PackageSourceErrorSelectedTextColor : Styles.PackageSourceErrorTextColor),
				PackageSourceViewModel.ValidationFailureMessage);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:7,代码来源:PackageSourceCellRenderer.cs

示例7: GetPackageSourceDescriptionMarkup

		string GetPackageSourceDescriptionMarkup (CellRendererState flags = CellRendererState.Focused)
		{
			return MarkupString.Format (
				"<b>{0}</b>\n<span foreground='{2}'>{1}</span>",
				PackageSourceViewModel.Name,
				PackageSourceViewModel.Source,
				Ide.Gui.Styles.ColorGetHex (flags.HasFlag (CellRendererState.Selected) ? Styles.PackageSourceUrlSelectedTextColor : Styles.PackageSourceUrlTextColor));
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:8,代码来源:PackageSourceCellRenderer.cs


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