2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
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.
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
20 using Tizen.NUI.Components;
22 namespace NUITizenGallery
24 public partial class KeyboardTest1Page : ContentPage
26 public KeyboardTest1Page()
28 InitializeComponent();
29 dateTimeKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Datetime));
30 emailKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Email));
31 emoticonKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Emoticon));
32 hexKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.HEX));
33 ipLayoutKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.IP));
34 monthKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Month));
35 normalKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Normal));
36 numberKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Number));
37 numberOnlyKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.NumberOnly));
38 passworKeyboarddButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Password));
39 phoneNumberKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.PhoneNumber));
40 terminalKeyboardButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.Terminal));
41 urlKeyboarddButton.Command = new Command(() => SetOutputMethod(InputMethod.PanelLayoutType.URL));
44 private void SetOutputMethod(InputMethod.PanelLayoutType inputLayoutType)
46 InputMethod im = new InputMethod();
47 im.PanelLayout = inputLayoutType;
48 textField.InputMethodSettings = im.OutputMap;
51 protected override void Dispose(DisposeTypes type)
58 if (type == DisposeTypes.Explicit)
60 RemoveAllChildren(true);
66 private void RemoveAllChildren(bool dispose = false)
68 RecursiveRemoveChildren(this, dispose);
71 private void RecursiveRemoveChildren(View parent, bool dispose)
78 int maxChild = (int)parent.ChildCount;
79 for (int i = maxChild - 1; i >= 0; --i)
81 View child = parent.GetChildAt((uint)i);
86 RecursiveRemoveChildren(child, dispose);