Page MenuHomePhabricator (Chris)

LoadDialog.as
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

LoadDialog.as

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);
}
};

File Metadata

Mime Type
text/x-java
Expires
Sun, Nov 15, 1:04 PM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
152356
Default Alt Text
LoadDialog.as (1 KB)

Event Timeline