1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Refactor: @Test whitespace clean-up and other corelib changes

This commit is contained in:
gnosygnu
2021-11-28 08:16:54 -05:00
parent 2a4abd8f75
commit b0082fd231
1059 changed files with 23816 additions and 21909 deletions

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="/100_core"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/110_gfml"/>
<classpathentry kind="lib" path="lib/swt.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,38 +1,38 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.draws.*; import gplx.gfui.imgs.*;
public class GfuiBorderMgr_tst {
@Before public void setup() {
borderMgr = GfuiBorderMgr.new_();
}
@Test public void NullToEdge() { // all null -> one edge
@Test public void NullToEdge() { // all null -> one edge
tst_Eq(borderMgr, null, null, null, null, null);
borderMgr.Top_(red);
tst_Eq(borderMgr, null, red, null, null, null);
}
@Test public void EdgeToAll() { // one edge -> all edge
@Test public void EdgeToAll() { // one edge -> all edge
borderMgr.Top_(red);
tst_Eq(borderMgr, null, red, null, null, null);
borderMgr.All_(black);
tst_Eq(borderMgr, black, null, null, null, null);
}
@Test public void AllToEdge() { // all edge -> one new; three old
@Test public void AllToEdge() { // all edge -> one new; three old
borderMgr.All_(red);
tst_Eq(borderMgr, red, null, null, null, null);

View File

@@ -1,21 +1,39 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
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.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.customs; import gplx.GfoMsg;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.Hash_adp;
import gplx.Hash_adp_;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.core.interfaces.InjectAble;
import gplx.gfui.PointAdp;
import gplx.gfui.PointAdp_;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.ipts.IptArg;
import gplx.gfui.ipts.IptBnd;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptEventData;
import gplx.gfui.ipts.IptEventType;
import gplx.gfui.ipts.IptEventType_;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.ipts.IptMouseBtn_;
import gplx.gfui.ipts.IptMouseMove;
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();
@@ -29,7 +47,7 @@ public class GfuiMoveElemBnd implements IptBnd, Gfo_invk, InjectAble {
}
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) {
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;
@@ -66,10 +84,10 @@ public class GfuiMoveElemBnd implements IptBnd, Gfo_invk, InjectAble {
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));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Up), PointAdp_.new_(0, -10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Down), PointAdp_.new_(0, 10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Left), PointAdp_.new_(-10, 0));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Right), PointAdp_.new_(10, 0));
}
}
class IptBndArgsBldr {

View File

@@ -1,20 +1,43 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
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.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.customs; import gplx.GfoMsg;
import gplx.Hash_adp;
import gplx.Hash_adp_;
import gplx.Keyval_hash;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.gfui.PointAdp;
import gplx.gfui.PointAdp_;
import gplx.gfui.SizeAdp;
import gplx.gfui.SizeAdp_;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.controls.elems.GfuiElem_;
import gplx.gfui.controls.gxws.GxwElem;
import gplx.gfui.controls.gxws.GxwElemFactory_;
import gplx.gfui.controls.standards.GfuiBtn;
import gplx.gfui.controls.windows.GfuiWin;
import gplx.gfui.ipts.IptBnd;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptEventData;
import gplx.gfui.ipts.IptEventType;
import gplx.gfui.ipts.IptEventType_;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.ipts.IptMouseBtn_;
import gplx.gfui.ipts.IptMouseMove;
import gplx.gfui.layouts.GftGrid;
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);
@@ -78,9 +101,9 @@ class GfuiResizeFormBnd implements IptBnd {
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));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Up), SizeAdp_.new_(0, -10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Down), SizeAdp_.new_(0, 10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Left), SizeAdp_.new_(-10, 0));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.MOD_1ST.Add(IptKey_.Shift).Add(IptKey_.Right), SizeAdp_.new_(10, 0));
}
}

View File

@@ -1,20 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
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.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.customs; import gplx.Tfds;
import gplx.gfui.controls.standards.GfuiBtn;
import gplx.gfui.controls.standards.GfuiBtn_;
import gplx.gfui.controls.windows.GfuiWin;
import gplx.gfui.controls.windows.GfuiWin_;
import gplx.gfui.ipts.IptEventMgr;
import gplx.gfui.ipts.IptEvtDataKey;
import gplx.gfui.ipts.IptKey;
import gplx.gfui.ipts.IptKey_;
import org.junit.Before;
import org.junit.Test;
public class GfuiMoveElemBtn_tst {
@Before public void setup() {
form = GfuiWin_.app_("form"); form.Size_(100, 100);
@@ -22,12 +31,12 @@ public class GfuiMoveElemBtn_tst {
GfuiMoveElemBnd bnd = GfuiMoveElemBnd.new_(); bnd.TargetElem_set(form);
moveBtn.IptBnds().Add(bnd);
}
@Test public void Basic() {
@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);}
IptKey MoveRightArg() {return IptKey_.MOD_1ST.Add(IptKey_.Right);}
GfuiWin form; GfuiBtn moveBtn;
}

View File

@@ -13,16 +13,20 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
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() {}
}
package gplx.gfui.controls.customs; import gplx.Err_;
import gplx.core.interfaces.InjectAble;
import gplx.gfui.controls.windows.GfuiWin;
import gplx.gfui.controls.windows.GfuiWin_;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptKey_;
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_.MOD_1ST, IptKey_.MOD_2ND, IptKey_.T));
statusBar.MoveButton().TargetElem_set(form);
}
public static GfuiStatusBarBnd new_() {return new GfuiStatusBarBnd();} GfuiStatusBarBnd() {}
}

View File

@@ -1,20 +1,33 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
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.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.customs; import gplx.Datetime_now;
import gplx.GfoMsg;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.UsrMsg;
import gplx.UsrMsgWkr_;
import gplx.gfui.DirInt;
import gplx.gfui.controls.windows.GfuiWin;
import gplx.gfui.draws.ColorAdp_;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.layouts.GftBand;
import gplx.gfui.layouts.GftGrid;
public class GfuiStatusBoxBnd implements Gfo_invk {
public GfuiStatusBox Box() {return statusBox;} GfuiStatusBox statusBox = GfuiStatusBox_.new_("statusBox");
void ShowTime() {
@@ -31,7 +44,7 @@ public class GfuiStatusBoxBnd implements Gfo_invk {
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));
IptBnd_.cmd_to_(IptCfg_.Null, win, this, GfuiStatusBoxBnd.Invk_ShowTime, IptKey_.add_(IptKey_.MOD_1ST, 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)));
}

View File

@@ -1,23 +1,73 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.imgs.*; import gplx.gfui.kits.core.*;
import gplx.gfui.layouts.swts.*;
import gplx.gfui.controls.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.windows.*;
import gplx.core.strings.*; import gplx.core.interfaces.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.elems; import gplx.Bool_;
import gplx.Err_;
import gplx.GfoMsg;
import gplx.Gfo_evt_mgr;
import gplx.Gfo_evt_mgr_;
import gplx.Gfo_invk_;
import gplx.Gfo_invk_cmd;
import gplx.Gfo_invk_cmd_mgr;
import gplx.GfsCtx;
import gplx.Hash_adp;
import gplx.Hash_adp_;
import gplx.Keyval_hash;
import gplx.Object_;
import gplx.Ordered_hash;
import gplx.Ordered_hash_;
import gplx.String_;
import gplx.core.interfaces.InjectAble;
import gplx.gfui.GfuiAlign;
import gplx.gfui.GfuiAlign_;
import gplx.gfui.PointAdp;
import gplx.gfui.PointAdp_;
import gplx.gfui.RectAdp;
import gplx.gfui.RectAdp_;
import gplx.gfui.SizeAdp;
import gplx.gfui.SizeAdp_;
import gplx.gfui.controls.GfuiBorderMgr;
import gplx.gfui.controls.gxws.GxwCore_base;
import gplx.gfui.controls.gxws.GxwElem;
import gplx.gfui.controls.gxws.GxwElemFactory_;
import gplx.gfui.controls.windows.GfuiFocusMgr;
import gplx.gfui.controls.windows.GfuiFocusOrderer;
import gplx.gfui.controls.windows.GfuiWin;
import gplx.gfui.controls.windows.GfuiWinKeyCmdMgr;
import gplx.gfui.draws.ColorAdp;
import gplx.gfui.draws.ColorAdp_;
import gplx.gfui.draws.FontStyleAdp;
import gplx.gfui.draws.FontStyleAdp_;
import gplx.gfui.draws.PenAdp_;
import gplx.gfui.gfxs.GfxStringData;
import gplx.gfui.gfxs.PaintArgs;
import gplx.gfui.ipts.IptBndMgr;
import gplx.gfui.ipts.IptEventMgr;
import gplx.gfui.ipts.IptEventType;
import gplx.gfui.ipts.IptEvtDataKey;
import gplx.gfui.ipts.IptEvtDataKeyHeld;
import gplx.gfui.ipts.IptEvtDataMouse;
import gplx.gfui.ipts.IptKey;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.kits.core.Gfui_kit;
import gplx.gfui.kits.core.Gfui_kit_;
import gplx.gfui.kits.core.Swing_kit;
import gplx.gfui.layouts.GftGrid;
import gplx.gfui.layouts.GftItem;
import gplx.gfui.layouts.swts.Swt_layout_data;
import gplx.gfui.layouts.swts.Swt_layout_mgr;
public class GfuiElemBase implements GfuiElem {
//% Layout
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;
@@ -55,7 +105,7 @@ public class GfuiElemBase implements GfuiElem {
SizeChanged_ignore = false;
}
public void Zorder_front() {underMgr.Zorder_front();} public void Zorder_back() {underMgr.Zorder_back();}
@gplx.Virtual public void Zorder_front_and_focus() {
public void Zorder_front_and_focus() {
this.Zorder_front();
this.Visible_set(true);
this.Focus();
@@ -66,28 +116,28 @@ public class GfuiElemBase implements GfuiElem {
public void Layout_data_(Swt_layout_data v) {underElem.Core().Layout_data_(v);}
//% Visual
@gplx.Virtual public boolean Visible() {return underMgr.Visible();} @gplx.Virtual public void Visible_set(boolean v) {underMgr.Visible_set(v);}
public boolean Visible() {return underMgr.Visible();} public void Visible_set(boolean v) {underMgr.Visible_set(v);}
public GfuiElem Visible_on_() {this.Visible_set(true); return this;} public GfuiElem Visible_off_() {this.Visible_set(false); return this;}
@gplx.Virtual public ColorAdp BackColor() {return backColor;} ColorAdp backColor = ColorAdp_.White;
@gplx.Virtual public GfuiElem BackColor_(ColorAdp v) {backColor = v; underMgr.BackColor_set(backColor); return this;}
public ColorAdp BackColor() {return backColor;} ColorAdp backColor = ColorAdp_.White;
public GfuiElem BackColor_(ColorAdp v) {backColor = v; underMgr.BackColor_set(backColor); return this;}
public GfuiBorderMgr Border() {return border;} GfuiBorderMgr border = GfuiBorderMgr.new_();
public GfuiElem Border_on_() {border.All_(PenAdp_.new_(ColorAdp_.Black, 1)); return this;}
public GfuiElem Border_off_() {border.All_(null); return this;}
public GfxStringData TextMgr() {return textMgr;} GfxStringData textMgr;
public String Text() {return textMgr.Val();}
public GfuiElem Text_any_(Object obj) {return Text_(Object_.Xto_str_strict_or_null_mark(obj));}
@gplx.Virtual public GfuiElem Text_(String v) {
public GfuiElem Text_(String v) {
this.TextMgr().Text_set(v);
Click_key_set_(v);
return this;
}
@gplx.Virtual public GfuiElem ForeColor_(ColorAdp v) {textMgr.Color_(v); return this;}
public GfuiElem ForeColor_(ColorAdp v) {textMgr.Color_(v); return this;}
public void TextAlignH_(GfuiAlign v) {textMgr.AlignH_(v);}
public GfuiElem TextAlignH_left_() {textMgr.AlignH_(GfuiAlign_.Left); return this;}
public GfuiElem TextAlignH_right_() {textMgr.AlignH_(GfuiAlign_.Right); return this;}
public GfuiElem TextAlignH_center_() {textMgr.AlignH_(GfuiAlign_.Mid); return this;}
public String TipText() {return underElem.Core().TipText();} public GfuiElem TipText_(String v) {underElem.Core().TipText_set(v); return this;}
@gplx.Virtual public void Redraw() {underMgr.Invalidate();}
public void Redraw() {underMgr.Invalidate();}
public boolean CustomDraw() {return customDraw;} public void CustomDraw_set(boolean v) {customDraw = v;} private boolean customDraw;
@@ -101,7 +151,7 @@ public class GfuiElemBase implements GfuiElem {
focusKey_order_manual = val;
return this;
}
@gplx.Virtual public void Focus() {
public void Focus() {
if (subElems.Count() == 0) // if no subs, focus self
underElem.Core().Focus();
else if (defaultFocusKey != null) { // if default is specified, focus it
@@ -124,10 +174,10 @@ public class GfuiElemBase implements GfuiElem {
public IptBndMgr IptBnds() {return iptBnds;} IptBndMgr iptBnds = IptBndMgr.new_();
//% ActionKey
@gplx.Virtual public void Click() {}
@gplx.Virtual public boolean Click_able() {return false;}
public void Click() {}
public boolean Click_able() {return false;}
public IptKey Click_key() {return clickKey;}
@gplx.Internal @gplx.Virtual protected void Click_key_set_(String v) {clickKey = GfuiWinKeyCmdMgr.ExtractKeyFromText(v);} IptKey clickKey = IptKey_.None;
@gplx.Internal protected void Click_key_set_(String v) {clickKey = GfuiWinKeyCmdMgr.ExtractKeyFromText(v);} IptKey clickKey = IptKey_.None;
//% Owner
public String Key_of_GfuiElem() {return keyIdf;} public GfuiElem Key_of_GfuiElem_(String val) {keyIdf = val; return this;} private String keyIdf;
@@ -140,9 +190,9 @@ public class GfuiElemBase implements GfuiElem {
}
//% Form
@gplx.Virtual public GfuiWin OwnerWin() {return ownerForm;} public GfuiElem OwnerWin_(GfuiWin val) {ownerForm = val; return this;} GfuiWin ownerForm = null;
@gplx.Virtual public boolean Opened_done() {return ownerForm == null ? false : ownerForm.Opened_done();}
@gplx.Virtual public void Opened_cbk() {
public GfuiWin OwnerWin() {return ownerForm;} public GfuiElem OwnerWin_(GfuiWin val) {ownerForm = val; return this;} GfuiWin ownerForm = null;
public boolean Opened_done() {return ownerForm == null ? false : ownerForm.Opened_done();}
public void Opened_cbk() {
for (int i = 0; i < subElems.Count(); i++) {
GfuiElem elem = subElems.Get_at(i);
elem.Opened_cbk();
@@ -154,23 +204,23 @@ public class GfuiElemBase implements GfuiElem {
}
//% Cbks
@gplx.Virtual public boolean KeyDownCbk(IptEvtDataKey data) {IptEventMgr.ExecKeyDown(this, data); return true;}
@gplx.Virtual public boolean KeyUpCbk(IptEvtDataKey data) {IptEventMgr.ExecKeyUp(this, data); return true;}
@gplx.Virtual public boolean KeyHeldCbk(IptEvtDataKeyHeld data) {IptEventMgr.ExecKeyPress(this, data); return true;}
@gplx.Virtual public boolean MouseDownCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseDown(this, data); return true;}
@gplx.Virtual public boolean MouseUpCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseUp(this, data); return true;}
@gplx.Virtual public boolean MouseMoveCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseMove(this, data); return true;}
@gplx.Virtual public boolean MouseWheelCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseWheel(this, data); return true;}
@gplx.Virtual public boolean PaintCbk(PaintArgs args) {border.DrawData(args.Graphics()); return true;}
@gplx.Virtual public boolean PaintBackgroundCbk(PaintArgs args) {return true;}
@gplx.Virtual public boolean DisposeCbk() {return true;}
@gplx.Virtual public boolean VisibleChangedCbk() {return true;}
@gplx.Virtual public boolean FocusGotCbk() {
public boolean KeyDownCbk(IptEvtDataKey data) {IptEventMgr.ExecKeyDown(this, data); return true;}
public boolean KeyUpCbk(IptEvtDataKey data) {IptEventMgr.ExecKeyUp(this, data); return true;}
public boolean KeyHeldCbk(IptEvtDataKeyHeld data) {IptEventMgr.ExecKeyPress(this, data); return true;}
public boolean MouseDownCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseDown(this, data); return true;}
public boolean MouseUpCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseUp(this, data); return true;}
public boolean MouseMoveCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseMove(this, data); return true;}
public boolean MouseWheelCbk(IptEvtDataMouse data) {IptEventMgr.ExecMouseWheel(this, data); return true;}
public boolean PaintCbk(PaintArgs args) {border.DrawData(args.Graphics()); return true;}
public boolean PaintBackgroundCbk(PaintArgs args) {return true;}
public boolean DisposeCbk() {return true;}
public boolean VisibleChangedCbk() {return true;}
public boolean FocusGotCbk() {
GfuiFocusMgr.Instance.FocusedElem_set(this);
return true;
}
@gplx.Virtual public boolean FocusLostCbk() {return true;}
@gplx.Virtual public boolean SizeChangedCbk() {
public boolean FocusLostCbk() {return true;}
public boolean SizeChangedCbk() {
this.TextMgr().OwnerSize_sync(this.Size());
this.Border().Bounds_sync(RectAdp_.size_(this.Size().Op_subtract(1)));
if (SizeChanged_ignore
@@ -186,8 +236,8 @@ public class GfuiElemBase implements GfuiElem {
//% InjectAble
public GfuiElem Inject_(InjectAble sub) {sub.Inject(this); return this;}
@gplx.Virtual public GxwElem UnderElem() {return underElem;} GxwElem underElem;
@gplx.Virtual public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
public GxwElem UnderElem() {return underElem;} GxwElem underElem;
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, GfuiElemKeys.Redraw_cmd)) Redraw();
else if (ctx.Match(k, GfuiElemKeys.Key_set)) {
String v = m.ReadStr("v");
@@ -241,15 +291,15 @@ public class GfuiElemBase implements GfuiElem {
else if (ctx.Match(k, GfuiElemKeys.Zorder_front_cmd)) Zorder_front();
else if (ctx.Match(k, Invk_OwnerWin_cmd)) return OwnerWin();
else {
if (ctx.Help_browseMode()) {
String_bldr sb = String_bldr_.new_();
for (int i = 0; i < this.SubElems().Count(); i++) {
GfuiElem subE = (GfuiElem)this.SubElems().Get_at(i);
sb.Add_str_w_crlf(subE.Key_of_GfuiElem());
}
return sb.To_str();
}
else {
// if (ctx.Help_browseMode()) {
// String_bldr sb = String_bldr_.new_();
// for (int i = 0; i < this.SubElems().Count(); i++) {
// GfuiElem subE = (GfuiElem)this.SubElems().Get_at(i);
// sb.Add_str_w_crlf(subE.Key_of_GfuiElem());
// }
// return sb.To_str();
// }
// else {
Object rv = this.InvkMgr().Invk(ctx, ikey, k, m, this);
if (rv != Gfo_invk_.Rv_unhandled) return rv;
@@ -257,7 +307,7 @@ public class GfuiElemBase implements GfuiElem {
if (findObj == null) findObj = this.subElems.Get_by(k);
if (findObj == null) return Gfo_invk_.Rv_unhandled;
return findObj; // necessary for gplx.images
}
// }
}
return this;
} public static final String Invk_OwnerWin_cmd = "ownerWin";
@@ -267,7 +317,7 @@ public class GfuiElemBase implements GfuiElem {
}
public Gfui_kit Kit() {return kit;} private Gfui_kit kit = Gfui_kit_.Mem();
@gplx.Virtual public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
this.kit = Swing_kit.Instance; // NOTE: assume that callers want Swing; SWT / Mem should be calling ctor_kit_GfuiElemBase
underElem = UnderElem_make(ctorArgs);
underElem.Host_set(this);
@@ -277,7 +327,7 @@ public class GfuiElemBase implements GfuiElem {
this.Focus_able_(Bool_.Cast(ctorArgs.Get_val_or(GfuiElem_.InitKey_focusAble, true)));
underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
}
@gplx.Virtual public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
this.kit = kit;
this.keyIdf = key;
this.underElem = underElem;
@@ -288,7 +338,7 @@ public class GfuiElemBase implements GfuiElem {
this.Focus_able_(Bool_.Cast(ctorArgs.Get_val_or(GfuiElem_.InitKey_focusAble, true)));
// underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
}
@gplx.Virtual public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.control_();}
public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.control_();}
public Object SubItms_getObj(String key) {return injected.Get_by(key);}
public GfuiElemBase SubItms_add(String key, Object v) {injected.Add(key, v); return this;}
public Ordered_hash XtnAtrs() {return xtnAtrs;} Ordered_hash xtnAtrs = Ordered_hash_.New();

View File

@@ -1,25 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import java.awt.KeyboardFocusManager;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws;
import gplx.gfui.gfxs.PaintArgs;
import gplx.gfui.ipts.IptEvtDataKey;
import gplx.gfui.ipts.IptEvtDataKeyHeld;
import gplx.gfui.ipts.IptEvtDataMouse;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.ipts.IptMouseBtn_;
import gplx.gfui.ipts.IptMouseWheel;
import gplx.gfui.ipts.IptMouseWheel_;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*;
public class GxwCbkHost_ {
public class GxwCbkHost_ {
public static final GxwCbkHost Null = new GfuiHost_cls_null();
public static final boolean ExecKeyEvent(GxwCbkHost host, KeyEvent e) {
boolean rv = true; int id = e.getID(), val = e.getKeyCode();
@@ -34,10 +41,10 @@ public class GxwCbkHost_ {
}
else {
if (e.isShiftDown()) val |= IptKey_.Shift.Val();
if (e.isControlDown()) val |= IptKey_.Ctrl.Val();
if (e.isControlDown()) val |= IptKey_.Ctrl.Val();
if (e.isAltDown()) val |= IptKey_.Alt.Val();
if (e.isMetaDown()) val |= IptKey_.Meta.Val();
IptEvtDataKey keyData = IptEvtDataKey.int_(val);
// Tfds.Write(e.getKeyChar(), e.getKeyCode(), val, id);
if (id == KeyEvent.KEY_PRESSED) rv = host.KeyDownCbk(keyData);
else if (id == KeyEvent.KEY_RELEASED) rv = host.KeyUpCbk(keyData);
if (keyData.Handled()) rv = false; // was false

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
public class GxwElemFactory_cls_lang extends GxwElemFactory_base {

View File

@@ -1,31 +1,35 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws; import gplx.GfoMsg;
import gplx.GfsCtx;
import gplx.gfui.RectAdp;
import gplx.gfui.gfxs.GfxAdpBase;
import gplx.gfui.gfxs.PaintArgs;
import gplx.gfui.ipts.IptEvtDataMouse;
import gplx.gfui.ipts.IptKey;
import gplx.gfui.ipts.IptMouseBtn;
import gplx.gfui.ipts.IptMouseBtn_;
import gplx.gfui.ipts.IptMouseWheel_;
import javax.swing.JComponent;
import java.awt.AWTEvent;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import javax.swing.JComponent;
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*;
public class GxwElem_lang extends JComponent implements GxwElem {
public static final String AlignH_cmd = "AlignH";
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host;} GxwCbkHost host = GxwCbkHost_.Null;
@@ -58,8 +62,7 @@ public class GxwElem_lang extends JComponent implements GxwElem {
public GxwCore_base Core() {return ctrlMgr;} GxwCore_base ctrlMgr;
public void SendKeyDown(IptKey key) {}
public void SendMouseMove(int x, int y) {}
public void SendMouseDown(IptMouseBtn btn) {
}
public void SendMouseDown(IptMouseBtn btn) {}
public void EnableDoubleBuffering() {} // eliminates flickering during OnPaint
JComponent comp = null;
public GxwElem_lang() {this.ctor_GxwElem();}

View File

@@ -1,38 +1,43 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.gxws; import gplx.Err_;
import gplx.GfoMsg;
import gplx.GfsCtx;
import gplx.gfui.GfuiAlign;
import gplx.gfui.GfuiAlign_;
import gplx.gfui.RectAdp_;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.draws.ColorAdp;
import gplx.gfui.gfxs.GfxAdpBase;
import gplx.gfui.gfxs.PaintArgs;
import gplx.gfui.ipts.IptEvtDataMouse;
import gplx.gfui.ipts.IptKey;
import gplx.gfui.ipts.IptMouseBtn;
import gplx.gfui.ipts.IptMouseBtn_;
import gplx.gfui.ipts.IptMouseWheel;
import gplx.gfui.ipts.IptMouseWheel_;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
import javax.swing.text.JTextComponent;
import gplx.gfui.draws.*;
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*; import gplx.gfui.controls.elems.*;
public class GxwTextBox_lang extends JTextArea implements GxwTextFld {
public Object UnderElem() {return this;}
public GxwCore_base Core() {return ctrlMgr;} GxwCore_base ctrlMgr;
@@ -86,7 +91,7 @@ public class GxwTextBox_lang extends JTextArea implements GxwTextFld {
}
public void EnableDoubleBuffering() {} // eliminates flickering during OnPaint
public void CreateControlIfNeeded() {}
@gplx.Virtual public void ctor_MsTextBox_() {
public void ctor_MsTextBox_() {
ctor_();
}
}
@@ -108,7 +113,7 @@ class GxwTextFld_cls_lang extends JTextField implements GxwTextFld {
} // NOTE: sometimes fails when skipping ahead in dvd player; v = 0, and start/end = 0
}
public int SelLen() {return this.getSelectionEnd() - this.getSelectionStart();} public void SelLen_set(int v) {this.setSelectionEnd(this.SelBgn() + v);}
@gplx.Virtual public void ctor_MsTextBox_() {
public void ctor_MsTextBox_() {
ctor_();
}
//@#if !plat_wce

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.langs.gfs.*;
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.imgs.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.standards; 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 Gfui_html extends GfuiElemBase {
@@ -22,8 +22,8 @@ public class Gfui_html extends GfuiElemBase {
public byte Html_doc_html_load_tid() {return under.Html_doc_html_load_tid();}
public void Html_doc_html_load_tid_(byte v) {under.Html_doc_html_load_tid_(v);}
public void Html_js_enabled_(boolean v) {under.Html_js_enabled_(v);}
@gplx.Virtual public String Html_js_eval_proc_as_str(String name, Object... args) {return under.Html_js_eval_proc_as_str(name, args);}
@gplx.Virtual public boolean Html_js_eval_proc_as_bool(String name, Object... args) {return under.Html_js_eval_proc_as_bool(name, args);}
public String Html_js_eval_proc_as_str(String name, Object... args) {return under.Html_js_eval_proc_as_str(name, args);}
public boolean Html_js_eval_proc_as_bool(String name, Object... args) {return under.Html_js_eval_proc_as_bool(name, args);}
public String Html_js_eval_script(String script) {return under.Html_js_eval_script(script);}
public Object Html_js_eval_script_as_obj(String script) {return under.Html_js_eval_script_as_obj(script);}
public String Html_js_send_json(String name, String data) {return under.Html_js_send_json(name, data);}

View File

@@ -13,18 +13,18 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*;
public class Gfui_tab_itm_data_tst {
@Before public void init() {} private Gfui_tab_itm_data_fxt fxt = new Gfui_tab_itm_data_fxt();
@Test public void Get_idx_after_closing() {
fxt.Test_Get_idx_after_closing(0, 1, -1);
fxt.Test_Get_idx_after_closing(4, 5, 3);
fxt.Test_Get_idx_after_closing(3, 5, 4);
}
}
class Gfui_tab_itm_data_fxt {
public void Test_Get_idx_after_closing(int cur, int len, int expd) {
Tfds.Eq(expd, Gfui_tab_itm_data.Get_idx_after_closing(cur, len));
}
}
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*;
public class Gfui_tab_itm_data_tst {
@Before public void init() {} private Gfui_tab_itm_data_fxt fxt = new Gfui_tab_itm_data_fxt();
@Test public void Get_idx_after_closing() {
fxt.Test_Get_idx_after_closing(0, 1, -1);
fxt.Test_Get_idx_after_closing(4, 5, 3);
fxt.Test_Get_idx_after_closing(3, 5, 4);
}
}
class Gfui_tab_itm_data_fxt {
public void Test_Get_idx_after_closing(int cur, int len, int expd) {
Tfds.Eq(expd, Gfui_tab_itm_data.Get_idx_after_closing(cur, len));
}
}

View File

@@ -1,21 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.core.interfaces.*;
import gplx.gfui.ipts.*; import gplx.gfui.controls.standards.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.tabs; import gplx.GfoMsg;
import gplx.Gfo_evt_mgr_;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.core.interfaces.InjectAble;
import gplx.gfui.controls.standards.GfuiBtn;
import gplx.gfui.controls.standards.GfuiBtn_;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptKey_;
class TabBoxEvt_nameChange {
public static String Key = "TabBoxEvt_nameChange";
public static void Send(TabBoxMgr mgr, TabPnlItm itm) {
@@ -40,8 +48,8 @@ class TabBoxEvt_tabSelectByBtn {
class TabBnd_selectTab implements InjectAble, Gfo_invk {
public void Inject(Object obj) {
tabBox = TabBox_.cast(obj);
IptBnd_.cmd_to_(IptCfg_.Null, tabBox, this, SelectNext_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Tab), IptKey_.add_(IptKey_.Ctrl, IptKey_.PageDown));
IptBnd_.cmd_to_(IptCfg_.Null, tabBox, this, SelectPrev_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Tab, IptKey_.Shift), IptKey_.add_(IptKey_.Ctrl, IptKey_.PageUp));
IptBnd_.cmd_to_(IptCfg_.Null, tabBox, this, SelectNext_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Tab), IptKey_.add_(IptKey_.MOD_1ST, IptKey_.PageDown));
IptBnd_.cmd_to_(IptCfg_.Null, tabBox, this, SelectPrev_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Tab, IptKey_.Shift), IptKey_.add_(IptKey_.MOD_1ST, IptKey_.PageUp));
}
void Select(GfoMsg msg, int delta) {
TabPnlItm curTab = tabBox.Mgr().CurTab();
@@ -60,8 +68,8 @@ class TabBnd_selectTab implements InjectAble, Gfo_invk {
class TabBnd_reorderTab implements InjectAble, Gfo_invk {
public void Inject(Object owner) {
GfuiBtn btn = GfuiBtn_.cast(owner);
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MovePrev_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Left));
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MoveNext_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Right));
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MovePrev_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Left));
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MoveNext_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Right));
}
@gplx.Internal protected void MoveTab(GfuiBtn curBtn, int delta) {
TabPnlItm curItm = tabBox.Mgr().Get_by(curBtn.Key_of_GfuiElem());

View File

@@ -1,29 +1,29 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*; import gplx.gfui.controls.tabs.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
public class TabBox_tst {
// @Before public void setup() {
// fx = TabBoxFxt.new_();
// } TabBoxFxt fx;
@Test public void Add() {
@Test public void Add() {
// fx.Make(1).tst_Selected("0").FetchBtnAt(0).tst_X(0);
// fx.Make(3).tst_Selected("2").FetchBtnAt(2).tst_X(160);
}
// @Test public void Del_at() {
// @Test public void Del_at() {
// fx.Make(2).Del_at(1).tst_Btns("0");
// fx.Make(2).Del_at(0).tst_Btns("1");
// fx.Make(3).Del_at(0).tst_Btns("1", "2");
@@ -34,17 +34,17 @@ public class TabBox_tst {
// fx.Make(3).Select(1).Del_at(0).tst_Selected("1"); // 0 deleted; 1 still remains active (but will have idx of 0
// fx.Make(3).Select(2).Del_at(2).tst_Selected("1"); // 2 deleted; 1 selected
// }
// @Test public void Selected_byAdd() {
// @Test public void Selected_byAdd() {
// fx.Make(2).Select(0).tst_Selected("0").Select(1).tst_Selected("1");
// }
// @Test public void Selected_byBtn() {
// @Test public void Selected_byBtn() {
// fx.Make(2).tst_Selected("1");
//
// GfuiBtn btn = fx.TabBox().SubBtnArea().Get_at(0);
// btn.Click();
// fx.tst_Selected("0");
// }
// @Test public void ReorderTab() {
// @Test public void ReorderTab() {
// fx.Make(3).Reorder(0, -1).tst_Raised(false);
// fx.Make(3).Reorder(2, 1).tst_Raised(false);
// fx.Make(3).Reorder(0, 1).tst_Btns("1", "0", "2").tst_Raised(true).tst_FocusOrder();

View File

@@ -1,22 +1,52 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.gfui.draws.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.envs.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.customs.*;
import gplx.core.envs.*;
import gplx.gfml.*; import gplx.langs.gfs.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.Err_;
import gplx.GfoMsg;
import gplx.GfoMsg_;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.Gfo_invk_cmd;
import gplx.GfsCtx;
import gplx.Io_mgr;
import gplx.Io_url;
import gplx.Io_url_;
import gplx.Object_;
import gplx.String_;
import gplx.UsrDlg_;
import gplx.UsrMsg;
import gplx.UsrMsgWkr;
import gplx.UsrMsgWkr_;
import gplx.core.envs.System_;
import gplx.gfml.GfmlDataNde;
import gplx.gfui.PointAdp;
import gplx.gfui.PointAdp_;
import gplx.gfui.controls.customs.GfuiIoDialogUtl;
import gplx.gfui.controls.customs.GfuiStatusBarBnd;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.controls.standards.GfuiTextBox;
import gplx.gfui.controls.standards.GfuiTextBox_;
import gplx.gfui.draws.FontAdp;
import gplx.gfui.draws.FontStyleAdp_;
import gplx.gfui.envs.ScreenAdp_;
import gplx.gfui.envs.TimerAdp;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.layouts.GftBand;
import gplx.langs.gfs.GfsCore;
public class GfoConsoleWin implements Gfo_invk, UsrMsgWkr {
GfuiWin win; GfoConsoleWinCmds cmds; GfuiTextBox statusBox, resultBox; GfuiTextBoxLogger logger;
public boolean Enabled() {return enabled;} public GfoConsoleWin Enabled_(boolean v) {enabled = v; return this;} private boolean enabled = true;
@@ -40,11 +70,11 @@ public class GfoConsoleWin implements Gfo_invk, UsrMsgWkr {
cmds = new GfoConsoleWinCmds(this);
cmds.Owner_set(win); cmds.Init();
IptBnd_.cmd_to_(IptCfg_.Null, win, cmds, GfoConsoleWinCmds.Invk_Hide, IptKey_.Escape);
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Exec, IptKey_.add_(IptKey_.Ctrl, IptKey_.E));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Save, IptKey_.add_(IptKey_.Ctrl, IptKey_.S));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Load, IptKey_.add_(IptKey_.Ctrl, IptKey_.L));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Help, IptKey_.add_(IptKey_.Ctrl, IptKey_.D));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Clear, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.C));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Exec, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.E));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Save, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.S));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Load, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.L));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Help, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.D));
IptBnd_.cmd_to_(IptCfg_.Null, consoleBox, cmds, GfoConsoleWinCmds.Invk_Clear, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.MOD_2ND, IptKey_.C));
logger = new GfuiTextBoxLogger(this).Init(statusBox);
// gplx.core.ios.GfioApp.InitGfs();
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Note, this);

View File

@@ -1,21 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.core.interfaces.*;
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.GfoMsg;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.core.interfaces.InjectAble;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.ipts.IptMouseBtn_;
public class GfuiCmdForm implements Gfo_invk, InjectAble {
public void Inject(Object ownerObj) {
GfuiElem owner = (GfuiElem)ownerObj;
@@ -33,7 +40,7 @@ public class GfuiCmdForm implements Gfo_invk, InjectAble {
GfuiCmdForm cmd = new GfuiCmdForm(); cmd.cmdForm = rv;
IptBnd_.cmd_to_(IptCfg_.Null, rv, cmd, HideMe_cmd, IptKey_.Escape);
IptBnd_.cmd_to_(IptCfg_.Null, hostElem, cmd, DoStuff, IptKey_.add_(IptKey_.Ctrl, IptKey_.Space), IptMouseBtn_.Right);
IptBnd_.cmd_to_(IptCfg_.Null, hostElem, cmd, DoStuff, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Space), IptMouseBtn_.Right);
return rv;
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import org.junit.*; import gplx.gfui.controls.elems.*;
public class GfuiFocusOrderer_tst {
@@ -20,28 +20,28 @@ public class GfuiFocusOrderer_tst {
owner = GfuiElem_.new_();
list = List_adp_.New(); // list of all controls
}
@Test public void Horizontal() {
@Test public void Horizontal() {
ini_Subs(owner, list, xy_(40, 0), xy_(20, 0), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 2);
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 2, 1, 0);
}
@Test public void Vertical() {
@Test public void Vertical() {
ini_Subs(owner, list, xy_(0, 40), xy_(0, 20), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 2);
GfuiFocusOrderer.OrderByY(owner);
tst_FocusIndxs(owner, list, 2, 1, 0);
}
@Test public void Grid() {
@Test public void Grid() {
ini_Subs(owner, list, xy_(20, 20), xy_(0, 20), xy_(20, 0), xy_(0, 0));
tst_FocusIndxs(owner, list, 0, 1, 2, 3);
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 3, 2, 1, 0);
}
@Test public void Deep() {
@Test public void Deep() {
ini_Subs(owner, list, xy_(20, 0), xy_(0, 0));
GfuiElem sub0 = sub_(owner, 0), sub1 = sub_(owner, 1);
ini_Subs(sub0, list, xy_(20, 0), xy_(0, 0));
@@ -51,7 +51,7 @@ public class GfuiFocusOrderer_tst {
GfuiFocusOrderer.OrderByX(owner);
tst_FocusIndxs(owner, list, 3, 0, 5, 4, 2, 1);
}
@Test public void Manusl() {
@Test public void Manusl() {
ini_Subs(owner, list, xy_(0, 0), xy_(20, 0));
tst_FocusIndxs(owner, list, 0, 1);

View File

@@ -1,20 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.GfoMsg;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.gfui.PointAdp;
import gplx.gfui.RectAdp;
import gplx.gfui.RectAdp_;
import gplx.gfui.SizeAdp;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptEventType_;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.ipts.IptMouseBtn_;
public class GfuiForm_menu implements Gfo_invk {
public GfuiWin Form() {return form;} GfuiWin form;
void Visible_toggle(GfoMsg msg) {
@@ -45,7 +57,7 @@ public class GfuiForm_menu implements Gfo_invk {
// form.CmdsA().Del(GfuiWin.Invk_Minimize);
// form.CmdsA().Del(GfuiStatusBoxBnd.Invk_ShowTime);
IptBnd_.cmd_to_(IptCfg_.Null, form, this, Visible_hide_cmd, IptKey_.Escape);
IptBnd_.cmd_to_(IptCfg_.Null, owner, this, Visible_toggle_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Space), IptMouseBtn_.Right);
IptBnd_.cmd_to_(IptCfg_.Null, owner, this, Visible_toggle_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Space), IptMouseBtn_.Right);
form.TaskbarParkingWindowFix(owner.OwnerWin()); // else ContextMenu shows up as WindowsFormsParkingWindow
form.QuitMode_(GfuiQuitMode.Suspend);

View File

@@ -1,34 +1,44 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;
import javax.swing.border.EmptyBorder;
import gplx.gfui.draws.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*;
import gplx.langs.gfs.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.Char_;
import gplx.Err_;
import gplx.GfoMsg;
import gplx.GfoMsgUtl;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.Hash_adp;
import gplx.Hash_adp_;
import gplx.Int_;
import gplx.String_;
import gplx.gfui.controls.gxws.GxwWin;
import gplx.gfui.draws.ColorAdp;
import gplx.gfui.draws.ColorAdpCache;
import gplx.gfui.draws.ColorAdp_;
import gplx.gfui.draws.FontStyleAdp;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptKey;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.kits.core.GfuiEnv_;
import gplx.gfui.layouts.GftBand;
import gplx.gfui.layouts.GftGrid;
import gplx.langs.gfs.GfsCore;
import javax.swing.*;
import java.awt.*;
public class GfuiMenuBar implements Gfo_invk {
public Object Under() {return winMenu;}
public boolean Visible() {return visible;} private boolean visible;
@@ -130,7 +140,7 @@ public class GfuiMenuBar implements Gfo_invk {
root = GfuiMenuBarItm.root_(winMenu);
itms.Add(root.Key(), root);
this.win = win;
IptBnd_.cmd_to_(GfuiEnv_.IptBndMgr_win, win, this, Invk_visible_toggle, IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift, IptKey_.F12));
IptBnd_.cmd_to_(GfuiEnv_.IptBndMgr_win, win, this, Invk_visible_toggle, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Shift, IptKey_.F12));
win.SubItms_add(SubItms_key, this);
}
Hash_adp itms = Hash_adp_.New(); GfuiWin win;

View File

@@ -1,23 +1,51 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import java.awt.Window;
import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.customs.*;
import gplx.core.envs.*; import gplx.gfui.imgs.*;
public class GfuiWin extends GfuiElemBase {
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.Datetime_now;
import gplx.GfoMsg;
import gplx.Gfo_evt_mgr_;
import gplx.Gfo_invk_cmd;
import gplx.Gfo_invk_cmd_mgr;
import gplx.GfsCtx;
import gplx.Keyval_hash;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.String_;
import gplx.UsrDlg_;
import gplx.UsrMsg;
import gplx.core.envs.Env_;
import gplx.gfui.SizeAdp;
import gplx.gfui.SizeAdp_;
import gplx.gfui.controls.customs.GfuiStatusBoxBnd;
import gplx.gfui.controls.elems.GfuiElemBase;
import gplx.gfui.controls.elems.GfuiElemKeys;
import gplx.gfui.controls.gxws.GxwElem;
import gplx.gfui.controls.gxws.GxwElemFactory_;
import gplx.gfui.controls.gxws.GxwWin;
import gplx.gfui.imgs.IconAdp;
import gplx.gfui.ipts.IptBnd_;
import gplx.gfui.ipts.IptCfg_;
import gplx.gfui.ipts.IptEventData;
import gplx.gfui.ipts.IptKey_;
import gplx.gfui.kits.core.GfuiEnv_;
import gplx.gfui.kits.core.Gfui_kit;
import gplx.gfui.kits.core.Gfui_kit_;
import gplx.gfui.layouts.GftGrid;
import java.awt.*;
public class GfuiWin extends GfuiElemBase {
private GxwWin win; private List_adp loadList = List_adp_.New();
public void Show() {win.ShowWin();}
public void Hide() {win.HideWin();}
@@ -25,7 +53,7 @@ public class GfuiWin extends GfuiElemBase {
public IconAdp Icon() {return win.IconWin();} public GfuiWin Icon_(IconAdp icon) {win.IconWin_set(icon); return this;}
public boolean Pin() {return win.Pin();} public GfuiWin Pin_(boolean v) {win.Pin_set(v); return this;}
public GfuiWin Pin_() {return Pin_(true);} public void Pin_toggle() {Pin_(!Pin());}
@gplx.Virtual public void Quit() {GfuiQuitMode.Exec(this, quitMode);}
public void Quit() {GfuiQuitMode.Exec(this, quitMode);}
public boolean Maximized() {return win.Maximized();} public void Maximized_(boolean v) {win.Maximized_(v);}
public boolean Minimized() {return win.Minimized();} public void Minimized_(boolean v) {win.Minimized_(v);}
public GfuiQuitMode QuitMode() {return quitMode;} public GfuiWin QuitMode_(GfuiQuitMode val) {quitMode = val; return this;} private GfuiQuitMode quitMode = GfuiQuitMode.ExitApp; // easier to debug
@@ -44,9 +72,9 @@ public class GfuiWin extends GfuiElemBase {
win = (GxwWin)underElem;
win.OpenedCmd_set(Gfo_invk_cmd.New_by_key(this, Evt_Opened));
Gfo_evt_mgr_.Sub(this, GfuiElemKeys.IptRcvd_evt, keyCmdMgr, GfuiWinKeyCmdMgr.CheckForHotKey_cmd);
IptBnd_.cmd_(IptCfg_.Null, this, StopAppByAltF4_evt, IptKey_.Alt.Add(IptKey_.F4));
// IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin.Instance, GfoConsoleWin.Invk_Show, IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.E));
IptBnd_.cmd_(IptCfg_.Null, this, Invk_ShowFocusOwner, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.F12));
IptBnd_.cmd_(IptCfg_.Null, this, StopAppByAltF4_evt, IptKey_.MOD_2ND.Add(IptKey_.F4));
// IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin.Instance, GfoConsoleWin.Invk_Show, IptKey_.MOD_1ST.Add(IptKey_.MOD_2ND).Add(IptKey_.E));
IptBnd_.cmd_(IptCfg_.Null, this, Invk_ShowFocusOwner, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.MOD_2ND, IptKey_.F12));
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
focusMgr = GfuiWinFocusMgr.new_(this);
}
@@ -55,9 +83,9 @@ public class GfuiWin extends GfuiElemBase {
win = (GxwWin)this.UnderElem();
win.OpenedCmd_set(Gfo_invk_cmd.New_by_key(this, Evt_Opened));
Gfo_evt_mgr_.Sub(this, GfuiElemKeys.IptRcvd_evt, keyCmdMgr, GfuiWinKeyCmdMgr.CheckForHotKey_cmd);
IptBnd_.cmd_(IptCfg_.Null, this, StopAppByAltF4_evt, IptKey_.Alt.Add(IptKey_.F4));
IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin.Instance, GfoConsoleWin.Invk_Show, IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.E));
IptBnd_.cmd_(IptCfg_.Null, this, Invk_ShowFocusOwner, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.F12));
IptBnd_.cmd_(IptCfg_.Null, this, StopAppByAltF4_evt, IptKey_.MOD_2ND.Add(IptKey_.F4));
IptBnd_.cmd_to_(IptCfg_.Null, this, GfoConsoleWin.Instance, GfoConsoleWin.Invk_Show, IptKey_.MOD_1ST.Add(IptKey_.MOD_2ND).Add(IptKey_.E));
IptBnd_.cmd_(IptCfg_.Null, this, Invk_ShowFocusOwner, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.MOD_2ND, IptKey_.F12));
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
focusMgr = GfuiWinFocusMgr.new_(this);
}

View File

@@ -1,23 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.Err_;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.controls.gxws.GxwElem;
import gplx.gfui.controls.gxws.GxwTextMemo_lang;
import java.awt.Component;
import java.awt.Container;
import java.awt.FocusTraversalPolicy;
import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
public class GfuiWinFocusMgr {
public List_adp SubElems() {return subElems;} List_adp subElems = List_adp_.New();
public void InitForm() {this.Init(win);}
@@ -71,7 +75,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
GfuiElem elem = null;
try {elem = (GfuiElem)elems.Get_at(idx);}
catch (Exception e) {
System.out.println(idx);
System.out.println("getComponentAfter:" + e.getMessage() + ":" + idx);
Err_.Noop(e);
}
if (elem == null) return c; // FIXME: why is elem null?; REP: add new tab through history and then close out
@@ -107,7 +111,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
}
}
catch (Exception e) {
System.out.println(idx);
System.out.println("getComponentBefore:" + e.getMessage() + ":" + idx);
Err_.Noop(e);
}
if (elem == null) return c; // FIXME: why is elem null?; REP: add new tab through history and then close out

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
import gplx.core.lists.*; import gplx.core.bits.*;

View File

@@ -1,27 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class ColorAdp__tst {
@Test public void parse_hex_() {
public class ColorAdp__tst {
@Test public void parse_hex_() {
tst_parse_hex_("#00000000", 0, 0, 0, 0);
tst_parse_hex_("#000102FF", 0, 1, 2, 255);
tst_parse_hex_("#FF000102", 255, 0, 1, 2);
}
@Test public void parse_int_() {
@Test public void parse_int_() {
tst_parse_int_(0, 0, 0, 0, 0);
tst_parse_int_(255, 0, 0, 0, 255);
tst_parse_int_(65535, 0, 0, 255, 255);
@@ -29,7 +29,7 @@ public class ColorAdp__tst {
tst_parse_int_(Int_.Max_value, 127, 255, 255, 255);
tst_parse_int_(-1, 255, 255, 255, 255);
}
@Test public void parse() {
@Test public void parse() {
tst_parse_("0,0,0,0", 0, 0, 0, 0); // parse all ints
tst_parse_("0,0,0", 255, 0, 0, 0); // a=255, parse rest
tst_parse_("255", 0, 0, 0, 255); // parse as single int

View File

@@ -13,12 +13,12 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.envs; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.envs.*;
public class ClipboardAdp__tst {
@Test public void Basic() {
ClipboardAdp_.SetText("test");
Tfds.Eq(true, ClipboardAdp_.IsText());
Tfds.Eq("test", ClipboardAdp_.GetText());
}
}
package gplx.gfui.envs; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.envs.*;
public class ClipboardAdp__tst {
@Test public void Basic() {
ClipboardAdp_.SetText("test");
Tfds.Eq(true, ClipboardAdp_.IsText());
Tfds.Eq("test", ClipboardAdp_.GetText());
}
}

View File

@@ -13,15 +13,15 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.envs; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.envs.*;
public class ScreenAdp_tst {
@Test public void parse() {
ScreenAdp actl = ScreenAdp_.parse("{screen{0}");
Tfds.Eq(0, actl.Index());
}
@Test public void opposite_() {
ScreenAdp actl = ScreenAdp_.from_point_(PointAdp_.new_(2000, 2000));
Tfds.Eq(0, actl.Index());
}
}
package gplx.gfui.envs; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.envs.*;
public class ScreenAdp_tst {
@Test public void parse() {
ScreenAdp actl = ScreenAdp_.parse("{screen{0}");
Tfds.Eq(0, actl.Index());
}
@Test public void opposite_() {
ScreenAdp actl = ScreenAdp_.from_point_(PointAdp_.new_(2000, 2000));
Tfds.Eq(0, actl.Index());
}
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.gfxs; import gplx.*; import gplx.gfui.*;
import gplx.core.strings.*;
public abstract class GfxItm_base implements GfxItm {
@@ -24,7 +24,7 @@ public abstract class GfxItm_base implements GfxItm {
GfxItm_base comp = GfxItm_base.as_(obj); if (comp == null) return false;
return Object_.Eq(pos, comp.pos) && Object_.Eq(size, comp.size);
}
@gplx.Virtual public void ctor_GfxItmBase(PointAdp posVal, SizeAdp sizeVal) {
public void ctor_GfxItmBase(PointAdp posVal, SizeAdp sizeVal) {
pos = posVal; size = sizeVal;
}
public static GfxItm_base as_(Object obj) {return obj instanceof GfxItm_base ? (GfxItm_base)obj : null;}

View File

@@ -1,25 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.imgs; import gplx.*; import gplx.gfui.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2021 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.imgs;
import gplx.Err_;
import gplx.Io_url;
import gplx.Io_url_;
import gplx.core.gfo_regys.GfoRegy;
import gplx.core.gfo_regys.GfoRegyItm;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import java.awt.Image;
import java.net.MalformedURLException;
import java.net.URL;
import gplx.core.gfo_regys.*;
public class IconAdp {
public Icon UnderIcon() {return icon;} private final Icon icon;
public Image XtoImage() {return ((ImageIcon)icon).getImage();}
@@ -37,7 +39,10 @@ public class IconAdp {
public static void regy_loadDir_shallow(Io_url imgDir) {GfoRegy.Instance.RegDir(imgDir, "*.png", false, "_", ".");}
public static IconAdp regy_(String key) {
GfoRegyItm itm = GfoRegy.Instance.FetchOrNull(key);
if (itm == null) {UsrDlg_.Instance.Warn("missing icon; key={0}", key); return null;}
if (itm == null) {
// UsrDlg_.Instance.Warn("missing icon; key={0}", key);
return null;
}
if (itm.ValType() != GfoRegyItm.ValType_Url) throw Err_.new_wo_type("regyItm should be of type url", "key", key);
return IconAdp.file_(itm.Url());
}

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.imgs; import gplx.*; import gplx.gfui.*;
import org.junit.*;
import gplx.core.consoles.*;
@@ -23,14 +23,14 @@ public class ImageAdp_tst {
@Before public void setup() {
load = Tfds.RscDir.GenSubFil_nest("150_gfui", "imgs", "strawberry_java.bmp");
} ImageAdp img; Io_url load;
@Test public void load_() {
@Test public void load_() {
img = ImageAdp_.file_(load);
Tfds.Eq(80, img.Width());
Tfds.Eq(80, img.Height());
Tfds.Eq("80,80", img.Size().toString());
Tfds.Eq(img.Url(), load);
}
@Test public void SaveAsBmp() {
@Test public void SaveAsBmp() {
img = ImageAdp_.file_(load);
Io_url save = load.GenNewNameOnly("strawberry_temp");
DateAdp beforeModifiedTime = Io_mgr.Instance.QueryFil(save).ModifiedTime();

View File

@@ -13,17 +13,17 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*;
public class GfuiClickKeyMgr_tst {
@Test public void ExtractKeyFromText() {
tst_ExtractKey("&click", IptKey_.C);
tst_ExtractKey("&", IptKey_.None);
tst_ExtractKey("trailing &", IptKey_.None);
tst_ExtractKey("me & you", IptKey_.None);
}
void tst_ExtractKey(String text, IptKey expd) {
IptKey actl = GfuiWinKeyCmdMgr.ExtractKeyFromText(text);
Tfds.Eq(expd, actl);
}
}
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*;
public class GfuiClickKeyMgr_tst {
@Test public void ExtractKeyFromText() {
tst_ExtractKey("&click", IptKey_.C);
tst_ExtractKey("&", IptKey_.None);
tst_ExtractKey("trailing &", IptKey_.None);
tst_ExtractKey("me & you", IptKey_.None);
}
void tst_ExtractKey(String text, IptKey expd) {
IptKey actl = GfuiWinKeyCmdMgr.ExtractKeyFromText(text);
Tfds.Eq(expd, actl);
}
}

View File

@@ -1,25 +1,25 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptArgChainMgr_tst {
@Before public void setup() {
fx = new IptArgChainMgr_fx();
} IptArgChainMgr_fx fx;
@Test public void Add() {
@Test public void Add() {
fx.run_Add(IptKey_.A, IptKey_.B, IptKey_.C);
fx.tst_(IptKey_.A, 1);
fx.tst_(IptKey_.B, 1);
@@ -27,7 +27,7 @@ public class IptArgChainMgr_tst {
fx.tst_(IptKey_.B, 0);
fx.tst_(IptKey_.C, 0);
}
@Test public void Del() {
@Test public void Del() {
fx.run_Add(IptKey_.A, IptKey_.B, IptKey_.C);
fx.run_Del(IptKey_.A, IptKey_.B, IptKey_.C);
fx.tst_(IptKey_.A, 0);

View File

@@ -1,20 +1,25 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
public class IptArg_ {
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.Err;
import gplx.Err_;
import gplx.Int_;
import gplx.Ordered_hash;
import gplx.Ordered_hash_;
import gplx.String_;
public class IptArg_ {
public static final IptArg[] Ary_empty = new IptArg[0];
public static final IptArg Null = null;
public static final String Wildcard_key = "wildcard";
@@ -91,6 +96,7 @@ class IptMacro {
Reg("mod", "c", IptKey_.add_(IptKey_.Ctrl));
Reg("mod", "a", IptKey_.add_(IptKey_.Alt));
Reg("mod", "s", IptKey_.add_(IptKey_.Shift));
Reg("mod", "m", IptKey_.add_(IptKey_.Meta));
Reg("mod", "ca", IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt));
Reg("mod", "cs", IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift));
Reg("mod", "as", IptKey_.add_(IptKey_.Alt, IptKey_.Shift));

View File

@@ -1,22 +1,22 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.Tfds;
import org.junit.Test;
public class IptArg_parser_tst {
@Test public void KeyBasic() {
@Test public void KeyBasic() {
tst_parse_Key_("key.a", IptKey_.A);
tst_parse_Key_("key.d0", IptKey_.D0);
tst_parse_Key_("key.semicolon", IptKey_.Semicolon);
@@ -25,34 +25,35 @@ public class IptArg_parser_tst {
tst_parse_Key_("key.ctrl", IptKey_.Ctrl);
tst_parse_Key_("key.none", IptKey_.None);
} void tst_parse_Key_(String raw, IptKey expd) {Tfds.Eq(expd.Val(), IptKey_.parse(raw).Val());}
@Test public void KbdCmdModifiers() {
@Test public void KbdCmdModifiers() {
tst_parse_Key_("key.ctrl+key.enter", IptKey_.Ctrl.Add(IptKey_.Enter));
tst_parse_Key_("key.alt+key.escape", IptKey_.Alt.Add(IptKey_.Escape));
tst_parse_Key_("key.shift+key.f1", IptKey_.Shift.Add(IptKey_.F1));
tst_parse_Key_("key.meta+key.f1", IptKey_.Meta.Add(IptKey_.F1));
tst_parse_Key_("key.shift+key.ctrl", IptKey_.Ctrl.Add(IptKey_.Shift));
tst_parse_Key_("key.ctrl+key.alt+key.slash", IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.Slash));
}
@Test public void KeyWhitespace() {
@Test public void KeyWhitespace() {
tst_parse_Key_("key.ctrl + key.alt + key.slash", IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.Slash));
}
@Test public void MouseBtn() {
@Test public void MouseBtn() {
tst_parse_MouseBtn_("mouse.left", IptMouseBtn_.Left);
tst_parse_MouseBtn_("mouse.right", IptMouseBtn_.Right);
tst_parse_MouseBtn_("mouse.middle", IptMouseBtn_.Middle);
tst_parse_MouseBtn_("mouse.x1", IptMouseBtn_.X1);
tst_parse_MouseBtn_("mouse.x2", IptMouseBtn_.X2);
} void tst_parse_MouseBtn_(String raw, IptMouseBtn expd) {Tfds.Eq(expd, IptMouseBtn_.parse(raw));}
@Test public void MouseWheel() {
@Test public void MouseWheel() {
tst_parse_MouseWheel_("wheel.up", IptMouseWheel_.Up);
tst_parse_MouseWheel_("wheel.down", IptMouseWheel_.Down);
} void tst_parse_MouseWheel_(String raw, IptMouseWheel expd) {Tfds.Eq(expd, IptMouseWheel_.parse(raw));}
@Test public void Mod() {
@Test public void Mod() {
tst_parse_("mod.c", IptKey_.Ctrl);
tst_parse_("mod.cs", IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift));
tst_parse_("mod.cas", IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.Shift));
tst_parse_("mod.c+key.c", IptKey_.add_(IptKey_.Ctrl, IptKey_.C));
}
@Test public void All() {
@Test public void All() {
tst_parse_("key.c", IptKey_.C);
tst_parse_("mouse.left", IptMouseBtn_.Left);
tst_parse_("wheel.up", IptMouseWheel_.Up);

View File

@@ -1,20 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import gplx.core.interfaces.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.Err_;
import gplx.GfoMsg;
import gplx.GfoMsg_;
import gplx.Hash_adp;
import gplx.Hash_adp_;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.Ordered_hash;
import gplx.Ordered_hash_;
import gplx.String_;
import gplx.UsrDlg_;
import gplx.UsrMsg;
import gplx.core.interfaces.SrlAble;
import gplx.core.interfaces.SrlAble_;
public class IptBndMgr implements SrlAble {
public IptEventType EventsToFwd() {return eventsToFwd;}
public void EventsToFwd_set(IptEventType v) {eventsToFwd = v;} IptEventType eventsToFwd = IptEventType_.KeyDown;
@@ -168,7 +180,7 @@ public class IptBndMgr implements SrlAble {
else throw Err_.new_unhandled(v);
}
}
class IptBndHash implements SrlAble {
class IptBndHash implements SrlAble {
private IptBndListItm wildcard_list;
public IptEventType EventType() {return eventType;} IptEventType eventType;
public int Count() {return hash.Count();}
@@ -208,7 +220,7 @@ class IptBndHash implements SrlAble {
Ordered_hash hash = Ordered_hash_.New();
public IptBndHash(IptEventType eventType) {this.eventType = eventType;}
}
class IptBndListItm implements SrlAble {
class IptBndListItm implements SrlAble {
public String IptKey() {return iptKey;} private String iptKey;
public int Count() {return list.Count();}
public IptBnd Get_at(int i) {return (IptBnd)list.Get_at(i);}

View File

@@ -1,25 +1,25 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.core.strings.*;
public class IptBndMgr_tst {
@Before public void setup() {
fx = new IptBndMgr_fx();
} IptBndMgr_fx fx;
@Test public void Add() {
@Test public void Add() {
fx.ini_Clear().run_Add("key.a").tst_Exec_same("key.a").tst_Exec_none("key.b");
fx.ini_Clear().run_Add("key.ctrl+key.a").tst_Exec_same("key.ctrl+key.a").tst_Exec_none("key.ctrl").tst_Exec_none("key.a");
fx.ini_Clear().run_Add("key.a|key.b").tst_Exec_same("key.a").tst_Exec_same("key.b").tst_Exec_none("key.c");

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import gplx.core.strings.*;
public class IptBnd_ {

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptCfg_tst {
@@ -22,16 +22,16 @@ public class IptCfg_tst {
cfg = new IptCfg_mok();
key = IptBndsOwner_mok.Invk_Reg;
} IptBndsOwner_mok box; IptCfg_mok cfg; String key;
@Test public void Basic() {
@Test public void Basic() {
cfg.run_GetOrDflt(box, key, IptKey_.A);
box.tst_SendKey(IptKey_.A, 1);
}
@Test public void Del() {
@Test public void Del() {
cfg.run_GetOrDflt(box, key, IptKey_.A);
box.IptBnds().Cfgs_delAll();
box.tst_SendKey(IptKey_.A, 0);
}
@Test public void Change() {
@Test public void Change() {
cfg.run_GetOrDflt(box, key, IptKey_.A);
cfg.run_Set(key, IptKey_.B);
box.tst_SendKey(IptKey_.B, 1);
@@ -40,19 +40,19 @@ public class IptCfg_tst {
box.tst_SendKey(IptKey_.C, 1);
box.tst_SendKey(IptKey_.B, 0);
}
@Test public void SetBeforeInit() {
@Test public void SetBeforeInit() {
cfg.run_Set(key, IptKey_.B);
cfg.run_GetOrDflt(box, key, IptKey_.A);
box.tst_SendKey(IptKey_.B, 1);
box.tst_SendKey(IptKey_.A, 0);
}
@Test public void SetBeforeInit_msg() {
@Test public void SetBeforeInit_msg() {
cfg.run_Set_msg(key, 2, IptKey_.B);
cfg.run_GetOrDflt(box, key, IptKey_.A); // iptBnd exists; ignore Key_.A (and also msg=1)
box.tst_SendKey(IptKey_.B, 2);
box.tst_SendKey(IptKey_.A, 0);
}
@Test public void Chained() {
@Test public void Chained() {
cfg.run_GetOrDflt(box, key, IptKeyChain.parse("key.ctrl+key.a,key.b"));
cfg.run_Set(key, IptKey_.A);
box.tst_SendKey(IptKey_.A, 1);

View File

@@ -1,28 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import gplx.gfui.envs.*; import gplx.gfui.controls.elems.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.GfoMsg;
import gplx.GfoMsg_;
import gplx.Gfo_evt_mgr_;
import gplx.Gfo_invk;
import gplx.Gfo_invk_;
import gplx.GfsCtx;
import gplx.gfui.controls.elems.GfuiElem;
import gplx.gfui.controls.elems.GfuiElemKeys;
import gplx.gfui.envs.TimerAdp;
public class IptEventMgr implements Gfo_invk {
public static void ExecKeyDown(GfuiElem sender, IptEvtDataKey keyState) {
keyHandled = false; keyStateCur = keyState; // cache for simultaneous ipt events (ex: key.ctrl + mouse.left)
IptEventData iptData = IptEventData.new_(sender, IptEventType_.KeyDown, keyState.Key(), keyState, mouseStateCur);
// if (keyState.Key().Eq(IptKey_.add_(IptKey_.F1))) {
// Tfds.Write(keyState.Key(), keyState.Key().Val());
// }
sender.IptBnds().Process(iptData);
sender.IptBnds().Process(iptData);
SendData(iptData);
keyHandled = keyState.Handled(); // WORKAROUND (WinForms): cache keyHandled b/c KeyDown.Handled=true does not make KeyPress.Handled=true;
}

View File

@@ -1,22 +1,22 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*; import gplx.gfui.ipts.*;
public class IptEventType_tst {
@Test public void Has() {
@Test public void Has() {
tst_Has(IptEventType_.KeyDown, IptEventType_.KeyDown, true);
tst_Has(IptEventType_.KeyUp, IptEventType_.KeyDown, false);
tst_Has(IptEventType_.None, IptEventType_.KeyDown, false);
@@ -25,7 +25,7 @@ public class IptEventType_tst {
tst_Has(IptEventType_.MouseDown.Add(IptEventType_.MouseUp), IptEventType_.KeyDown, false);
tst_Has(IptEventType_.KeyDown.Add(IptEventType_.KeyUp), IptEventType_.None, false);
} void tst_Has(IptEventType val, IptEventType find, boolean expd) {Tfds.Eq(expd, IptEventType_.Has(val, find));}
@Test public void add_() {
@Test public void add_() {
tst_add(IptEventType_.KeyDown, IptEventType_.KeyDown, IptEventType_.KeyDown.Val());
tst_add(IptEventType_.KeyDown, IptEventType_.KeyUp, IptEventType_.KeyDown.Val() + IptEventType_.KeyUp.Val());
} void tst_add(IptEventType lhs, IptEventType rhs, int expd) {Tfds.Eq(expd, IptEventType_.add_(lhs, rhs).Val());}

View File

@@ -1,22 +1,22 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class IptKeyStrMgr_tst {
@Test public void KeyBasic() {
@Test public void KeyBasic() {
tst_XtoUiStr(IptKey_.A, "a");
tst_XtoUiStr(IptKey_.Z, "z");
tst_XtoUiStr(IptKey_.Shift.Add(IptKey_.A), "A");
@@ -43,7 +43,7 @@ public class IptKeyStrMgr_tst {
tst_XtoUiStrShifted(IptKey_.OpenBracket, "[", "{");
tst_XtoUiStrShifted(IptKey_.CloseBracket, "]", "}");
}
@Test public void FetchByKeyPress() {
@Test public void FetchByKeyPress() {
tst_FetchByKeyPress('a', IptKey_.add_(IptKey_.A));
tst_FetchByKeyPress('A', IptKey_.add_(IptKey_.A, IptKey_.Shift));
tst_FetchByKeyPress('1', IptKey_.add_(IptKey_.D1));

View File

@@ -1,23 +1,36 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts;
import gplx.Bool_;
import gplx.Err_;
import gplx.Int_;
import gplx.List_adp;
import gplx.List_adp_;
import gplx.Ordered_hash;
import gplx.Ordered_hash_;
import gplx.String_;
import gplx.core.bits.Bitmask_;
import gplx.core.envs.Op_sys;
import gplx.core.primitives.EnmMgr;
import gplx.core.primitives.Int_obj_ref;
import gplx.core.stores.DataRdr;
import java.awt.event.KeyEvent;
import gplx.core.primitives.*; import gplx.core.stores.*; import gplx.core.bits.*;
public class IptKey_ {
private static EnmMgr enm_mgr = EnmMgr.new_().BitRngBgn_(65536).BitRngEnd_(262144).Prefix_("key.");
public static final int KeyCode_Shift = 65536, KeyCode_Ctrl = 131072, KeyCode_Alt = 262144, KeyCode_Meta = 524288;
private static EnmMgr enm_mgr = EnmMgr.new_().BitRngBgn_(KeyCode_Shift).BitRngEnd_(KeyCode_Meta).Prefix_("key.");
public static IptKey[] Ary(IptKey... ary) {return ary;}
public static final IptKey[] Ary_empty = new IptKey[0];
public static IptKey as_(Object obj) {return obj instanceof IptKey ? (IptKey)obj : null;}
@@ -75,7 +88,6 @@ public class IptKey_ {
enm_mgr.RegObj(val, name, rv);
return rv;
}
public static final int KeyCode_Shift = 65536, KeyCode_Ctrl = 131072, KeyCode_Alt = 262144;
public static final IptKey
// NOTE: integer values represent .NET keycodes; NOTE: SWT keycodes are converted to SWING keycodes in Swt_core_lnrs
// none
@@ -179,8 +191,15 @@ public class IptKey_ {
, Shift = new_(KeyCode_Shift, "shift")
, Ctrl = new_(KeyCode_Ctrl, "ctrl")
, Alt = new_(KeyCode_Alt, "alt")
, ShiftKey = new_(16, "shiftKey") , CtrlKey = new_(17, "ctrlKey") , AltKey = new_(18, "altKey") // NOTE: used for .NET NPI
, Meta = new_(KeyCode_Meta, "meta")
// NOTE: used for .NET NPI
, ShiftKey = new_(16, "shiftKey")
, CtrlKey = new_(17, "ctrlKey")
, AltKey = new_(18, "altKey")
;
public static final IptKey
MOD_1ST = Op_sys.Cur().Tid_is_osx() ? Meta : Ctrl,
MOD_2ND = Alt;
private static Ordered_hash ui_str_hash;
public static Ordered_hash Ui_str_hash() {
if (ui_str_hash == null) {
@@ -222,9 +241,10 @@ public class IptKey_ {
public static String To_str(int orig_val) {
String mod_str = "", rv = "";
int temp_val = orig_val;
boolean mod_c = Bitmask_.Has_int(temp_val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Ctrl.Val());}
boolean mod_a = Bitmask_.Has_int(temp_val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Alt.Val());}
boolean mod_s = Bitmask_.Has_int(temp_val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Shift.Val());}
boolean mod_c = Bitmask_.Has_int(temp_val, IptKey_.Ctrl.Val()); if (mod_c) {mod_str += "c"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Ctrl.Val());}
boolean mod_a = Bitmask_.Has_int(temp_val, IptKey_.Alt.Val()); if (mod_a) {mod_str += "a"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Alt.Val());}
boolean mod_s = Bitmask_.Has_int(temp_val, IptKey_.Shift.Val()); if (mod_s) {mod_str += "s"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Shift.Val());}
boolean mod_m = Bitmask_.Has_int(temp_val, IptKey_.Meta.Val()); if (mod_m) {mod_str += "m"; temp_val = Bitmask_.Flip_int(Bool_.N, temp_val, IptKey_.Meta.Val());}
if (String_.Len_gt_0(mod_str)) {
rv = "mod." + mod_str;
// handle modifiers only, like "mod.cs"; else will be "mod.cs+key.#0"

View File

@@ -1,31 +1,33 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.ipts;
import gplx.Tfds;
import org.junit.Test;
public class IptKey__tst {
private final IptKey__fxt fxt = new IptKey__fxt();
@Test public void To_str() {
@Test public void To_str() {
fxt.Test_to_str(196608, "mod.cs");
}
@Test public void To_str__numeric() {
@Test public void To_str__numeric() {
fxt.Test_to_str(12345, "key.#12345");
}
@Test public void Parse() {
@Test public void Parse() {
fxt.Test_parse("key.#10", 10);
}
// public static final int KeyCode_Shift = 65536, KeyCode_Ctrl = 131072, KeyCode_Alt = 262144;
}
class IptKey__fxt {
public void Test_to_str(int keycode, String expd) {

View File

@@ -1,18 +1,18 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.kits.core; import gplx.*; import gplx.gfui.*; import gplx.gfui.kits.*;
import gplx.gfui.imgs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.customs.*; import gplx.gfui.controls.windows.*;
public abstract class Gfui_kit_base implements Gfui_kit {
@@ -26,9 +26,9 @@ public abstract class Gfui_kit_base implements Gfui_kit {
public void Cfg_set(String type, String key, Object val) {}
public boolean Kit_mode__ready() {return true;}
public void Kit_init(Gfo_usr_dlg gui_wtr) {}
@gplx.Virtual public void Kit_run() {}
@gplx.Virtual public void Kit_term() {kit_term_cbk.Exec();}
@gplx.Virtual public void Ask_ok(String grp_key, String msg_key, String fmt, Object... args) {}
public void Kit_run() {}
public void Kit_term() {kit_term_cbk.Exec();}
public void Ask_ok(String grp_key, String msg_key, String fmt, Object... args) {}
public boolean Ask_yes_no(String grp_key, String msg_key, String fmt, Object... args) {return false;}
public int Ask_yes_no_cancel(String grp_key, String msg_key, String fmt, Object... args) {return Gfui_dlg_msg_.Btn_cancel;}
public boolean Ask_ok_cancel(String grp_key, String msg_key, String fmt, Object... args) {return false;}
@@ -41,7 +41,7 @@ public abstract class Gfui_kit_base implements Gfui_kit {
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 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;
@@ -66,22 +66,22 @@ public abstract class Gfui_kit_base implements Gfui_kit {
owner.SubElems().Add(rv);
return rv;
}
@gplx.Virtual 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_btn_impl(), ctor_args);
owner.SubElems().Add(rv);
return rv;
}
@gplx.Virtual public GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args) {
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) {
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) {
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;
@@ -93,10 +93,10 @@ public abstract class Gfui_kit_base implements Gfui_kit {
protected abstract GxwElem New_grp_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;}
@gplx.Virtual public Gfui_mnu_grp New_mnu_bar(String key, GfuiWin owner) {return Gfui_mnu_grp_.Noop;}
public Gfui_dlg_file New_dlg_file(byte type, String msg) {return Gfui_dlg_file_.Noop;}
public Gfui_dlg_msg New_dlg_msg(String msg) {return Gfui_dlg_msg_.Noop;}
public Gfui_mnu_grp New_mnu_popup(String key, GfuiElem owner) {return Gfui_mnu_grp_.Noop;}
public Gfui_mnu_grp New_mnu_bar(String key, GfuiWin owner) {return Gfui_mnu_grp_.Noop;}
public abstract ImageAdp New_img_load(Io_url url);
public Object New_color(int a, int r, int g, int b) {return null;}
public float Calc_font_height(GfuiElem elem, String s) {return 13;}

View File

@@ -1,37 +1,37 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfui.layouts; import gplx.*; import gplx.gfui.*;
import org.junit.*;
public class GftBand_tst {
@Before public void setup() {
fx.Clear().ini_OwnerSize(200, 400);
} GftGrid_fx fx = new GftGrid_fx();
@Test public void Bands_1() {
@Test public void Bands_1() {
fx .ini_AddItms(2)
.ini_Set(0, GftBand.new_().Cells_num_(2))
.run()
.tst_Filter(0, 1).tst_X(0, 100).tst_W_all(100).tst_H_all(20).tst_Y_all(0);
}
@Test public void Bands_1_half() { // only add 1 to 2 cell-band
@Test public void Bands_1_half() { // only add 1 to 2 cell-band
fx .ini_AddItms(1)
.ini_Set(0, GftBand.new_().Cells_num_(2))
.run()
.tst_Filter(0).tst_X(0).tst_W(100).tst_H(20).tst_Y(0);
}
@Test public void Bands_2() { // put cells 2, 3 on band 1
@Test public void Bands_2() { // put cells 2, 3 on band 1
fx .ini_AddItms(4)
.ini_Set(0, GftBand.new_().Cells_num_(2))
.ini_Set(1, GftBand.new_().Cells_num_(2))
@@ -39,43 +39,43 @@ public class GftBand_tst {
.tst_Filter(0, 1).tst_X(0, 100).tst_W_all(100).tst_H_all(20).tst_Y_all(0)
.tst_Filter(2, 3).tst_X(0, 100).tst_W_all(100).tst_H_all(20).tst_Y_all(20); // put on 2nd row
}
@Test public void Pct_one() {
@Test public void Pct_one() {
fx .ini_AddItms(1)
.ini_Set(0, GftBand.new_().Cell_pct_(50))
.run()
.tst_Filter(0).tst_X(0).tst_W(100).tst_H_all(20).tst_Y_all(0);
}
@Test public void Pct_many() {
@Test public void Pct_many() {
fx .ini_AddItms(3)
.ini_Set(0, GftBand.new_().Cell_pct_(20).Cell_pct_(70).Cell_pct_(10))
.run()
.tst_Filter(0, 2).tst_W(40, 140, 20).tst_X(0, 40, 180).tst_H_all(20).tst_Y_all(0);
}
@Test public void Mix_pctAtEnd() {
@Test public void Mix_pctAtEnd() {
fx .ini_AddItms(2)
.ini_Set(0, GftBand.new_().Cell_abs_(60).Cell_pct_(100))
.run()
.tst_Filter(0, 1).tst_X(0, 60).tst_W(60, 140).tst_H_all(20).tst_Y_all(0);
}
@Test public void Mix_pctAtBgn() {
@Test public void Mix_pctAtBgn() {
fx .ini_AddItms(2)
.ini_Set(0, GftBand.new_().Cell_pct_(100).Cell_abs_(60))
.run()
.tst_Filter(0, 1).tst_X(0, 140).tst_W(140, 60).tst_H_all(20).tst_Y_all(0);
}
@Test public void Mix_pctAtMid() {
@Test public void Mix_pctAtMid() {
fx .ini_AddItms(3)
.ini_Set(0, GftBand.new_().Cell_abs_(60).Cell_pct_(100).Cell_abs_(40))
.run()
.tst_Filter(0, 2).tst_X(0, 60, 160).tst_W(60, 100, 40).tst_H_all(20).tst_Y_all(0);
}
@Test public void Height_pct() {
@Test public void Height_pct() {
fx .ini_AddItms(1)
.ini_Set(0, GftBand.new_().Cell_pct_(100).Len1_pct_(100))
.run()
.tst_Filter(0).tst_X(0).tst_W(200).tst_H_all(400).tst_Y_all(0);
}
@Test public void Height_mix() {
@Test public void Height_mix() {
fx .ini_AddItms(3)
.ini_Set(0, GftBand.new_().Cells_num_(1).Len1_abs_( 60))
.ini_Set(1, GftBand.new_().Cells_num_(1).Len1_pct_(100))
@@ -85,14 +85,14 @@ public class GftBand_tst {
.tst_Filter(1).tst_H(320).tst_Y_all( 60).tst_X(0).tst_W(200)
.tst_Filter(2).tst_H( 20).tst_Y_all(380).tst_X(0).tst_W(200);
}
@Test public void RevDir() {
@Test public void RevDir() {
fx .ini_AddItms(2).ini_BandDir(DirInt.Bwd)
.ini_Set(0, 1, GftBand.new_().Cells_num_(1).Len1_abs_(20))
.run()
.tst_Filter(0).tst_W(200).tst_H(20).tst_X(0).tst_Y(380)
.tst_Filter(1).tst_W(200).tst_H(20).tst_X(0).tst_Y(360);
}
@Test public void SubLyts() {
@Test public void SubLyts() {
fx .ini_AddItms(2).ini_AddLyts(2)
.ini_Lyt(0).ini_Set(0, GftBand.new_().Cells_num_(1).Len1_pct_(100))
.ini_Lyt(1).ini_Set(0, GftBand.new_().Cells_num_(1).Len1_abs_( 20)).ini_BandDir(DirInt.Bwd)
@@ -100,7 +100,7 @@ public class GftBand_tst {
.tst_Filter(0).tst_W(200).tst_H(400).tst_X(0).tst_Y( 0)
.tst_Filter(1).tst_W(200).tst_H( 20).tst_X(0).tst_Y(380);
}
@Test public void Var() {
@Test public void Var() {
fx .ini_AddItms(2)
.ini_ItmWidth(0, 30).ini_ItmWidth(1, 40)
.ini_Set(0, GftBand.new_().Cells_var_(2))