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 /// This is a container widget that takes a standard edje design file and wraps it very thinly in a widget.
25 /// <since_tizen> preview </since_tizen>
26 [Obsolete("This has been deprecated in API12")]
27 public class Layout : Container
29 SmartEvent _languageChanged;
30 SmartEvent _themeChanged;
35 /// Creates and initializes a new instance of the Layout class.
37 /// <param name="parent">The parent is a given container, which will be attached by the layout as a child. It's <see cref="EvasObject"/> type.</param>
38 /// <since_tizen> preview </since_tizen>
39 [Obsolete("This has been deprecated in API12")]
40 public Layout(EvasObject parent) : base(parent)
45 /// Creates and initializes a new instance of the Layout class.
47 /// <since_tizen> preview </since_tizen>
48 [Obsolete("This has been deprecated in API12")]
49 protected Layout() : base()
54 /// LanguageChanged will be triggered when the program's language is changed.
56 /// <since_tizen> preview </since_tizen>
57 [Obsolete("This has been deprecated in API12")]
58 public event EventHandler LanguageChanged;
61 /// ThemeChanged will be triggered when the theme is changed.
63 /// <since_tizen> preview </since_tizen>
64 [Obsolete("This has been deprecated in API12")]
65 public event EventHandler ThemeChanged;
68 /// Gets the edje layout.
70 /// <since_tizen> preview </since_tizen>
71 [Obsolete("This has been deprecated in API12")]
72 public EdjeObject EdjeObject
76 if (_edjeHandle == IntPtr.Zero)
77 _edjeHandle = Interop.Elementary.elm_layout_edje_get(RealHandle);
78 return new EdjeObject(_edjeHandle);
83 /// Gets or sets the accessibility state of texblock (text) parts in a layout object.
85 /// <since_tizen> preview </since_tizen>
86 [Obsolete("This has been deprecated in API12")]
87 public bool TextBlockAccessibility
91 return Interop.Elementary.elm_layout_edje_object_can_access_get(RealHandle);
95 Interop.Elementary.elm_layout_edje_object_can_access_set(RealHandle, value);
100 /// Freezes the Elementary layout object.
101 /// This function puts all the changes on hold.
102 /// Successive freezes will nest, requiring an equal number of thaws.
104 /// <returns>The frozen state, or 0 if the object is not frozen or on error.</returns>
105 /// <since_tizen> preview </since_tizen>
106 [Obsolete("This has been deprecated in API12")]
109 return Interop.Elementary.elm_layout_freeze(RealHandle);
113 /// Thaws the Elementary object.
114 /// If sucessives freezes were done, an equal number of thaws will be required.
116 /// <returns>The frozen state, or 0 if the object is not frozen or on error.</returns>
117 /// <since_tizen> preview </since_tizen>
118 [Obsolete("This has been deprecated in API12")]
121 return Interop.Elementary.elm_layout_thaw(RealHandle);
126 /// Manually forces a sizing re-evaluation.
127 /// This is useful when the minimum size required by the edje theme of this layout has changed.
128 /// The change on the minimum size required by the edje theme is not immediately reported to the elementary layout, so one needs to call this function in order to tell the widget (layout) that it needs to reevaluate its own size.
129 /// The minimum size of the theme is calculated based on the minimum size of parts, the size of elements inside containers like the box and table, etc.
130 /// All of this can change due to state changes, and that's when this function should be called.
132 /// <since_tizen> preview </since_tizen>
133 [Obsolete("This has been deprecated in API12")]
134 public void Resizing()
136 Interop.Elementary.elm_layout_sizing_eval(RealHandle);
140 /// Requests sizing re-evaluation, restricted to the current width and/or height.
141 /// Useful mostly when there are TEXTBLOCK parts defining the height of an object and nothing else, restricting it to a minimum width. Calling this function will restrict minimum size in the Edje calculation to whatever size the layout has at the moment.
143 /// <param name="width">Restrict minimum size of the current width.</param>
144 /// <param name="height">Restrict minimum size of the current height.</param>
145 /// <since_tizen> preview </since_tizen>
146 [Obsolete("This has been deprecated in API12")]
147 public void Resizing(bool width, bool height)
149 Interop.Elementary.elm_layout_sizing_restricted_eval(RealHandle, width, height);
153 /// Gets the edje data from the given layout.
154 /// This function fetches the data specified inside the edje theme of this layout.
155 /// This function returns null if the data is not found.
157 /// <param name="key">The data key.</param>
158 /// <returns>The data.</returns>
159 /// <since_tizen> preview </since_tizen>
160 [Obsolete("This has been deprecated in API12")]
161 public string GetEdjeData(string key)
163 return Interop.Elementary.elm_layout_data_get(RealHandle, key);
167 /// Gets the text set in the given part.
169 /// <param name="part">The text part to retrieve the text off.</param>
170 /// <returns></returns>
171 /// <since_tizen> preview </since_tizen>
172 [Obsolete("This has been deprecated in API12")]
173 public override string GetPartText(string part)
175 return Interop.Elementary.elm_layout_text_get(RealHandle, part);
179 /// Sets the text set in the given part.
181 /// <param name="part">The text part to retrieve the text off.</param>
182 /// <param name="text">The text to set.</param>
183 /// <returns></returns>
184 /// <since_tizen> preview </since_tizen>
185 [Obsolete("This has been deprecated in API12")]
186 public override bool SetPartText(string part, string text)
188 return Interop.Elementary.elm_layout_text_set(RealHandle, part, text);
192 /// Appends a child to the layout box part.
193 /// Once the object is appended, it will become a child of the layout.
194 /// Its lifetime will be bound to the layout. Whenever the layout dies, the child will be deleted automatically.
197 /// This will only work if the layout edc have box part.
199 /// <param name="part">The part.</param>
200 /// <param name="child">The object to append.</param>
201 /// <returns>Success is true.</returns>
202 /// <since_tizen> preview </since_tizen>
203 [Obsolete("This has been deprecated in API12")]
204 public bool BoxAppend(string part, EvasObject child)
207 return Interop.Elementary.elm_layout_box_append(RealHandle, part, child.Handle);
211 /// Prepends a child to the layout box part.
212 /// Once the object is prepended, it will become a child of the layout.
213 /// Its lifetime will be bound to the layout. Whenever the layout dies, the child will be deleted automatically.
216 /// This will only work if the layout edc have box part.
218 /// <param name="part">The part.</param>
219 /// <param name="child">The object to prepend.</param>
220 /// <returns>Success is true.</returns>
221 /// <since_tizen> preview </since_tizen>
222 [Obsolete("This has been deprecated in API12")]
223 public bool BoxPrepend(string part, EvasObject child)
226 return Interop.Elementary.elm_layout_box_prepend(RealHandle, part, child.Handle);
230 /// Removes a child from the given part box.
231 /// The object will be removed from the box part and its lifetime will not be handled by the layout anymore.
234 /// This will only work if the layout edc have box part.
236 /// <param name="part">The part.</param>
237 /// <param name="child">The object to remove.</param>
238 /// <returns>Success if true</returns>
239 /// <since_tizen> preview </since_tizen>
240 [Obsolete("This has been deprecated in API12")]
241 public bool BoxRemove(string part, EvasObject child)
244 return Interop.Elementary.elm_layout_box_remove(RealHandle, part, child.Handle) != IntPtr.Zero;
248 /// Removes all the children from the given part box.
249 /// The objects will be removed from the box part and their lifetime will not be handled by the layout anymore.
252 /// This will only work if the layout edc have box part.
254 /// <param name="part">The part.</param>
255 /// <param name="clear">If true, then all the objects will be deleted as well, otherwise they will just be removed and will be dangling on the canvas.</param>
256 /// <returns>Success if true.</returns>
257 /// <since_tizen> preview </since_tizen>
258 [Obsolete("This has been deprecated in API12")]
259 public bool BoxRemoveAll(string part, bool clear)
262 return Interop.Elementary.elm_layout_box_remove_all(RealHandle, part, clear);
266 /// Inserts a child to the layout box part at a given position.
267 /// Once the object is inserted, it will become a child of the layout.
268 /// Its lifetime will be bound to the layout. Whenever the layout dies, the child will be deleted automatically.
271 /// This will only work if the layout edc have box part.
273 /// <param name="part">The part.</param>
274 /// <param name="child">The child object to insert into the box.</param>
275 /// <param name="position">The numeric position >=0 to insert the child.</param>
276 /// <returns>Success if true.</returns>
277 /// <since_tizen> preview </since_tizen>
278 [Obsolete("This has been deprecated in API12")]
279 public bool BoxInsertAt(string part, EvasObject child, uint position)
282 return Interop.Elementary.elm_layout_box_insert_at(RealHandle, part, child.Handle, position);
286 /// Inserts a child to the layout box part before a reference object.
287 /// Once the object is inserted, it will become child of the layout.
288 /// Its lifetime will be bound to the layout. Whenever the layout dies, the child will be deleted automatically.
291 /// This will only work if the layout edc have box part.
293 /// <param name="part">The part.</param>
294 /// <param name="child">The child object to insert into the box.</param>
295 /// <param name="reference">Another reference object to insert before the box.</param>
296 /// <returns>Success is true.</returns>
297 /// <since_tizen> preview </since_tizen>
298 [Obsolete("This has been deprecated in API12")]
299 public bool BoxInsertBefore(string part, EvasObject child, EvasObject reference)
302 return Interop.Elementary.elm_layout_box_insert_before(RealHandle, part, child.Handle, reference.Handle);
306 /// Sets the layout content.
308 /// <param name="part">The swallow part name in the edje file.</param>
309 /// <param name="content">The child that will be added in this layout object.</param>
310 /// <returns>TRUE on success, FALSE otherwise.</returns>
311 /// <since_tizen> preview </since_tizen>
312 [Obsolete("This has been deprecated in API12")]
313 public override bool SetPartContent(string part, EvasObject content)
315 return SetPartContent(part, content, false);
319 /// Sets the layout content.
321 /// <param name="part">The name of a particular part.</param>
322 /// <param name="content">The content.</param>
323 /// <param name="preserveOldContent">true, preserve old content will be unset. false, preserve old content will not be unset.</param>
324 /// <returns>TRUE on success, FALSE otherwise.</returns>
325 /// <since_tizen> preview </since_tizen>
326 [Obsolete("This has been deprecated in API12")]
327 public override bool SetPartContent(string part, EvasObject content, bool preserveOldContent)
329 if (preserveOldContent)
331 Interop.Elementary.elm_layout_content_unset(RealHandle, part);
333 UpdatePartContents(content, part);
334 return Interop.Elementary.elm_layout_content_set(RealHandle, part, content);
338 /// Sets the edje group from the elementary theme that is used as a layout.
340 /// <param name="klass">The class of the group.</param>
341 /// <param name="group">The group.</param>
342 /// <param name="style">The style to use.</param>
343 /// <since_tizen> preview </since_tizen>
344 [Obsolete("This has been deprecated in API12")]
345 public void SetTheme(string klass, string group, string style)
347 Interop.Elementary.elm_layout_theme_set(RealHandle, klass, group, style);
351 /// Sets the file that is used as a layout.
353 /// <param name="file">The path to the file (edje) that is used as a layout.</param>
354 /// <param name="group">The group that the layout belongs to in the edje file.</param>
355 /// <since_tizen> preview </since_tizen>
356 [Obsolete("This has been deprecated in API12")]
357 public void SetFile(string file, string group)
359 Interop.Elementary.elm_layout_file_set(RealHandle, file, group);
363 /// Sets the background color of a layout.
365 /// <since_tizen> preview </since_tizen>
366 [Obsolete("This has been deprecated in API12")]
367 public override Color BackgroundColor
373 Interop.Elementary.elm_object_color_class_del(RealHandle, "bg");
377 SetPartColor("bg", value);
379 _backgroundColor = value;
384 /// Sets the vertical text alignment of the layout's text part.
387 /// API, elm_layout_text_valign_set, is an internal API only in Tizen. Available since Tizen_4.0.
389 /// <since_tizen> preview </since_tizen>
390 [Obsolete("This has been deprecated in API12")]
391 public virtual void SetVerticalTextAlignment(string part, double valign)
393 Interop.Elementary.elm_layout_text_valign_set(RealHandle, part, valign);
397 /// Gets the vertical text alignment of the layout's text part.
400 /// API, elm_layout_text_valign_get, is an internal API only in Tizen. Available since Tizen_4.0.
402 /// <since_tizen> preview </since_tizen>
403 [Obsolete("This has been deprecated in API12")]
404 public virtual double GetVerticalTextAlignment(string part)
406 return Interop.Elementary.elm_layout_text_valign_get(RealHandle, part);
410 /// The callback of the Realized Event.
412 /// <since_tizen> preview </since_tizen>
413 [Obsolete("This has been deprecated in API12")]
414 protected override void OnRealized()
417 _languageChanged = new SmartEvent(this, this.RealHandle, "language,changed");
418 _languageChanged.On += (s, e) =>
420 LanguageChanged?.Invoke(this, EventArgs.Empty);
423 _themeChanged = new SmartEvent(this, this.RealHandle, "theme,changed");
424 _themeChanged.On += (s, e) =>
426 ThemeChanged?.Invoke(this, EventArgs.Empty);
431 /// Sets the content at a part of a given container widget.
433 /// <param name="parent">The parent is a given container which will be attached by the layout as a child. It's <see cref="EvasObject"/> type.</param>
434 /// <returns>The new object, otherwise null if it cannot be created.</returns>
435 /// <since_tizen> preview </since_tizen>
436 [Obsolete("This has been deprecated in API12")]
437 protected override IntPtr CreateHandle(EvasObject parent)
439 return Interop.Elementary.elm_layout_add(parent.Handle);