65
70
this.leftPadding = leftPadding;
66
71
this.rightPadding = rightPadding;
74
public bool ShowTopShadow {
75
get { return showTopShadow; }
77
showTopShadow = value;
82
public int ShadowSize {
92
public double ShadowStrengh {
97
shadowStrengh = value;
69
102
public bool GradientBackround { get; set; }
104
public Gdk.Color? BorderColor { get; set; }
106
public Gdk.Color? BackgroundColor {
107
get { return backgroundColor; }
109
backgroundColor = value;
114
public bool UseChildBackgroundColor {
116
return useChildBackgroundColor;
119
useChildBackgroundColor = value;
71
124
protected override void OnAdded (Widget widget)
73
126
base.OnAdded (widget);
126
179
cr.Pattern = pat;
127
180
cr.FillPreserve ();
182
} else if (BackgroundColor != null) {
183
using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
184
cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
185
cr.Color = BackgroundColor.Value.ToCairoColor ();
188
} else if (useChildBackgroundColor && Child != null) {
189
using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
190
cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
191
cr.Color = Child.Style.Base (StateType.Normal).ToCairoColor ();
131
196
bool res = base.OnExposeEvent (evnt);
133
Gdk.GC borderColor = Style.DarkGC (Gtk.StateType.Normal);
198
var borderColor = new Gdk.GC (GdkWindow);
199
borderColor.RgbFgColor = BorderColor != null ? BorderColor.Value : Style.Dark (Gtk.StateType.Normal);
135
201
rect = Allocation;
136
202
for (int n=0; n<topMargin; n++)
137
203
GdkWindow.DrawLine (borderColor, rect.X, rect.Y + n, rect.Right - 1, rect.Y + n);
139
205
for (int n=0; n<bottomMargin; n++)
140
GdkWindow.DrawLine (borderColor, rect.X, rect.Bottom - n - 1, rect.Right - 1, rect.Bottom - n - 1);
206
GdkWindow.DrawLine (borderColor, rect.X, rect.Bottom - n, rect.Right, rect.Bottom - n);
142
208
for (int n=0; n<leftMargin; n++)
143
GdkWindow.DrawLine (borderColor, rect.X + n, rect.Y, rect.X + n, rect.Bottom - 1);
209
GdkWindow.DrawLine (borderColor, rect.X + n, rect.Y, rect.X + n, rect.Bottom);
145
211
for (int n=0; n<rightMargin; n++)
146
GdkWindow.DrawLine (borderColor, rect.Right - n - 1, rect.Y, rect.Right - n - 1, rect.Bottom - 1);
212
GdkWindow.DrawLine (borderColor, rect.Right - n, rect.Y, rect.Right - n, rect.Bottom);
215
using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
216
cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, shadowSize);
217
Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Y + shadowSize);
218
pat.AddColorStop (0, new Cairo.Color (0, 0, 0, shadowStrengh));
219
pat.AddColorStop (1, new Cairo.Color (0, 0, 0, 0));
225
borderColor.Dispose ();