2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 /// The Background is a widget that use for setting (solid) background decorations to a window (unless it has transparency enabled)
23 /// or to any container object.
25 /// <since_tizen> preview </since_tizen>
26 public class Background : Layout
29 /// Creates and initializes a new instance of the Background class.
31 /// <param name="parent">The EvasObject to which the new background will be attached as a child.</param>
32 /// <since_tizen> preview </since_tizen>
33 public Background(EvasObject parent) : base(parent)
35 Style = "transparent";
39 /// Sets or gets the color to the background.
41 /// <since_tizen> preview </since_tizen>
42 public override Color Color
46 return BackgroundColor;
50 BackgroundColor = value;
55 /// Sets or gets the image to the background.
57 /// <since_tizen> preview </since_tizen>
62 return Interop.Elementary.BackgroundFileGet(RealHandle);
66 Interop.Elementary.elm_bg_file_set(RealHandle, value, IntPtr.Zero);
71 /// Sets or gets the mode of display for a given background widget's image.
74 /// This sets how the background widget will display its image.
75 /// This will only work if the file was previously set with an image file on object.
76 /// The image can be display tiled, scaled, centered, or stretched. Scaled by default.
78 /// <since_tizen> preview </since_tizen>
79 public BackgroundOptions BackgroundOption
83 return (BackgroundOptions)Interop.Elementary.elm_bg_option_get(RealHandle);
87 Interop.Elementary.elm_bg_option_set(RealHandle, (Interop.Elementary.BackgroundOptions)value);
92 /// Sets the size of the pixmap representation of the image set on a given background widget.
93 /// This method just makes sense if an image file was set.
94 /// This is just a hint for the underlying system.
95 /// The real size of the pixmap may differ depending on the type of image being loaded, being bigger than requested.
97 /// <param name="w">The new width of the image pixmap representation.</param>
98 /// <param name="h">The new height of the image pixmap representation.</param>
99 /// <since_tizen> preview </since_tizen>
100 public void SetFileLoadSize(int w, int h)
104 Interop.Elementary.elm_bg_load_size_set(RealHandle, w, h);
108 throw new Exception("This method just makes sense if an image file was set.");
113 /// Creates a widget handle.
115 /// <param name="parent">Parent EvasObject.</param>
116 /// <returns>Handle IntPtr.</returns>
117 /// <since_tizen> preview </since_tizen>
118 protected override IntPtr CreateHandle(EvasObject parent)
120 return Interop.Elementary.elm_bg_add(parent.Handle);
125 /// Enumeration for the background types.
127 /// <since_tizen> preview </since_tizen>
128 public enum BackgroundOptions
131 /// Centers the background image.
136 /// Scales the background image, retaining the aspect ratio.
141 /// Stretches the background image to fill the UI component's area.
146 /// Tiles the background image at its original size.