Skip to content

Commit

Permalink
add overloads (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaggerJo committed Jun 30, 2019
1 parent 0ecc151 commit 966961d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/Avalonia.FuncUI/DSL.attrs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,21 @@ module DSL_Property_Attrs =
static member inline borderThickness<'T when 'T : (member set_BorderThickness : Avalonia.Thickness -> unit)>(value: Avalonia.Thickness) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "BorderThickness"; Value = value }

static member inline borderThickness<'T when 'T : (member set_Padding : Avalonia.Thickness -> unit)>(value: double) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "BorderThickness"; Value = Avalonia.Thickness(value) }

static member inline borderThickness<'T when 'T : (member set_Padding : Avalonia.Thickness -> unit)>(horizontal: double, vertical: double) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "BorderThickness"; Value = Avalonia.Thickness(horizontal, vertical) }

static member inline borderThickness<'T when 'T : (member set_Padding : Avalonia.Thickness -> unit)>(left: double, top: double, right: double, bottom: double) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "BorderThickness"; Value = Avalonia.Thickness(left, top, right, bottom) }

static member inline borderBrush<'T when 'T : (member set_BorderBrush : Avalonia.Media.IBrush -> unit)>(brush: Avalonia.Media.IBrush) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "BorderBrush"; Value = brush }

static member inline borderBrush<'T when 'T : (member set_BorderBrush : Avalonia.Media.IBrush -> unit)>(brush: string) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "BorderBrush"; Value = Avalonia.Media.SolidColorBrush.Parse(brush).ToImmutable() }

static member inline viewportSize<'T when 'T : (member set_ViewportSize : double -> unit)>(size: double) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "ViewportSize"; Value = size }

Expand Down Expand Up @@ -181,6 +193,9 @@ module DSL_Property_Attrs =
static member inline headerBackground<'T when 'T : (member set_HeaderBackground : Avalonia.Media.IBrush -> unit)>(brush: Avalonia.Media.IBrush) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "HeaderBackground"; Value = brush }

static member inline headerBackground<'T when 'T : (member set_HeaderBackground : Avalonia.Media.IBrush -> unit)>(brush: string) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "HeaderBackground"; Value = Avalonia.Media.SolidColorBrush.Parse(brush).ToImmutable() }

static member inline foreground<'T when 'T : (member set_Foreground : Avalonia.Media.IBrush -> unit)>(brush: Avalonia.Media.IBrush) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "Foreground"; Value = brush }

Expand Down Expand Up @@ -364,6 +379,9 @@ module DSL_Property_Attrs =
static member inline stroke<'T when 'T : (member set_Stroke : Avalonia.Media.IBrush -> unit)>(brush: Avalonia.Media.IBrush) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "Stroke"; Value = brush }

static member inline stroke<'T when 'T : (member set_Stroke : Avalonia.Media.IBrush -> unit)>(brush: string) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "Stroke"; Value = Avalonia.Media.SolidColorBrush.Parse(brush).ToImmutable() }

static member inline staysOpen<'T when 'T : (member set_StaysOpen : bool -> unit)>(value: bool) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "StaysOpen"; Value = value }

Expand Down Expand Up @@ -647,6 +665,9 @@ module DSL_Property_Attrs =
static member inline classes<'T when 'T : (member set_Classes : Classes -> unit)>(value: Classes) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "Classes"; Value = value }

static member inline classes<'T when 'T : (member set_Classes : Classes -> unit)>(value: string list) : TypedAttr<'T> =
TypedAttr<_>.Property { Name = "Classes"; Value = Classes(value) }

static member inline children<'T when 'T : (member get_Children : unit -> Controls)>(children: View list) : TypedAttr<'T> =
TypedAttr<_>.Content {
Name = "Children"
Expand Down
2 changes: 0 additions & 2 deletions src/Avalonia.FuncUI/DSL.base.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ type Views () =
if (cache.Count >= Views.CacheMaxLength) then
cache.Clear()

printfn "cache length is %i" cache.Count

let hasValue, value = cache.TryGetValue key

match hasValue with
Expand Down

0 comments on commit 966961d

Please sign in to comment.