Exemplo n.º 1
0
        protected override void Render(Gdk.Drawable drawable, Widget widget,
                                       Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
                                       Gdk.Rectangle expose_area, CellRendererState flags)
        {
            Pango.Layout layout = GetLayout(widget);

            // FIXME: If this code is ever built into its own library,
            // the call to Tomboy will definitely have to change
            layout.SetText(Tomboy.GuiUtils.GetPrettyPrintDate(date, show_time));

            int x, y, w, h;

            CalculateSize(layout, out x, out y, out w, out h);

            StateType state = RendererStateToWidgetState(flags);

            Gdk.GC gc;
            if (state.Equals(StateType.Selected))
            {
                // Use the proper Gtk.StateType so text appears properly when selected
                gc = new Gdk.GC(drawable);
                gc.Copy(widget.Style.TextGC(state));
                gc.RgbFgColor = widget.Style.Foreground(state);
            }
            else
            {
                gc = widget.Style.TextGC(Gtk.StateType.Normal);
            }

            drawable.DrawLayout(
                gc,
                cell_area.X + (int)Xalign + (int)Xpad,
                cell_area.Y + ((cell_area.Height - h) / 2),
                layout);
        }
Exemplo n.º 2
0
 /// <summary>
 /// equals method overriden for state.
 /// </summary>
 /// <param name="obj">the obj to be equaled to</param>
 /// <returns></returns>
 public override bool Equals(object obj)
 {
     return(StateType.Equals((obj as State <T>).StateType));
 }