mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Gui: Tweak positioning of gui elements / font sizes
This commit is contained in:
@@ -198,7 +198,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
for (int i = 0; i < args_len; i++)
|
||||
ctor_args.Add(args[i]);
|
||||
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, Swt_text_w_border.Margin_t__text);
|
||||
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();
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Swt_combo_ctrl extends Swt_text_w_border implements GxwElem, GxwCom
|
||||
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(), Swt_text_w_border.Margin_t__combo);
|
||||
super(owner, color, new Keyval_hash());
|
||||
Display display = owner.Under_control().getDisplay();
|
||||
Shell shell = owner.Under_control().getShell();
|
||||
this.swt_text = super.Under_text();
|
||||
|
||||
@@ -122,9 +122,10 @@ abstract class Swt_core__base extends GxwCore_base {
|
||||
Swt_layout_mgr__grid gfui_layout = (Swt_layout_mgr__grid)v;
|
||||
GridLayout swt_layout = new GridLayout();
|
||||
swt_layout.numColumns = gfui_layout.Cols();
|
||||
swt_layout.marginHeight = gfui_layout.Margin_h();
|
||||
swt_layout.marginWidth = gfui_layout.Margin_w();
|
||||
swt_layout.verticalSpacing = gfui_layout.Spacing_h();
|
||||
if (gfui_layout.Margin_w() > -1) swt_layout.marginWidth = gfui_layout.Margin_w();
|
||||
if (gfui_layout.Margin_h() > -1) swt_layout.marginHeight = gfui_layout.Margin_h();
|
||||
if (gfui_layout.Spacing_w() > -1) swt_layout.horizontalSpacing = gfui_layout.Spacing_w();
|
||||
if (gfui_layout.Spacing_h() > -1) swt_layout.verticalSpacing = gfui_layout.Spacing_h();
|
||||
|
||||
Composite control_as_composite = (Composite)control;
|
||||
control_as_composite.setLayout(swt_layout);
|
||||
|
||||
@@ -46,8 +46,9 @@ class Swt_core__frames extends Swt_core__base {
|
||||
Frames_h_set(outer_rect.height);
|
||||
|
||||
// vertically center
|
||||
int text_size = frames[1].Item().getSize().y;
|
||||
text_w_border.margins_t = (outer_rect.height - text_size) / 2;
|
||||
int text_size = frames[frames_len - 1].Item().getSize().y;
|
||||
text_w_border.margins_t = (outer_rect.height - text_size) / 2;
|
||||
// Tfds.Write(outer_rect.height, frames[frames_len - 2].Item().getSize().y, text_size, text_w_border.margins_t, frames[frames_len - 1].Item().getToolTipText());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -104,6 +105,7 @@ class Swt_frame_itm__center_v implements Swt_frame_itm {
|
||||
public void Rect_set(int new_w, int new_h) {
|
||||
int margin_t = margin_owner.margins_t;
|
||||
int margin_b = margin_owner.margins_b;
|
||||
// Tfds.Write(margin_t, margin_b, new_h - (margin_t + margin_b), control.getToolTipText());
|
||||
Swt_control_.Rect_set(control, 0, margin_t, new_w, new_h - (margin_t + margin_b));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,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, Keyval_hash ctorArgs, int margin_t) {
|
||||
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, text_elem_style, color);
|
||||
@@ -47,7 +47,7 @@ public class Swt_text_w_border implements GxwTextFld, Swt_control {
|
||||
{ new Swt_frame_itm__manual(text_margin, 1, 1, -2, -2)
|
||||
, new Swt_frame_itm__center_v(text_elem, this)
|
||||
});
|
||||
this.margins_t = margin_t;
|
||||
this.margins_t = this.margins_b = Margin_v_dflt;
|
||||
text_elem.addKeyListener(new Swt_lnr_key(this));
|
||||
text_elem.addMouseListener(new Swt_lnr_mouse(this));
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class Swt_text_w_border implements GxwTextFld, Swt_control {
|
||||
@Override public Composite Under_composite() {return null;}
|
||||
@Override public Control Under_menu_control() {return text_elem;}
|
||||
public Text Under_text() {return text_elem;}
|
||||
@Override public int SelBgn() {return text_elem.getCaretPosition();} @Override public void SelBgn_set(int v) {text_elem.setSelection(v);}
|
||||
@Override public int SelBgn() {return text_elem.getCaretPosition();} @Override public void SelBgn_set(int v) {text_elem.setSelection(v);}
|
||||
@Override public int SelLen() {return text_elem.getSelectionCount();} @Override public void SelLen_set(int v) {text_elem.setSelection(this.SelBgn(), this.SelBgn() + v);}
|
||||
@Override public String TextVal() {return text_elem.getText();} @Override public void TextVal_set(String v) {text_elem.setText(v);}
|
||||
@Override public GxwCore_base Core() {return core;} Swt_core__frames core;
|
||||
@@ -64,10 +64,10 @@ public class Swt_text_w_border implements GxwTextFld, Swt_control {
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
return null;
|
||||
}
|
||||
public int Margins_l() {return margins_l;} int margins_l;
|
||||
public int Margins_r() {return margins_r;} int margins_r;
|
||||
public int Margins_t() {return margins_t;} int margins_t;
|
||||
public int Margins_b() {return margins_b;} int margins_b;
|
||||
public int Margins_l() {return margins_l;} public int margins_l;
|
||||
public int Margins_r() {return margins_r;} public int margins_r;
|
||||
public int Margins_t() {return margins_t;} public int margins_t;
|
||||
public int Margins_b() {return margins_b;} public int margins_b;
|
||||
public void Margins_set(int left, int top, int right, int bot) {
|
||||
this.margins_l = left; this.margins_t = top; this.margins_r = right; this.margins_b = bot;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class Swt_text_w_border implements GxwTextFld, Swt_control {
|
||||
text_margin.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
|
||||
text_margin.setSize(25, 25);
|
||||
}
|
||||
public static final int Margin_t__text = 4, Margin_t__combo = 6; // magic constants
|
||||
public static final int Margin_v_dflt = 4;
|
||||
}
|
||||
class Swt_lnr_traverse_ignore_ctrl implements TraverseListener {
|
||||
public void keyTraversed(TraverseEvent e) {
|
||||
|
||||
Reference in New Issue
Block a user