mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.3.4.1'
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>150_gfui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
Binary file not shown.
@@ -25,10 +25,10 @@ public class IptBnd_txt_range implements InjectAble, GfoInvkAble, GfoEvObj {
|
||||
this.getListCmd = getListCmd; this.getCmd = getCmd; this.setCmd = setCmd; this.setEvt = setEvt;
|
||||
return this;
|
||||
} String getListCmd, getCmd, setCmd, setEvt;
|
||||
public IptBnd_txt_range PropList_(KeyVal[] list) {
|
||||
public IptBnd_txt_range PropList_(Keyval[] list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
} KeyVal[] list = null;
|
||||
} Keyval[] list = null;
|
||||
public void Inject(Object owner) {
|
||||
txtBox = GfuiTextBox_.cast(owner);
|
||||
txtBox.TextAlignH_center_();
|
||||
@@ -67,7 +67,7 @@ public class IptBnd_txt_range implements InjectAble, GfoInvkAble, GfoEvObj {
|
||||
}
|
||||
void ReadyEvtCmd() {
|
||||
if (getListCmd != null)
|
||||
list = (KeyVal[])GfoInvkAble_.InvkCmd(propInvk, getListCmd);
|
||||
list = (Keyval[])GfoInvkAble_.InvkCmd(propInvk, getListCmd);
|
||||
Object curId = GfoInvkAble_.InvkCmd(propInvk, getCmd);
|
||||
WhenEvtCmd(curId);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ 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 IptKey[] Ary(IptKey... ary) {return ary;}
|
||||
public static final IptKey[] Ary_empty = new IptKey[0];
|
||||
public static final IptKey[] Ary_empty = new IptKey[0];
|
||||
public static IptKey as_(Object obj) {return obj instanceof IptKey ? (IptKey)obj : null;}
|
||||
public static IptKey cast(Object obj) {try {return (IptKey)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, IptKey.class, obj);}}
|
||||
public static IptKey add_(IptKey... ary) {
|
||||
@@ -68,7 +68,7 @@ public class IptKey_ {
|
||||
return rv;
|
||||
}
|
||||
public static final int KeyCode_Shift = 65536, KeyCode_Ctrl = 131072, KeyCode_Alt = 262144;
|
||||
public static final IptKey
|
||||
public static final IptKey
|
||||
None = new_(0, "none")
|
||||
, Back = new_(8, "back"), Tab = new_(9, "tab"), Clear = new_(12, "clear"), Enter = new_(KeyEvent.VK_ENTER, "enter")
|
||||
, ShiftKey = new_(16, "shiftKey"), CtrlKey = new_(17, "ctrlKey"), AltKey = new_(18, "altKey")
|
||||
|
||||
@@ -17,6 +17,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public interface GxwComboBox extends GxwElem {
|
||||
void DataSource_set(Object... ary);
|
||||
int SelBgn(); void SelBgn_set(int v);
|
||||
int SelLen(); void SelLen_set(int v);
|
||||
void Sel_(int bgn, int end);
|
||||
Object SelectedItm(); void SelectedItm_set(Object v);
|
||||
String[] DataSource_as_str_ary();
|
||||
void DataSource_set(Object... ary);
|
||||
String Text_fallback(); void Text_fallback_(String v);
|
||||
int List_sel_idx(); void List_sel_idx_(int v);
|
||||
boolean List_visible(); void List_visible_(boolean v);
|
||||
void Items__update(String[] ary);
|
||||
void Items__size_to_fit(int count);
|
||||
void Items__visible_rows_(int v);
|
||||
void Items__jump_len_(int v);
|
||||
void Margins_set(int left, int top, int right, int bot);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
public class GxwComboBox_lang extends JComboBox implements GxwComboBox, GxwElem, ActionListener {
|
||||
public String[] DataSource_as_str_ary() {return String_.Ary_empty;}
|
||||
public void DataSource_set(Object... ary) {
|
||||
for (Object o : ary)
|
||||
this.insertItemAt(o, this.getItemCount());
|
||||
@@ -33,9 +34,20 @@ public class GxwComboBox_lang extends JComboBox implements GxwComboBox, GxwElem,
|
||||
obj = cb.getSelectedItem();
|
||||
*/
|
||||
}
|
||||
public int SelBgn() {return -1;} public void SelBgn_set(int v) {}
|
||||
public int SelLen() {return 0;} public void SelLen_set(int v) {}
|
||||
public void Sel_(int bgn, int end) {}
|
||||
public Object SelectedItm() {return this.getEditor().getItem();} public void SelectedItm_set(Object v) {
|
||||
this.getEditor().setItem(v);
|
||||
}
|
||||
@Override public String Text_fallback() {return "";} @Override public void Text_fallback_(String v) {}
|
||||
@Override public int List_sel_idx() {return -1;} @Override public void List_sel_idx_(int v) {}
|
||||
public boolean List_visible() {return false;} public void List_visible_(boolean v) {}
|
||||
public void Items__update(String[] ary) {}
|
||||
public void Items__size_to_fit(int count) {}
|
||||
public void Items__visible_rows_(int v) {}
|
||||
public void Items__jump_len_(int v) {}
|
||||
public void Margins_set(int left, int top, int right, int bot) {}
|
||||
void ctor_() {
|
||||
ctrlMgr = GxwCore_lang.new_(this);
|
||||
this.enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
|
||||
|
||||
@@ -19,13 +19,13 @@ package gplx.gfui; import gplx.*;
|
||||
public abstract class GxwElemFactory_base {
|
||||
@gplx.Internal protected abstract GxwElem control_();
|
||||
@gplx.Internal protected abstract GxwWin win_app_();
|
||||
@gplx.Internal protected abstract GxwWin win_tool_(KeyValHash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwWin win_toaster_(KeyValHash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwWin win_tool_(Keyval_hash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwWin win_toaster_(Keyval_hash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwElem lbl_();
|
||||
@gplx.Internal protected abstract GxwTextFld text_fld_();
|
||||
@gplx.Internal protected abstract GxwTextFld text_memo_();
|
||||
@gplx.Internal protected abstract GxwTextHtml text_html_();
|
||||
@gplx.Internal protected abstract GxwCheckListBox checkListBox_(KeyValHash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwCheckListBox checkListBox_(Keyval_hash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwComboBox comboBox_();
|
||||
@gplx.Internal protected abstract GxwListBox listBox_();
|
||||
// @gplx.Internal protected GxwElem spacer_() {return MockControl.new_();}
|
||||
@@ -37,15 +37,15 @@ class GxwElemFactory_ {
|
||||
}
|
||||
class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwElem control_() {return new GxwElem_lang();}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.FetchValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(Keyval_hash ctorArgs) {
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
GxwWin ownerElem = ownerForm == null ? null : (GxwWin)ownerForm.UnderElem();
|
||||
return GxwWin_jdialog.new_(ownerElem);
|
||||
// return GxwWin_lang.new_();
|
||||
}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(Keyval_hash ctorArgs) {
|
||||
GfsCtx ctx = GfsCtx.new_(); ctx.Match("", "");
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.FetchValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
GxwWin ownerElem = ownerForm == null ? null : (GxwWin)ownerForm.UnderElem();
|
||||
return GxwWin_jwindow.new_(ownerElem);
|
||||
// return GxwWin_lang.new_();
|
||||
@@ -55,20 +55,20 @@ class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return GxwTextBox_lang_.fld_();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return GxwTextBox_lang_.memo_();}
|
||||
@gplx.Internal @Override protected GxwTextHtml text_html_() {return new GxwTextHtml_lang().ctor();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return GxwComboBox_lang.new_();}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return GxwListBox_lang.new_();}
|
||||
}
|
||||
class GxwElemFactory_cls_mock extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwElem control_() {return GxwElem_mock_base.new_();}
|
||||
@gplx.Internal @Override protected GxwWin win_app_() {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(Keyval_hash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(Keyval_hash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwElem lbl_() {return GxwElem_mock_base.new_();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return new MockTextBox();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return new MockTextBoxMulti();}
|
||||
@gplx.Internal @Override protected GxwTextHtml text_html_() {return new MockTextBoxMulti();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return new MockComboBox();}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return new MockListBox();}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GxwElem_mock_base implements GxwElem {
|
||||
public GxwCore_base Core() {return ctrlMgr;} final GxwCore_mock ctrlMgr = new GxwCore_mock();
|
||||
public GxwCore_base Core() {return ctrlMgr;} final GxwCore_mock ctrlMgr = new GxwCore_mock();
|
||||
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host;} GxwCbkHost host = GxwCbkHost_.Null;
|
||||
public String TextVal() {return text;} public void TextVal_set(String v) {text = v;} private String text = "";
|
||||
public void SendKeyDown(IptKey key) {}
|
||||
@@ -38,7 +38,7 @@ class MockTextBox extends GxwElem_mock_base implements GxwTextFld {
|
||||
public void CreateControlIfNeeded() {}
|
||||
public void Margins_set(int left, int top, int right, int bot) {}
|
||||
}
|
||||
class MockTextBoxMulti extends MockTextBox implements GxwTextMemo, GxwTextHtml { public KeyVal[] Html_sel_atrs() {return KeyVal_.Ary_empty;}
|
||||
class MockTextBoxMulti extends MockTextBox implements GxwTextMemo, GxwTextHtml { public Keyval[] Html_sel_atrs() {return Keyval_.Ary_empty;}
|
||||
public void Html_enabled(boolean v) {}
|
||||
public String Html_doc_html() {return "";}
|
||||
public void Html_css_set(String s) {}
|
||||
@@ -62,7 +62,19 @@ class MockTextBoxMulti extends MockTextBox implements GxwTextMemo, GxwTextHtml {
|
||||
public void ScrollTillCaretIsVisible() {}
|
||||
}
|
||||
class MockComboBox extends GxwElem_mock_base implements GxwComboBox {
|
||||
public int SelBgn() {return -1;} public void SelBgn_set(int v) {}
|
||||
public int SelLen() {return 0;} public void SelLen_set(int v) {}
|
||||
public void Sel_(int bgn, int end) {}
|
||||
public String[] DataSource_as_str_ary() {return String_.Ary_empty;}
|
||||
public void DataSource_set(Object... ary) {}
|
||||
public String Text_fallback() {return "";} public void Text_fallback_(String v) {}
|
||||
public int List_sel_idx() {return -1;} public void List_sel_idx_(int v) {}
|
||||
public boolean List_visible() {return false;} public void List_visible_(boolean v) {}
|
||||
public void Items__update(String[] ary) {}
|
||||
public void Items__size_to_fit(int count) {}
|
||||
public void Items__visible_rows_(int v) {}
|
||||
public void Items__jump_len_(int v) {}
|
||||
public void Margins_set(int left, int top, int right, int bot) {}
|
||||
public Object SelectedItm() {return selectedItm;} public void SelectedItm_set(Object v) {this.selectedItm = v;} Object selectedItm;
|
||||
}
|
||||
class MockListBox extends GxwElem_mock_base implements GxwListBox {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
interface GxwTextHtml extends GxwTextMemo {
|
||||
KeyVal[] Html_sel_atrs();
|
||||
Keyval[] Html_sel_atrs();
|
||||
void Html_enabled(boolean v);
|
||||
String Html_doc_html();
|
||||
void Html_css_set(String s);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class GxwTextHtml_lang extends JScrollPane implements GxwTextHtml {
|
||||
this.setBorder(null);
|
||||
return this;
|
||||
}
|
||||
public KeyVal[] Html_sel_atrs() {return editor.Html_sel_atrs();}
|
||||
public Keyval[] Html_sel_atrs() {return editor.Html_sel_atrs();}
|
||||
public String Html_doc_html() {return editor.Html_doc_html();}
|
||||
public void Html_css_set(String s) {editor.Html_css_set(s);}
|
||||
@Override public void Margins_set(int left, int top, int right, int bot) {}
|
||||
@@ -162,9 +162,9 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
sb.Add("selBgn=").Add(Int_.To_str(Html_sel_bgn())).Add_char_crlf();
|
||||
sb.Add("selEnd=").Add(Int_.To_str(Html_sel_end())).Add_char_crlf();
|
||||
sb.Add("selTxt=").Add(Html_sel_text()).Add_char_crlf();
|
||||
KeyVal[] atrs = Html_sel_atrs();
|
||||
Keyval[] atrs = Html_sel_atrs();
|
||||
for (int i = 0; i < atrs.length; i++) {
|
||||
KeyVal atr = atrs[i];
|
||||
Keyval atr = atrs[i];
|
||||
sb.Add(atr.Key() + "=").Add(atr.Val_to_str_or_null()).Add_char_crlf();
|
||||
}
|
||||
return sb.To_str();
|
||||
@@ -208,15 +208,15 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
if (atr_val instanceof javax.swing.text.AttributeSet)
|
||||
Html_sel_atrs((AttributeSet)atr_val, list, itm_key, dlm);
|
||||
else
|
||||
list.Add(KeyVal_.new_(itm_key, atr_val));
|
||||
list.Add(Keyval_.new_(itm_key, atr_val));
|
||||
}
|
||||
}
|
||||
public KeyVal[] Html_sel_atrs() {
|
||||
if (String_.Eq(this.getContentType(), "text/plain")) return KeyVal_.Ary_empty;
|
||||
Element elm = Html_sel_elm(); if (elm == null) return KeyVal_.Ary_empty;
|
||||
public Keyval[] Html_sel_atrs() {
|
||||
if (String_.Eq(this.getContentType(), "text/plain")) return Keyval_.Ary_empty;
|
||||
Element elm = Html_sel_elm(); if (elm == null) return Keyval_.Ary_empty;
|
||||
List_adp sel_atrs_list = List_adp_.new_();
|
||||
Html_sel_atrs(elm.getAttributes(), sel_atrs_list, null, ".");
|
||||
return (KeyVal[])sel_atrs_list.To_ary(KeyVal.class);
|
||||
return (Keyval[])sel_atrs_list.To_ary(Keyval.class);
|
||||
}
|
||||
|
||||
@Override public void processKeyEvent(KeyEvent e) {
|
||||
|
||||
@@ -252,17 +252,17 @@ class GxwElemFactory_swt extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwWin win_app_() {
|
||||
return new Swt_win(display);
|
||||
}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(Keyval_hash ctorArgs) {
|
||||
return null;
|
||||
}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(Keyval_hash ctorArgs) {
|
||||
return null;
|
||||
}
|
||||
@gplx.Internal @Override protected GxwElem lbl_() {return null;}
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return null;}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return null;}
|
||||
@gplx.Internal @Override protected GxwTextHtml text_html_() {return null;}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return null;}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return null;}
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public class Gxw_html_load_tid_ {
|
||||
else if (String_.Eq(s, Key_url)) return Tid_url;
|
||||
else throw Err_.new_unimplemented();
|
||||
}
|
||||
public static KeyVal[] Options__list = KeyVal_.Ary(KeyVal_.new_(Key_mem), KeyVal_.new_(Key_url));
|
||||
public static Keyval[] Options__list = Keyval_.Ary(Keyval_.new_(Key_mem), Keyval_.new_(Key_url));
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GfuiWin extends GfuiElemBase {
|
||||
smallOpenSize = size;
|
||||
return this;
|
||||
} private SizeAdp smallOpenSize = SizeAdp_.Null;
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
win = (GxwWin)underElem;
|
||||
win.OpenedCmd_set(GfoInvkAbleCmd.new_(this, Evt_Opened));
|
||||
@@ -51,7 +51,7 @@ public class GfuiWin extends GfuiElemBase {
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
|
||||
focusMgr = GfuiWinFocusMgr.new_(this);
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
win = (GxwWin)this.UnderElem();
|
||||
win.OpenedCmd_set(GfoInvkAbleCmd.new_(this, Evt_Opened));
|
||||
@@ -62,8 +62,8 @@ public class GfuiWin extends GfuiElemBase {
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
|
||||
focusMgr = GfuiWinFocusMgr.new_(this);
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {
|
||||
String type = (String)ctorArgs.FetchValOr(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_app);
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {
|
||||
String type = (String)ctorArgs.Get_val_or(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_app);
|
||||
if (String_.Eq(type, GfuiWin_.InitKey_winType_tool)) return GxwElemFactory_.Instance.win_tool_(ctorArgs);
|
||||
else if (String_.Eq(type, GfuiWin_.InitKey_winType_toaster)) return GxwElemFactory_.Instance.win_toaster_(ctorArgs);
|
||||
else return GxwElemFactory_.Instance.win_app_();
|
||||
|
||||
@@ -25,15 +25,15 @@ public class GfuiWin_ {
|
||||
;
|
||||
public static GfuiWin as_(Object obj) {return obj instanceof GfuiWin ? (GfuiWin)obj : null;}
|
||||
public static GfuiWin cast(Object obj) {try {return (GfuiWin)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiWin.class, obj);}}
|
||||
public static GfuiWin app_(String key) {return bld_(key, InitKey_winType_app, KeyValHash.new_());}
|
||||
public static GfuiWin tool_(String key) {return bld_(key, InitKey_winType_tool, KeyValHash.new_()).TaskbarVisible_(false);}
|
||||
public static GfuiWin app_(String key) {return bld_(key, InitKey_winType_app, new Keyval_hash());}
|
||||
public static GfuiWin tool_(String key) {return bld_(key, InitKey_winType_tool, new Keyval_hash()).TaskbarVisible_(false);}
|
||||
public static GfuiWin sub_(String key, GfuiWin ownerWin) {
|
||||
KeyValHash ctorArgs = KeyValHash.new_();
|
||||
Keyval_hash ctorArgs = new Keyval_hash();
|
||||
if (ownerWin != null) ctorArgs.Add(GfuiElem_.InitKey_ownerWin, ownerWin); // WORKAROUND/JAVA: null ownerWin will fail when adding to hash
|
||||
return bld_(key, InitKey_winType_tool, ctorArgs);
|
||||
}
|
||||
public static GfuiWin toaster_(String key, GfuiWin ownerWin) {return bld_(key, InitKey_winType_toaster, KeyValHash.new_().Add(GfuiElem_.InitKey_ownerWin, ownerWin));}
|
||||
static GfuiWin bld_(String key, String winType, KeyValHash ctorArgs) {
|
||||
public static GfuiWin toaster_(String key, GfuiWin ownerWin) {return bld_(key, InitKey_winType_toaster, new Keyval_hash().Add(GfuiElem_.InitKey_ownerWin, ownerWin));}
|
||||
static GfuiWin bld_(String key, String winType, Keyval_hash ctorArgs) {
|
||||
GfuiWin rv = new GfuiWin();
|
||||
rv.Key_of_GfuiElem_(key);
|
||||
ctorArgs.Add(InitKey_winType, winType)
|
||||
@@ -41,7 +41,7 @@ public class GfuiWin_ {
|
||||
rv.ctor_GfuiBox_base(ctorArgs);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiWin kit_(Gfui_kit kit, String key, GxwWin under, KeyValHash ctorArgs) {
|
||||
public static GfuiWin kit_(Gfui_kit kit, String key, GxwWin under, Keyval_hash ctorArgs) {
|
||||
GfuiWin rv = new GfuiWin();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, under, ctorArgs);
|
||||
return rv;
|
||||
|
||||
@@ -125,9 +125,9 @@ public class GfuiWin_toaster extends GfuiWin { public void ShowPopup(GfuiWin own
|
||||
this.Pos_(this.X(), PopupAnchorTop); //this.Top - increment
|
||||
this.Size_(SizeAdp_.new_(this.Width(), this.Height() + increment));
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.fullyGrown = SizeAdp_.new_(600, 96);
|
||||
this.Pos_(-100, -100); this.Size_(fullyGrown); super.Show(); super.Hide();// was 20,20; set to fullyGrown b/c of java
|
||||
@@ -161,7 +161,7 @@ public class GfuiWin_toaster extends GfuiWin { public void ShowPopup(GfuiWin own
|
||||
GfuiWin_toaster rv = new GfuiWin_toaster();
|
||||
// rv.Icon_(IconAdp.cfg_("popup"));
|
||||
rv.ctor_GfuiBox_base
|
||||
(KeyValHash.new_()
|
||||
(new Keyval_hash()
|
||||
.Add(GfuiElem_.InitKey_focusAble, false)
|
||||
.Add(GfuiElem_.InitKey_ownerWin, owner)
|
||||
.Add(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_toaster)
|
||||
|
||||
@@ -70,7 +70,7 @@ public interface GfuiElem extends GfoInvkAble, GxwCbkHost, IptBndsOwner, GftItem
|
||||
|
||||
//% Infrastructure
|
||||
GxwElem UnderElem();
|
||||
GxwElem UnderElem_make(KeyValHash ctorArgs);
|
||||
void ctor_GfuiBox_base(KeyValHash ctorArgs);
|
||||
GxwElem UnderElem_make(Keyval_hash ctorArgs);
|
||||
void ctor_GfuiBox_base(Keyval_hash ctorArgs);
|
||||
void Invoke(GfoInvkAbleCmd cmd);
|
||||
}
|
||||
|
||||
@@ -261,17 +261,17 @@ 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(KeyValHash ctorArgs) {
|
||||
@gplx.Virtual 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);
|
||||
underMgr = underElem.Core();
|
||||
subElems = GfuiElemList.new_(this);
|
||||
textMgr = GfxStringData.new_(this, underElem);
|
||||
this.Focus_able_(Bool_.cast(ctorArgs.FetchValOr(GfuiElem_.InitKey_focusAble, true)));
|
||||
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, KeyValHash ctorArgs) {
|
||||
@gplx.Virtual public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
this.kit = kit;
|
||||
this.keyIdf = key;
|
||||
this.underElem = underElem;
|
||||
@@ -279,10 +279,10 @@ public class GfuiElemBase implements GfuiElem {
|
||||
underMgr = underElem.Core();
|
||||
subElems = GfuiElemList.new_(this);
|
||||
textMgr = GfxStringData.new_(this, underElem);
|
||||
this.Focus_able_(Bool_.cast(ctorArgs.FetchValOr(GfuiElem_.InitKey_focusAble, true)));
|
||||
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(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
@gplx.Virtual 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();
|
||||
|
||||
@@ -32,8 +32,8 @@ public class GfuiElem_ {
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
}
|
||||
public static KeyValHash init_focusAble_true_() {return KeyValHash.new_().Add(GfuiElem_.InitKey_focusAble, true);}
|
||||
public static KeyValHash init_focusAble_false_() {return KeyValHash.new_().Add(GfuiElem_.InitKey_focusAble, false);}
|
||||
public static Keyval_hash init_focusAble_true_() {return new Keyval_hash().Add(GfuiElem_.InitKey_focusAble, true);}
|
||||
public static Keyval_hash init_focusAble_false_() {return new Keyval_hash().Add(GfuiElem_.InitKey_focusAble, false);}
|
||||
public static void Y_adj(int adj, GfuiElem... ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -35,8 +35,8 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
Object o = GfoInvkAble_.InvkCmd(UnderElem(), Invk_btn_img);
|
||||
return o == UnderElem() ? null : (ImageAdp)o; // NOTE: lgc guard
|
||||
} public GfuiBtn Btn_img_(ImageAdp v) {GfoInvkAble_.InvkCmd_val(UnderElem(), Invk_btn_img_, v); return this;}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
focusBorder = GfuiBorderMgr.new_().All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.TextMgr().AlignH_(GfuiAlign_.Mid);
|
||||
@@ -46,7 +46,7 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
Inject_(GfuiFocusXferBnd.Instance);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
this.kit = kit;
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
focusBorder = GfuiBorderMgr.new_().All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GfuiBtn_ {
|
||||
rv.Click_invk(GfoInvkAbleCmd.new_(invk, m));
|
||||
return rv;
|
||||
}
|
||||
public static GfuiBtn kit_(Gfui_kit kit, String key, GxwElem elm, KeyValHash ctorArgs) {
|
||||
public static GfuiBtn kit_(Gfui_kit kit, String key, GxwElem elm, Keyval_hash ctorArgs) {
|
||||
GfuiBtn rv = new GfuiBtn();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, elm, ctorArgs);
|
||||
return rv;
|
||||
|
||||
@@ -51,8 +51,8 @@ public class GfuiChkBox extends GfuiElemBase {
|
||||
}
|
||||
@Override public boolean FocusGotCbk() {super.FocusGotCbk(); this.Redraw(); return true;} // Redraw for focusBorder
|
||||
@Override public boolean FocusLostCbk() {super.FocusLostCbk(); this.Redraw(); return true;} // Redraw for focusBorder
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@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);
|
||||
focusBorder.All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
Inject_(GfuiFocusXferBnd.Instance).Inject_(GfuiBtnClickBnd.Instance);
|
||||
|
||||
@@ -17,18 +17,42 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiComboBox extends GfuiElemBase {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.comboBox_();} GxwComboBox comboBox;
|
||||
public Object SelectedItm() {return comboBox.SelectedItm();} public void SelectedItm_set(Object v) {comboBox.SelectedItm_set(v);}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.comboBox = (GxwComboBox)this.UnderElem();
|
||||
}
|
||||
public void DataSource_set(Object... ary) {
|
||||
comboBox.DataSource_set(ary);
|
||||
this.combo = (GxwComboBox)this.UnderElem();
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.comboBox_();} private GxwComboBox combo;
|
||||
public int SelBgn() {return combo.SelBgn();} public void SelBgn_set(int v) {combo.SelBgn_set(v); GfoEvMgr_.Pub(this, Evt__selection_start_changed);}
|
||||
public int SelLen() {return combo.SelLen();} public void SelLen_set(int v) {combo.SelLen_set(v);}
|
||||
public void Sel_(int bgn, int len) {combo.Sel_(bgn, len);}
|
||||
public Object SelectedItm() {return combo.SelectedItm();} public void SelectedItm_set(Object v) {combo.SelectedItm_set(v);}
|
||||
public String[] DataSource_as_str_ary() {return combo.DataSource_as_str_ary();}
|
||||
public void DataSource_set(Object... ary) {combo.DataSource_set(ary);}
|
||||
public String Text_fallback() {return combo.Text_fallback();}
|
||||
public void Text_fallback_(String v) {combo.Text_fallback_(v);}
|
||||
public int List_sel_idx() {return combo.List_sel_idx();}
|
||||
public void List_sel_idx_(int v) {combo.List_sel_idx_(v);}
|
||||
public boolean List_visible() {return combo.List_visible();}
|
||||
public void List_visible_(boolean v) {combo.List_visible_(v);}
|
||||
public void Items__update(String[] ary) {combo.Items__update(ary);}
|
||||
public void Items__size_to_fit(int len) {combo.Items__size_to_fit(len);}
|
||||
public void Items__visible_rows_(int v) {combo.Items__visible_rows_(v);}
|
||||
public void Items__jump_len_(int v) {combo.Items__jump_len_(v);}
|
||||
public void Margins_set(int left, int top, int right, int bot) {combo.Margins_set(left, top, right, bot);}
|
||||
public static GfuiComboBox new_() {
|
||||
GfuiComboBox rv = new GfuiComboBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
}
|
||||
public static GfuiComboBox kit_(Gfui_kit kit, String key, GxwElem elm, Keyval_hash ctorArgs) {
|
||||
GfuiComboBox rv = new GfuiComboBox();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, elm, ctorArgs);
|
||||
rv.combo = (GxwComboBox)elm;
|
||||
return rv;
|
||||
}
|
||||
public static final String
|
||||
Evt__selected_changed = "Selected_changed"
|
||||
, Evt__selected_accepted = "Selected_accepted"
|
||||
, Evt__selection_start_changed = "SelectionStartChanged"
|
||||
;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ public class GfuiLbl extends GfuiElemBase { // standard label does not support t
|
||||
this.TextMgr().DrawData(args.Graphics());
|
||||
return true;
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class GfuiLbl_ {
|
||||
rv.TextMgr().AlignH_(GfuiAlign_.Mid);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiLbl kit_(Gfui_kit kit, String key, GxwElem elm, KeyValHash ctorArgs) {
|
||||
public static GfuiLbl kit_(Gfui_kit kit, String key, GxwElem elm, Keyval_hash ctorArgs) {
|
||||
GfuiLbl rv = new GfuiLbl();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, elm, ctorArgs);
|
||||
return rv;
|
||||
|
||||
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import gplx.core.lists.*; /*EnumerAble*/
|
||||
public class GfuiListBox extends GfuiElemBase {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.listBox_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.listBox_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.listBox = (GxwListBox)UnderElem();
|
||||
}
|
||||
|
||||
@@ -54,12 +54,12 @@ public class GfuiTextBox extends GfuiElemBase {
|
||||
|
||||
@gplx.Internal protected void SetTextBox(GxwTextFld textBox) {this.textBox = textBox;}
|
||||
@gplx.Internal protected void CreateControlIfNeeded() {textBox.CreateControlIfNeeded();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.text_fld_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.text_fld_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
textBox = (GxwTextFld)this.UnderElem();
|
||||
} GxwTextFld textBox;
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
textBox = (GxwTextFld)underElem;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GfuiTextBox_ {
|
||||
rv.Key_of_GfuiElem_(key).Owner_(owner);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiTextBox kit_(Gfui_kit kit, String key, GxwTextFld wk_textBox, KeyValHash ctorArgs) {
|
||||
public static GfuiTextBox kit_(Gfui_kit kit, String key, GxwTextFld wk_textBox, Keyval_hash ctorArgs) {
|
||||
GfuiTextBox rv = new GfuiTextBox();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, wk_textBox, ctorArgs);
|
||||
return rv;
|
||||
|
||||
@@ -32,8 +32,8 @@ public class GfuiTextMemo extends GfuiTextBox { public int LinesPerScreen() {re
|
||||
public void SelectionStart_toFirstChar() {textBox.SelectionStart_toFirstChar(); GfoEvMgr_.Pub(this, SelectionStartChanged_evt);}
|
||||
public void ScrollTillSelectionStartIsFirstLine() {textBox.ScrollTillSelectionStartIsFirstLine();}
|
||||
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.text_memo_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.text_memo_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
textBox = (GxwTextMemo)UnderElem();
|
||||
this.SetTextBox(textBox);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Gfui_html extends GfuiElemBase {
|
||||
this.Html_doc_html_load_by_mem(v);
|
||||
return this;
|
||||
}
|
||||
public static Gfui_html kit_(Gfui_kit kit, String key, Gxw_html under, KeyValHash ctorArgs) {
|
||||
public static Gfui_html kit_(Gfui_kit kit, String key, Gxw_html under, Keyval_hash ctorArgs) {
|
||||
Gfui_html rv = new Gfui_html();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctorArgs);
|
||||
rv.under = under;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Gfui_tab_itm extends GfuiElemBase {
|
||||
public String Tab_name() {return under.Tab_name();} public void Tab_name_(String v) {under.Tab_name_(v);}
|
||||
public String Tab_tip_text() {return under.Tab_tip_text();} public void Tab_tip_text_(String v) {under.Tab_tip_text_(v);}
|
||||
public void Subs_add(GfuiElem elem) {under.Subs_add(elem);}
|
||||
public static Gfui_tab_itm kit_(Gfui_kit kit, String key, Gxw_tab_itm under, KeyValHash ctor_args) {
|
||||
public static Gfui_tab_itm kit_(Gfui_kit kit, String key, Gxw_tab_itm under, Keyval_hash ctor_args) {
|
||||
Gfui_tab_itm rv = new Gfui_tab_itm();
|
||||
// rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctor_args); // causes swt_tab_itm to break, since it's not a real Swt Control
|
||||
rv.under = under;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Gfui_tab_mgr extends GfuiElemBase {
|
||||
public ColorAdp Btns_unselected_color() {return under.Btns_unselected_color();} public void Btns_unselected_color_(ColorAdp v) {under.Btns_unselected_color_(v);}
|
||||
public Gfui_tab_itm Tabs_add(Gfui_tab_itm_data tab_data) {
|
||||
Gxw_tab_itm tab_itm = under.Tabs_add(tab_data);
|
||||
return Gfui_tab_itm.kit_(this.Kit(), tab_data.Key(), tab_itm, KeyValHash.Empty);
|
||||
return Gfui_tab_itm.kit_(this.Kit(), tab_data.Key(), tab_itm, new Keyval_hash());
|
||||
}
|
||||
public int Btns_height() {return under.Btns_height();} public void Btns_height_(int v) {under.Btns_height_(v);}
|
||||
public boolean Btns_place_on_top() {return under.Btns_place_on_top();} public void Btns_place_on_top_(boolean v) {under.Btns_place_on_top_(v);}
|
||||
@@ -32,7 +32,7 @@ public class Gfui_tab_mgr extends GfuiElemBase {
|
||||
public void Tabs_select_by_idx(int idx) {under.Tabs_select_by_idx(idx);}
|
||||
public void Tabs_close_by_idx(int idx) {under.Tabs_close_by_idx(idx);}
|
||||
public void Tabs_switch(int src, int trg) {under.Tabs_switch(src, trg);}
|
||||
public static Gfui_tab_mgr kit_(Gfui_kit kit, String key, Gxw_tab_mgr under, KeyValHash ctor_args) {
|
||||
public static Gfui_tab_mgr kit_(Gfui_kit kit, String key, Gxw_tab_mgr under, Keyval_hash ctor_args) {
|
||||
Gfui_tab_mgr rv = new Gfui_tab_mgr();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctor_args);
|
||||
rv.under = under;
|
||||
|
||||
@@ -28,8 +28,8 @@ public class GfuiCheckListBox extends GfuiElemBase {
|
||||
public List_adp Items_getChecked() {return checkListBox.Items_getChecked();}
|
||||
|
||||
GxwCheckListBox checkListBox;
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.checkListBox = (GxwCheckListBox)UnderElem();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiCheckListPanel extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
InitToggleWidget();
|
||||
InitReverseWidget();
|
||||
|
||||
@@ -17,10 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiFormPanel extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Width_(60); // default to 60; do not force callers to always set width
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.FetchValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
|
||||
GfoFactory_gfui.Btn_MoveBox(this, ownerForm);
|
||||
GfoFactory_gfui.Btn_MinWin2(this);
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public abstract class GfuiIoUrlSelectBox extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
label = GfuiLbl_.sub_("label", this);
|
||||
pathBox.Owner_(this, "pathBox");
|
||||
|
||||
@@ -16,8 +16,8 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Text_("*");
|
||||
this.TipText_("move/resize");
|
||||
|
||||
@@ -29,7 +29,7 @@ public class GfuiStatusBar extends GfuiElemBase {
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String StatusBarFocus_cmd = "StatusBarFocus";
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
moveBtn = GfuiMoveElemBtn.new_();
|
||||
statusBox = GfuiStatusBox_.new_("statusBox");
|
||||
|
||||
@@ -68,14 +68,14 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
return this;
|
||||
} static final String Invk_HideWindow = "HideWindow", Invk_WriteText = "WriteText", Invk_Text_empty = "Text_empty";
|
||||
TimerAdp timer;
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
this.Visible_set(false);
|
||||
timer = TimerAdp.new_(this, Invk_HideWindow, 2000, false);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
@@ -83,7 +83,7 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
timerCmd = kit.New_cmd_sync(this);
|
||||
timer = TimerAdp.new_(timerCmd, GfuiInvkCmd_.Invk_sync, 2000, false);
|
||||
} GfuiInvkCmd timerCmd;
|
||||
public void ctor_kit_GfuiElemBase_drd(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
public void ctor_kit_GfuiElemBase_drd(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TabBox extends GfuiElemBase {
|
||||
else return super.Invk(GfsCtx.Instance, 0, k, m);
|
||||
return this;
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
btnBox = TabBtnAreaMgr.new_("btnBox", this);
|
||||
pnlBox = TabPnlAreaMgr.new_("pnlBox", this);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TabBoxEvt_orderChanged {
|
||||
|
||||
public static final String OrderChanged_evt = "OrderChanged_evt";
|
||||
public static void Publish(TabBox tabBox, int curIdx, int newIdx) {
|
||||
GfoEvMgr_.PubVals(tabBox, OrderChanged_evt, KeyVal_.new_("curIdx", curIdx), KeyVal_.new_("newIdx", newIdx));
|
||||
GfoEvMgr_.PubVals(tabBox, OrderChanged_evt, Keyval_.new_("curIdx", curIdx), Keyval_.new_("newIdx", newIdx));
|
||||
}
|
||||
public static TabBoxEvt_orderChanged Handle(GfsCtx ctx, GfoMsg m) {
|
||||
TabBoxEvt_orderChanged rv = new TabBoxEvt_orderChanged();
|
||||
|
||||
@@ -32,13 +32,14 @@ public interface Gfui_kit extends GfoInvkAble {
|
||||
int Ask_yes_no_cancel(String grp_key, String msg_key, String fmt, Object... args);
|
||||
GfuiInvkCmd New_cmd_sync(GfoInvkAble invk);
|
||||
GfuiInvkCmd New_cmd_async(GfoInvkAble invk);
|
||||
GfuiWin New_win_app(String key, KeyVal... args);
|
||||
GfuiWin New_win_utl(String key, GfuiWin owner, KeyVal... args);
|
||||
Gfui_html New_html(String key, GfuiElem owner, KeyVal... args);
|
||||
Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiTextBox New_text_box(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiBtn New_btn(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiLbl New_lbl(String key, GfuiElem owner, KeyVal... args);
|
||||
GfuiWin New_win_app(String key, Keyval... args);
|
||||
GfuiWin New_win_utl(String key, GfuiWin owner, Keyval... args);
|
||||
Gfui_html New_html(String key, GfuiElem owner, Keyval... args);
|
||||
Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiTextBox New_text_box(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args);
|
||||
GfuiLbl New_lbl(String key, GfuiElem owner, Keyval... args);
|
||||
Gfui_dlg_file New_dlg_file(byte type, String msg);
|
||||
Gfui_dlg_msg New_dlg_msg(String msg);
|
||||
ImageAdp New_img_load(Io_url path);
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
private KeyValHash ctor_args = KeyValHash.new_();
|
||||
private Keyval_hash ctor_args = new Keyval_hash();
|
||||
public abstract byte Tid();
|
||||
public abstract String Key();
|
||||
public abstract GxwElemFactory_base Factory();
|
||||
@@ -36,43 +36,48 @@ public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
public void Btn_img_(GfuiBtn btn, IconAdp v) {}
|
||||
public GfuiInvkCmd New_cmd_sync(GfoInvkAble invk) {return new Gfui_kit_cmd_sync(invk);}
|
||||
public GfuiInvkCmd New_cmd_async(GfoInvkAble invk) {return new Gfui_kit_cmd_async(invk);}
|
||||
public GfuiWin New_win_app(String key, KeyVal... args) {
|
||||
public GfuiWin New_win_app(String key, Keyval... args) {
|
||||
GfuiWin rv = GfuiWin_.kit_(this, key, this.Factory().win_app_(), ctor_args);
|
||||
main_win = rv;
|
||||
return rv;
|
||||
}
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, KeyVal... args) {return GfuiWin_.kit_(this, key, this.Factory().win_tool_(ctor_args), ctor_args);}
|
||||
@gplx.Virtual public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, Keyval... args) {return GfuiWin_.kit_(this, key, this.Factory().win_tool_(ctor_args), ctor_args);}
|
||||
@gplx.Virtual public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
Gfui_html rv = Gfui_html.kit_(this, key, this.New_html_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, KeyVal... args) {
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, Keyval... args) {
|
||||
Gfui_tab_mgr rv = Gfui_tab_mgr.kit_(this, key, this.New_tab_mgr_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public Gfui_tab_itm New_tab_itm(String key, Gfui_tab_mgr owner, KeyVal... args) {
|
||||
public Gfui_tab_itm New_tab_itm(String key, Gfui_tab_mgr owner, Keyval... args) {
|
||||
Gfui_tab_itm rv = Gfui_tab_itm.kit_(this, key, this.New_tab_itm_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiTextBox rv = GfuiTextBox_.kit_(this, key, this.Factory().text_fld_(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiBtn New_btn(String key, GfuiElem owner, KeyVal... args) {
|
||||
@gplx.Virtual public GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiBtn rv = GfuiBtn_.kit_(this, key, New_btn_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiLbl New_lbl(String key, GfuiElem owner, KeyVal... args) {
|
||||
@gplx.Virtual public GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiComboBox rv = GfuiComboBox.kit_(this, key, New_combo_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiLbl New_lbl(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiLbl rv = GfuiLbl_.kit_(this, key, New_btn_impl(), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Virtual public GfuiStatusBox New_status_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
@gplx.Virtual public GfuiStatusBox New_status_box(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiStatusBox rv = GfuiStatusBox_.kit_(this, key, this.Factory().text_memo_());
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
@@ -82,6 +87,7 @@ public abstract class Gfui_kit_base implements Gfui_kit {
|
||||
protected abstract Gxw_tab_mgr New_tab_mgr_impl();
|
||||
protected abstract Gxw_tab_itm New_tab_itm_impl();
|
||||
protected abstract GxwElem New_btn_impl();
|
||||
protected abstract GxwElem New_combo_impl();
|
||||
@gplx.Virtual public Gfui_dlg_file New_dlg_file(byte type, String msg) {return Gfui_dlg_file_.Noop;}
|
||||
@gplx.Virtual public Gfui_dlg_msg New_dlg_msg(String msg) {return Gfui_dlg_msg_.Noop;}
|
||||
@gplx.Virtual public Gfui_mnu_grp New_mnu_popup(String key, GfuiElem owner) {return Gfui_mnu_grp_.Noop;}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Mem_kit extends Gfui_kit_base {
|
||||
@Override public String Key() {return "mem";}
|
||||
@Override public GxwElemFactory_base Factory() {return factory;} private GxwElemFactory_cls_mock factory = new GxwElemFactory_cls_mock();
|
||||
public void New_html_impl_prototype_(Gxw_html v) {html_impl_prototype = v;} private Gxw_html html_impl_prototype;
|
||||
@Override public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
|
||||
@Override public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
if (html_impl_prototype == null)
|
||||
return super.New_html(key, owner, args);
|
||||
else {
|
||||
@@ -33,6 +33,7 @@ public class Mem_kit extends Gfui_kit_base {
|
||||
@Override protected Gxw_tab_mgr New_tab_mgr_impl() {return new Mem_tab_mgr();}
|
||||
@Override protected Gxw_tab_itm New_tab_itm_impl() {return new Mem_tab_itm();}
|
||||
@Override protected GxwElem New_btn_impl() {return factory.control_();}
|
||||
@Override protected GxwElem New_combo_impl() {return factory.comboBox_();}
|
||||
@Override public ImageAdp New_img_load(Io_url url) {return ImageAdp_null.Instance;}
|
||||
public static final Mem_kit Instance = new Mem_kit(); Mem_kit() {}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,6 @@ public class Swing_kit extends Gfui_kit_base {
|
||||
@Override protected Gxw_tab_mgr New_tab_mgr_impl() {return new Mem_tab_mgr();}
|
||||
@Override protected Gxw_tab_itm New_tab_itm_impl() {return new Mem_tab_itm();}
|
||||
@Override protected GxwElem New_btn_impl() {return factory.control_();}
|
||||
@Override protected GxwElem New_combo_impl() {return factory.control_();}
|
||||
public static final Swing_kit Instance = new Swing_kit(); Swing_kit() {}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.omg.PortableServer.THREAD_POLICY_ID;
|
||||
|
||||
import gplx.core.threads.*;
|
||||
public class Swt_kit implements Gfui_kit {
|
||||
private final KeyValHash ctor_args = KeyValHash.new_(); private final KeyValHash ctor_args_null = KeyValHash.new_();
|
||||
private final Keyval_hash ctor_args = new Keyval_hash(); private final Keyval_hash ctor_args_null = new Keyval_hash();
|
||||
private final Hash_adp kit_args = Hash_adp_.new_(); private Swt_msg_wkr_stop msg_wkr_stop;
|
||||
private Gfo_usr_dlg gui_wtr; private String xul_runner_path = null;
|
||||
private final Bry_fmtr ask_fmtr = Bry_fmtr.new_().Fail_when_invalid_escapes_(false); private final Bry_bfr ask_bfr = Bry_bfr.new_();
|
||||
@@ -80,7 +80,14 @@ public class Swt_kit implements Gfui_kit {
|
||||
shell.open();
|
||||
Cursor cursor = new Cursor(display, SWT.CURSOR_ARROW);
|
||||
shell.setCursor(cursor); // set cursor to hand else cursor defaults to Hourglass until mouse is moved; DATE: 2014-01-31
|
||||
boolean first = true;
|
||||
while (!shell.isDisposed()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
// shell.setMinimized(true);
|
||||
shell.setActive();
|
||||
shell.forceFocus();
|
||||
}
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
@@ -98,9 +105,9 @@ public class Swt_kit implements Gfui_kit {
|
||||
return;
|
||||
}
|
||||
// add kv to widget_cfg_hash; new controls will get properties from cfg_hash
|
||||
KeyValHash widget_cfg_hash = (KeyValHash)kit_args.Get_by(type);
|
||||
Keyval_hash widget_cfg_hash = (Keyval_hash)kit_args.Get_by(type);
|
||||
if (widget_cfg_hash == null) {
|
||||
widget_cfg_hash = KeyValHash.new_();
|
||||
widget_cfg_hash = new Keyval_hash();
|
||||
kit_args.Add(type, widget_cfg_hash);
|
||||
}
|
||||
widget_cfg_hash.Add_if_dupe_use_nth(key, val);
|
||||
@@ -126,31 +133,31 @@ public class Swt_kit implements Gfui_kit {
|
||||
}
|
||||
public GfuiInvkCmd New_cmd_sync (GfoInvkAble invk) {return new Swt_gui_cmd(this, gui_wtr, display, invk, Bool_.N);}
|
||||
public GfuiInvkCmd New_cmd_async(GfoInvkAble invk) {return new Swt_gui_cmd(this, gui_wtr, display, invk, Bool_.Y);}
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, KeyVal... args) {
|
||||
public GfuiWin New_win_utl(String key, GfuiWin owner, Keyval... args) {
|
||||
return GfuiWin_.kit_(this, key, new Swt_win(shell), ctor_args_null);
|
||||
}
|
||||
public GfuiWin New_win_app(String key, KeyVal... args) {
|
||||
public GfuiWin New_win_app(String key, Keyval... args) {
|
||||
Swt_win win = new Swt_win(display);
|
||||
this.shell = win.UnderShell();
|
||||
shell.setLayout(null);
|
||||
return GfuiWin_.kit_(this, key, win, ctor_args_null);
|
||||
}
|
||||
public GfuiBtn New_btn(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiBtn rv = GfuiBtn_.kit_(this, key, new Swt_btn_no_border(Swt_control_.cast_or_fail(owner), ctor_args), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public GfuiLbl New_lbl(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiLbl New_lbl(String key, GfuiElem owner, Keyval... args) {
|
||||
GfuiLbl rv = GfuiLbl_.kit_(this, key, new Swt_lbl(Swt_control_.cast_or_fail(owner), ctor_args), ctor_args);
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
|
||||
public Gfui_html New_html(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
// check cfg for browser type
|
||||
KeyValHash html_cfg_args = (KeyValHash)kit_args.Get_by(Gfui_kit_.Cfg_HtmlBox);
|
||||
Keyval_hash html_cfg_args = (Keyval_hash)kit_args.Get_by(Gfui_kit_.Cfg_HtmlBox);
|
||||
if (html_cfg_args != null) {
|
||||
KeyVal browser_type = html_cfg_args.FetchOrNull(Cfg_Html_BrowserType);
|
||||
Keyval browser_type = html_cfg_args.Get_kvp_or_null(Cfg_Html_BrowserType);
|
||||
if (browser_type != null) ctor_args.Add(browser_type);
|
||||
}
|
||||
Swt_html swt_html = new Swt_html(this, Swt_control_.cast_or_fail(owner), ctor_args);
|
||||
@@ -160,7 +167,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
swt_html.Delete_elems_(owner, gfui_html);
|
||||
return gfui_html;
|
||||
}
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, KeyVal... args) {
|
||||
public Gfui_tab_mgr New_tab_mgr(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
Swt_tab_mgr rv_swt = new Swt_tab_mgr(this, Swt_control_.cast_or_fail(owner), ctor_args);
|
||||
Gfui_tab_mgr rv = Gfui_tab_mgr.kit_(this, key, rv_swt, ctor_args);
|
||||
@@ -168,19 +175,26 @@ public class Swt_kit implements Gfui_kit {
|
||||
rv_swt.EvMgr_(rv.EvMgr());
|
||||
return rv;
|
||||
}
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiTextBox New_text_box(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
int args_len = args.length;
|
||||
for (int i = 0; i < args_len; i++)
|
||||
ctor_args.Add(args[i]);
|
||||
boolean border_on = Bool_.cast(ctor_args.FetchValOr(GfuiTextBox.CFG_border_on_, true));
|
||||
boolean border_on = Bool_.cast(ctor_args.Get_val_or(GfuiTextBox.CFG_border_on_, true));
|
||||
GxwTextFld under = new Swt_text_w_border(Swt_control_.cast_or_fail(owner), New_color(border_on ? ColorAdp_.LightGray : ColorAdp_.White), ctor_args);
|
||||
GfuiTextBox rv = GfuiTextBox_.kit_(this, key, under, ctor_args);
|
||||
rv.Owner_(owner);
|
||||
ctor_args.Clear();
|
||||
return rv;
|
||||
}
|
||||
public GfuiStatusBox New_status_box(String key, GfuiElem owner, KeyVal... args) {
|
||||
public GfuiComboBox New_combo(String key, GfuiElem owner, Keyval... args) {
|
||||
Swt_combo_ctrl rv_swt = new Swt_combo_ctrl(Swt_control_.cast_or_fail(owner), this.New_color(ColorAdp_.LightGray), ctor_args);
|
||||
GfuiComboBox rv = GfuiComboBox.kit_(this, key, rv_swt, ctor_args);
|
||||
rv.Owner_(owner);
|
||||
rv_swt.EvMgr_(rv.EvMgr());
|
||||
return rv;
|
||||
}
|
||||
public GfuiStatusBox New_status_box(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Clear();
|
||||
GfuiStatusBox rv = GfuiStatusBox_.kit_(this, key, new Swt_text(Swt_control_.cast_or_fail(owner), ctor_args));
|
||||
rv.Owner_(owner);
|
||||
|
||||
@@ -16,6 +16,9 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui;
|
||||
import gplx.Byte_ascii;
|
||||
import gplx.String_;
|
||||
|
||||
import org.eclipse.swt.*;
|
||||
import org.eclipse.swt.browser.*;
|
||||
import org.eclipse.swt.custom.*;
|
||||
@@ -23,6 +26,8 @@ import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.events.KeyListener;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.*;
|
||||
import org.eclipse.swt.layout.*;
|
||||
import org.eclipse.swt.widgets.*;
|
||||
@@ -30,8 +35,10 @@ public class Swt_app_main {
|
||||
public static void main(String[] args) {
|
||||
// Drag_drop();
|
||||
// List_fonts();
|
||||
// keystrokes(args);
|
||||
Permission_denied();
|
||||
keystrokes(args);
|
||||
// Permission_denied();
|
||||
// Combo_default();
|
||||
// Combo_composite();
|
||||
}
|
||||
static void Drag_drop() {
|
||||
final Display display = new Display();
|
||||
@@ -197,4 +204,226 @@ public class Swt_app_main {
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
public static void Combo_dflt() {
|
||||
Display display = new Display();
|
||||
Shell shell = new Shell(display);
|
||||
shell.setLayout(new FillLayout());
|
||||
|
||||
String[] ITEMS = { "A", "B", "C", "D" };
|
||||
|
||||
final Combo combo = new Combo(shell, SWT.DROP_DOWN);
|
||||
combo.setItems(ITEMS);
|
||||
combo.select(2);
|
||||
|
||||
combo.addSelectionListener(new SelectionListener() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
System.out.println(combo.getText());
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
System.out.println(combo.getText());
|
||||
}
|
||||
});
|
||||
combo.addKeyListener(new KeyListener() {
|
||||
@Override
|
||||
public void keyReleased(KeyEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent arg0) {
|
||||
System.out.println(combo.getText());
|
||||
if (arg0.keyCode == Byte_ascii.Ltr_a) {
|
||||
combo.setItem(0, "a");
|
||||
combo.setListVisible(true);
|
||||
}
|
||||
else if (arg0.keyCode == Byte_ascii.Ltr_b) {
|
||||
combo.setItem(0, "b");
|
||||
combo.setListVisible(true);
|
||||
}
|
||||
// System.out.println(combo.getText());
|
||||
}
|
||||
});
|
||||
|
||||
shell.open();
|
||||
combo.setListVisible(true);
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
public static void Combo_composite() {
|
||||
final Display display = new Display();
|
||||
final Shell shell = new Shell(display);
|
||||
GridLayout gridLayout = new GridLayout();
|
||||
gridLayout.numColumns = 2;
|
||||
gridLayout.makeColumnsEqualWidth = true;
|
||||
shell.setLayout(gridLayout);
|
||||
final Text text = new Text(shell, SWT.BORDER);
|
||||
text.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
|
||||
Text text2 = new Text(shell, SWT.BORDER);
|
||||
text2.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_END));
|
||||
shell.pack();
|
||||
shell.open();
|
||||
|
||||
final Shell combo_shell = new Shell(display, SWT.ON_TOP);
|
||||
combo_shell.setLayout(new FillLayout());
|
||||
final Table combo_table = new Table(combo_shell, SWT.SINGLE);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
new TableItem(combo_table, SWT.NONE);
|
||||
}
|
||||
|
||||
text.addListener(SWT.KeyDown, new Listener() {
|
||||
@Override public void handleEvent(Event event) {
|
||||
int index = -1;
|
||||
switch (event.keyCode) {
|
||||
case SWT.ARROW_DOWN:
|
||||
if (event.stateMask == SWT.ALT) {
|
||||
Rectangle text_bounds = display.map(shell, null, text.getBounds());
|
||||
combo_shell.setBounds(text_bounds.x, text_bounds.y + text_bounds.height, text_bounds.width, (text_bounds.height - 1) * combo_table.getItems().length);
|
||||
combo_shell.setVisible(true);
|
||||
} else {
|
||||
index = (combo_table.getSelectionIndex() + 1) % combo_table.getItemCount();
|
||||
combo_table.setSelection(index);
|
||||
event.doit = false;
|
||||
}
|
||||
break;
|
||||
case SWT.ARROW_UP:
|
||||
if (event.stateMask == SWT.ALT) {
|
||||
combo_shell.setVisible(false);
|
||||
} else {
|
||||
index = combo_table.getSelectionIndex() - 1;
|
||||
if (index < 0) index = combo_table.getItemCount() - 1;
|
||||
combo_table.setSelection(index);
|
||||
event.doit = false;
|
||||
}
|
||||
break;
|
||||
case SWT.CR:
|
||||
if (combo_shell.isVisible() && combo_table.getSelectionIndex() != -1) {
|
||||
text.setText(combo_table.getSelection()[0].getText());
|
||||
combo_shell.setVisible(false);
|
||||
}
|
||||
break;
|
||||
case SWT.ESC:
|
||||
combo_shell.setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
text.addListener(SWT.Modify, new Listener() {
|
||||
@Override public void handleEvent(Event event) {
|
||||
String string = text.getText();
|
||||
if (string.length() == 0) {
|
||||
combo_shell.setVisible(false);
|
||||
} else {
|
||||
TableItem[] items = combo_table.getItems();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].setText(string + '-' + i);
|
||||
}
|
||||
|
||||
Rectangle text_bounds = display.map(shell, null, text.getBounds());
|
||||
combo_shell.setBounds(text_bounds.x, text_bounds.y + text_bounds.height, text_bounds.width, (text_bounds.height - 1) * items.length);
|
||||
combo_shell.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
combo_table.addListener(SWT.DefaultSelection, new Listener() {
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
text.setText(combo_table.getSelection()[0].getText());
|
||||
combo_shell.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
combo_table.addListener(SWT.KeyDown, new Listener() {
|
||||
@Override public void handleEvent(Event event) {
|
||||
if (event.keyCode == SWT.ESC) {
|
||||
combo_shell.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final Swt_shell_hider shell_hider = new Swt_shell_hider(combo_shell);
|
||||
Listener focus_out_listener = new Listener() {
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
if (display.isDisposed()) return;
|
||||
Control control = display.getFocusControl();
|
||||
// if (control == null || (control != text && control != combo_table)) {
|
||||
// combo_shell.setVisible(false);
|
||||
// }
|
||||
if (control == null || (control == text || control == combo_table)) {
|
||||
// combo_shell.setVisible(false);
|
||||
shell_hider.Active = true;
|
||||
display.asyncExec(shell_hider);
|
||||
//Thread t = new Thread(shell_hider); t.start();
|
||||
//Swt_shell_hider
|
||||
}
|
||||
|
||||
// boolean combo_is_focus = combo_table.isFocusControl();
|
||||
// boolean text_is_focus = text.isFocusControl();
|
||||
// if (control == null || (control == text)) {
|
||||
// combo_shell.setVisible(false);
|
||||
// }
|
||||
// if (control == null || (control == combo_table)) {
|
||||
// combo_shell.setVisible(true);
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
combo_table.addListener(SWT.FocusOut, focus_out_listener);
|
||||
text.addListener(SWT.FocusOut, focus_out_listener);
|
||||
|
||||
Listener focus_in_listener = new Listener() {
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
if (display.isDisposed()) return;
|
||||
Control control = display.getFocusControl();
|
||||
if (control == combo_table) {
|
||||
// combo_shell.setVisible(false);
|
||||
//display.asyncExec(shell_hider);
|
||||
shell_hider.Active = false;
|
||||
//Swt_shell_hider
|
||||
}
|
||||
// boolean combo_is_focus = combo_table.isFocusControl();
|
||||
// boolean text_is_focus = text.isFocusControl();
|
||||
// if (control == null || (control == text)) {
|
||||
// combo_shell.setVisible(false);
|
||||
// }
|
||||
// if (control == null || (control == combo_table)) {
|
||||
// combo_shell.setVisible(true);
|
||||
// }
|
||||
}
|
||||
};
|
||||
combo_table.addListener(SWT.FocusIn, focus_in_listener);
|
||||
|
||||
shell.addListener(SWT.Move, new Listener() {
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
combo_shell.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) display.sleep();
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
}
|
||||
class Swt_shell_hider implements Runnable {
|
||||
public boolean Active = true;
|
||||
|
||||
private Shell combo_shell;
|
||||
public Swt_shell_hider(Shell combo_shell) {this.combo_shell = combo_shell;}
|
||||
@Override public void run() {
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// } catch (InterruptedException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
if (Active) {
|
||||
combo_shell.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
class Swt_btn implements GxwElem, Swt_control {
|
||||
private Button btn;
|
||||
public Swt_btn(Swt_control owner, KeyValHash ctorArgs) {
|
||||
public Swt_btn(Swt_control owner, Keyval_hash ctorArgs) {
|
||||
btn = new Button(owner.Under_composite(), SWT.FLAT | SWT.PUSH);
|
||||
core = new Swt_core_cmds(btn);
|
||||
btn.addKeyListener(new Swt_lnr_key(this));
|
||||
@@ -58,7 +58,7 @@ class Swt_btn implements GxwElem, Swt_control {
|
||||
}
|
||||
class Swt_btn_no_border implements GxwElem, Swt_control {
|
||||
private ImageAdp btn_img; private Composite box_grp; private Label box_btn;
|
||||
public Swt_btn_no_border(Swt_control owner_control, KeyValHash ctorArgs) {
|
||||
public Swt_btn_no_border(Swt_control owner_control, Keyval_hash ctorArgs) {
|
||||
Composite owner = owner_control.Under_composite();
|
||||
Make_btn_no_border(owner.getDisplay(), owner.getShell(), owner);
|
||||
this.core = new Swt_core_cmds(box_btn);
|
||||
|
||||
99
150_gfui/xtn/gplx/gfui/Swt_combo.java
Normal file
99
150_gfui/xtn/gplx/gfui/Swt_combo.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui;
|
||||
|
||||
import gplx.GfoEvMgr;
|
||||
import gplx.GfoEvMgrOwner;
|
||||
import gplx.GfoEvMgr_;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Keyval_hash;
|
||||
import gplx.String_;
|
||||
import gplx.Tfds;
|
||||
import gplx.core.threads.Thread_adp;
|
||||
import gplx.core.threads.Thread_adp_;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
class Swt_combo implements GxwElem, GxwComboBox, Swt_control, GfoEvMgrOwner {
|
||||
private final Combo combo;
|
||||
public Swt_combo(Swt_control owner, Keyval_hash ctorArgs) {
|
||||
combo = new Combo(owner.Under_composite(), SWT.DROP_DOWN);
|
||||
core = new Swt_core_cmds(combo);
|
||||
combo.addKeyListener(new Swt_lnr_key(this));
|
||||
combo.addMouseListener(new Swt_lnr_mouse(this));
|
||||
combo.addSelectionListener(new Swt_combo__selection_listener(this));
|
||||
}
|
||||
@Override public GfoEvMgr EvMgr() {return ev_mgr;} private GfoEvMgr ev_mgr; public void EvMgr_(GfoEvMgr v) {ev_mgr = v;}
|
||||
@Override public Control Under_control() {return combo;}
|
||||
@Override public Control Under_menu_control() {return combo;}
|
||||
@Override public String TextVal() {return combo.getText();} @Override public void TextVal_set(String v) {combo.setText(v);}
|
||||
@Override public GxwCore_base Core() {return core;} GxwCore_base core;
|
||||
@Override public GxwCbkHost Host() {return host;} @Override public void Host_set(GxwCbkHost host) {this.host = host;} GxwCbkHost host;
|
||||
@Override public Composite Under_composite() {return null;}
|
||||
@Override public void EnableDoubleBuffering() {}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return null;}
|
||||
@Override public Object SelectedItm() {return null;}
|
||||
@Override public int SelBgn() {return combo.getSelection().x;} @Override public void SelBgn_set(int v) {combo.setSelection(new Point(combo.getSelection().y, v));}
|
||||
@Override public int SelLen() {return combo.getSelection().y;} @Override public void SelLen_set(int v) {combo.setSelection(new Point(v, combo.getSelection().x));}
|
||||
@Override public void Sel_(int bgn, int end) {combo.setSelection(new Point(bgn, end));}
|
||||
@Override public void SelectedItm_set(Object v) {}
|
||||
@Override public String[] DataSource_as_str_ary() {return String_.Ary_empty;}
|
||||
@Override public void DataSource_set(Object... ary) {combo.setItems((String[])ary);}
|
||||
@Override public String Text_fallback() {return "";} @Override public void Text_fallback_(String v) {}
|
||||
@Override public int List_sel_idx() {return -1;} @Override public void List_sel_idx_(int v) {}
|
||||
@Override public void Items__update(String[] ary) {}
|
||||
@Override public void Items__size_to_fit(int count) {}
|
||||
@Override public void Items__visible_rows_(int v) {}
|
||||
@Override public void Items__jump_len_(int v) {}
|
||||
@Override public void Margins_set(int left, int top, int right, int bot) {}
|
||||
// @Override public void DataSource_update(Object... ary) {
|
||||
// String[] src = (String[])ary;
|
||||
// int trg_len = combo.getItems().length;
|
||||
// int src_len = src.length;
|
||||
// for (int i = 0; i < trg_len; ++i) {
|
||||
// combo.setItem(i, i < src_len ? src[i] : "");
|
||||
// }
|
||||
// }
|
||||
@Override public boolean List_visible() {return combo.getListVisible();}
|
||||
@Override public void List_visible_(boolean v) {
|
||||
String prv_text = combo.getText();
|
||||
combo.setListVisible(v);
|
||||
String cur_text = combo.getText();
|
||||
while (!String_.Eq(cur_text, prv_text)) { // NOTE: setting setListVisible to true may cause text to grab item from dropDown list; try to reset to original value; DATE:2016-03-14
|
||||
Thread_adp_.Sleep(1);
|
||||
combo.setText(prv_text);
|
||||
cur_text = combo.getText();
|
||||
}
|
||||
int text_len = prv_text == null ? 0 : prv_text.length();
|
||||
combo.setSelection(new Point(text_len, text_len));
|
||||
}
|
||||
}
|
||||
class Swt_combo__selection_listener implements SelectionListener {
|
||||
private final Swt_combo combo;
|
||||
public Swt_combo__selection_listener(Swt_combo combo) {this.combo = combo;}
|
||||
@Override public void widgetSelected(SelectionEvent arg0) {
|
||||
GfoEvMgr_.Pub(combo, GfuiComboBox.Evt__selected_changed);
|
||||
}
|
||||
@Override public void widgetDefaultSelected(SelectionEvent arg0) {}
|
||||
}
|
||||
394
150_gfui/xtn/gplx/gfui/Swt_combo_ctrl.java
Normal file
394
150_gfui/xtn/gplx/gfui/Swt_combo_ctrl.java
Normal file
@@ -0,0 +1,394 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui;
|
||||
|
||||
import gplx.*;
|
||||
import gplx.core.envs.Op_sys;
|
||||
import gplx.core.envs.Op_sys_;
|
||||
import gplx.core.threads.Thread_adp_;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
public class Swt_combo_ctrl extends Swt_text_w_border implements GxwElem, GxwComboBox, Swt_control, GfoEvMgrOwner { // REF: https://www.eclipse.org/forums/index.php/t/351029/; http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet320.java
|
||||
private final Text swt_text;
|
||||
private final Swt_combo_list list;
|
||||
public Swt_combo_ctrl(Swt_control owner, Color color, Keyval_hash ctorArgs) {
|
||||
super(owner, color, new Keyval_hash());
|
||||
Display display = owner.Under_control().getDisplay();
|
||||
Shell shell = owner.Under_control().getShell();
|
||||
this.swt_text = super.Under_text();
|
||||
this.list = new Swt_combo_list(display, shell, this);
|
||||
|
||||
swt_text.addListener(SWT.KeyDown, new Swt_combo_text__key_down(list));
|
||||
swt_text.addListener(SWT.MouseUp, new Swt_combo_text__mouse_up(list));
|
||||
|
||||
Table swt_list = list.Under_table_as_swt();
|
||||
swt_list.addListener(SWT.DefaultSelection, new Swt_combo_list__default_selection(this, list));
|
||||
swt_list.addListener(SWT.KeyDown, new Swt_combo_list__default_selection(this, list));
|
||||
swt_list.addListener(SWT.MouseDown, new Swt_combo_list__mouse_down(this, list));
|
||||
|
||||
// listeners to hide list-box when focus is transfered, shell is moved, text-box is clicked, etc
|
||||
Swt_combo_ctrl__list_hider_cmd list_hide_cmd = new Swt_combo_ctrl__list_hider_cmd(list);
|
||||
Swt_combo_ctrl__focus_out focus_out_lnr = new Swt_combo_ctrl__focus_out(display, this, list, list_hide_cmd);
|
||||
swt_text.addListener(SWT.FocusOut, focus_out_lnr);
|
||||
swt_list.addListener(SWT.FocusOut, focus_out_lnr);
|
||||
swt_text.addListener(SWT.FocusIn, new Swt_combo_text__focus_in(this, list));
|
||||
swt_list.addListener(SWT.FocusIn, new Swt_combo_ctrl__focus_in(display, list, list_hide_cmd));
|
||||
shell.addListener(SWT.Move, new Swt_combo_shell__move(list));
|
||||
}
|
||||
@Override public GfoEvMgr EvMgr() {return ev_mgr;} private GfoEvMgr ev_mgr; public void EvMgr_(GfoEvMgr v) {ev_mgr = v;}
|
||||
@Override public Object SelectedItm() {return null;}
|
||||
@Override public void SelectedItm_set(Object v) {}
|
||||
@Override public void Sel_(int bgn, int end) {swt_text.setSelection(new Point(bgn, end));}
|
||||
@Override public String[] DataSource_as_str_ary() {return list.Items_str_ary();}
|
||||
@Override public void DataSource_set(Object... ary) {list.Items_((String[])ary);}
|
||||
@Override public String Text_fallback() {return text_fallback;} private String text_fallback = "";// preserve original-text when using cursor keys in list-box
|
||||
@Override public void Text_fallback_(String v) {text_fallback = v;}
|
||||
public void Text_fallback_restore() {
|
||||
if (String_.Len_eq_0(text_fallback)) return; // handle escape pressed after dropdown is visible, but down / up not pressed
|
||||
this.Text_(text_fallback);
|
||||
this.text_fallback = "";
|
||||
}
|
||||
@Override public void Items__update(String[] ary) {list.Items_(ary);}
|
||||
@Override public void Items__size_to_fit(int count) {list.Resize_shell(count);}
|
||||
@Override public int List_sel_idx() {return list.Sel_idx();}
|
||||
@Override public void List_sel_idx_(int v) {list.Sel_idx_(v);}
|
||||
@Override public boolean List_visible() {return list.Visible();}
|
||||
@Override public void List_visible_(boolean v) {list.Visible_(v);}
|
||||
@Override public void Items__visible_rows_(int v) {list.Visible_rows = v;}
|
||||
@Override public void Items__jump_len_(int v) {list.Jump_len = v;}
|
||||
public Rectangle Bounds() {return super.Under_control().getBounds();}
|
||||
public String Text() {return swt_text.getText();} public void Text_(String v) {swt_text.setText(v);}
|
||||
public void Sel_all() {
|
||||
String text_text = swt_text.getText();
|
||||
this.Sel_(0, String_.Len(text_text));
|
||||
}
|
||||
}
|
||||
class Swt_combo_list {
|
||||
private final Display display; private final Shell owner_shell;
|
||||
private final Swt_combo_ctrl ctrl;
|
||||
private final Shell shell;
|
||||
private final Table table;
|
||||
private int list_len;
|
||||
public int Jump_len = 5;
|
||||
public int Visible_rows = 10;
|
||||
public Swt_combo_list(Display display, Shell owner_shell, Swt_combo_ctrl ctrl) {
|
||||
this.display = display; this.owner_shell = owner_shell; this.ctrl = ctrl;
|
||||
this.shell = new Shell(display, SWT.ON_TOP);
|
||||
shell.setLayout(new FillLayout());
|
||||
this.table = new Table(shell, SWT.SINGLE);
|
||||
}
|
||||
public Table Under_table_as_swt() {return table;}
|
||||
public int Items_len() {return table.getItemCount();}
|
||||
public TableItem[] Items() {return table.getItems();}
|
||||
public TableItem Sel_itm(int i) {return table.getSelection()[i];}
|
||||
public void Items_text_(int idx, String v) {table.getItem(idx).setText(v);}
|
||||
public String[] Items_str_ary() {return items_str_ary;} private String[] items_str_ary = String_.Ary_empty;
|
||||
public void Items_(String[] new_ary) {
|
||||
int new_len = new_ary.length;
|
||||
if (new_len == 0) Visible_(Bool_.N); // if new_ary is empty, then hide list box; else, brief flicker as items are removed
|
||||
|
||||
// remove all cur-items that are no longer needed b/c new_ary is smaller
|
||||
int cur_len = list_len;
|
||||
for (int i = new_len; i < cur_len; ++i) {
|
||||
table.remove(new_len);
|
||||
}
|
||||
|
||||
// update new_ary;
|
||||
for (int i = 0; i < new_len; ++i) {
|
||||
TableItem item = null;
|
||||
if (i < cur_len) // existing item; reuse it
|
||||
item = table.getItem(i);
|
||||
else // no ite; create a new one
|
||||
item = new TableItem(table, SWT.NONE);
|
||||
String cur_text = item.getText();
|
||||
String new_text = new_ary[i];
|
||||
if (!String_.Eq(cur_text, new_text) && new_text != null) {
|
||||
item.setText(new_text);
|
||||
}
|
||||
}
|
||||
this.list_len = new_len;
|
||||
|
||||
// resize list-shell to # of items
|
||||
int max_len = this.Visible_rows;
|
||||
if ( new_len == cur_len // do not resize if same #
|
||||
|| new_len > max_len && cur_len > max_len // do not resize if new_len and cur_len are both off-screen
|
||||
) {}
|
||||
this.items_str_ary = new_ary;
|
||||
// else
|
||||
// Resize_shell(list_len);
|
||||
}
|
||||
public int Sel_idx() {return table.getSelectionIndex();}
|
||||
public void Sel_idx_(int v) {table.setSelection(v);}
|
||||
public void Sel_idx_nudge(boolean fwd) {Sel_idx_adj(fwd, 1);}
|
||||
public void Sel_idx_jump(boolean fwd) {Sel_idx_adj(fwd, Jump_len);}
|
||||
private void Sel_idx_adj(boolean fwd, int adj) {
|
||||
if (!Visible()) Visible_(Bool_.Y); // these are called by cursor keys; always make visible
|
||||
int cur_idx = table.getSelectionIndex();
|
||||
int new_idx = cur_idx;
|
||||
int idx_n = list_len - 1;
|
||||
if (fwd) {
|
||||
if (cur_idx == idx_n)
|
||||
new_idx = -1;
|
||||
else if (cur_idx == -1)
|
||||
new_idx = 0;
|
||||
else {
|
||||
new_idx = cur_idx + adj;
|
||||
if (new_idx >= idx_n)
|
||||
new_idx = idx_n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cur_idx == 0)
|
||||
new_idx = -1;
|
||||
else if (cur_idx == -1)
|
||||
new_idx = idx_n;
|
||||
else {
|
||||
new_idx = cur_idx - adj;
|
||||
if (new_idx < 0)
|
||||
new_idx = 0;
|
||||
}
|
||||
}
|
||||
Sel_idx_by_key(new_idx);
|
||||
}
|
||||
public void Sel_idx_by_key(int v) {
|
||||
table.setSelection(v);
|
||||
if (v == -1) { // nothing selected; restore orig
|
||||
ctrl.Text_fallback_restore();
|
||||
} else { // something selected; transfer selected item to text
|
||||
String sel_text = table.getItem(v).getText();
|
||||
ctrl.Text_(sel_text);
|
||||
ctrl.Sel_(sel_text.length(), sel_text.length());
|
||||
}
|
||||
GfoEvMgr_.Pub(ctrl, GfuiComboBox.Evt__selected_changed);
|
||||
}
|
||||
public boolean Visible() {return shell.isVisible();}
|
||||
public void Visible_(boolean v) {
|
||||
if (v && list_len == 0) return; // never show if 0 items; occurs when users presses alt+down or down when in combo-box
|
||||
shell.setVisible(v);
|
||||
}
|
||||
public void Resize_shell(int len) {
|
||||
Rectangle text_bounds = display.map(owner_shell, null, ctrl.Bounds());
|
||||
int adj = Op_sys.Cur().Tid() == Op_sys.Lnx.Tid() ? 9 : 2; // NOTE: magic-numbers from gnosygnu's Windows-7, OS-X and openSUSE; Linux # is not correct for different number of items, but looks acceptable for 25;
|
||||
int max_len = this.Visible_rows;
|
||||
int height = (table.getItemHeight() * (len > max_len ? max_len : len)) + adj;
|
||||
if (height != shell.getSize().y) // only resize if height is different
|
||||
shell.setBounds(text_bounds.x, text_bounds.y + text_bounds.height - 1, text_bounds.width, height);
|
||||
}
|
||||
}
|
||||
class Swt_combo_text__key_down implements Listener { // for list-box, highlight item or toggle visiblility based on keys
|
||||
private final Swt_combo_list list;
|
||||
public Swt_combo_text__key_down(Swt_combo_list list) {
|
||||
this.list = list;
|
||||
}
|
||||
@Override public void handleEvent(Event event) {
|
||||
try {
|
||||
int mask = event.stateMask;
|
||||
boolean no_modifier = false;
|
||||
boolean ctrl_modifier = false;
|
||||
boolean alt_modifier = false;
|
||||
if ((mask & SWT.ALT) == SWT.ALT) {alt_modifier = true;}
|
||||
else if ((mask & SWT.CTRL) == SWT.CTRL){ctrl_modifier = true;}
|
||||
else if ((mask & SWT.SHIFT) == SWT.SHIFT){}
|
||||
else
|
||||
no_modifier = true;
|
||||
switch (event.keyCode) {
|
||||
case SWT.ARROW_DOWN:
|
||||
if (event.stateMask == SWT.ALT) {
|
||||
list.Visible_(true);
|
||||
} else {
|
||||
list.Sel_idx_nudge(Bool_.Y);
|
||||
}
|
||||
event.doit = false;
|
||||
break;
|
||||
case SWT.ARROW_UP:
|
||||
if (event.stateMask == SWT.ALT) {
|
||||
list.Visible_(false);
|
||||
} else {
|
||||
list.Sel_idx_nudge(Bool_.N);
|
||||
}
|
||||
event.doit = false;
|
||||
break;
|
||||
case SWT.PAGE_DOWN:
|
||||
if (no_modifier) {
|
||||
list.Sel_idx_jump(Bool_.Y);
|
||||
event.doit = false;
|
||||
}
|
||||
else if (ctrl_modifier || alt_modifier) {
|
||||
list.Visible_(Bool_.N);
|
||||
event.doit = false;
|
||||
}
|
||||
break;
|
||||
case SWT.PAGE_UP:
|
||||
if (no_modifier) {
|
||||
list.Sel_idx_jump(Bool_.N);
|
||||
event.doit = false;
|
||||
}
|
||||
else if (ctrl_modifier || alt_modifier) {
|
||||
list.Visible_(Bool_.N);
|
||||
event.doit = false;
|
||||
}
|
||||
break;
|
||||
case SWT.CR:
|
||||
if (list.Visible() && list.Sel_idx() != -1) {
|
||||
list.Visible_(false);
|
||||
}
|
||||
break;
|
||||
case SWT.ESC:
|
||||
list.Sel_idx_by_key(-1);
|
||||
list.Visible_(false);
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
class Swt_combo_text__mouse_up implements Listener { // if list-box is visible, left-click on text-box should hide list-box; note that left-click does not fire focus-in event; EX: focus html-box; click on url-box; focus-in event not fired
|
||||
private final Swt_combo_list list;
|
||||
public Swt_combo_text__mouse_up(Swt_combo_list list) {
|
||||
this.list = list;
|
||||
}
|
||||
@Override public void handleEvent(Event event) {
|
||||
if (event.button == 1) { // left-click
|
||||
if (list.Visible()) {
|
||||
list.Visible_(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
class Swt_combo_list__default_selection implements Listener { // transfer list-box's selected to text-box
|
||||
private final Swt_combo_ctrl ctrl; private final Swt_combo_list list;
|
||||
public Swt_combo_list__default_selection(Swt_combo_ctrl ctrl, Swt_combo_list list) {
|
||||
this.ctrl = ctrl; this.list = list;
|
||||
}
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
ctrl.Text_(list.Sel_itm(0).getText());
|
||||
list.Visible_(false);
|
||||
}
|
||||
}
|
||||
class Swt_combo_list__key_down implements Listener { // hide list-box if escape pressed
|
||||
private final Swt_combo_ctrl ctrl; private final Swt_combo_list list;
|
||||
public Swt_combo_list__key_down(Swt_combo_ctrl ctrl, Swt_combo_list list) {
|
||||
this.ctrl = ctrl;
|
||||
this.list = list;
|
||||
}
|
||||
@Override public void handleEvent(Event event) {
|
||||
if (event.keyCode == SWT.ESC) {
|
||||
ctrl.Text_fallback_restore();
|
||||
list.Visible_(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
class Swt_combo_list__mouse_down implements Listener { // left-click on list-box should transfer item to text-box and publish "accepted" event
|
||||
private final Swt_combo_ctrl ctrl;
|
||||
private final Swt_combo_list list;
|
||||
public Swt_combo_list__mouse_down(Swt_combo_ctrl ctrl, Swt_combo_list list) {
|
||||
this.ctrl = ctrl;
|
||||
this.list = list;
|
||||
}
|
||||
@Override public void handleEvent(Event event) {
|
||||
if (event.button == 1) { // left-click
|
||||
ctrl.Text_(list.Sel_itm(0).getText());
|
||||
GfoEvMgr_.Pub(ctrl, GfuiComboBox.Evt__selected_changed);
|
||||
GfoEvMgr_.Pub(ctrl, GfuiComboBox.Evt__selected_accepted);
|
||||
}
|
||||
}
|
||||
}
|
||||
class Swt_combo_ctrl__focus_out implements Listener { // run hide-cmd when list-box when text-box / list-box loses focus
|
||||
private final Display display;
|
||||
private final Control text_as_swt, list_as_swt;
|
||||
private final Swt_combo_ctrl__list_hider_cmd list_hide_cmd;
|
||||
public Swt_combo_ctrl__focus_out(Display display, Swt_combo_ctrl ctrl, Swt_combo_list list, Swt_combo_ctrl__list_hider_cmd list_hide_cmd) {
|
||||
this.list_hide_cmd = list_hide_cmd;
|
||||
this.display = display;
|
||||
this.text_as_swt = ctrl.Under_text();
|
||||
this.list_as_swt = list.Under_table_as_swt();
|
||||
}
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
if (display.isDisposed()) return;
|
||||
Control control = display.getFocusControl();
|
||||
if (control == null || control == text_as_swt || control == list_as_swt) {
|
||||
list_hide_cmd.Active = true;
|
||||
display.asyncExec(list_hide_cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
class Swt_combo_ctrl__focus_in implements Listener { // cancel hide-cmd if list-box gains focus
|
||||
private final Display display;
|
||||
private final Swt_combo_ctrl__list_hider_cmd list_hide_cmd;
|
||||
private final Control list_as_swt;
|
||||
|
||||
public Swt_combo_ctrl__focus_in(Display display, Swt_combo_list list, Swt_combo_ctrl__list_hider_cmd list_hide_cmd) {
|
||||
this.display = display;
|
||||
this.list_as_swt = list.Under_table_as_swt();
|
||||
this.list_hide_cmd = list_hide_cmd;
|
||||
}
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
if (display.isDisposed()) return;
|
||||
Control control = display.getFocusControl();
|
||||
if (control == list_as_swt)
|
||||
list_hide_cmd.Active = false;
|
||||
}
|
||||
}
|
||||
class Swt_combo_text__focus_in implements Listener { // hide list-box when text-box is focused
|
||||
private final Swt_combo_ctrl ctrl; private final Swt_combo_list list;
|
||||
public Swt_combo_text__focus_in(Swt_combo_ctrl ctrl, Swt_combo_list list) {
|
||||
this.ctrl = ctrl; this.list = list;
|
||||
}
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
if (list.Visible())
|
||||
list.Visible_(false);
|
||||
else
|
||||
ctrl.Sel_all();
|
||||
}
|
||||
}
|
||||
class Swt_combo_shell__move implements Listener { // hide list-box when shell is moved
|
||||
private final Swt_combo_list list;
|
||||
public Swt_combo_shell__move(Swt_combo_list list) {this.list = list;}
|
||||
@Override public void handleEvent(Event arg0) {
|
||||
list.Visible_(false);
|
||||
}
|
||||
}
|
||||
class Swt_combo_ctrl__list_hider_cmd implements Runnable { // hide list-box; can be "canceled"
|
||||
private final Swt_combo_list list;
|
||||
public boolean Active = true;
|
||||
public Swt_combo_ctrl__list_hider_cmd(Swt_combo_list list) {
|
||||
this.list = list;
|
||||
}
|
||||
@Override public void run() {
|
||||
if (Active)
|
||||
list.Visible_(false);
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,17 @@ class Swt_lnr_key implements KeyListener {
|
||||
case Byte_ascii.Ltr_u: case Byte_ascii.Ltr_v: case Byte_ascii.Ltr_w: case Byte_ascii.Ltr_x: case Byte_ascii.Ltr_y: case Byte_ascii.Ltr_z:
|
||||
val -= 32; // lowercase keys are transmitted as ascii value, instead of key value; EX: "a" is 97 instead of 65
|
||||
break;
|
||||
case 39: val = IptKey_.Quote.Val(); break;
|
||||
case 44: val = IptKey_.Comma.Val(); break;
|
||||
case 45: val = IptKey_.Minus.Val(); break;
|
||||
case 46: val = IptKey_.Period.Val(); break;
|
||||
case 47: val = IptKey_.Slash.Val(); break;
|
||||
case 59: val = IptKey_.Semicolon.Val(); break;
|
||||
case 61: val = IptKey_.Equal.Val(); break;
|
||||
case 91: val = IptKey_.OpenBracket.Val(); break;
|
||||
case 93: val = IptKey_.CloseBracket.Val(); break;
|
||||
case 96: val = IptKey_.Tick.Val(); break;
|
||||
case 127: val = IptKey_.Delete.Val(); break;
|
||||
case 16777217: val = IptKey_.Up.Val(); break;
|
||||
case 16777218: val = IptKey_.Down.Val(); break;
|
||||
case 16777219: val = IptKey_.Left.Val(); break;
|
||||
@@ -90,6 +101,7 @@ class Swt_lnr_key implements KeyListener {
|
||||
case 16777222: val = IptKey_.PageDown.Val(); break;
|
||||
case 16777223: val = IptKey_.Home.Val(); break;
|
||||
case 16777224: val = IptKey_.End.Val(); break;
|
||||
case 16777225: val = IptKey_.Insert.Val(); break;
|
||||
case 16777226: val = IptKey_.F1.Val(); break;
|
||||
case 16777227: val = IptKey_.F2.Val(); break;
|
||||
case 16777228: val = IptKey_.F3.Val(); break;
|
||||
@@ -104,11 +116,15 @@ class Swt_lnr_key implements KeyListener {
|
||||
case 16777237: val = IptKey_.F12.Val(); break;
|
||||
case 16777259: val = IptKey_.Equal.Val(); break;
|
||||
case 16777261: val = IptKey_.Minus.Val(); break;
|
||||
case 16777298: val = IptKey_.CapsLock.Val(); break;
|
||||
case 16777299: val = IptKey_.NumLock.Val(); break;
|
||||
case 16777300: val = IptKey_.ScrollLock.Val(); break;
|
||||
case 16777301: val = IptKey_.Pause.Val(); break;
|
||||
case 16777303: val = IptKey_.PrintScreen.Val(); break;
|
||||
case 327680: val = IptKey_.Insert.Val(); break;
|
||||
}
|
||||
if (Has_ctrl(ev.stateMask)) val |= IptKey_.KeyCode_Ctrl;
|
||||
|
||||
if (Has_ctrl(ev.stateMask)) val |= IptKey_.KeyCode_Ctrl;
|
||||
if (Bitmask_.Has_int(ev.stateMask, IptKey_.KeyCode_Shift)) val |= IptKey_.KeyCode_Alt;
|
||||
if (Bitmask_.Has_int(ev.stateMask, IptKey_.KeyCode_Ctrl)) val |= IptKey_.KeyCode_Shift;
|
||||
// Tfds.Write(String_.Format("val={4} keyCode={0} stateMask={1} keyLocation={2} character={3}", ev.keyCode, ev.stateMask, ev.keyLocation, ev.character, val));
|
||||
|
||||
@@ -37,11 +37,11 @@ import org.eclipse.swt.graphics.*;
|
||||
import org.eclipse.swt.widgets.*;
|
||||
class Swt_html implements Gxw_html, Swt_control, FocusListener {
|
||||
private Swt_html_lnr_location lnr_location; private Swt_html_lnr_status lnr_status;
|
||||
public Swt_html(Swt_kit kit, Swt_control owner_control, KeyValHash ctorArgs) {
|
||||
public Swt_html(Swt_kit kit, Swt_control owner_control, Keyval_hash ctorArgs) {
|
||||
this.kit = kit;
|
||||
lnr_location = new Swt_html_lnr_location(this);
|
||||
lnr_status = new Swt_html_lnr_status(this);
|
||||
Object browser_tid_obj = ctorArgs.FetchValOr(Swt_kit.Cfg_Html_BrowserType, null);
|
||||
Object browser_tid_obj = ctorArgs.Get_val_or(Swt_kit.Cfg_Html_BrowserType, null);
|
||||
this.browser_tid = browser_tid_obj == null ? Browser_tid_none : Int_.cast(browser_tid_obj);
|
||||
browser = new Browser(owner_control.Under_composite(), browser_tid);
|
||||
core = new Swt_core_cmds_html(this, browser);
|
||||
@@ -52,6 +52,7 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
|
||||
browser.addStatusTextListener(lnr_status);
|
||||
browser.addFocusListener(this);
|
||||
browser.addTitleListener(new Swt_html_lnr_title(this));
|
||||
// browser.addOpenWindowListener(new Swt_open_window_listener(this)); // handle target='blank'
|
||||
// browser.addTraverseListener(new Swt_html_lnr_Traverse(this));
|
||||
}
|
||||
public Swt_kit Kit() {return kit;} private Swt_kit kit;
|
||||
@@ -251,6 +252,13 @@ class Swt_html_lnr_mouse implements MouseListener {
|
||||
return IptEvtDataMouse.new_(btn, IptMouseWheel_.None, ev.x, ev.y);
|
||||
}
|
||||
}
|
||||
//class Swt_open_window_listener implements OpenWindowListener {
|
||||
// private final Swt_html html_box;
|
||||
// public Swt_open_window_listener(Swt_html html_box) {this.html_box = html_box;}
|
||||
// @Override public void open(WindowEvent arg0) {
|
||||
// Tfds.Write();
|
||||
// }
|
||||
//}
|
||||
/*
|
||||
NOTE_1:browser scrollbar and click
|
||||
a click in the scrollbar area will raise a mouse-down/mouse-up event in content-editable mode
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Label;
|
||||
|
||||
class Swt_lbl implements GxwElem, Swt_control {
|
||||
private Label lbl;
|
||||
public Swt_lbl(Swt_control owner, KeyValHash ctorArgs) {
|
||||
public Swt_lbl(Swt_control owner, Keyval_hash ctorArgs) {
|
||||
lbl = new Label(owner.Under_composite(), SWT.CENTER);
|
||||
core = new Swt_core_cmds(lbl);
|
||||
lbl.addKeyListener(new Swt_lnr_key(this));
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.eclipse.swt.widgets.*;
|
||||
public class Swt_tab_mgr implements Gxw_tab_mgr, Swt_control, FocusListener, GfoEvMgrOwner {
|
||||
private GfuiInvkCmd cmd_sync;
|
||||
// private GfuiInvkCmd cmd_async; // NOTE: async needed for some actions like responding to key_down and calling .setSelection; else app hangs; DATE:2014-04-30
|
||||
public Swt_tab_mgr(Swt_kit kit, Swt_control owner_control, KeyValHash ctorArgs) {
|
||||
public Swt_tab_mgr(Swt_kit kit, Swt_control owner_control, Keyval_hash ctorArgs) {
|
||||
this.kit = kit;
|
||||
tab_folder = new CTabFolder(owner_control.Under_composite(), SWT.BORDER);
|
||||
tab_folder.setBorderVisible(false);
|
||||
@@ -113,7 +113,7 @@ public class Swt_tab_mgr implements Gxw_tab_mgr, Swt_control, FocusListener, Gfo
|
||||
Gfui_tab_itm_data trg_tab_data = Get_tab_data(trg_tab_itm);
|
||||
int src_tab_idx = src_tab_data.Idx(), trg_tab_idx = trg_tab_data.Idx();
|
||||
tab_folder.setSelection(trg_tab_itm);
|
||||
GfoEvMgr_.PubVals(this, Gfui_tab_mgr.Evt_tab_switched, KeyVal_.new_("src", src_tab_data.Key()), KeyVal_.new_("trg", trg_tab_data.Key()));
|
||||
GfoEvMgr_.PubVals(this, Gfui_tab_mgr.Evt_tab_switched, Keyval_.new_("src", src_tab_data.Key()), Keyval_.new_("trg", trg_tab_data.Key()));
|
||||
return src_tab_idx < trg_tab_idx;
|
||||
}
|
||||
public void Tabs_select_by_itm(CTabItem itm) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
class Swt_text implements GxwTextFld, Swt_control {
|
||||
private Text text_box;
|
||||
public Swt_text(Swt_control owner_control, KeyValHash ctorArgs) {
|
||||
public Swt_text(Swt_control owner_control, Keyval_hash ctorArgs) {
|
||||
int text_box_args = ctorArgs.Has(GfuiTextBox_.Ctor_Memo)
|
||||
? SWT.MULTI | SWT.WRAP | SWT.V_SCROLL
|
||||
: SWT.NONE
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Swt_text_w_border implements GxwTextFld, Swt_control {
|
||||
private Composite text_host;
|
||||
private Composite text_margin;
|
||||
private Text text_elem;
|
||||
public Swt_text_w_border(Swt_control owner_control, Color color, KeyValHash ctorArgs) {
|
||||
public Swt_text_w_border(Swt_control owner_control, Color color, Keyval_hash ctorArgs) {
|
||||
Composite owner = owner_control.Under_composite();
|
||||
int text_elem_style = ctorArgs.Has(GfuiTextBox_.Ctor_Memo) ? SWT.MULTI | SWT.WRAP | SWT.V_SCROLL : SWT.FLAT;
|
||||
New_box_text_w_border(owner.getDisplay(), owner.getShell(), text_elem_style, color);
|
||||
@@ -72,7 +72,7 @@ public class Swt_text_w_border implements GxwTextFld, Swt_control {
|
||||
text_host = new Composite(shell, SWT.FLAT);
|
||||
text_margin = new Composite(text_host, SWT.FLAT);
|
||||
text_elem = new Text(text_margin, style);
|
||||
text_elem .addTraverseListener(Swt_lnr_traverse_ignore_ctrl._); // do not allow ctrl+tab to change focus when pressed in text box; allows ctrl+tab to be used by other bindings; DATE:2014-04-30
|
||||
text_elem .addTraverseListener(Swt_lnr_traverse_ignore_ctrl.Instance); // do not allow ctrl+tab to change focus when pressed in text box; allows ctrl+tab to be used by other bindings; DATE:2014-04-30
|
||||
text_host.setSize(20, 20);
|
||||
text_host.setBackground(color);
|
||||
text_margin.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
|
||||
@@ -85,5 +85,5 @@ class Swt_lnr_traverse_ignore_ctrl implements TraverseListener {
|
||||
public void keyTraversed(TraverseEvent e) {
|
||||
if (Swt_lnr_key.Has_ctrl(e.stateMask)) e.doit = false;
|
||||
}
|
||||
public static final Swt_lnr_traverse_ignore_ctrl _ = new Swt_lnr_traverse_ignore_ctrl();
|
||||
public static final Swt_lnr_traverse_ignore_ctrl Instance = new Swt_lnr_traverse_ignore_ctrl();
|
||||
}
|
||||
Reference in New Issue
Block a user