Background bg2 = new Background(window)
{
- Color = new Color(255, 255, 255, 100)
+ Color = new Color(60, 128, 255, 100)
};
Show(bg1, 0, 0, 500, 500);
Show(bg2, 100, 100, 500, 500);
void Show(Background bg, int x, int y, int w, int h)
{
- bg.Show();
bg.Move(x, y);
bg.Resize(w, h);
+ bg.Show();
}
}
}
{
public Background(EvasObject parent) : base(parent)
{
+ Style = "transparent";
}
public override Color Color
{
- //TO-DO: Consider to support alpha to elm_bg.
get
{
- int r;
- int g;
- int b;
- Interop.Elementary.elm_bg_color_get(Handle, out r, out g, out b);
- return new Color(r, g, b);
+ int r = 0;
+ int g = 0;
+ int b = 0;
+ int a = 0;
+ var swallowContent = GetPartContent("elm.swallow.rectangle");
+ if (swallowContent != IntPtr.Zero)
+ {
+ Interop.Evas.evas_object_color_get(swallowContent, out r, out g, out b, out a);
+ }
+ return new Color(r, g, b, a);
}
set
{
- Interop.Elementary.elm_bg_color_set(Handle, value.R, value.G, value.B);
+ var swallowContent = GetPartContent("elm.swallow.rectangle");
+ if(swallowContent == IntPtr.Zero)
+ {
+ Interop.Elementary.elm_bg_color_set(Handle, value.R, value.G, value.B);
+ swallowContent = GetPartContent("elm.swallow.rectangle");
+ }
+ Interop.Evas.evas_object_color_set(swallowContent, value.R, value.G, value.B, value.A);
}
}
{
Interop.Elementary.elm_object_part_color_set(Handle, part, color.R, color.G, color.B, color.A);
}
+
+ internal IntPtr GetPartContent(string part)
+ {
+ return Interop.Elementary.elm_object_part_content_get(Handle, part);
+ }
}
}