7 namespace Circ
.Frontend
.GtkSharp
10 public class MessagesPanel
: TextView
12 TextTagTable textTags
;
18 public MessagesPanel(): base()
20 this.Editable
= false;
21 //this.DoubleBuffered = true;
22 this.WrapMode
= Gtk
.WrapMode
.Word
;
23 this.CursorVisible
= false;
26 this.CanFocus
= false;
28 background
= new Gdk
.Color ();
29 Gdk
.Color
.Parse ("#eeeeec", ref background
);
30 this.ModifyBg (StateType
.Normal
, background
);
31 this.ModifyBase (StateType
.Normal
, background
);
33 RgbColor textColor
= LibContrast
.GetBestColorFromBackground(new RgbColor((byte)(background
.Red
/257),
34 (byte)(background
.Green
/257), (byte)(background
.Blue
/257)), ColorPalette
.Aqua
);
35 this.ModifyText(StateType
.Normal
, new Gdk
.Color(textColor
.Red
, textColor
.Green
, textColor
.Blue
));
39 this.buffer
= new TextBuffer(textTags
);
41 this.endMark
= buffer
.CreateMark("end", buffer
.EndIter
, false);
42 //this.buffer.InsertText += InsertionHandler;
45 private void InitTextTags()
47 textTags
= new TextTagTable();
50 //TextTag message = new TextTag("message");
51 TextTag author
= new TextTag("author");
52 TextTag hl
= new TextTag("hl");
53 TextTag itsme
= new TextTag("itsme");
54 TextTag notice
= new TextTag("notice");
55 TextTag time
= new TextTag("time");
58 // Tuning (follow Tango color scheme)
59 RgbColor hlColor
= LibContrast
.GetBestColorFromBackground(new RgbColor((byte)(background
.Red
/257),
60 (byte)(background
.Green
/257), (byte)(background
.Blue
/257)), ColorPalette
.DarkRed
);
61 hl
.ForegroundGdk
= new Gdk
.Color(hlColor
.Red
, hlColor
.Green
, hlColor
.Blue
);
62 hl
.PixelsBelowLines
= 3;
64 //message.ForegroundGdk = new Color(46, 52, 54);
65 //message.PixelsBelowLines = 3;
67 RgbColor authorColor
= LibContrast
.GetBestColorFromBackground(new RgbColor((byte)(background
.Red
/257),
68 (byte)(background
.Green
/257), (byte)(background
.Blue
/257)), ColorPalette
.DarkBlue
);
69 author
.ForegroundGdk
= new Color(authorColor
.Red
, authorColor
.Green
, authorColor
.Blue
);
70 author
.Weight
= Pango
.Weight
.Bold
;
72 RgbColor meColor
= LibContrast
.GetBestColorFromBackground(new RgbColor((byte)(background
.Red
/257),
73 (byte)(background
.Green
/257), (byte)(background
.Blue
/257)), ColorPalette
.Brown
);
74 itsme
.ForegroundGdk
= new Color(meColor
.Red
, meColor
.Green
, meColor
.Blue
);
83 internal void ScrollToEnd()
85 this.ScrollMarkOnscreen(endMark
);