This commit is contained in:
Vadim Lopatin 2015-01-05 18:04:58 +03:00
parent 5fdf4ad935
commit 78f407c474
1 changed files with 6 additions and 5 deletions

View File

@ -61,7 +61,6 @@ class FileDialog : Dialog, CustomGridCellAdapter {
protected FilePathPanel _edPath; protected FilePathPanel _edPath;
protected EditLine _edFilename; protected EditLine _edFilename;
protected StringGridWidget _fileList; protected StringGridWidget _fileList;
//protected StringGridWidget places;
protected VerticalLayout leftPanel; protected VerticalLayout leftPanel;
protected VerticalLayout rightPanel; protected VerticalLayout rightPanel;
protected Action _action; protected Action _action;
@ -390,7 +389,7 @@ class FilePathPanelItem : HorizontalLayout {
class FilePathPanelButtons : WidgetGroup { class FilePathPanelButtons : WidgetGroup {
protected string _path; protected string _path;
Listener!OnPathSelectionHandler onPathSelectionListener; Listener!OnPathSelectionHandler onPathSelectionListener;
bool onPathSelected(string path) { protected bool onPathSelected(string path) {
if (onPathSelectionListener.assigned) { if (onPathSelectionListener.assigned) {
return onPathSelectionListener(path); return onPathSelectionListener(path);
} }
@ -401,7 +400,7 @@ class FilePathPanelButtons : WidgetGroup {
layoutWidth = FILL_PARENT; layoutWidth = FILL_PARENT;
clickable = true; clickable = true;
} }
void init(string path) { protected void init(string path) {
_path = path; _path = path;
_children.clear(); _children.clear();
string itemPath = path; string itemPath = path;
@ -520,6 +519,7 @@ interface PathSelectedHandler {
bool onPathSelected(string path); bool onPathSelected(string path);
} }
/// Panel - either path segment buttons or text editor line
class FilePathPanel : FrameLayout { class FilePathPanel : FrameLayout {
Listener!OnPathSelectionHandler onPathSelectionListener; Listener!OnPathSelectionHandler onPathSelectionListener;
static const ID_SEGMENTS = "SEGMENTS"; static const ID_SEGMENTS = "SEGMENTS";
@ -554,13 +554,14 @@ class FilePathPanel : FrameLayout {
} }
return false; return false;
} }
bool onSegmentsClickOutside(Widget w) { protected bool onSegmentsClickOutside(Widget w) {
// switch to editor // switch to editor
_edPath.text = toUTF32(_path);
showChild(ID_EDITOR); showChild(ID_EDITOR);
_edPath.setFocus(); _edPath.setFocus();
return true; return true;
} }
bool onEditorAction(const Action action) { protected bool onEditorAction(const Action action) {
if (action.id == EditorActions.InsertNewLine) { if (action.id == EditorActions.InsertNewLine) {
string fn = buildNormalizedPath(toUTF8(_edPath.text)); string fn = buildNormalizedPath(toUTF8(_edPath.text));
if (exists(fn) && isDir(fn)) if (exists(fn) && isDir(fn))