From 605dd2b5d4b3e068e210ffa9ddf88408a93dccc0 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Sat, 30 Mar 2024 10:08:02 +0100 Subject: [PATCH] better menu separators --- haxe/ui/_module/styles/default/menus.css | 10 ++++++++++ haxe/ui/containers/menus/MenuSeparator.hx | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/haxe/ui/_module/styles/default/menus.css b/haxe/ui/_module/styles/default/menus.css index 80c02459a..80cba32a7 100644 --- a/haxe/ui/_module/styles/default/menus.css +++ b/haxe/ui/_module/styles/default/menus.css @@ -149,6 +149,11 @@ } .menuseparator { + width: 100%; + height: auto; +} + +.menuseparator-line { height: 1px; width: 100%; background-color: $normal-border-color; @@ -158,3 +163,8 @@ .menu.rounded .menuitem { border-radius: 3px; } + +.menu.rounded .menuseparator { + padding-top: 3px; + padding-bottom: 3px; +} diff --git a/haxe/ui/containers/menus/MenuSeparator.hx b/haxe/ui/containers/menus/MenuSeparator.hx index 00d6703eb..eeef51c97 100644 --- a/haxe/ui/containers/menus/MenuSeparator.hx +++ b/haxe/ui/containers/menus/MenuSeparator.hx @@ -1,6 +1,27 @@ package haxe.ui.containers.menus; import haxe.ui.core.Component; +import haxe.ui.core.CompositeBuilder; +import haxe.ui.layouts.DefaultLayout; +@:composite(Builder, Layout) class MenuSeparator extends Component { -} \ No newline at end of file +} + +//*********************************************************************************************************** +// Composite Builder +//*********************************************************************************************************** +@:dox(hide) @:noCompletion +@:access(haxe.ui.core.Component) +private class Builder extends CompositeBuilder { + public override function create() { + super.create(); + var line = new Component(); + line.scriptAccess = false; + line.addClass("menuseparator-line"); + _component.addComponent(line); + } +} + +private class Layout extends DefaultLayout { +}