import "Array"
default extern int __ecereVMethodID_class_OnGetDataFromString;
-default static void _workAround()
+default __attribute__((unused)) static void _workAround()
{
int a;
a.OnGetDataFromString(0);
borderStyle = deep;
clientSize = { 64, 18 };
- watch(background) { editBox.background = background; };
- watch(foreground) { editBox.foreground = foreground; };
- watch(opacity) { editBox.opacity = opacity; };
-
-#if defined(__WIN32__)
- PathBox()
- {
- path[0] = '\0';
- }
-#endif
+ watch(background) { editBox.background = background; };
+ watch(foreground) { editBox.foreground = foreground; };
+ watch(selectionColor) { editBox.selectionColor = selectionColor; };
+ watch(selectionText) { editBox.selectionText = selectionText; };
+ watch(opacity) { editBox.opacity = opacity; };
PathTypeExpected typeExpected;
FileDialog browseDialog;
-#if defined(__WIN32__)
char path[MAX_LOCATION];
-#endif
BitmapResource file { "<:ecere>mimeTypes/file.png", transparent = true, alphaBlend = true };
BitmapResource brokenFile { "<:ecere>mimeTypes/brokenFile.png", transparent = true, alphaBlend = true };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
+ if(modifiedDocument)
+ NotifyModified(master, this);
+
if(browseDialog)
{
char browsePath[MAX_LOCATION];
- char * baseBrowsePath = null;
PathBox pathBox = this;
DataBox dataBox = pathBoxDataBox;
ListBox listBox;
DirectoriesBox dirsBox = pathBoxDirsBox;
- char * ebContents = editBox.contents;
+ const char * ebContents = editBox.contents;
String backFilePath = CopyString(browseDialog.filePath);
+ char * baseBrowsePath = dirsBox ? dirsBox.baseBrowsePath : null;
browsePath[0] = '\0';
strncpy(browsePath, browseDialog.filePath, MAX_LOCATION); browsePath[MAX_LOCATION-1] = '\0';
- if(dirsBox && dirsBox.baseBrowsePath && dirsBox.baseBrowsePath[0])
- PathCat(browsePath, dirsBox.baseBrowsePath);
+ if(baseBrowsePath && baseBrowsePath[0] && ((ebContents && ebContents[0]) || !backFilePath || !backFilePath[0]))
+ PathCat(browsePath, baseBrowsePath);
PathCat(browsePath, ebContents);
browseDialog.filePath = (ebContents && ebContents[0]) ? browsePath : "";
- if(pathBox.typeExpected == directory && browsePath[0] && FileExists(browsePath).isDirectory)
+ if(pathBox.typeExpected == directory && browsePath[0] && FileExists(browsePath).isDirectory && backFilePath && backFilePath[0])
StripLastDirectory(browsePath, browsePath);
while(browsePath[0] && !FileExists(browsePath).isDirectory)
StripLastDirectory(browsePath, browsePath);
{
BitmapResource icon = null;
char path[MAX_LOCATION];
- FileAttribs exists;
+ FileAttribs exists { };
GetSystemPathBuffer(path, editBox.contents);
- exists = FileExists(path);
-
+ if(!(path[0] == DIR_SEP && path[1] == DIR_SEP && (!path[2] || !strchr(&path[2], DIR_SEP))))
+ exists = FileExists(path);
+
switch(typeExpected)
{
case any:
typeExpected = value;
if(browseDialog && browseDialog.type == open && typeExpected == directory)
browseDialog.type = selectDir;
- }
+ }
}
}
void SelectAll() { editBox.SelectAll(); }
void Deselect() { editBox.Deselect(); }
- property String path
+ property const String path
{
set
{
virtual bool OnPrepareBrowseDir(char ** directory);
virtual bool OnBrowsedDir(char ** directory);
- watch(foreground) { list.foreground = foreground; };
- watch(background) { list.background = background; };
+ watch(foreground) { list.foreground = foreground; };
+ watch(background) { list.background = background; };
+ //watch(selectionColor) { list.selectionColor = selectionColor; };
+ //watch(selectionText) { list.selectionText = selectionText; };
+ watch(opacity) { list.opacity = opacity; };
property Array<String> strings
{
DataRow row;
for(row = list.firstRow; row; row = row.next)
{
- String string = row.string;
+ const String string = row.string;
if(string && string[0])
array.Add(CopyUnixPath(string));
}
listBox.SetData(null, dir);
listBox.modifiedDocument = true;
if(listBox.currentRow == listBox.lastRow && listBox.lastRow.string)
- {
- DataRow r = listBox.lastRow;
- char * s = r.string;
listBox.currentRow = listBox.AddString("");
- }
}
delete dir;
}