mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Gui: Change UI to use SWT Grid Layout instead of manual XOWA layout
This commit is contained in:
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.imgs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
import gplx.core.interfaces.*;
|
||||
public interface GfuiElem extends Gfo_invk, GxwCbkHost, IptBndsOwner, GftItem, Gfo_evt_itm {
|
||||
//% Layout
|
||||
@@ -32,6 +33,8 @@ public interface GfuiElem extends Gfo_invk, GxwCbkHost, IptBndsOwner, GftItem, G
|
||||
void Zorder_front(); void Zorder_back();
|
||||
PointAdp Pos();
|
||||
SizeAdp Size();
|
||||
Swt_layout_mgr Layout_mgr(); void Layout_mgr_(Swt_layout_mgr v);
|
||||
Swt_layout_data Layout_data(); void Layout_data_(Swt_layout_data v);
|
||||
|
||||
//% Visual
|
||||
boolean Visible(); void Visible_set(boolean v); GfuiElem Visible_on_(); GfuiElem Visible_off_();
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.imgs.*; import gplx.gfui.kits.core.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
import gplx.gfui.controls.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.standards.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.core.strings.*; import gplx.core.interfaces.*;
|
||||
public class GfuiElemBase implements GfuiElem {
|
||||
@@ -61,6 +62,11 @@ public class GfuiElemBase implements GfuiElem {
|
||||
this.Visible_set(true);
|
||||
this.Focus();
|
||||
}
|
||||
public Swt_layout_mgr Layout_mgr() {return underElem.Core().Layout_mgr();}
|
||||
public void Layout_mgr_(Swt_layout_mgr v) {underElem.Core().Layout_mgr_(v);}
|
||||
public Swt_layout_data Layout_data() {return underElem.Core().Layout_data();}
|
||||
public void Layout_data_(Swt_layout_data v) {underElem.Core().Layout_data_(v);}
|
||||
|
||||
//% Visual
|
||||
@gplx.Virtual public boolean Visible() {return underMgr.Visible();} @gplx.Virtual public void Visible_set(boolean v) {underMgr.Visible_set(v);}
|
||||
public GfuiElem Visible_on_() {this.Visible_set(true); return this;} public GfuiElem Visible_off_() {this.Visible_set(false); return this;}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
public abstract class GxwCore_base {
|
||||
public abstract void Controls_add(GxwElem sub);
|
||||
public abstract void Controls_del(GxwElem sub);
|
||||
@@ -32,6 +33,10 @@ public abstract class GxwCore_base {
|
||||
public abstract ColorAdp ForeColor(); public abstract void ForeColor_set(ColorAdp v);
|
||||
public abstract FontAdp TextFont(); public abstract void TextFont_set(FontAdp v);
|
||||
public abstract String TipText(); public abstract void TipText_set(String v);
|
||||
public abstract Swt_layout_mgr Layout_mgr();
|
||||
public abstract void Layout_mgr_(Swt_layout_mgr v);
|
||||
public abstract Swt_layout_data Layout_data();
|
||||
public abstract void Layout_data_(Swt_layout_data v);
|
||||
|
||||
public abstract int Focus_index(); public abstract void Focus_index_set(int v);
|
||||
public abstract boolean Focus_able(); public abstract void Focus_able_(boolean v);
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.controls.gxws.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
public class GxwCore_lang extends GxwCore_base {
|
||||
@Override public int Width() {return control.getWidth();} @Override public void Width_set(int v) {control.setSize(v, control.getHeight());}
|
||||
@Override public int Height() {return control.getHeight();} @Override public void Height_set(int v) {control.setSize(control.getWidth(), v);}
|
||||
@@ -78,6 +79,11 @@ public class GxwCore_lang extends GxwCore_base {
|
||||
prvFont = v;
|
||||
}
|
||||
@Override public String TipText() {return tipText;} @Override public void TipText_set(String v) {tipText = v;} String tipText;
|
||||
@Override public Swt_layout_mgr Layout_mgr() {return null;}
|
||||
@Override public void Layout_mgr_(Swt_layout_mgr v) {}
|
||||
@Override public Swt_layout_data Layout_data() {return null;}
|
||||
@Override public void Layout_data_(Swt_layout_data v) {}
|
||||
|
||||
@Override public void Controls_add(GxwElem sub) {
|
||||
try {
|
||||
JComponent component = (JComponent)sub;
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.ipts.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
public class GxwCore_mock extends GxwCore_base {
|
||||
@Override public int Width() {return size.Width();} @Override public void Width_set(int v) {size = SizeAdp_.new_(v, size.Height());}
|
||||
@Override public int Height() {return size.Height();} @Override public void Height_set(int v) {size = SizeAdp_.new_(size.Width(), v);}
|
||||
@@ -30,6 +31,10 @@ public class GxwCore_mock extends GxwCore_base {
|
||||
@Override public ColorAdp ForeColor() {return textColor;} @Override public void ForeColor_set(ColorAdp v) {textColor = v;} ColorAdp textColor = ColorAdp_.Null;
|
||||
@Override public FontAdp TextFont() {return font;} @Override public void TextFont_set(FontAdp v) {font = v;} FontAdp font;
|
||||
@Override public String TipText() {return tipText;} @Override public void TipText_set(String v) {tipText = v;} private String tipText;
|
||||
@Override public Swt_layout_mgr Layout_mgr() {return null;}
|
||||
@Override public void Layout_mgr_(Swt_layout_mgr v) {}
|
||||
@Override public Swt_layout_data Layout_data() {return null;}
|
||||
@Override public void Layout_data_(Swt_layout_data v) {}
|
||||
|
||||
@Override public void Controls_add(GxwElem sub) {list.Add(sub);}
|
||||
@Override public void Controls_del(GxwElem sub) {list.Del(sub);}
|
||||
|
||||
@@ -47,6 +47,7 @@ import gplx.gfui.SizeAdp;
|
||||
import gplx.gfui.controls.elems.GfuiElem;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
|
||||
public JTextArea Inner() {return txt_box;} GxwTextBox_lang txt_box;
|
||||
public GxwCore_base Core() {return core;} GxwCore_base core;
|
||||
@@ -322,6 +323,11 @@ class GxwCore_host extends GxwCore_base {
|
||||
@Override public ColorAdp ForeColor(){return outer.ForeColor();} @Override public void ForeColor_set(ColorAdp v){outer.ForeColor_set(v); inner.ForeColor_set(v);}
|
||||
@Override public FontAdp TextFont(){return outer.TextFont();} @Override public void TextFont_set(FontAdp v){outer.TextFont_set(v); inner.TextFont_set(v);}
|
||||
@Override public String TipText() {return tipText;} @Override public void TipText_set(String v) {tipText = v;} String tipText;
|
||||
@Override public Swt_layout_mgr Layout_mgr() {return null;}
|
||||
@Override public void Layout_mgr_(Swt_layout_mgr v) {}
|
||||
@Override public Swt_layout_data Layout_data() {return null;}
|
||||
@Override public void Layout_data_(Swt_layout_data v) {}
|
||||
|
||||
public Object Reapply() {
|
||||
TextFont_set(outer.TextFont()); return this;} // HACK:
|
||||
|
||||
|
||||
21
150_gfui/src/gplx/gfui/controls/gxws/Gxw_grp.java
Normal file
21
150_gfui/src/gplx/gfui/controls/gxws/Gxw_grp.java
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
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.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.controls.standards.*;
|
||||
public interface Gxw_grp extends GxwElem {
|
||||
}
|
||||
26
150_gfui/src/gplx/gfui/controls/standards/Gfui_grp.java
Normal file
26
150_gfui/src/gplx/gfui/controls/standards/Gfui_grp.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
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.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
public class Gfui_grp extends GfuiElemBase {
|
||||
public static Gfui_grp kit_(Gfui_kit kit, String key, GxwElem under, Keyval_hash ctor_args) {
|
||||
Gfui_grp rv = new Gfui_grp();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, under, ctor_args);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user