4
// Mike Krüger <mkrueger@novell.com>
6
// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
8
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
// of this software and associated documentation files (the "Software"), to deal
10
// in the Software without restriction, including without limitation the rights
11
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
// copies of the Software, and to permit persons to whom the Software is
13
// furnished to do so, subject to the following conditions:
15
// The above copyright notice and this permission notice shall be included in
16
// all copies or substantial portions of the Software.
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
namespace Mono.TextEditor
31
public class ChunkStyle
35
bool transparentBackround = true;
37
public Gdk.Color Color {
46
public Gdk.Color BackgroundColor {
51
backColor = value; transparentBackround = false;
55
public bool TransparentBackround {
56
get { return transparentBackround; }
57
set { transparentBackround = value; }
70
public bool Underline {
80
public ChunkStyle (ChunkStyle style)
83
backColor = style.backColor;
85
Italic = style.Italic;
86
transparentBackround = style.transparentBackround;
89
public Pango.Style GetStyle (Pango.Style defaultStyle)
91
return Italic ? Pango.Style.Italic : Pango.Style.Normal;
93
public Pango.Weight GetWeight (Pango.Weight defaultWeight)
95
if (defaultWeight == Pango.Weight.Bold)
96
return Bold ? Pango.Weight.Heavy : Pango.Weight.Bold;
97
return Bold ? Pango.Weight.Bold : Pango.Weight.Normal;
100
public ChunkStyle () : this (new Gdk.Color (0, 0, 0), false)
104
public ChunkStyle (Gdk.Color color) : this (color, false)
108
public ChunkStyle (Gdk.Color color, bool bold)
114
public ChunkStyle (Gdk.Color color, bool bold, bool italic)
118
this.Italic = italic;
121
public override string ToString ()
123
return String.Format ("[ChunkStyle: Color={0}, bold={1}]", color, Bold);
126
public override int GetHashCode ()
128
return color.GetHashCode () ^ Bold.GetHashCode ();
131
public override bool Equals (object o)
133
ChunkStyle c = o as ChunkStyle;
134
return c != null && Bold == c.Bold && Italic == c.Italic && color.GetHashCode () == c.color.GetHashCode ();