1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-10-27 20:34:16 +00:00

Gui: Use constants for showing / hiding search / allpages

This commit is contained in:
gnosygnu 2017-03-28 07:57:28 -04:00
parent 13002e5efb
commit 909a715332
2 changed files with 15 additions and 9 deletions

View File

@ -338,12 +338,14 @@ public class Xog_win_itm implements Gfo_invk, Gfo_evt_itm {
.Spacing_w_(4) // sets space between buttons, or else very squished
.Spacing_h_(0) // not needed since only one row, but be explicit
);
int toolbar_text_height = 24;
url_box.Layout_data_(new Swt_layout_data__grid().Grab_excess_w_(true).Align_w__fill_().Min_w_(100).Hint_h_(toolbar_text_height));
search_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(160).Hint_h_(toolbar_text_height));
search_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(16).Hint_h_(toolbar_text_height));
allpages_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(160).Hint_h_(toolbar_text_height));
allpages_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(20).Hint_h_(toolbar_text_height)); // force 20 width to add even more space to right-hand of screen
int toolbar_grp_h = Xog_win_itm_.Toolbar_grp_h; // WORKAROUND.SWT: need to specify height, else SWT will shrink textbox on re-layout when showing / hiding search / allpages; DATE:2017-03-28
int toolbar_txt_w = Xog_win_itm_.Toolbar_txt_w;
int toolbar_btn_w = Xog_win_itm_.Toolbar_btn_w;
url_box.Layout_data_(new Swt_layout_data__grid().Grab_excess_w_(true).Align_w__fill_().Min_w_(100).Hint_h_(toolbar_grp_h));
search_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(toolbar_txt_w).Hint_h_(toolbar_grp_h));
search_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(toolbar_btn_w).Hint_h_(toolbar_grp_h));
allpages_box.Layout_data_(new Swt_layout_data__grid().Hint_w_(toolbar_txt_w).Hint_h_(toolbar_grp_h));
allpages_exec_btn.Layout_data_(new Swt_layout_data__grid().Align_w__fill_().Hint_w_(toolbar_btn_w).Hint_h_(toolbar_grp_h)); // force 20 width to add even more space to right-hand of screen
// tab / html space
tab_mgr.Init_by_kit(kit);

View File

@ -29,14 +29,14 @@ public class Xog_win_itm_ {
public static void Show_widget(boolean show, GfuiElem box, GfuiElem btn) {
int box_w, btn_w;
if (show) {
box_w = 160;
btn_w = 16;
box_w = Toolbar_txt_w;
btn_w = Toolbar_btn_w;
}
else {
box_w = 0;
btn_w = 0;
}
box.Layout_data_(new gplx.gfui.layouts.swts.Swt_layout_data__grid().Hint_w_(box_w).Hint_h_(24));
box.Layout_data_(new gplx.gfui.layouts.swts.Swt_layout_data__grid().Hint_w_(box_w).Hint_h_(Toolbar_grp_h)); // WORKAROUND.SWT: need to specify height, else SWT will shrink textbox on re-layout when showing / hiding search / allpages; DATE:2017-03-28
btn.Layout_data_(new gplx.gfui.layouts.swts.Swt_layout_data__grid().Hint_w_(btn_w).Align_w__fill_());
}
public static Gfui_grp new_grp(Xoae_app app, Gfui_kit kit, GfuiElem win, String id) {
@ -72,4 +72,8 @@ public class Xog_win_itm_ {
}
}
public static String new_tiptext(Xoae_app app, int id) {return String_.new_u8(app.Usere().Lang().Msg_mgr().Val_by_id(app.Usere().Wiki(), id));}
public static final int
Toolbar_grp_h = 24
, Toolbar_txt_w = 160
, Toolbar_btn_w = 16;
}