mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Gui: Add hand cursor
This commit is contained in:
parent
1b6eaca401
commit
360129b7de
@ -65,6 +65,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
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();
|
||||
private final Object thread_lock = new Object();
|
||||
private Cursor hand_cursor;
|
||||
public byte Tid() {return Gfui_kit_.Swt_tid;}
|
||||
public String Key() {return "swt";}
|
||||
public Display Swt_display() {return display;} private Display display;
|
||||
@ -83,6 +84,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
this.msg_wkr_stop = new Swt_msg_wkr_stop(this, gui_wtr);
|
||||
this.display = new Display();
|
||||
this.clipboard = new Swt_clipboard(display);
|
||||
this.hand_cursor = new Cursor(display, SWT.CURSOR_HAND);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Warn, GfoConsoleWin.Instance);
|
||||
UsrDlg_.Instance.Reg(UsrMsgWkr_.Type_Stop, msg_wkr_stop);
|
||||
if (xul_runner_path != null) System.setProperty("org.eclipse.swt.browser.XULRunnerPath", xul_runner_path);
|
||||
@ -157,7 +159,9 @@ public class Swt_kit implements Gfui_kit {
|
||||
return GfuiWin_.kit_(this, key, win, ctor_args_null);
|
||||
}
|
||||
public GfuiBtn New_btn(String key, GfuiElem owner, Keyval... args) {
|
||||
ctor_args.Add("cursor", hand_cursor);
|
||||
GfuiBtn rv = GfuiBtn_.kit_(this, key, new Swt_btn_no_border(Swt_control_.cast_or_fail(owner), ctor_args), ctor_args);
|
||||
ctor_args.Del("cursor");
|
||||
owner.SubElems().Add(rv);
|
||||
return rv;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import gplx.gfui.controls.standards.GfuiBtn;
|
||||
import gplx.gfui.imgs.ImageAdp;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
@ -37,11 +38,12 @@ import org.eclipse.swt.widgets.Shell;
|
||||
public 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, Keyval_hash ctorArgs) {
|
||||
Composite owner = owner_control.Under_composite();
|
||||
Composite owner = owner_control.Under_composite();
|
||||
Make_btn_no_border(owner.getDisplay(), owner.getShell(), owner);
|
||||
this.core = new Swt_core_cmds(box_btn);
|
||||
box_btn.addKeyListener(new Swt_lnr_key(this));
|
||||
box_btn.addMouseListener(new Swt_lnr_mouse(this));
|
||||
box_btn.setCursor((Cursor)ctorArgs.Get_val_or_null("cursor"));
|
||||
}
|
||||
@Override public Control Under_control() {return box_btn;}
|
||||
@Override public Control Under_menu_control() {return box_btn;}
|
||||
@ -55,13 +57,13 @@ public class Swt_btn_no_border implements GxwElem, Swt_control {
|
||||
else if (ctx.Match(k, GfuiBtn.Invk_btn_img_)) Btn_img_((ImageAdp)m.CastObj("v"));
|
||||
return null;
|
||||
}
|
||||
void Btn_img_(ImageAdp v) {
|
||||
private void Btn_img_(ImageAdp v) {
|
||||
if (box_btn == null || v == null) return;
|
||||
SizeAdp size = core.Size();
|
||||
int dif = 6;
|
||||
box_btn.setImage((Image)v.Resize(size.Width() - dif, size.Height() - dif).Under());
|
||||
}
|
||||
void Make_btn_no_border(Display display, Shell shell, Control owner) {
|
||||
private void Make_btn_no_border(Display display, Shell shell, Control owner) {
|
||||
box_grp = new Composite(shell, SWT.FLAT);
|
||||
box_btn = new Label(shell, SWT.FLAT);
|
||||
box_btn.setSize(25, 25);
|
||||
|
@ -91,7 +91,7 @@ public class Xog_bnd_win implements Gfo_invk {
|
||||
if (ctx.Match(k, Invk__when_key_down)) When_key_down(m);
|
||||
else if (ctx.Match(k, Invk__when_key_press)) When_key_up(m);
|
||||
else if (ctx.Match(k, Invk__when_key_up)) When_key_up(m);
|
||||
else if (ctx.Match(k, Invk__when_clear)) Remap_and_close("None");
|
||||
else if (ctx.Match(k, Invk__when_clear)) binding_txt.Text_("None");
|
||||
else if (ctx.Match(k, Invk__when_ok)) Remap_and_close(binding_txt.Text());
|
||||
|
||||
else if (ctx.Match(k, Invk__when_cxl)) {win.Close();}
|
||||
|
Loading…
Reference in New Issue
Block a user