blob: 0091d2532c4ca89f8c361bfeec7a5aa01a3e34d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
using ElmSharp;
using System;
using ELayout = ElmSharp.Layout;
namespace Xamarin.Forms.Platform.Tizen.Native
{
public class EditfieldEntry : Native.Entry, IMeasurable
{
ELayout _editfieldLayout;
int _heightPadding = 0;
public EditfieldEntry(EvasObject parent) : base(parent)
{
}
protected override IntPtr CreateHandle(EvasObject parent)
{
var bg = new ELayout(parent);
bg.SetTheme("layout", "background", "default");
_editfieldLayout = new ELayout(parent);
_editfieldLayout.SetTheme("layout", "editfield", "singleline");
Handle = base.CreateHandle(parent);
_editfieldLayout.SetPartContent("elm.swallow.content", this);
bg.SetPartContent("elm.swallow.content", _editfieldLayout);
// The minimun size for the Content area of an Editfield. This is used to calculate the size when layouting.
_heightPadding = _editfieldLayout.EdjeObject["elm.swallow.content"].Geometry.Height;
return bg;
}
public new ElmSharp.Size Measure(int availableWidth, int availableHeight)
{
var textBlockSize = base.Measure(availableWidth, availableHeight);
// Calculate the minimum size by adding the width of a TextBlock and an Editfield.
textBlockSize.Width += _editfieldLayout.MinimumWidth;
// If the height of a TextBlock is shorter than Editfield, use the minimun height of the Editfield.
// Or add the height of the EditField to the TextBlock
if (textBlockSize.Height < _editfieldLayout.MinimumHeight)
textBlockSize.Height = _editfieldLayout.MinimumHeight;
else
textBlockSize.Height += _heightPadding;
return textBlockSize;
}
}
}
|