From e91114994e3246a2e6834ac39efd34be8349dcbd Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Sun, 8 Feb 2015 19:51:41 +0300 Subject: [PATCH] fix issue #52 - showCloseButton flag --- examples/example1/src/example1.d | 2 +- src/dlangui/widgets/tabs.d | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/example1/src/example1.d b/examples/example1/src/example1.d index 9a8f8905..42835599 100644 --- a/examples/example1/src/example1.d +++ b/examples/example1/src/example1.d @@ -376,7 +376,7 @@ extern (C) int UIAppMain(string[] args) { } else { SourceEdit editor = new SourceEdit(filename); if (editor.load(filename)) { - tabs.addTab(editor, toUTF32(baseName(filename))); + tabs.addTab(editor, toUTF32(baseName(filename)), null, true); tabs.selectTab(filename); } else { destroy(editor); diff --git a/src/dlangui/widgets/tabs.d b/src/dlangui/widgets/tabs.d index 9bc77ee9..a436a7cf 100644 --- a/src/dlangui/widgets/tabs.d +++ b/src/dlangui/widgets/tabs.d @@ -109,7 +109,7 @@ class TabItemWidget : HorizontalLayout { _closeButton.drawableId = "close"; _closeButton.trackHover = true; _closeButton.onClickListener = &onClick; - if (_enableCloseButton) { + if (!_enableCloseButton) { _closeButton.visibility = Visibility.Gone; } else { _closeButton.visibility = Visibility.Visible; @@ -260,6 +260,14 @@ class TabControl : WidgetGroupDefaultDrawing { } } } + + /// when true, shows close buttons in tabs + @property bool enableCloseButton() { return _enableCloseButton; } + /// ditto + @property void enableCloseButton(bool enabled) { + _enableCloseButton = enabled; + } + /// returns tab count @property int tabCount() const { return _items.length;