3 static FileFilter txtFilters[] =
5 { "Text Files (*.txt)", "txt" },
8 static FileType txtTypes[] =
10 { "Text Files", "txt", always },
14 eNodepadWindow appWindow;
16 class eNodepadWindow : Window
19 borderStyle = sizable;
28 Menu fileMenu { menu, "File", f };
31 fileMenu, "Open", o, ctrlO;
33 bool NotifySelect(MenuItem selection, Modifiers mods)
35 if(openDialog.Modal() == ok)
37 File f = FileOpen(openDialog.filePath, read);
40 fileName = openDialog.filePath;
47 MenuDivider { fileMenu };
48 MenuItem saveItem { fileMenu, "Save", s, ctrlS, NotifySelect = MenuFileSave };
49 MenuItem saveItemAs { fileMenu, "Save As...", a, NotifySelect = MenuFileSaveAs };
50 MenuDivider { fileMenu };
51 MenuItem exitItem { fileMenu, "Exit", x, altF4, NotifySelect = MenuFileExit };
52 MenuPlacement { menu, "Edit", e };
53 FileDialog fileSaveDialog
55 master = this, type = save, text = "Save File...",
56 types = txtTypes, sizeTypes = sizeof(txtTypes), filters = txtFilters, sizeFilters = sizeof(txtFilters)
60 master = this, type = open, text = "Load File...",
61 types = txtTypes, sizeTypes = sizeof(txtTypes), filters = txtFilters, sizeFilters = sizeof(txtFilters)
63 saveDialog = fileSaveDialog;
65 bool OnSaveFile(char * fileName)
67 File f = FileOpen(fileName, write);
70 editBox.Save(f, false);
71 modifiedDocument = false;
79 this, font = { "Lucida Console", 10 }, anchor = { left = 0.0, top = 0.0, right = 0.0, bottom = 0.0 }, hasHorzScroll = true, hasVertScroll = true, multiLine = true;
81 bool OnFileModified(FileChange fileChange, char * param)
87 bool NotifyModified(EditBox editBox)
89 modifiedDocument = true;
96 if(app.paramLocation[0])
97 LoadFile(app.paramLocation);
101 bool LoadFile(char * filePath)
104 f = FileOpen(filePath, read);
115 bool OnFileModified(FileChange fileChange, char * param)
122 class eNotepad : GuiApplication
124 char paramLocation[MAX_LOCATION];
130 strcpy(paramLocation, argv[1]); // how to check if the path is valid?
132 paramLocation[0] = '\0';
134 appWindow = eNodepadWindow { };