Merge pull request #585 from r4j4h/close-tab-on-midddle-mouse-click

Added functionality to close tabs with middle mouse click
This commit is contained in:
Vadim Lopatin 2019-01-05 18:03:05 +03:00 committed by GitHub
commit edb42f5008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 12 deletions

View File

@ -589,20 +589,27 @@ class TabControl : WidgetGroupDefaultDrawing {
}
protected bool onMouse(Widget source, MouseEvent event) {
if (event.action == MouseAction.ButtonDown && event.button == MouseButton.Left) {
if (source.compareId("MORE")) {
Log.d("tab MORE button pressed");
if (handleMorePopupMenu())
if (event.action == MouseAction.ButtonDown ) {
if (event.button == MouseButton.Left) {
if (source.compareId("MORE")) {
Log.d("tab MORE button pressed");
if (handleMorePopupMenu())
return true;
if (moreButtonClick.assigned) {
moreButtonClick(this);
}
return true;
if (moreButtonClick.assigned) {
moreButtonClick(this);
}
return true;
}
string id = source.id;
int index = tabIndex(id);
if (index >= 0) {
selectTab(index, true);
string id = source.id;
int index = tabIndex(id);
if (index >= 0) {
selectTab(index, true);
}
} else if (event.button == MouseButton.Middle) {
bool closeButtonEnabled = (cast(TabItemWidget)source)._enableCloseButton;
if ( closeButtonEnabled ) {
tabClose(source.id);
}
}
}
return true;