mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.3.4.1'
This commit is contained in:
@@ -32,13 +32,14 @@ public interface Gfui_kit extends GfoInvkAble {
|
||||
int Ask_yes_no_cancel(String grp_key, String msg_key, String fmt, Object... args);
|
||||
GfuiInvkCmd New_cmd_sync(GfoInvkAble invk);
|
||||
GfuiInvkCmd New_cmd_async(GfoInvkAble invk);
|
||||
GfuiWin New_win_app(String key, KeyVal... args);
|
||||
GfuiWin New_win_utl(String key, GfuiWin owner, KeyVal... args);
|
||||
Gfui_html New_html(String key, GfuiElem owner, KeyVal... args);
|
||||
Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiTextBox New_text_box(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiBtn New_btn(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiLbl New_lbl(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiWin New_win_app(String key, Keyval... args);
|
||||
GfuiWin New_win_utl(String key, GfuiWin owner, Keyval... args);
|
||||
Gfui_html New_html(String key, GfuiElem owner, Keyval... args);
|
||||
Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiTextBox New_text_box(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiLbl New_lbl(String key, GfuiElem owner, Keyval... args);
|
||||
Gfui_dlg_file New_dlg_file(byte type, String msg);
|
||||
Gfui_dlg_msg New_dlg_msg(String msg);
|
||||
ImageAdp New_img_load(Io_url path);
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
private KeyValHash ctor_args = KeyValHash.new_();
|
||||
private Keyval_hash ctor_args = new Keyval_hash();
|
||||
public abstract byte Tid();
|
||||
public abstract String Key();
|
||||
public abstract GxwElemFactory_base Factory();
|
||||
@@ -36,43 +36,48 @@ public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
public void Btn_img_(GfuiBtn btn, IconAdp v) {}
|
||||
public GfuiInvkCmd New_cmd_sync(GfoInvkAble invk) {return new Gfui_kit_cmd_sync(invk);}
|
||||
public GfuiInvkCmd New_cmd_async(GfoInvkAble invk) {return new Gfui_kit_cmd_async(invk);}
|
||||
public GfuiWin New_win_app(String key, KeyVal... args) {
|
||||
public GfuiWin New_win_app(String key, Keyval... args) {
|
||||
GfuiWin rv = GfuiWin_.kit_(this, key, this.Factory().win_app_(), ctor_args);
|
||||
main_win = rv;
|
||||
return rv;
|
||||
}
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, KeyVal... args) {return GfuiWin_.kit_(this, key, this.Factory().win_tool_(ctor_args), ctor_args);}
|
||||
@gplx.Virtual public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, Keyval... args) {return GfuiWin_.kit_(this, key, this.Factory().win_tool_(ctor_args), ctor_args);}
|
||||
@gplx.Virtual public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
Gfui_html rv = Gfui_html.kit_(this, key, this.New_html_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, KeyVal... args) {
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, Keyval... args) {
|
||||
Gfui_tab_mgr rv = Gfui_tab_mgr.kit_(this, key, this.New_tab_mgr_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public Gfui_tab_itm New_tab_itm(String key, Gfui_tab_mgr owner, KeyVal... args) {
|
||||
public Gfui_tab_itm New_tab_itm(String key, Gfui_tab_mgr owner, Keyval... args) {
|
||||
Gfui_tab_itm rv = Gfui_tab_itm.kit_(this, key, this.New_tab_itm_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiTextBox rv = GfuiTextBox_.kit_(this, key, this.Factory().text_fld_(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiBtn New_btn(String key, GfuiElem owner, KeyVal... args) {
|
||||
@gplx.Virtual public GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiBtn rv = GfuiBtn_.kit_(this, key, New_btn_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiLbl New_lbl(String key, GfuiElem owner, KeyVal... args) {
|
||||
@gplx.Virtual public GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiComboBox rv = GfuiComboBox.kit_(this, key, New_combo_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiLbl New_lbl(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiLbl rv = GfuiLbl_.kit_(this, key, New_btn_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiStatusBox New_status_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
@gplx.Virtual public GfuiStatusBox New_status_box(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiStatusBox rv = GfuiStatusBox_.kit_(this, key, this.Factory().text_memo_());
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
@@ -82,6 +87,7 @@ public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
protected abstract Gxw_tab_mgr New_tab_mgr_impl();
|
||||
protected abstract Gxw_tab_itm New_tab_itm_impl();
|
||||
protected abstract GxwElem New_btn_impl();
|
||||
protected abstract GxwElem New_combo_impl();
|
||||
@gplx.Virtual public Gfui_dlg_file New_dlg_file(byte type, String msg) {return Gfui_dlg_file_.Noop;}
|
||||
@gplx.Virtual public Gfui_dlg_msg New_dlg_msg(String msg) {return Gfui_dlg_msg_.Noop;}
|
||||
@gplx.Virtual public Gfui_mnu_grp New_mnu_popup(String key, GfuiElem owner) {return Gfui_mnu_grp_.Noop;}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Mem_kit extends Gfui_kit_base {
|
||||
@Override public String Key() {return "mem";}
|
||||
@Override public GxwElemFactory_base Factory() {return factory;} private GxwElemFactory_cls_mock factory = new GxwElemFactory_cls_mock();
|
||||
public void New_html_impl_prototype_(Gxw_html v) {html_impl_prototype = v;} private Gxw_html html_impl_prototype;
|
||||
@Override public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
|
||||
@Override public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
if (html_impl_prototype == null)
|
||||
return super.New_html(key, owner, args);
|
||||
else {
|
||||
@@ -33,6 +33,7 @@ public class Mem_kit extends Gfui_kit_base {
|
||||
@Override protected Gxw_tab_mgr New_tab_mgr_impl() {return new Mem_tab_mgr();}
|
||||
@Override protected Gxw_tab_itm New_tab_itm_impl() {return new Mem_tab_itm();}
|
||||
@Override protected GxwElem New_btn_impl() {return factory.control_();}
|
||||
@Override protected GxwElem New_combo_impl() {return factory.comboBox_();}
|
||||
@Override public ImageAdp New_img_load(Io_url url) {return ImageAdp_null.Instance;}
|
||||
public static final Mem_kit Instance = new Mem_kit(); Mem_kit() {}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,6 @@ public class Swing_kit extends Gfui_kit_base {
|
||||
@Override protected Gxw_tab_mgr New_tab_mgr_impl() {return new Mem_tab_mgr();}
|
||||
@Override protected Gxw_tab_itm New_tab_itm_impl() {return new Mem_tab_itm();}
|
||||
@Override protected GxwElem New_btn_impl() {return factory.control_();}
|
||||
@Override protected GxwElem New_combo_impl() {return factory.control_();}
|
||||
public static final Swing_kit Instance = new Swing_kit(); Swing_kit() {}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.omg.PortableServer.THREAD_POLICY_ID;
|
||||
|
||||
import gplx.core.threads.*;
|
||||
public class Swt_kit implements Gfui_kit {
|
||||
private final KeyValHash ctor_args = KeyValHash.new_(); private final KeyValHash ctor_args_null = KeyValHash.new_();
|
||||
private final Keyval_hash ctor_args = new Keyval_hash(); private final Keyval_hash ctor_args_null = new Keyval_hash();
|
||||
private final Hash_adp kit_args = Hash_adp_.new_(); private Swt_msg_wkr_stop msg_wkr_stop;
|
||||
private Gfo_usr_dlg gui_wtr; private String xul_runner_path = null;
|
||||
private final Bry_fmtr ask_fmtr = Bry_fmtr.new_().Fail_when_invalid_escapes_(false); private final Bry_bfr ask_bfr = Bry_bfr.new_();
|
||||
@@ -80,7 +80,14 @@ public class Swt_kit implements Gfui_kit {
|
||||
shell.open();
|
||||
Cursor cursor = new Cursor(display, SWT.CURSOR_ARROW);
|
||||
shell.setCursor(cursor); // set cursor to hand else cursor defaults to Hourglass until mouse is moved; DATE: 2014-01-31
|
||||
boolean first = true;
|
||||
while (!shell.isDisposed()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
// shell.setMinimized(true);
|
||||
shell.setActive();
|
||||
shell.forceFocus();
|
||||
}
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
@@ -98,9 +105,9 @@ public class Swt_kit implements Gfui_kit {
|
||||
return;
|
||||
}
|
||||
// add kv to widget_cfg_hash; new controls will get properties from cfg_hash
|
||||
KeyValHash widget_cfg_hash = (KeyValHash)kit_args.Get_by(type);
|
||||
Keyval_hash widget_cfg_hash = (Keyval_hash)kit_args.Get_by(type);
|
||||
if (widget_cfg_hash == null) {
|
||||
widget_cfg_hash = KeyValHash.new_();
|
||||
widget_cfg_hash = new Keyval_hash();
|
||||
kit_args.Add(type, widget_cfg_hash);
|
||||
}
|
||||
widget_cfg_hash.Add_if_dupe_use_nth(key, val);
|
||||
@@ -126,31 +133,31 @@ public class Swt_kit implements Gfui_kit {
|
||||
}
|
||||
public GfuiInvkCmd New_cmd_sync (GfoInvkAble invk) {return new Swt_gui_cmd(this, gui_wtr, display, invk, Bool_.N);}
|
||||
public GfuiInvkCmd New_cmd_async(GfoInvkAble invk) {return new Swt_gui_cmd(this, gui_wtr, display, invk, Bool_.Y);}
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, KeyVal... args) {
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, Keyval... args) {
|
||||
return GfuiWin_.kit_(this, key, new Swt_win(shell), ctor_args_null);
|
||||
}
|
||||
public GfuiWin New_win_app(String key, KeyVal... args) {
|
||||
public GfuiWin New_win_app(String key, Keyval... args) {
|
||||
Swt_win win = new Swt_win(display);
|
||||
this.shell = win.UnderShell();
|
||||
shell.setLayout(null);
|
||||
return GfuiWin_.kit_(this, key, win, ctor_args_null);
|
||||
}
|
||||
public GfuiBtn New_btn(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiBtn rv = GfuiBtn_.kit_(this, key, new Swt_btn_no_border(Swt_control_.cast_or_fail(owner), ctor_args), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public GfuiLbl New_lbl(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiLbl New_lbl(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiLbl rv = GfuiLbl_.kit_(this, key, new Swt_lbl(Swt_control_.cast_or_fail(owner), ctor_args), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
|
||||
public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
// check cfg for browser type
|
||||
KeyValHash html_cfg_args = (KeyValHash)kit_args.Get_by(Gfui_kit_.Cfg_HtmlBox);
|
||||
Keyval_hash html_cfg_args = (Keyval_hash)kit_args.Get_by(Gfui_kit_.Cfg_HtmlBox);
|
||||
if (html_cfg_args != null) {
|
||||
KeyVal browser_type = html_cfg_args.FetchOrNull(Cfg_Html_BrowserType);
|
||||
Keyval browser_type = html_cfg_args.Get_kvp_or_null(Cfg_Html_BrowserType);
|
||||
if (browser_type != null) ctor_args.Add(browser_type);
|
||||
}
|
||||
Swt_html swt_html = new Swt_html(this, Swt_control_.cast_or_fail(owner), ctor_args);
|
||||
@@ -160,7 +167,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
swt_html.Delete_elems_(owner, gfui_html);
|
||||
return gfui_html;
|
||||
}
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, KeyVal... args) {
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
Swt_tab_mgr rv_swt = new Swt_tab_mgr(this, Swt_control_.cast_or_fail(owner), ctor_args);
|
||||
Gfui_tab_mgr rv = Gfui_tab_mgr.kit_(this, key, rv_swt, ctor_args);
|
||||
@@ -168,19 +175,26 @@ public class Swt_kit implements Gfui_kit {
|
||||
rv_swt.EvMgr_(rv.EvMgr());
|
||||
return rv;
|
||||
}
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
int args_len = args.length;
|
||||
for (int i = 0; i < args_len; i++)
|
||||
ctor_args.Add(args[i]);
|
||||
boolean border_on = Bool_.cast(ctor_args.FetchValOr(GfuiTextBox.CFG_border_on_, true));
|
||||
boolean border_on = Bool_.cast(ctor_args.Get_val_or(GfuiTextBox.CFG_border_on_, true));
|
||||
GxwTextFld under = new Swt_text_w_border(Swt_control_.cast_or_fail(owner), New_color(border_on ? ColorAdp_.LightGray : ColorAdp_.White), ctor_args);
|
||||
GfuiTextBox rv = GfuiTextBox_.kit_(this, key, under, ctor_args);
|
||||
rv.Owner_(owner);
|
||||
ctor_args.Clear();
|
||||
return rv;
|
||||
}
|
||||
public GfuiStatusBox New_status_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args) {
|
||||
Swt_combo_ctrl rv_swt = new Swt_combo_ctrl(Swt_control_.cast_or_fail(owner), this.New_color(ColorAdp_.LightGray), ctor_args);
|
||||
GfuiComboBox rv = GfuiComboBox.kit_(this, key, rv_swt, ctor_args);
|
||||
rv.Owner_(owner);
|
||||
rv_swt.EvMgr_(rv.EvMgr());
|
||||
return rv;
|
||||
}
|
||||
public GfuiStatusBox New_status_box(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
GfuiStatusBox rv = GfuiStatusBox_.kit_(this, key, new Swt_text(Swt_control_.cast_or_fail(owner), ctor_args));
|
||||
rv.Owner_(owner);
|
||||
|
||||
Reference in New Issue
Block a user