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.
21 public enum DateTimeFieldType
31 public class DateTimeSelector : Layout
34 DateTime _cacheDateTime;
36 public DateTimeSelector(EvasObject parent) : base(parent)
38 _changed = new SmartEvent(this, this.RealHandle, "changed");
39 _changed.On += (s, e) =>
41 DateTime newDateTime = DateTime;
42 DateTimeChanged?.Invoke(this, new DateChangedEventArgs(_cacheDateTime, newDateTime));
43 DateTime = newDateTime;
47 public event EventHandler<DateChangedEventArgs> DateTimeChanged;
53 return Interop.Elementary.elm_datetime_format_get(RealHandle);
57 Interop.Elementary.elm_datetime_format_set(RealHandle, value);
61 public DateTime MaximumDateTime
65 var tm = new Interop.Libc.SystemTime();
66 Interop.Elementary.elm_datetime_value_max_get(RealHandle, ref tm);
71 Interop.Libc.SystemTime tm = value;
72 Interop.Elementary.elm_datetime_value_max_set(RealHandle, ref tm);
76 public DateTime MinimumDateTime
80 var tm = new Interop.Libc.SystemTime();
81 Interop.Elementary.elm_datetime_value_min_get(RealHandle, ref tm);
86 Interop.Libc.SystemTime tm = value;
87 Interop.Elementary.elm_datetime_value_min_set(RealHandle, ref tm);
91 public DateTime DateTime
95 var tm = new Interop.Libc.SystemTime();
96 Interop.Elementary.elm_datetime_value_get(RealHandle, ref tm);
101 Interop.Libc.SystemTime tm = value;
102 Interop.Elementary.elm_datetime_value_set(RealHandle, ref tm);
103 _cacheDateTime = value;
107 public bool IsFieldVisible(DateTimeFieldType type)
109 return Interop.Elementary.elm_datetime_field_visible_get(RealHandle, (int)type);
112 public void SetFieldLimit(DateTimeFieldType type, int minimum, int maximum)
114 Interop.Elementary.elm_datetime_field_limit_set(RealHandle, (int)type, minimum, maximum);
117 public void SetFieldVisible(DateTimeFieldType type, bool visible)
119 Interop.Elementary.elm_datetime_field_visible_set(RealHandle, (int)type, visible);
122 protected override IntPtr CreateHandle(EvasObject parent)
124 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
125 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
127 RealHandle = Interop.Elementary.elm_datetime_add(handle);
128 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);