Open source Star Ruler 2 source code!

This commit is contained in:
Lucas de Vries
2018-07-17 14:15:37 +02:00
commit cc307720ff
4342 changed files with 2365070 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
import dialogs.Dialog;
import elements.GuiFileChooser;
class LoadDialog : Dialog {
GuiFileChooser@ chooser;
GuiButton@ confirm;
LoadDialog(IGuiElement@ bind, const string& folder) {
super(bind);
addTitle(locale::LOAD);
@window.callback = this;
@chooser = GuiFileChooser(window, Alignment(Left+12, Top+38, Right-12, Bottom-12), folder, "", CFM_Single);
@confirm = GuiButton(window, Alignment(Left+0.8f+4, Bottom-42, Right-12, Bottom-12), locale::LOAD);
confirm.disabled = true;
height = 500;
addDialog(this);
}
void focus() {
Dialog::focus();
}
string get_path() {
return chooser.getSelectedPath(true);
}
//Event callbacks
void clickConfirm() {
}
bool onGuiEvent(const GuiEvent& event) {
if((event.caller is chooser && event.type == GUI_Confirmed)
|| (event.caller is confirm && event.type == GUI_Clicked)) {
if(chooser.selectedCount != 0)
clickConfirm();
close();
return true;
}
if(event.caller is chooser && event.type == GUI_Changed)
confirm.disabled = chooser.selectedCount == 0;
return Dialog::onGuiEvent(event);
}
};