mirror of https://github.com/buggins/dlangui.git
refactoring of signal names
This commit is contained in:
parent
f38b143a40
commit
ba1b13b290
|
@ -190,7 +190,7 @@ class EditFrame : AppFrame {
|
||||||
FileDialog dlg = createFileDialog(caption, false);
|
FileDialog dlg = createFileDialog(caption, false);
|
||||||
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
_editor.text=""d;
|
_editor.text=""d;
|
||||||
|
@ -209,7 +209,7 @@ class EditFrame : AppFrame {
|
||||||
FileDialog dlg = createFileDialog(caption, false);
|
FileDialog dlg = createFileDialog(caption, false);
|
||||||
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
saveSourceFile(filename);
|
saveSourceFile(filename);
|
||||||
|
@ -223,7 +223,7 @@ class EditFrame : AppFrame {
|
||||||
FileDialog dlg = createFileDialog(caption);
|
FileDialog dlg = createFileDialog(caption);
|
||||||
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
openSourceFile(filename);
|
openSourceFile(filename);
|
||||||
|
|
|
@ -297,8 +297,8 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
};
|
};
|
||||||
MenuItem enLang = (new MenuItem(new Action(611, "MENU_VIEW_LANGUAGE_EN"))).type(MenuItemType.Radio).checked(true);
|
MenuItem enLang = (new MenuItem(new Action(611, "MENU_VIEW_LANGUAGE_EN"))).type(MenuItemType.Radio).checked(true);
|
||||||
MenuItem ruLang = (new MenuItem(new Action(612, "MENU_VIEW_LANGUAGE_RU"))).type(MenuItemType.Radio);
|
MenuItem ruLang = (new MenuItem(new Action(612, "MENU_VIEW_LANGUAGE_RU"))).type(MenuItemType.Radio);
|
||||||
enLang.onMenuItemClick = onLangChange;
|
enLang.menuItemClick = onLangChange;
|
||||||
ruLang.onMenuItemClick = onLangChange;
|
ruLang.menuItemClick = onLangChange;
|
||||||
langItem.add(enLang);
|
langItem.add(enLang);
|
||||||
langItem.add(ruLang);
|
langItem.add(ruLang);
|
||||||
viewItem.add(langItem);
|
viewItem.add(langItem);
|
||||||
|
@ -318,9 +318,9 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
theme1.onMenuItemClick = onThemeChange;
|
theme1.menuItemClick = onThemeChange;
|
||||||
theme2.onMenuItemClick = onThemeChange;
|
theme2.menuItemClick = onThemeChange;
|
||||||
theme3.onMenuItemClick = onThemeChange;
|
theme3.menuItemClick = onThemeChange;
|
||||||
themeItem.add(theme1);
|
themeItem.add(theme1);
|
||||||
themeItem.add(theme2);
|
themeItem.add(theme2);
|
||||||
themeItem.add(theme3);
|
themeItem.add(theme3);
|
||||||
|
@ -338,7 +338,7 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
mainMenuItems.add(windowItem);
|
mainMenuItems.add(windowItem);
|
||||||
mainMenuItems.add(helpItem);
|
mainMenuItems.add(helpItem);
|
||||||
MainMenu mainMenu = new MainMenu(mainMenuItems);
|
MainMenu mainMenu = new MainMenu(mainMenuItems);
|
||||||
mainMenu.onMenuItemClickListener = delegate(MenuItem item) {
|
mainMenu.menuItemClick = delegate(MenuItem item) {
|
||||||
Log.d("mainMenu.onMenuItemListener", item.label);
|
Log.d("mainMenu.onMenuItemListener", item.label);
|
||||||
const Action a = item.action;
|
const Action a = item.action;
|
||||||
if (a) {
|
if (a) {
|
||||||
|
@ -356,7 +356,7 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt"));
|
dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp"));
|
dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp"));
|
||||||
//dlg.filterIndex = 2;
|
//dlg.filterIndex = 2;
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
if (filename.endsWith(".d") || filename.endsWith(".txt") || filename.endsWith(".cpp") || filename.endsWith(".h") || filename.endsWith(".c")
|
if (filename.endsWith(".d") || filename.endsWith(".txt") || filename.endsWith(".cpp") || filename.endsWith(".h") || filename.endsWith(".c")
|
||||||
|
@ -395,7 +395,7 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
|
|
||||||
// ========= create tabs ===================
|
// ========= create tabs ===================
|
||||||
|
|
||||||
tabs.onTabChangedListener = delegate(string newTabId, string oldTabId) {
|
tabs.tabChanged = delegate(string newTabId, string oldTabId) {
|
||||||
window.windowCaption = tabs.tab(newTabId).text.value ~ " - dlangui example 1"d;
|
window.windowCaption = tabs.tab(newTabId).text.value ~ " - dlangui example 1"d;
|
||||||
};
|
};
|
||||||
tabs.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
|
tabs.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
|
||||||
|
@ -861,7 +861,7 @@ void main()
|
||||||
treeLayout.addChild(new ResizerWidget());
|
treeLayout.addChild(new ResizerWidget());
|
||||||
treeLayout.addChild(treeControlledPanel);
|
treeLayout.addChild(treeControlledPanel);
|
||||||
|
|
||||||
tree.selectionListener = delegate(TreeItems source, TreeItem selectedItem, bool activated) {
|
tree.selectionChange = delegate(TreeItems source, TreeItem selectedItem, bool activated) {
|
||||||
dstring label = "Selected item: "d ~ toUTF32(selectedItem.id) ~ (activated ? " selected + activated"d : " selected"d);
|
dstring label = "Selected item: "d ~ toUTF32(selectedItem.id) ~ (activated ? " selected + activated"d : " selected"d);
|
||||||
treeItemLabel.text = label;
|
treeItemLabel.text = label;
|
||||||
};
|
};
|
||||||
|
|
|
@ -135,7 +135,7 @@ class SpreadSheetWidget : WidgetGroupDefaultDrawing, OnScrollHandler, CellSelect
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach(sb; _scrollbars)
|
foreach(sb; _scrollbars)
|
||||||
sb.onScrollEventListener = this;
|
sb.scrollEvent = this;
|
||||||
foreach(view; _views) {
|
foreach(view; _views) {
|
||||||
view.cellSelected = this;
|
view.cellSelected = this;
|
||||||
view.cellActivated = this;
|
view.cellActivated = this;
|
||||||
|
|
|
@ -139,7 +139,7 @@ class EditFrame : AppFrame {
|
||||||
FileDialog dlg = createFileDialog(caption, false);
|
FileDialog dlg = createFileDialog(caption, false);
|
||||||
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
//_editor.text=""d;
|
//_editor.text=""d;
|
||||||
|
@ -158,7 +158,7 @@ class EditFrame : AppFrame {
|
||||||
FileDialog dlg = createFileDialog(caption, false);
|
FileDialog dlg = createFileDialog(caption, false);
|
||||||
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
saveSourceFile(filename);
|
saveSourceFile(filename);
|
||||||
|
@ -172,7 +172,7 @@ class EditFrame : AppFrame {
|
||||||
FileDialog dlg = createFileDialog(caption);
|
FileDialog dlg = createFileDialog(caption);
|
||||||
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
dlg.addFilter(FileFilterEntry(UIString("DML files"d), "*.dml"));
|
||||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
string filename = result.stringParam;
|
string filename = result.stringParam;
|
||||||
openSourceFile(filename);
|
openSourceFile(filename);
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Dialog : VerticalLayout {
|
||||||
protected uint _flags;
|
protected uint _flags;
|
||||||
protected string _icon;
|
protected string _icon;
|
||||||
|
|
||||||
Signal!DialogResultHandler onDialogResult;
|
Signal!DialogResultHandler dialogResult;
|
||||||
|
|
||||||
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
|
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
|
||||||
super("dialog-main-widget");
|
super("dialog-main-widget");
|
||||||
|
@ -160,8 +160,8 @@ class Dialog : VerticalLayout {
|
||||||
*/
|
*/
|
||||||
void close(const Action action) {
|
void close(const Action action) {
|
||||||
if (action) {
|
if (action) {
|
||||||
if (onDialogResult.assigned)
|
if (dialogResult.assigned)
|
||||||
onDialogResult(this, action);
|
dialogResult(this, action);
|
||||||
else if (_parentWindow && !_popup)
|
else if (_parentWindow && !_popup)
|
||||||
_parentWindow.dispatchAction(action);
|
_parentWindow.dispatchAction(action);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ class Dialog : VerticalLayout {
|
||||||
if (_flags & DialogFlag.Popup) {
|
if (_flags & DialogFlag.Popup) {
|
||||||
DialogFrame _frame = new DialogFrame(this, _cancelButton !is null);
|
DialogFrame _frame = new DialogFrame(this, _cancelButton !is null);
|
||||||
if (_cancelButton) {
|
if (_cancelButton) {
|
||||||
_frame.onCloseButtonClickListener = delegate(Widget w) {
|
_frame.closeButtonClick = delegate(Widget w) {
|
||||||
close(_cancelButton.action);
|
close(_cancelButton.action);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -253,7 +253,7 @@ class FileDialog : Dialog, CustomGridCellAdapter {
|
||||||
}
|
}
|
||||||
res.ownAdapter = adapter;
|
res.ownAdapter = adapter;
|
||||||
res.layoutWidth(WRAP_CONTENT).layoutHeight(FILL_PARENT).layoutWeight(0);
|
res.layoutWidth(WRAP_CONTENT).layoutHeight(FILL_PARENT).layoutWeight(0);
|
||||||
res.onItemClickListener = delegate(Widget source, int itemIndex) {
|
res.itemClick = delegate(Widget source, int itemIndex) {
|
||||||
openDirectory(_roots[itemIndex].path, null);
|
openDirectory(_roots[itemIndex].path, null);
|
||||||
res.selectItem(-1);
|
res.selectItem(-1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -351,7 +351,7 @@ class FileDialog : Dialog, CustomGridCellAdapter {
|
||||||
filterLabels ~= f.label.value;
|
filterLabels ~= f.label.value;
|
||||||
_cbFilters = new ComboBox("filter", filterLabels);
|
_cbFilters = new ComboBox("filter", filterLabels);
|
||||||
_cbFilters.selectedItemIndex = _filterIndex;
|
_cbFilters.selectedItemIndex = _filterIndex;
|
||||||
_cbFilters.onItemClickListener = delegate(Widget source, int itemIndex) {
|
_cbFilters.itemClick = delegate(Widget source, int itemIndex) {
|
||||||
_filterIndex = itemIndex;
|
_filterIndex = itemIndex;
|
||||||
reopenDirectory();
|
reopenDirectory();
|
||||||
return true;
|
return true;
|
||||||
|
@ -472,7 +472,7 @@ class FilePathPanelItem : HorizontalLayout {
|
||||||
string d = baseName(fullPath);
|
string d = baseName(fullPath);
|
||||||
Action a = new Action(itemId++, toUTF32(d));
|
Action a = new Action(itemId++, toUTF32(d));
|
||||||
MenuItem item = new MenuItem(a);
|
MenuItem item = new MenuItem(a);
|
||||||
item.onMenuItemClick = delegate(MenuItem item) {
|
item.menuItemClick = delegate(MenuItem item) {
|
||||||
if (onPathSelectionListener.assigned)
|
if (onPathSelectionListener.assigned)
|
||||||
return onPathSelectionListener(fullPath);
|
return onPathSelectionListener(fullPath);
|
||||||
return false;
|
return false;
|
||||||
|
@ -618,7 +618,7 @@ class FilePathPanel : FrameLayout {
|
||||||
_segments = new FilePathPanelButtons(ID_SEGMENTS);
|
_segments = new FilePathPanelButtons(ID_SEGMENTS);
|
||||||
_edPath = new EditLine(ID_EDITOR);
|
_edPath = new EditLine(ID_EDITOR);
|
||||||
_edPath.layoutWidth = FILL_PARENT;
|
_edPath.layoutWidth = FILL_PARENT;
|
||||||
_edPath.editorActionListener = &onEditorAction;
|
_edPath.editorAction = &onEditorAction;
|
||||||
_edPath.focusChange = &onEditorFocusChanged;
|
_edPath.focusChange = &onEditorFocusChanged;
|
||||||
_segments.click = &onSegmentsClickOutside;
|
_segments.click = &onSegmentsClickOutside;
|
||||||
_segments.onPathSelectionListener = &onPathSelected;
|
_segments.onPathSelectionListener = &onPathSelected;
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MessageBox : Dialog {
|
||||||
_actions = buttons;
|
_actions = buttons;
|
||||||
_defaultButtonIndex = defaultButtonIndex;
|
_defaultButtonIndex = defaultButtonIndex;
|
||||||
if (handler) {
|
if (handler) {
|
||||||
onDialogResult = delegate (Dialog dlg, const Action action) {
|
dialogResult = delegate (Dialog dlg, const Action action) {
|
||||||
handler(action);
|
handler(action);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class StringComboBoxItem : SettingsItem {
|
||||||
}
|
}
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
cb.selectedItemIndex = index;
|
cb.selectedItemIndex = index;
|
||||||
cb.onItemClickListener = delegate(Widget source, int itemIndex) {
|
cb.itemClick = delegate(Widget source, int itemIndex) {
|
||||||
if (itemIndex >= 0 && itemIndex < _items.length)
|
if (itemIndex >= 0 && itemIndex < _items.length)
|
||||||
setting.str = _items[itemIndex].stringId;
|
setting.str = _items[itemIndex].stringId;
|
||||||
return true;
|
return true;
|
||||||
|
@ -117,7 +117,7 @@ class IntComboBoxItem : SettingsItem {
|
||||||
}
|
}
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
cb.selectedItemIndex = index;
|
cb.selectedItemIndex = index;
|
||||||
cb.onItemClickListener = delegate(Widget source, int itemIndex) {
|
cb.itemClick = delegate(Widget source, int itemIndex) {
|
||||||
if (itemIndex >= 0 && itemIndex < _items.length)
|
if (itemIndex >= 0 && itemIndex < _items.length)
|
||||||
setting.integer = _items[itemIndex].intId;
|
setting.integer = _items[itemIndex].intId;
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,7 +151,7 @@ class FloatComboBoxItem : SettingsItem {
|
||||||
}
|
}
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
cb.selectedItemIndex = index;
|
cb.selectedItemIndex = index;
|
||||||
cb.onItemClickListener = delegate(Widget source, int itemIndex) {
|
cb.itemClick = delegate(Widget source, int itemIndex) {
|
||||||
if (itemIndex >= 0 && itemIndex < _items.length)
|
if (itemIndex >= 0 && itemIndex < _items.length)
|
||||||
setting.floating = _items[itemIndex].intId / cast(double)_divider;
|
setting.floating = _items[itemIndex].intId / cast(double)_divider;
|
||||||
return true;
|
return true;
|
||||||
|
@ -389,7 +389,7 @@ class SettingsDialog : Dialog {
|
||||||
_tree = new TreeWidget("prop_tree");
|
_tree = new TreeWidget("prop_tree");
|
||||||
_tree.styleId = STYLE_SETTINGS_TREE;
|
_tree.styleId = STYLE_SETTINGS_TREE;
|
||||||
_tree.layoutHeight(FILL_PARENT).layoutHeight(FILL_PARENT).minHeight(200).minWidth(100);
|
_tree.layoutHeight(FILL_PARENT).layoutHeight(FILL_PARENT).minHeight(200).minWidth(100);
|
||||||
_tree.selectionListener = &onTreeItemSelected;
|
_tree.selectionChange = &onTreeItemSelected;
|
||||||
_tree.fontSize = 16;
|
_tree.fontSize = 16;
|
||||||
_frame = new FrameLayout("prop_pages");
|
_frame = new FrameLayout("prop_pages");
|
||||||
_frame.styleId = STYLE_SETTINGS_PAGES;
|
_frame.styleId = STYLE_SETTINGS_PAGES;
|
||||||
|
|
|
@ -234,7 +234,7 @@ class AppFrame : VerticalLayout, MenuItemClickHandler, MenuItemActionHandler {
|
||||||
_body = createBody();
|
_body = createBody();
|
||||||
_body.focusGroup = true;
|
_body.focusGroup = true;
|
||||||
if (_mainMenu) {
|
if (_mainMenu) {
|
||||||
_mainMenu.onMenuItemClickListener = &onMenuItemClick;
|
_mainMenu.menuItemClick = &onMenuItemClick;
|
||||||
addChild(_mainMenu);
|
addChild(_mainMenu);
|
||||||
}
|
}
|
||||||
if (_toolbarHost)
|
if (_toolbarHost)
|
||||||
|
|
|
@ -46,8 +46,6 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
|
||||||
|
|
||||||
/** Handle item click. */
|
/** Handle item click. */
|
||||||
Signal!OnItemSelectedHandler itemClick;
|
Signal!OnItemSelectedHandler itemClick;
|
||||||
/// itemClick signal alias for backward compatibility; will be deprecated in future
|
|
||||||
alias onItemClickListener = itemClick;
|
|
||||||
|
|
||||||
protected Widget createSelectedItemWidget() {
|
protected Widget createSelectedItemWidget() {
|
||||||
Widget res;
|
Widget res;
|
||||||
|
@ -71,8 +69,8 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
|
||||||
if (_selectedItemIndex == index)
|
if (_selectedItemIndex == index)
|
||||||
return this;
|
return this;
|
||||||
_selectedItemIndex = index;
|
_selectedItemIndex = index;
|
||||||
if (onItemClickListener.assigned)
|
if (itemClick.assigned)
|
||||||
onItemClickListener(this, index);
|
itemClick(this, index);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +123,7 @@ class ComboBoxBase : HorizontalLayout, OnClickHandler {
|
||||||
_popup = window.showPopup(_popupList, this, PopupAlign.Below | PopupAlign.FitAnchorSize);
|
_popup = window.showPopup(_popupList, this, PopupAlign.Below | PopupAlign.FitAnchorSize);
|
||||||
_popup.flags = PopupFlags.CloseOnClickOutside;
|
_popup.flags = PopupFlags.CloseOnClickOutside;
|
||||||
_popup.styleId = STYLE_POPUP_MENU;
|
_popup.styleId = STYLE_POPUP_MENU;
|
||||||
_popup.onPopupCloseListener = delegate (PopupWidget source) {
|
_popup.popupClosed = delegate (PopupWidget source) {
|
||||||
_popup = null;
|
_popup = null;
|
||||||
_popupList = null;
|
_popupList = null;
|
||||||
};
|
};
|
||||||
|
|
|
@ -508,7 +508,7 @@ class AbstractSlider : WidgetGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// scroll event listeners
|
/// scroll event listeners
|
||||||
Signal!OnScrollHandler onScrollEventListener;
|
Signal!OnScrollHandler scrollEvent;
|
||||||
|
|
||||||
/// returns slider position
|
/// returns slider position
|
||||||
@property int position() const { return _position; }
|
@property int position() const { return _position; }
|
||||||
|
@ -564,10 +564,10 @@ class AbstractSlider : WidgetGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sendScrollEvent(ScrollAction action, int position) {
|
bool sendScrollEvent(ScrollAction action, int position) {
|
||||||
if (!onScrollEventListener.assigned)
|
if (!scrollEvent.assigned)
|
||||||
return false;
|
return false;
|
||||||
ScrollEvent event = new ScrollEvent(action, _minValue, _maxValue, _pageSize, position);
|
ScrollEvent event = new ScrollEvent(action, _minValue, _maxValue, _pageSize, position);
|
||||||
bool res = onScrollEventListener(this, event);
|
bool res = scrollEvent(this, event);
|
||||||
if (event.positionChanged) {
|
if (event.positionChanged) {
|
||||||
_position = event.position;
|
_position = event.position;
|
||||||
if (_position > _maxValue)
|
if (_position > _maxValue)
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct DockSpace {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_resizer.visibility = Visibility.Gone;
|
_resizer.visibility = Visibility.Gone;
|
||||||
_resizer.resizeListener = &onResize;
|
_resizer.resizeEvent = &onResize;
|
||||||
return _resizer;
|
return _resizer;
|
||||||
}
|
}
|
||||||
/// host to be layed out
|
/// host to be layed out
|
||||||
|
|
|
@ -422,8 +422,8 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
||||||
override bool canShowPopupMenu(int x, int y) {
|
override bool canShowPopupMenu(int x, int y) {
|
||||||
if (_popupMenu is null)
|
if (_popupMenu is null)
|
||||||
return false;
|
return false;
|
||||||
if (_popupMenu.onBeforeOpeningSubmenu.assigned)
|
if (_popupMenu.openingSubmenu.assigned)
|
||||||
if (!_popupMenu.onBeforeOpeningSubmenu(_popupMenu))
|
if (!_popupMenu.openingSubmenu(_popupMenu))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -461,12 +461,12 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
||||||
/// shows popup at (x,y)
|
/// shows popup at (x,y)
|
||||||
override void showPopupMenu(int x, int y) {
|
override void showPopupMenu(int x, int y) {
|
||||||
/// if preparation signal handler assigned, call it; don't show popup if false is returned from handler
|
/// if preparation signal handler assigned, call it; don't show popup if false is returned from handler
|
||||||
if (_popupMenu.onBeforeOpeningSubmenu.assigned)
|
if (_popupMenu.openingSubmenu.assigned)
|
||||||
if (!_popupMenu.onBeforeOpeningSubmenu(_popupMenu))
|
if (!_popupMenu.openingSubmenu(_popupMenu))
|
||||||
return;
|
return;
|
||||||
_popupMenu.updateActionState(this);
|
_popupMenu.updateActionState(this);
|
||||||
PopupMenu popupMenu = new PopupMenu(_popupMenu);
|
PopupMenu popupMenu = new PopupMenu(_popupMenu);
|
||||||
popupMenu.onMenuItemActionListener = this;
|
popupMenu.menuItemAction = this;
|
||||||
PopupWidget popup = window.showPopup(popupMenu, this, PopupAlign.Point | PopupAlign.Right, x, y);
|
PopupWidget popup = window.showPopup(popupMenu, this, PopupAlign.Point | PopupAlign.Right, x, y);
|
||||||
popup.flags = PopupFlags.CloseOnClickOutside;
|
popup.flags = PopupFlags.CloseOnClickOutside;
|
||||||
}
|
}
|
||||||
|
@ -1504,7 +1504,7 @@ interface EditorActionHandler {
|
||||||
/// single line editor
|
/// single line editor
|
||||||
class EditLine : EditWidgetBase {
|
class EditLine : EditWidgetBase {
|
||||||
|
|
||||||
Signal!EditorActionHandler editorActionListener;
|
Signal!EditorActionHandler editorAction;
|
||||||
|
|
||||||
/// empty parameter list constructor - for usage by factory
|
/// empty parameter list constructor - for usage by factory
|
||||||
this() {
|
this() {
|
||||||
|
@ -1595,8 +1595,8 @@ class EditLine : EditWidgetBase {
|
||||||
case EditorActions.InsertNewLine:
|
case EditorActions.InsertNewLine:
|
||||||
case EditorActions.PrependNewLine:
|
case EditorActions.PrependNewLine:
|
||||||
case EditorActions.AppendNewLine:
|
case EditorActions.AppendNewLine:
|
||||||
if (editorActionListener.assigned) {
|
if (editorAction.assigned) {
|
||||||
return editorActionListener(a);
|
return editorAction(a);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EditorActions.Up:
|
case EditorActions.Up:
|
||||||
|
|
|
@ -292,7 +292,7 @@ class ResizerWidget : Widget {
|
||||||
protected Widget _nextWidget;
|
protected Widget _nextWidget;
|
||||||
protected string _styleVertical;
|
protected string _styleVertical;
|
||||||
protected string _styleHorizontal;
|
protected string _styleHorizontal;
|
||||||
Signal!ResizeHandler resizeListener;
|
Signal!ResizeHandler resizeEvent;
|
||||||
|
|
||||||
/// Orientation: Vertical to resize vertically, Horizontal - to resize horizontally
|
/// Orientation: Vertical to resize vertically, Horizontal - to resize horizontally
|
||||||
@property Orientation orientation() { return _orientation; }
|
@property Orientation orientation() { return _orientation; }
|
||||||
|
@ -405,8 +405,8 @@ class ResizerWidget : Widget {
|
||||||
_delta = _minDragDelta;
|
_delta = _minDragDelta;
|
||||||
if (_delta > _maxDragDelta)
|
if (_delta > _maxDragDelta)
|
||||||
_delta = _maxDragDelta;
|
_delta = _maxDragDelta;
|
||||||
} else if (resizeListener.assigned) {
|
} else if (resizeEvent.assigned) {
|
||||||
resizeListener(this, ResizerEventType.StartDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
resizeEvent(this, ResizerEventType.StartDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -418,16 +418,16 @@ class ResizerWidget : Widget {
|
||||||
if (_dragging) {
|
if (_dragging) {
|
||||||
//sendScrollEvent(ScrollAction.SliderReleased, _position);
|
//sendScrollEvent(ScrollAction.SliderReleased, _position);
|
||||||
_dragging = false;
|
_dragging = false;
|
||||||
if (resizeListener.assigned) {
|
if (resizeEvent.assigned) {
|
||||||
resizeListener(this, ResizerEventType.EndDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
resizeEvent(this, ResizerEventType.EndDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.action == MouseAction.Move && _dragging) {
|
if (event.action == MouseAction.Move && _dragging) {
|
||||||
int delta = _orientation == Orientation.Vertical ? event.y - _dragStart.y : event.x - _dragStart.x;
|
int delta = _orientation == Orientation.Vertical ? event.y - _dragStart.y : event.x - _dragStart.x;
|
||||||
if (resizeListener.assigned) {
|
if (resizeEvent.assigned) {
|
||||||
resizeListener(this, ResizerEventType.Dragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
resizeEvent(this, ResizerEventType.Dragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_delta = _dragStartPosition + delta;
|
_delta = _dragStartPosition + delta;
|
||||||
|
@ -487,8 +487,8 @@ class ResizerWidget : Widget {
|
||||||
if (_dragging) {
|
if (_dragging) {
|
||||||
resetState(State.Pressed);
|
resetState(State.Pressed);
|
||||||
_dragging = false;
|
_dragging = false;
|
||||||
if (resizeListener.assigned) {
|
if (resizeEvent.assigned) {
|
||||||
resizeListener(this, ResizerEventType.EndDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
resizeEvent(this, ResizerEventType.EndDragging, _orientation == Orientation.Vertical ? event.y : event.x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -57,16 +57,16 @@ interface ListAdapter {
|
||||||
/// List adapter for simple list of widget instances
|
/// List adapter for simple list of widget instances
|
||||||
class ListAdapterBase : ListAdapter {
|
class ListAdapterBase : ListAdapter {
|
||||||
/** Handle items change */
|
/** Handle items change */
|
||||||
protected Signal!OnAdapterChangeHandler onAdapterChangeListener;
|
protected Signal!OnAdapterChangeHandler adapterChanged;
|
||||||
|
|
||||||
/// connect adapter change handler
|
/// connect adapter change handler
|
||||||
override ListAdapter connect(OnAdapterChangeHandler handler) {
|
override ListAdapter connect(OnAdapterChangeHandler handler) {
|
||||||
onAdapterChangeListener.connect(handler);
|
adapterChanged.connect(handler);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/// disconnect adapter change handler
|
/// disconnect adapter change handler
|
||||||
override ListAdapter disconnect(OnAdapterChangeHandler handler) {
|
override ListAdapter disconnect(OnAdapterChangeHandler handler) {
|
||||||
onAdapterChangeListener.disconnect(handler);
|
adapterChanged.disconnect(handler);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/// returns integer item id by index (if supported)
|
/// returns integer item id by index (if supported)
|
||||||
|
@ -110,8 +110,8 @@ class ListAdapterBase : ListAdapter {
|
||||||
|
|
||||||
/// notify listeners about list items changes
|
/// notify listeners about list items changes
|
||||||
void updateViews() {
|
void updateViews() {
|
||||||
if (onAdapterChangeListener.assigned)
|
if (adapterChanged.assigned)
|
||||||
onAdapterChangeListener.emit(this);
|
adapterChanged.emit(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +545,7 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
||||||
_selectedItemIndex = -1;
|
_selectedItemIndex = -1;
|
||||||
_scrollbar = new ScrollBar("listscroll", orientation);
|
_scrollbar = new ScrollBar("listscroll", orientation);
|
||||||
_scrollbar.visibility = Visibility.Gone;
|
_scrollbar.visibility = Visibility.Gone;
|
||||||
_scrollbar.onScrollEventListener = &onScrollEvent;
|
_scrollbar.scrollEvent = &onScrollEvent;
|
||||||
addChild(_scrollbar);
|
addChild(_scrollbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,9 @@ class MenuItem {
|
||||||
protected MenuItem[] _subitems;
|
protected MenuItem[] _subitems;
|
||||||
protected MenuItem _parent;
|
protected MenuItem _parent;
|
||||||
/// handle menu item click (parameter is MenuItem)
|
/// handle menu item click (parameter is MenuItem)
|
||||||
Signal!MenuItemClickHandler onMenuItemClick;
|
Signal!MenuItemClickHandler menuItemClick;
|
||||||
/// handle menu item click action (parameter is Action)
|
/// handle menu item click action (parameter is Action)
|
||||||
Signal!MenuItemActionHandler onMenuItemAction;
|
Signal!MenuItemActionHandler menuItemAction;
|
||||||
/// item action id, 0 if no action
|
/// item action id, 0 if no action
|
||||||
@property int id() const { return _action is null ? 0 : _action.id; }
|
@property int id() const { return _action is null ? 0 : _action.id; }
|
||||||
/// returns count of submenu items
|
/// returns count of submenu items
|
||||||
|
@ -227,7 +227,7 @@ class MenuItem {
|
||||||
/// handle menu item click
|
/// handle menu item click
|
||||||
Signal!(void, MenuItem) onMenuItem;
|
Signal!(void, MenuItem) onMenuItem;
|
||||||
/// prepare for opening of submenu, return true if opening is allowed
|
/// prepare for opening of submenu, return true if opening is allowed
|
||||||
Signal!(bool, MenuItem) onBeforeOpeningSubmenu;
|
Signal!(bool, MenuItem) openingSubmenu;
|
||||||
|
|
||||||
/// call to update state for action (if action is assigned for widget)
|
/// call to update state for action (if action is assigned for widget)
|
||||||
void updateActionState(Widget w) {
|
void updateActionState(Widget w) {
|
||||||
|
@ -421,9 +421,9 @@ class MenuWidgetBase : ListWidget {
|
||||||
protected int _openedPopupIndex;
|
protected int _openedPopupIndex;
|
||||||
|
|
||||||
/// menu item click listener
|
/// menu item click listener
|
||||||
Signal!MenuItemClickHandler onMenuItemClickListener;
|
Signal!MenuItemClickHandler menuItemClick;
|
||||||
/// menu item action listener
|
/// menu item action listener
|
||||||
Signal!MenuItemActionHandler onMenuItemActionListener;
|
Signal!MenuItemActionHandler menuItemAction;
|
||||||
|
|
||||||
this(MenuWidgetBase parentMenu, MenuItem item, Orientation orientation) {
|
this(MenuWidgetBase parentMenu, MenuItem item, Orientation orientation) {
|
||||||
_parentMenu = parentMenu;
|
_parentMenu = parentMenu;
|
||||||
|
@ -534,7 +534,7 @@ class MenuWidgetBase : ListWidget {
|
||||||
PopupMenu popupMenu = new PopupMenu(itemWidget.item, this);
|
PopupMenu popupMenu = new PopupMenu(itemWidget.item, this);
|
||||||
PopupWidget popup = window.showPopup(popupMenu, itemWidget, orientation == Orientation.Horizontal ? PopupAlign.Below : PopupAlign.Right);
|
PopupWidget popup = window.showPopup(popupMenu, itemWidget, orientation == Orientation.Horizontal ? PopupAlign.Below : PopupAlign.Right);
|
||||||
requestActionsUpdate();
|
requestActionsUpdate();
|
||||||
popup.onPopupCloseListener = &onPopupClosed;
|
popup.popupClosed = &onPopupClosed;
|
||||||
popup.flags = PopupFlags.CloseOnClickOutside;
|
popup.flags = PopupFlags.CloseOnClickOutside;
|
||||||
_openedPopup = popup;
|
_openedPopup = popup;
|
||||||
_openedMenu = popupMenu;
|
_openedMenu = popupMenu;
|
||||||
|
@ -583,10 +583,10 @@ class MenuWidgetBase : ListWidget {
|
||||||
} else if (item.type == MenuItemType.Radio) {
|
} else if (item.type == MenuItemType.Radio) {
|
||||||
item.checked = true;
|
item.checked = true;
|
||||||
}
|
}
|
||||||
if (item.onMenuItemClick.assigned)
|
if (item.menuItemClick.assigned)
|
||||||
item.onMenuItemClick(item);
|
item.menuItemClick(item);
|
||||||
if (item.onMenuItemAction.assigned && item.action)
|
if (item.menuItemAction.assigned && item.action)
|
||||||
item.onMenuItemAction(item.action);
|
item.menuItemAction(item.action);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onMenuItem(MenuItem item) {
|
protected void onMenuItem(MenuItem item) {
|
||||||
|
@ -605,9 +605,9 @@ class MenuWidgetBase : ListWidget {
|
||||||
selectOnHover = false;
|
selectOnHover = false;
|
||||||
|
|
||||||
// copy menu item click listeners
|
// copy menu item click listeners
|
||||||
Signal!MenuItemClickHandler onMenuItemClickListenerCopy = onMenuItemClickListener;
|
Signal!MenuItemClickHandler onMenuItemClickListenerCopy = menuItemClick;
|
||||||
// copy item action listeners
|
// copy item action listeners
|
||||||
Signal!MenuItemActionHandler onMenuItemActionListenerCopy = onMenuItemActionListener;
|
Signal!MenuItemActionHandler onMenuItemActionListenerCopy = menuItemAction;
|
||||||
|
|
||||||
handleMenuItemClick(item);
|
handleMenuItemClick(item);
|
||||||
|
|
||||||
|
@ -798,9 +798,9 @@ class MainMenu : MenuWidgetBase {
|
||||||
debug(DebugMenus) Log.d("MainMenu.onMenuItem ", item.action.label);
|
debug(DebugMenus) Log.d("MainMenu.onMenuItem ", item.action.label);
|
||||||
|
|
||||||
// copy menu item click listeners
|
// copy menu item click listeners
|
||||||
Signal!MenuItemClickHandler onMenuItemClickListenerCopy = onMenuItemClickListener;
|
Signal!MenuItemClickHandler onMenuItemClickListenerCopy = menuItemClick;
|
||||||
// copy item action listeners
|
// copy item action listeners
|
||||||
Signal!MenuItemActionHandler onMenuItemActionListenerCopy = onMenuItemActionListener;
|
Signal!MenuItemActionHandler onMenuItemActionListenerCopy = menuItemAction;
|
||||||
|
|
||||||
deactivate();
|
deactivate();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class PopupWidget : LinearLayout {
|
||||||
|
|
||||||
protected uint _flags;
|
protected uint _flags;
|
||||||
/** popup close signal */
|
/** popup close signal */
|
||||||
Signal!OnPopupCloseHandler onPopupCloseListener;
|
Signal!OnPopupCloseHandler popupClosed;
|
||||||
//protected void delegate(PopupWidget popup) _onPopupCloseListener;
|
//protected void delegate(PopupWidget popup) _onPopupCloseListener;
|
||||||
/// popup close listener (called right before closing)
|
/// popup close listener (called right before closing)
|
||||||
//@property void delegate(PopupWidget popup) onPopupCloseListener() { return _onPopupCloseListener; }
|
//@property void delegate(PopupWidget popup) onPopupCloseListener() { return _onPopupCloseListener; }
|
||||||
|
@ -96,8 +96,8 @@ class PopupWidget : LinearLayout {
|
||||||
|
|
||||||
/// just call on close listener
|
/// just call on close listener
|
||||||
void onClose() {
|
void onClose() {
|
||||||
if (onPopupCloseListener.assigned)
|
if (popupClosed.assigned)
|
||||||
onPopupCloseListener(this);
|
popupClosed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
|
/// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
|
||||||
|
|
|
@ -111,12 +111,12 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
_vscrollbarMode = vscrollbarMode;
|
_vscrollbarMode = vscrollbarMode;
|
||||||
if (_vscrollbarMode != ScrollBarMode.Invisible) {
|
if (_vscrollbarMode != ScrollBarMode.Invisible) {
|
||||||
_vscrollbar = new ScrollBar("vscrollbar", Orientation.Vertical);
|
_vscrollbar = new ScrollBar("vscrollbar", Orientation.Vertical);
|
||||||
_vscrollbar.onScrollEventListener = this;
|
_vscrollbar.scrollEvent = this;
|
||||||
addChild(_vscrollbar);
|
addChild(_vscrollbar);
|
||||||
}
|
}
|
||||||
if (_hscrollbarMode != ScrollBarMode.Invisible) {
|
if (_hscrollbarMode != ScrollBarMode.Invisible) {
|
||||||
_hscrollbar = new ScrollBar("hscrollbar", Orientation.Horizontal);
|
_hscrollbar = new ScrollBar("hscrollbar", Orientation.Horizontal);
|
||||||
_hscrollbar.onScrollEventListener = this;
|
_hscrollbar.scrollEvent = this;
|
||||||
addChild(_hscrollbar);
|
addChild(_hscrollbar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ class TabItemWidget : HorizontalLayout {
|
||||||
private ImageButton _closeButton;
|
private ImageButton _closeButton;
|
||||||
private TabItem _item;
|
private TabItem _item;
|
||||||
private bool _enableCloseButton;
|
private bool _enableCloseButton;
|
||||||
Signal!TabCloseHandler onTabCloseListener;
|
Signal!TabCloseHandler tabClose;
|
||||||
@property TabItem tabItem() { return _item; }
|
@property TabItem tabItem() { return _item; }
|
||||||
@property TabControl tabControl() { return cast(TabControl)parent; }
|
@property TabControl tabControl() { return cast(TabControl)parent; }
|
||||||
this(TabItem item, bool enableCloseButton = true) {
|
this(TabItem item, bool enableCloseButton = true) {
|
||||||
|
@ -128,8 +128,8 @@ class TabItemWidget : HorizontalLayout {
|
||||||
protected bool onClick(Widget source) {
|
protected bool onClick(Widget source) {
|
||||||
if (source.compareId("CLOSE")) {
|
if (source.compareId("CLOSE")) {
|
||||||
Log.d("tab close button pressed");
|
Log.d("tab close button pressed");
|
||||||
if (onTabCloseListener.assigned)
|
if (tabClose.assigned)
|
||||||
onTabCloseListener(_item.id);
|
tabClose(_item.id);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -227,10 +227,10 @@ class TabControl : WidgetGroupDefaultDrawing {
|
||||||
protected string _tabButtonTextStyle;
|
protected string _tabButtonTextStyle;
|
||||||
|
|
||||||
/// signal of tab change (e.g. by clicking on tab header)
|
/// signal of tab change (e.g. by clicking on tab header)
|
||||||
Signal!TabHandler onTabChangedListener;
|
Signal!TabHandler tabChanged;
|
||||||
|
|
||||||
/// signal on tab close button
|
/// signal on tab close button
|
||||||
Signal!TabCloseHandler onTabCloseListener;
|
Signal!TabCloseHandler tabClose;
|
||||||
|
|
||||||
protected Align _tabAlignment;
|
protected Align _tabAlignment;
|
||||||
@property Align tabAlignment() { return _tabAlignment; }
|
@property Align tabAlignment() { return _tabAlignment; }
|
||||||
|
@ -378,8 +378,8 @@ class TabControl : WidgetGroupDefaultDrawing {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onTabClose(string tabId) {
|
protected void onTabClose(string tabId) {
|
||||||
if (onTabCloseListener.assigned)
|
if (tabClose.assigned)
|
||||||
onTabCloseListener(tabId);
|
tabClose(tabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// add new tab
|
/// add new tab
|
||||||
|
@ -389,7 +389,7 @@ class TabControl : WidgetGroupDefaultDrawing {
|
||||||
widget.parent = this;
|
widget.parent = this;
|
||||||
widget.click = &onClick;
|
widget.click = &onClick;
|
||||||
widget.setStyles(_tabButtonStyle, _tabButtonTextStyle);
|
widget.setStyles(_tabButtonStyle, _tabButtonTextStyle);
|
||||||
widget.onTabCloseListener = &onTabClose;
|
widget.tabClose = &onTabClose;
|
||||||
_children.insert(widget, index);
|
_children.insert(widget, index);
|
||||||
updateTabs();
|
updateTabs();
|
||||||
requestLayout();
|
requestLayout();
|
||||||
|
@ -548,8 +548,8 @@ class TabControl : WidgetGroupDefaultDrawing {
|
||||||
_children.get(i).state = State.Normal;
|
_children.get(i).state = State.Normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (onTabChangedListener.assigned)
|
if (tabChanged.assigned)
|
||||||
onTabChangedListener(_selectedTabId, previousSelectedTab);
|
tabChanged(_selectedTabId, previousSelectedTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ class TabHost : FrameLayout, TabHandler {
|
||||||
super(ID);
|
super(ID);
|
||||||
_tabControl = tabControl;
|
_tabControl = tabControl;
|
||||||
if (_tabControl !is null)
|
if (_tabControl !is null)
|
||||||
_tabControl.onTabChangedListener = &onTabChanged;
|
_tabControl.tabChanged = &onTabChanged;
|
||||||
styleId = STYLE_TAB_HOST;
|
styleId = STYLE_TAB_HOST;
|
||||||
}
|
}
|
||||||
protected TabControl _tabControl;
|
protected TabControl _tabControl;
|
||||||
|
@ -575,7 +575,7 @@ class TabHost : FrameLayout, TabHandler {
|
||||||
@property TabHost tabControl(TabControl newWidget) {
|
@property TabHost tabControl(TabControl newWidget) {
|
||||||
_tabControl = newWidget;
|
_tabControl = newWidget;
|
||||||
if (_tabControl !is null)
|
if (_tabControl !is null)
|
||||||
_tabControl.onTabChangedListener = &onTabChanged;
|
_tabControl.tabChanged = &onTabChanged;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,14 +584,14 @@ class TabHost : FrameLayout, TabHandler {
|
||||||
@property void hiddenTabsVisibility(Visibility v) { _hiddenTabsVisibility = v; }
|
@property void hiddenTabsVisibility(Visibility v) { _hiddenTabsVisibility = v; }
|
||||||
|
|
||||||
/// signal of tab change (e.g. by clicking on tab header)
|
/// signal of tab change (e.g. by clicking on tab header)
|
||||||
Signal!TabHandler onTabChangedListener;
|
Signal!TabHandler tabChanged;
|
||||||
|
|
||||||
protected override void onTabChanged(string newActiveTabId, string previousTabId) {
|
protected override void onTabChanged(string newActiveTabId, string previousTabId) {
|
||||||
if (newActiveTabId !is null) {
|
if (newActiveTabId !is null) {
|
||||||
showChild(newActiveTabId, _hiddenTabsVisibility, true);
|
showChild(newActiveTabId, _hiddenTabsVisibility, true);
|
||||||
}
|
}
|
||||||
if (onTabChangedListener.assigned)
|
if (tabChanged.assigned)
|
||||||
onTabChangedListener(newActiveTabId, previousTabId);
|
tabChanged(newActiveTabId, previousTabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get tab content widget by id
|
/// get tab content widget by id
|
||||||
|
@ -670,8 +670,8 @@ class TabWidget : VerticalLayout, TabHandler, TabCloseHandler {
|
||||||
super(ID);
|
super(ID);
|
||||||
_tabControl = new TabControl("TAB_CONTROL", tabAlignment);
|
_tabControl = new TabControl("TAB_CONTROL", tabAlignment);
|
||||||
_tabHost = new TabHost("TAB_HOST", _tabControl);
|
_tabHost = new TabHost("TAB_HOST", _tabControl);
|
||||||
_tabControl.onTabChangedListener.connect(this);
|
_tabControl.tabChanged.connect(this);
|
||||||
_tabControl.onTabCloseListener.connect(this);
|
_tabControl.tabClose.connect(this);
|
||||||
styleId = STYLE_TAB_WIDGET;
|
styleId = STYLE_TAB_WIDGET;
|
||||||
if (tabAlignment == Align.Top) {
|
if (tabAlignment == Align.Top) {
|
||||||
addChild(_tabControl);
|
addChild(_tabControl);
|
||||||
|
@ -687,19 +687,19 @@ class TabWidget : VerticalLayout, TabHandler, TabCloseHandler {
|
||||||
TabHost tabHost() { return _tabHost; }
|
TabHost tabHost() { return _tabHost; }
|
||||||
|
|
||||||
/// signal of tab change (e.g. by clicking on tab header)
|
/// signal of tab change (e.g. by clicking on tab header)
|
||||||
Signal!TabHandler onTabChangedListener;
|
Signal!TabHandler tabChanged;
|
||||||
/// signal on tab close button
|
/// signal on tab close button
|
||||||
Signal!TabCloseHandler onTabCloseListener;
|
Signal!TabCloseHandler tabClose;
|
||||||
|
|
||||||
protected override void onTabClose(string tabId) {
|
protected override void onTabClose(string tabId) {
|
||||||
if (onTabCloseListener.assigned)
|
if (tabClose.assigned)
|
||||||
onTabCloseListener(tabId);
|
tabClose(tabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void onTabChanged(string newActiveTabId, string previousTabId) {
|
protected override void onTabChanged(string newActiveTabId, string previousTabId) {
|
||||||
// forward to listener
|
// forward to listener
|
||||||
if (onTabChangedListener.assigned)
|
if (tabChanged.assigned)
|
||||||
onTabChangedListener(newActiveTabId, previousTabId);
|
tabChanged(newActiveTabId, previousTabId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// add new tab by id and label string resource id
|
/// add new tab by id and label string resource id
|
||||||
|
|
|
@ -659,9 +659,9 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
||||||
|
|
||||||
@property ref TreeItems items() { return _tree; }
|
@property ref TreeItems items() { return _tree; }
|
||||||
|
|
||||||
Signal!OnTreeSelectionChangeListener selectionListener;
|
Signal!OnTreeSelectionChangeListener selectionChange;
|
||||||
/// allows to provide individual popup menu for items
|
/// allows to provide individual popup menu for items
|
||||||
Listener!OnTreePopupMenuListener popupMenuListener;
|
Listener!OnTreePopupMenuListener popupMenu;
|
||||||
|
|
||||||
protected bool _needUpdateWidgets;
|
protected bool _needUpdateWidgets;
|
||||||
protected bool _needUpdateWidgetStates;
|
protected bool _needUpdateWidgetStates;
|
||||||
|
@ -678,8 +678,8 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MenuItem onTreeItemPopupMenu(TreeItems source, TreeItem selectedItem) {
|
protected MenuItem onTreeItemPopupMenu(TreeItems source, TreeItem selectedItem) {
|
||||||
if (popupMenuListener)
|
if (popupMenu)
|
||||||
return popupMenuListener(source, selectedItem);
|
return popupMenu(source, selectedItem);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,8 +827,8 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
||||||
selected.setFocus();
|
selected.setFocus();
|
||||||
makeWidgetVisible(selected, false, true);
|
makeWidgetVisible(selected, false, true);
|
||||||
}
|
}
|
||||||
if (selectionListener.assigned)
|
if (selectionChange.assigned)
|
||||||
selectionListener(source, selectedItem, activated);
|
selectionChange(source, selectedItem, activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeItemVisible(TreeItem item) {
|
void makeItemVisible(TreeItem item) {
|
||||||
|
|
|
@ -1218,6 +1218,9 @@ class Widget {
|
||||||
/// mouse event listener (bool delegate(Widget, MouseEvent)) - return true if event is processed by handler
|
/// mouse event listener (bool delegate(Widget, MouseEvent)) - return true if event is processed by handler
|
||||||
Signal!OnMouseHandler mouseEvent;
|
Signal!OnMouseHandler mouseEvent;
|
||||||
|
|
||||||
|
|
||||||
|
// Signal utils
|
||||||
|
|
||||||
/// helper function to add onCheckChangeListener in method chain
|
/// helper function to add onCheckChangeListener in method chain
|
||||||
Widget addOnClickListener(bool delegate(Widget) listener) {
|
Widget addOnClickListener(bool delegate(Widget) listener) {
|
||||||
click.connect(listener);
|
click.connect(listener);
|
||||||
|
|
|
@ -47,10 +47,10 @@ class WindowFrame : VerticalLayout {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Signal!OnClickHandler onCloseButtonClickListener;
|
Signal!OnClickHandler closeButtonClick;
|
||||||
protected bool onCloseButtonClick(Widget source) {
|
protected bool onCloseButtonClick(Widget source) {
|
||||||
if (onCloseButtonClickListener.assigned)
|
if (closeButtonClick.assigned)
|
||||||
onCloseButtonClickListener(source);
|
closeButtonClick(source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue