mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Source: Restore broken commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.interfaces.*; import gplx.gfui.controls.elems.*;
|
||||
public class DataBndr_whenEvt_execCmd implements InjectAble, Gfo_invk, Gfo_evt_itm {
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
public DataBndr_whenEvt_execCmd WhenArg_(String v) {whenArg = v; return this;} private String whenArg = "v";
|
||||
public DataBndr_whenEvt_execCmd WhenEvt_(Gfo_evt_itm whenSrc, String whenEvt) {
|
||||
this.whenEvt = whenEvt;
|
||||
Gfo_evt_mgr_.Sub_same(whenSrc, whenEvt, this);
|
||||
return this;
|
||||
}
|
||||
public DataBndr_whenEvt_execCmd GetCmd_(Gfo_invk getInvk, String getCmd) {
|
||||
this.getInvk = getInvk;
|
||||
this.getCmd = getCmd;
|
||||
return this;
|
||||
} Gfo_invk getInvk; String getCmd;
|
||||
public void Inject(Object owner) {
|
||||
setInvk = (Gfo_invk)owner;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, whenEvt)) {
|
||||
Object evtVal = m.CastObjOr(whenArg, "");
|
||||
Object getVal = getInvk.Invk(GfsCtx.Instance, 0, getCmd, GfoMsg_.new_cast_(getCmd).Add("v", evtVal));
|
||||
GfoMsg setMsg = GfoMsg_.new_cast_(setCmd).Add("v", Object_.Xto_str_strict_or_empty(getVal));
|
||||
setInvk.Invk(GfsCtx.Instance, 0, setCmd, setMsg);
|
||||
return Gfo_invk_.Rv_handled;
|
||||
}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
String whenEvt, setCmd; Gfo_invk setInvk;
|
||||
public static DataBndr_whenEvt_execCmd text_() {
|
||||
DataBndr_whenEvt_execCmd rv = new DataBndr_whenEvt_execCmd();
|
||||
rv.setCmd = GfuiElemKeys.Text_set;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.envs.*; import gplx.gfui.controls.windows.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
public class GfuiBnd_box_status implements Gfo_invk, UsrMsgWkr {
|
||||
public GfuiElem Box() {return box;} GfuiElem box;
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
box.Invoke(Gfo_invk_cmd.New_by_val(this, WriteText_cmd, umsg.To_str()));
|
||||
}
|
||||
public void WriteText(String text) {
|
||||
GfuiElem lastFocus = GfuiFocusMgr.Instance.FocusedElem(); // HACK:WINFORMS:.Visible=true will automatically transfer focus to textBox; force Focus back to original
|
||||
box.Text_(text);
|
||||
GfuiWin ownerWin = box.OwnerWin();
|
||||
if (ownerWin != null && !ownerWin.Visible()) {
|
||||
ownerWin.Visible_set(true);
|
||||
ownerWin.Zorder_front();
|
||||
}
|
||||
timer.Enabled_off(); timer.Enabled_on(); // reset time
|
||||
GfuiEnv_.DoEvents(); // WORKAROUND:WIN32: needed, else text will not refresh (ex: splash screen); will cause other timers to fire! (ex: mediaPlaylistMgr)
|
||||
if (lastFocus != null) lastFocus.Focus();
|
||||
}
|
||||
public void HideWin() {
|
||||
if (box.OwnerWin() != null)
|
||||
box.OwnerWin().Visible_off_();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, WriteText_cmd)) WriteText(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, TimerTick_evt)) HideWin();
|
||||
return this;
|
||||
} static final String TimerTick_evt = "TimerTick", WriteText_cmd = "WriteText";
|
||||
TimerAdp timer;
|
||||
public static GfuiBnd_box_status new_(String key) {
|
||||
GfuiBnd_box_status rv = new GfuiBnd_box_status();
|
||||
GfuiTextBox txtBox = GfuiTextBox_.new_();
|
||||
txtBox.Key_of_GfuiElem_(key);
|
||||
txtBox.BackColor_(ColorAdp_.Black).ForeColor_(ColorAdp_.Green).TextAlignH_right_();
|
||||
rv.box = txtBox;
|
||||
rv.timer = TimerAdp.new_(rv, TimerTick_evt, 2000, false);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.lists.*;
|
||||
import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
public class GfuiCheckListBox extends GfuiElemBase {
|
||||
public void Items_reverse() {checkListBox.Items_reverse();}
|
||||
public void Items_count() {checkListBox.Items_count();}
|
||||
public void Items_setAt(int i, boolean v) {checkListBox.Items_setCheckedAt(i, v);}
|
||||
public void Items_setAll(boolean v) {checkListBox.Items_setAll(v);}
|
||||
public void Items_clear() {checkListBox.Items_clear();}
|
||||
public void Items_add(Object item, boolean v) {checkListBox.Items_add(item, v);}
|
||||
public List_adp Items_getAll() {return checkListBox.Items_getAll();}
|
||||
public List_adp Items_getChecked() {return checkListBox.Items_getChecked();}
|
||||
|
||||
GxwCheckListBox checkListBox;
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.checkListBox = (GxwCheckListBox)UnderElem();
|
||||
}
|
||||
public static GfuiCheckListBox new_() {
|
||||
GfuiCheckListBox rv = new GfuiCheckListBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
public class GfuiCheckListPanel extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
InitToggleWidget();
|
||||
InitReverseWidget();
|
||||
InitListBoxWidget();
|
||||
|
||||
this.Lyt_activate();
|
||||
this.Lyt().Bands_add(GftBand.new_().Cell_abs_(60));
|
||||
this.Lyt().Bands_add(GftBand.new_().Cell_abs_(70));
|
||||
this.Lyt().Bands_add(GftBand.fillAll_());
|
||||
}
|
||||
public void Items_clear() {listBox.Items_clear();}
|
||||
public void Items_add(Object item, boolean checkBoxState) {listBox.Items_add(item, checkBoxState);}
|
||||
public List_adp Items_getAll() {return listBox.Items_getAll();}
|
||||
public List_adp Items_getChecked() {return listBox.Items_getChecked();}
|
||||
public void SetAllCheckStates(boolean v) {
|
||||
listBox.Items_setAll(v);
|
||||
}
|
||||
void InitToggleWidget() {
|
||||
toggle = GfuiChkBox_.invk_("toggle", this, "&toggle", this, ToggleChecks_cmd); toggle.Size_(60, 20); toggle.AlignH_set(GfuiAlign_.Left);
|
||||
}
|
||||
void InitReverseWidget() {
|
||||
GfuiBtn_.invk_("reverse", this, this, ReverseChks_cmd).Size_(70, 20).Text_("&reverse");
|
||||
}
|
||||
void InitListBoxWidget() {
|
||||
listBox.Owner_(this, "listBox");
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, ToggleChecks_cmd)) SetAllCheckStates(toggle.Val());
|
||||
else if (ctx.Match(k, ReverseChks_cmd)) listBox.Items_reverse();
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String ToggleChecks_cmd = "ToggleChecks", ReverseChks_cmd = "ReverseChks";
|
||||
GfuiChkBox toggle;
|
||||
GfuiCheckListBox listBox = GfuiCheckListBox.new_();
|
||||
public static GfuiCheckListPanel new_() {
|
||||
GfuiCheckListPanel rv = new GfuiCheckListPanel();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
39
150_gfui/src/gplx/gfui/controls/customs/GfuiFormPanel.java
Normal file
39
150_gfui/src/gplx/gfui/controls/customs/GfuiFormPanel.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.windows.*; import gplx.gfui.controls.elems.*;
|
||||
public class GfuiFormPanel extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Width_(60); // default to 60; do not force callers to always set width
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
|
||||
GfoFactory_gfui.Btn_MoveBox(this, ownerForm);
|
||||
GfoFactory_gfui.Btn_MinWin2(this);
|
||||
GfoFactory_gfui.Btn_QuitWin3(this);
|
||||
|
||||
this.Lyt_activate();
|
||||
this.Lyt().Bands_add(GftBand.new_().Cells_num_(3));
|
||||
}
|
||||
public static GfuiFormPanel new_(GfuiWin form) {
|
||||
GfuiFormPanel rv = new GfuiFormPanel();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_().Add(GfuiElem_.InitKey_ownerWin, form));
|
||||
rv.Owner_(form, "formPanel");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
53
150_gfui/src/gplx/gfui/controls/customs/GfuiIoDialogUtl.java
Normal file
53
150_gfui/src/gplx/gfui/controls/customs/GfuiIoDialogUtl.java
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import java.io.File;
|
||||
import java.awt.FileDialog;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
|
||||
public class GfuiIoDialogUtl {
|
||||
public static Io_url SelectDir() {return SelectDir(Io_url_.Empty);}
|
||||
public static Io_url SelectDir(Io_url startingDir) {
|
||||
FileDialog openFileDialog = NewOpenFileDialog(startingDir);
|
||||
// openFileDialog.FileName = @"press enter to select this folder";
|
||||
openFileDialog.setVisible(true);
|
||||
String selectedDir = openFileDialog.getDirectory();
|
||||
if (selectedDir == null) return Io_url_.Empty; // nothing selected
|
||||
Io_url selected = Io_url_.new_any_(selectedDir);
|
||||
Io_url selectedFil = selected.GenSubFil(openFileDialog.getFile());
|
||||
return selectedFil.OwnerDir();
|
||||
}
|
||||
public static Io_url SelectFile() {return SelectFile(Io_url_.Empty);}
|
||||
public static Io_url SelectFile(Io_url startingDir) {
|
||||
FileDialog openFileDialog = NewOpenFileDialog(startingDir);
|
||||
openFileDialog.setVisible(true);
|
||||
String selectedDir = openFileDialog.getDirectory();
|
||||
if (selectedDir == null) return Io_url_.Empty; // nothing selected
|
||||
Io_url selected = Io_url_.new_any_(selectedDir);
|
||||
Io_url selectedFil = selected.GenSubFil(openFileDialog.getFile());
|
||||
return selectedFil;
|
||||
}
|
||||
static FileDialog NewOpenFileDialog(Io_url startingDir) {
|
||||
//WORKAROUND (Windows.Forms): InitialDirectory only works for new instances; http://groups.google.com/groups?hl=en&lr=&threadm=ubk6dEUYDHA.536%40TK2MSFTNGP10.phx.gbl&rnum=30&prev=/groups%3Fq%3Ddotnet%2BInitialDirectory%26hl%3Den%26btnG%3DGoogle%2BSearch
|
||||
FileDialog openFileDialog = new FileDialog(new JFrame());
|
||||
if (!startingDir.EqNull())
|
||||
openFileDialog.setDirectory(startingDir.Xto_api());
|
||||
return openFileDialog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
public abstract class GfuiIoUrlSelectBox extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
label = GfuiLbl_.sub_("label", this);
|
||||
pathBox.Owner_(this, "pathBox");
|
||||
GfuiBtn_.invk_("selectPath", this, this, SelectAction_cmd).Text_("...");
|
||||
|
||||
this.Lyt_activate();
|
||||
this.Lyt().Bands_add(GftBand.new_().Cell_abs_(60).Cell_pct_(100).Cell_abs_(30));
|
||||
}
|
||||
public static final String PathSelected_evt = "PathSelected_evt";
|
||||
public GfuiLbl Label() {return label;} GfuiLbl label;
|
||||
public Io_url Url() {return Io_url_.new_any_(pathBox.TextMgr().Val());}
|
||||
public Io_url StartingFolder() {return startingFolder;}
|
||||
public void StartingFolder_set(Io_url v) {this.startingFolder = v;} Io_url startingFolder = Io_url_.Empty;
|
||||
@Override public void Focus() {pathBox.Focus();}
|
||||
|
||||
void SelectAction() {
|
||||
Io_url selectedPath = SelectAction_hook(this.startingFolder);
|
||||
if (selectedPath.EqNull()) return;
|
||||
pathBox.Text_(selectedPath.Raw());
|
||||
Gfo_evt_mgr_.Pub(this, PathSelected_evt);
|
||||
}
|
||||
protected abstract Io_url SelectAction_hook(Io_url startingFolder);
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, SelectAction_cmd)) SelectAction();
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String SelectAction_cmd = "SelectAction";
|
||||
|
||||
GfuiComboBox pathBox = GfuiComboBox.new_();
|
||||
}
|
||||
class IoFileSelector extends GfuiIoUrlSelectBox { @Override protected Io_url SelectAction_hook(Io_url startingFolder) {
|
||||
return GfuiIoDialogUtl.SelectFile(startingFolder);
|
||||
}
|
||||
public static IoFileSelector new_() {
|
||||
IoFileSelector rv = new IoFileSelector();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
return rv;
|
||||
} IoFileSelector() {}
|
||||
}
|
||||
class IoFolderSelector extends GfuiIoUrlSelectBox { @Override protected Io_url SelectAction_hook(Io_url startingFolder) {
|
||||
Io_url url = GfuiIoDialogUtl.SelectDir(startingFolder);
|
||||
this.StartingFolder_set(url);
|
||||
return url;
|
||||
}
|
||||
public static IoFolderSelector new_() {
|
||||
IoFolderSelector rv = new IoFolderSelector();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
return rv;
|
||||
} IoFolderSelector() {}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public class GfuiIoUrlSelectBox_ {
|
||||
public static GfuiIoUrlSelectBox dir_() {return IoFolderSelector.new_();}
|
||||
public static GfuiIoUrlSelectBox fil_() {return IoFileSelector.new_();}
|
||||
}
|
||||
82
150_gfui/src/gplx/gfui/controls/customs/GfuiMoveElemBnd.java
Normal file
82
150_gfui/src/gplx/gfui/controls/customs/GfuiMoveElemBnd.java
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.core.interfaces.*;
|
||||
public class GfuiMoveElemBnd implements IptBnd, Gfo_invk, InjectAble {
|
||||
public String Key() {return "gplx.gfui.moveWidget";}
|
||||
public List_adp Ipts() {return args;} List_adp args = List_adp_.New();
|
||||
public IptEventType EventTypes() {return IptEventType_.add_(IptEventType_.KeyDown, IptEventType_.MouseDown, IptEventType_.MouseMove, IptEventType_.MouseUp);}
|
||||
public void Exec(IptEventData iptData) {
|
||||
int val = iptData.EventType().Val();
|
||||
if (val == IptEventType_.KeyDown.Val()) ExecKeyDown(iptData);
|
||||
else if (val == IptEventType_.MouseDown.Val()) ExecMouseDown(iptData);
|
||||
else if (val == IptEventType_.MouseUp.Val()) ExecMouseUp(iptData);
|
||||
else if (val == IptEventType_.MouseMove.Val()) ExecMouseMove(iptData);
|
||||
}
|
||||
public GfuiElem TargetElem() {return targetElem;} public void TargetElem_set(GfuiElem v) {this.targetElem = v;} GfuiElem targetElem;
|
||||
public static final String target_idk = "target";
|
||||
@gplx.Virtual public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, target_idk)) return targetElem;
|
||||
else if (ctx.Match(k, "key")) return key;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
|
||||
public String Key_of_GfuiElem() {return keyIdf;} public void Key_of_GfuiElem_(String val) {keyIdf = val;} private String keyIdf = "moveElemBtnBnd";
|
||||
public void Inject(Object owner) {
|
||||
GfuiElem ownerElem = (GfuiElem)owner;
|
||||
ownerElem.IptBnds().Add(this);
|
||||
ownerElem.IptBnds().EventsToFwd_set(IptEventType_.None); // NOTE: suppress bubbling else ctrl+right will cause mediaPlayer to jump forward
|
||||
}
|
||||
|
||||
void ExecMouseDown(IptEventData msg) {
|
||||
moving = true;
|
||||
anchor = msg.MousePos();
|
||||
}
|
||||
void ExecMouseMove(IptEventData msg) {
|
||||
if (!moving) return;
|
||||
targetElem.Pos_(msg.MousePos().Op_subtract(anchor).Op_add(targetElem.Pos()));
|
||||
}
|
||||
void ExecMouseUp(IptEventData msg) {
|
||||
moving = false;
|
||||
}
|
||||
void ExecKeyDown(IptEventData msg) {
|
||||
PointAdp current = targetElem.Pos();
|
||||
PointAdp offset = PointAdp_.cast(hash.Get_by(msg.EventArg()));
|
||||
targetElem.Pos_(current.Op_add(offset));
|
||||
}
|
||||
@gplx.Internal protected void Key_set(String key) {this.key = key;} private String key;
|
||||
public Object Srl(GfoMsg owner) {return IptBnd_.Srl(owner, this);}
|
||||
|
||||
boolean moving = false;
|
||||
PointAdp anchor = PointAdp_.Zero; Hash_adp hash = Hash_adp_.New();
|
||||
public static GfuiMoveElemBnd new_() {return new GfuiMoveElemBnd();}
|
||||
GfuiMoveElemBnd() {
|
||||
args.Add_many(IptMouseBtn_.Left, IptMouseMove.AnyDirection);
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Up), PointAdp_.new_(0, -10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Down), PointAdp_.new_(0, 10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Left), PointAdp_.new_(-10, 0));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Right), PointAdp_.new_(10, 0));
|
||||
}
|
||||
}
|
||||
class IptBndArgsBldr {
|
||||
public static void AddWithData(List_adp list, Hash_adp hash, IptArg arg, Object data) {
|
||||
list.Add(arg);
|
||||
hash.Add(arg, data);
|
||||
}
|
||||
}
|
||||
88
150_gfui/src/gplx/gfui/controls/customs/GfuiMoveElemBtn.java
Normal file
88
150_gfui/src/gplx/gfui/controls/customs/GfuiMoveElemBtn.java
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.windows.*;
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Text_("*");
|
||||
this.TipText_("move/resize");
|
||||
|
||||
this.IptBnds().EventsToFwd_set(IptEventType_.None);
|
||||
this.IptBnds().Add(moveBinding);
|
||||
this.IptBnds().Add(GfuiResizeFormBnd.new_());
|
||||
}
|
||||
public void TargetElem_set(GfuiElem v) {moveBinding.TargetElem_set(v);}
|
||||
|
||||
final GfuiMoveElemBnd moveBinding = GfuiMoveElemBnd.new_();
|
||||
public static GfuiMoveElemBtn new_() {
|
||||
GfuiMoveElemBtn rv = new GfuiMoveElemBtn();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
class GfuiResizeFormBnd implements IptBnd {
|
||||
public String Key() {return "gplx.gfui.resizeForm";}
|
||||
public List_adp Ipts() {return args;} List_adp args = List_adp_.New();
|
||||
public IptEventType EventTypes() {return IptEventType_.KeyDown.Add(IptEventType_.MouseDown).Add(IptEventType_.MouseUp).Add(IptEventType_.MouseMove);}
|
||||
public void Exec(IptEventData iptData) {
|
||||
int val = iptData.EventType().Val();
|
||||
if (val == IptEventType_.KeyDown.Val()) ExecKeyDown(iptData);
|
||||
else if (val == IptEventType_.MouseDown.Val()) ExecMouseDown(iptData);
|
||||
else if (val == IptEventType_.MouseUp.Val()) ExecMouseUp(iptData);
|
||||
else if (val == IptEventType_.MouseMove.Val()) ExecMouseMove(iptData);
|
||||
}
|
||||
void ExecMouseDown(IptEventData iptData) {
|
||||
active = true;
|
||||
lastPos = iptData.MousePos();
|
||||
}
|
||||
void ExecMouseMove(IptEventData iptData) {
|
||||
if (!active) return;
|
||||
|
||||
PointAdp delta = iptData.MousePos().Op_subtract(lastPos);
|
||||
if (delta.Eq(PointAdp_.Zero)) return;
|
||||
ResizeForm(iptData.Sender(), XtoSize(delta));
|
||||
}
|
||||
void ExecMouseUp(IptEventData iptData) {
|
||||
active = false;
|
||||
}
|
||||
void ExecKeyDown(IptEventData iptData) {
|
||||
SizeAdp deltaSize = (SizeAdp)hash.Get_by(iptData.EventArg());
|
||||
ResizeForm(iptData.Sender(), deltaSize);
|
||||
}
|
||||
void ResizeForm(GfuiElem elem, SizeAdp deltaSize) {
|
||||
GfuiWin form = elem.OwnerWin();
|
||||
SizeAdp newSize = Op_add(form.Size(), deltaSize);
|
||||
form.Size_(newSize);
|
||||
GftGrid.LytExecRecur(form);
|
||||
form.Redraw(); // must redraw, else artifacts will remain; ex: grid may leave random lines
|
||||
}
|
||||
static SizeAdp XtoSize(PointAdp point) {return SizeAdp_.new_(point.X(), point.Y());}
|
||||
static SizeAdp Op_add(SizeAdp lhs, SizeAdp rhs) {return SizeAdp_.new_(lhs.Width() + rhs.Width(), lhs.Height() + rhs.Height());}
|
||||
public Object Srl(GfoMsg owner) {return IptBnd_.Srl(owner, this);}
|
||||
|
||||
boolean active = false; PointAdp lastPos = PointAdp_.Zero; Hash_adp hash = Hash_adp_.New();
|
||||
public static GfuiResizeFormBnd new_() {return new GfuiResizeFormBnd();}
|
||||
GfuiResizeFormBnd() {
|
||||
args.Add_many(IptMouseBtn_.Right, IptMouseMove.AnyDirection);
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Up), SizeAdp_.new_(0, -10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Down), SizeAdp_.new_(0, 10));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Left), SizeAdp_.new_(-10, 0));
|
||||
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Right), SizeAdp_.new_(10, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import org.junit.*; import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.customs.*;
|
||||
public class GfuiMoveElemBtn_tst {
|
||||
@Before public void setup() {
|
||||
form = GfuiWin_.app_("form"); form.Size_(100, 100);
|
||||
moveBtn = GfuiBtn_.new_("moveBtn");
|
||||
GfuiMoveElemBnd bnd = GfuiMoveElemBnd.new_(); bnd.TargetElem_set(form);
|
||||
moveBtn.IptBnds().Add(bnd);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
Tfds.Eq(form.X(), 0);
|
||||
IptEventMgr.ExecKeyDown(moveBtn, IptEvtDataKey.test_(MoveRightArg()));
|
||||
Tfds.Eq(form.X(), 10);
|
||||
}
|
||||
|
||||
IptKey MoveRightArg() {return IptKey_.Ctrl.Add(IptKey_.Right);}
|
||||
GfuiWin form; GfuiBtn moveBtn;
|
||||
}
|
||||
49
150_gfui/src/gplx/gfui/controls/customs/GfuiStatusBar.java
Normal file
49
150_gfui/src/gplx/gfui/controls/customs/GfuiStatusBar.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.elems.*;
|
||||
public class GfuiStatusBar extends GfuiElemBase {
|
||||
public GfuiStatusBox Box() {return statusBox;} GfuiStatusBox statusBox;
|
||||
public GfuiMoveElemBtn MoveButton() {return moveBtn;} GfuiMoveElemBtn moveBtn;
|
||||
void StatusBar_Focus() {
|
||||
statusBox.Focus_able_(true);
|
||||
statusBox.Visible_set(true);
|
||||
statusBox.Focus();
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, StatusBarFocus_cmd)) StatusBar_Focus();
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String StatusBarFocus_cmd = "StatusBarFocus";
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
moveBtn = GfuiMoveElemBtn.new_();
|
||||
statusBox = GfuiStatusBox_.new_("statusBox");
|
||||
statusBox.Owner_(this).Border_off_().Visible_on_();
|
||||
moveBtn.Owner_(this, "moveBox");
|
||||
GfoFactory_gfui.Btn_MinWin2(this);
|
||||
GfoFactory_gfui.Btn_QuitWin3(this);
|
||||
this.Lyt_activate();
|
||||
this.Lyt().Bands_add(GftBand.new_().Cell_pct_(100).Cell_abs_(20).Cell_abs_(20).Cell_abs_(20));
|
||||
}
|
||||
public static GfuiStatusBar new_() {
|
||||
GfuiStatusBar rv = new GfuiStatusBar();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.interfaces.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*;
|
||||
public class GfuiStatusBarBnd implements InjectAble {
|
||||
public GfuiStatusBar Bar() {return statusBar;} GfuiStatusBar statusBar = GfuiStatusBar.new_();
|
||||
public void Inject(Object owner) {
|
||||
GfuiWin form = GfuiWin_.as_(owner); if (form == null) throw Err_.new_type_mismatch(GfuiWin.class, owner);
|
||||
statusBar.Owner_(form, "statusBar");
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, form, statusBar, GfuiStatusBar.StatusBarFocus_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.T));
|
||||
statusBar.MoveButton().TargetElem_set(form);
|
||||
}
|
||||
public static GfuiStatusBarBnd new_() {return new GfuiStatusBarBnd();} GfuiStatusBarBnd() {}
|
||||
}
|
||||
94
150_gfui/src/gplx/gfui/controls/customs/GfuiStatusBox.java
Normal file
94
150_gfui/src/gplx/gfui/controls/customs/GfuiStatusBox.java
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.envs.*; import gplx.gfui.kits.core.*; import gplx.gfui.envs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.standards.*;
|
||||
public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public GfuiStatusBox Active_(boolean v) {active = v; return this;} private boolean active = true;
|
||||
public GfuiStatusBox VisibilityDuration_(int v) {timer.Interval_(v); visibilityDuration = v; return this;} int visibilityDuration;
|
||||
@Override public void Opened_cbk() {
|
||||
super.Opened_cbk();
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Note, this);
|
||||
}
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
if ( !active
|
||||
|| !this.OwnerElem().Visible() // WORKAROUND.WINFORMS: else application hangs on Invoke
|
||||
|| !this.Opened_done()
|
||||
) return;
|
||||
this.CreateControlIfNeeded(); // WORKAROUND.WINFORMS: else will sometimes throw: Cannot call Invoke or InvokeAsync on a control until the window handle has been created
|
||||
this.VisibilityDuration_(umsg.VisibilityDuration());
|
||||
String text = String_.Replace(umsg.To_str(), Op_sys.Cur().Nl_str(), " "); // replace NewLine with " " since TextBox cannot show NewLine
|
||||
Invoke(Gfo_invk_cmd.New_by_val(this, Invk_WriteText, text));
|
||||
}
|
||||
public void WriteText(String text) {
|
||||
if (!this.Visible()) {
|
||||
this.Visible_set(true);
|
||||
this.Zorder_front();
|
||||
}
|
||||
this.Text_(text);
|
||||
timer.Enabled_off().Enabled_on(); // Enabled_off().Enabled_on() resets timer; timer can be at second 1 of 3, and this will reset back to timer 0
|
||||
GfuiEnv_.DoEvents(); // WORKAROUND.WINFORMS: needed, else text will not refresh (ex: splash screen); NOTE!!: will cause other timers to fire! (ex: mediaPlaylistMgr)
|
||||
}
|
||||
@Override public void Focus() {
|
||||
this.Focus_able_(true);
|
||||
super.Focus();
|
||||
this.Focus_able_(false);
|
||||
}
|
||||
@Override public boolean DisposeCbk() {
|
||||
super.DisposeCbk();
|
||||
timer.Rls();
|
||||
UsrDlg_.Instance.RegOff(UsrMsgWkr_.Type_Note, this);
|
||||
if (timerCmd != null) timerCmd.Rls();
|
||||
return true;
|
||||
}
|
||||
void HideWindow() {
|
||||
timer.Enabled_off();
|
||||
Text_("");
|
||||
this.Visible_set(false);
|
||||
this.Zorder_back();
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_HideWindow)) HideWindow();
|
||||
else if (ctx.Match(k, Invk_Text_empty)) {timer.Enabled_off(); Text_(GfuiTextBox_.NewLine + Text());}
|
||||
else if (ctx.Match(k, Invk_WriteText)) WriteText(m.ReadStr("v"));
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} static final String Invk_HideWindow = "HideWindow", Invk_WriteText = "WriteText", Invk_Text_empty = "Text_empty";
|
||||
TimerAdp timer;
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
this.Visible_set(false);
|
||||
timer = TimerAdp.new_(this, Invk_HideWindow, 2000, false);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
this.Visible_set(true);
|
||||
timerCmd = kit.New_cmd_sync(this);
|
||||
timer = TimerAdp.new_(timerCmd, GfuiInvkCmd_.Invk_sync, 2000, false);
|
||||
} GfuiInvkCmd timerCmd;
|
||||
public void ctor_kit_GfuiElemBase_drd(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
this.Visible_set(true);
|
||||
timerCmd = kit.New_cmd_sync(this);
|
||||
// timer = TimerAdp.new_(timerCmd, GfuiInvkCmd_.Invk_sync, 2000, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.controls.windows.*;
|
||||
public class GfuiStatusBoxBnd implements Gfo_invk {
|
||||
public GfuiStatusBox Box() {return statusBox;} GfuiStatusBox statusBox = GfuiStatusBox_.new_("statusBox");
|
||||
void ShowTime() {
|
||||
statusBox.ExecUsrMsg(UsrMsgWkr_.Type_Note, UsrMsg.new_(Datetime_now.Get().XtoStr_gplx_long()));
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_ShowTime)) ShowTime();
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} public static final String Invk_ShowTime = "ShowTime";
|
||||
public static GfuiStatusBoxBnd gft_(GfuiWin owner) {
|
||||
GfuiStatusBoxBnd rv = new GfuiStatusBoxBnd();
|
||||
rv.ctor_GfuiStatusBoxBnd(owner);
|
||||
return rv;
|
||||
}
|
||||
void ctor_GfuiStatusBoxBnd(GfuiWin win) {
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, win, this, GfuiStatusBoxBnd.Invk_ShowTime, IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift, IptKey_.T));
|
||||
statusBox.Owner_(win).Visible_off_().BackColor_(ColorAdp_.Black).TextAlignH_right_().ForeColor_(ColorAdp_.Green);
|
||||
win.Lyt().SubLyts().Add(GftGrid.new_().Bands_dir_(DirInt.Bwd).Bands_add(GftBand.new_().Cells_num_(1).Len1_abs_(13)));
|
||||
}
|
||||
}
|
||||
32
150_gfui/src/gplx/gfui/controls/customs/GfuiStatusBox_.java
Normal file
32
150_gfui/src/gplx/gfui/controls/customs/GfuiStatusBox_.java
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
public class GfuiStatusBox_ {
|
||||
public static GfuiStatusBox new_(String key) {
|
||||
GfuiStatusBox rv = new GfuiStatusBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
rv.Key_of_GfuiElem_(key);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiStatusBox kit_(Gfui_kit kit, String key, GxwElem underElem) {
|
||||
GfuiStatusBox rv = new GfuiStatusBox();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, underElem, GfuiElem_.init_focusAble_false_());
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user