mirror of https://github.com/buggins/dlangui.git
fixes
This commit is contained in:
parent
f380eac0b4
commit
aa1204df50
|
|
@ -717,10 +717,11 @@ class FileNameEditLine : HorizontalLayout {
|
|||
|
||||
this(string ID = null) {
|
||||
super(ID);
|
||||
_edFileName = new EditLine("edFileName");
|
||||
_edFileName = new EditLine("FileNameEditLine_edFileName");
|
||||
_edFileName.minWidth(200);
|
||||
_btn = new Button("btnFile", "..."d);
|
||||
_btn = new Button("FileNameEditLine_btnFile", "..."d);
|
||||
_btn.styleId = STYLE_BUTTON_NOMARGINS;
|
||||
_btn.layoutWeight = 0;
|
||||
_btn.click = delegate(Widget src) {
|
||||
FileDialog dlg = new FileDialog(UIString(_caption), window, null, _fileDialogFlags);
|
||||
foreach(key, value; _filetypeIcons)
|
||||
|
|
@ -808,6 +809,7 @@ class DirEditLine : FileNameEditLine {
|
|||
super(ID);
|
||||
_fileDialogFlags = DialogFlag.Modal | DialogFlag.Resizable
|
||||
| FileDialogFlag.FileMustExist | FileDialogFlag.SelectDirectory | FileDialogFlag.EnableCreateDirectory;
|
||||
_caption = "Select directory"d;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -583,10 +583,18 @@ class MenuWidgetBase : ListWidget {
|
|||
} else if (item.type == MenuItemType.Radio) {
|
||||
item.checked = true;
|
||||
}
|
||||
if (item.menuItemClick.assigned)
|
||||
item.menuItemClick(item);
|
||||
if (item.menuItemAction.assigned && item.action)
|
||||
item.menuItemAction(item.action);
|
||||
MenuItem p = item;
|
||||
while (p) {
|
||||
if (p.menuItemClick.assigned) {
|
||||
p.menuItemClick(item);
|
||||
break;
|
||||
}
|
||||
if (p.menuItemAction.assigned && item.action) {
|
||||
p.menuItemAction(item.action);
|
||||
break;
|
||||
}
|
||||
p = p._parent;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onMenuItem(MenuItem item) {
|
||||
|
|
|
|||
|
|
@ -164,9 +164,19 @@ class TabItemList {
|
|||
return _list[index];
|
||||
}
|
||||
/// get item by index
|
||||
const (TabItem) get(int index) const {
|
||||
if (index < 0 || index >= _len)
|
||||
return null;
|
||||
return _list[index];
|
||||
}
|
||||
/// get item by index
|
||||
TabItem opIndex(int index) {
|
||||
return get(index);
|
||||
}
|
||||
/// get item by index
|
||||
const (TabItem) opIndex(int index) const {
|
||||
return get(index);
|
||||
}
|
||||
/// get item by id
|
||||
TabItem get(string id) {
|
||||
int idx = indexById(id);
|
||||
|
|
@ -175,6 +185,13 @@ class TabItemList {
|
|||
return _list[idx];
|
||||
}
|
||||
/// get item by id
|
||||
const (TabItem) get(string id) const {
|
||||
int idx = indexById(id);
|
||||
if (idx < 0)
|
||||
return null;
|
||||
return _list[idx];
|
||||
}
|
||||
/// get item by id
|
||||
TabItem opIndex(string id) {
|
||||
return get(id);
|
||||
}
|
||||
|
|
@ -204,7 +221,7 @@ class TabItemList {
|
|||
return res;
|
||||
}
|
||||
/// find tab index by id
|
||||
int indexById(string id) {
|
||||
int indexById(string id) const {
|
||||
import std.algorithm;
|
||||
for (int i = 0; i < _len; i++) {
|
||||
if (_list[i].id.equal(id))
|
||||
|
|
@ -287,6 +304,10 @@ class TabControl : WidgetGroupDefaultDrawing {
|
|||
TabItem tab(string id) {
|
||||
return _items.get(id);
|
||||
}
|
||||
/// returns tab item by id (null if not found)
|
||||
const(TabItem) tab(string id) const {
|
||||
return _items.get(id);
|
||||
}
|
||||
/// get tab index by tab id (-1 if not found)
|
||||
int tabIndex(string id) {
|
||||
return _items.indexById(id);
|
||||
|
|
@ -804,6 +825,14 @@ class TabWidget : VerticalLayout, TabHandler, TabCloseHandler {
|
|||
return super.onKeyEvent(event);
|
||||
}
|
||||
|
||||
@property const(TabItem) selectedTab() const {
|
||||
return _tabControl.tab(selectedTabId);
|
||||
}
|
||||
|
||||
@property TabItem selectedTab() {
|
||||
return _tabControl.tab(selectedTabId);
|
||||
}
|
||||
|
||||
@property string selectedTabId() const {
|
||||
return _tabControl._selectedTabId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue