mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Convert 'GUI - Window'
This commit is contained in:
@@ -18,24 +18,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.guis.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.guis.*;
|
||||
import gplx.gfui.*; import gplx.gfui.draws.*;
|
||||
public class Xol_font_info implements Gfo_invk, Gfo_evt_mgr_owner {
|
||||
public Xol_font_info(String name, float size, FontStyleAdp style) {this.name = name; this.size = size; this.style = style;}
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
public String Name() {return name;} public Xol_font_info Name_(String v) {name = v; Font_changed_pub(); return this;} private String name;
|
||||
public float Size() {return size;} public Xol_font_info Size_(float v) {size = v; Font_changed_pub(); return this;} private float size;
|
||||
public FontStyleAdp Style() {return style;} public Xol_font_info Style_(FontStyleAdp v) {style = v; Font_changed_pub(); return this;} private FontStyleAdp style;
|
||||
public Xol_font_info CloneNew() {return new Xol_font_info(name, size, style);}
|
||||
public FontAdp XtoFontAdp() {return FontAdp.new_(name, size, style);}
|
||||
private FontStyleAdp style;
|
||||
public Xol_font_info(String name, float size, FontStyleAdp style) {
|
||||
this.name = name; this.size = size; this.style = style;
|
||||
}
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} private Gfo_evt_mgr evt_mgr;
|
||||
public String Name() {return name;} public Xol_font_info Name_(String v) {name = v; Font_changed_pub(); return this;} private String name;
|
||||
public float Size() {return size;} public Xol_font_info Size_(float v) {size = v; Font_changed_pub(); return this;} private float size;
|
||||
public FontAdp To_font() {return FontAdp.new_(name, size, style);}
|
||||
public boolean Eq(FontAdp font) {return String_.Eq(name, font.Name()) && size == font.Size() && style.Val() == font.Style().Val();}
|
||||
public void Init_by_app(Xoae_app app) {
|
||||
app.Cfg().Bind_many_app(this, Cfg__font_name, Cfg__font_size);
|
||||
}
|
||||
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_name)) return name;
|
||||
else if (ctx.Match(k, Invk_name_)) Name_(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Invk_size)) return size;
|
||||
else if (ctx.Match(k, Invk_size_)) Size_(m.ReadFloat("v"));
|
||||
else if (ctx.Match(k, Invk_style_)) Style_(FontStyleAdp_.parse(m.ReadStr("v")));
|
||||
if (ctx.Match(k, Cfg__font_name)) Name_(m.ReadStr("v"));
|
||||
else if (ctx.Match(k, Cfg__font_size)) Size_(m.ReadFloat("v"));
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_name = "name", Invk_name_ = "name_", Invk_size = "size", Invk_size_ = "size_", Invk_style_ = "style_";
|
||||
public static final String Font_changed = "font_changed";
|
||||
private void Font_changed_pub() {Gfo_evt_mgr_.Pub_obj(this, Font_changed, "font", this);}
|
||||
|
||||
private static final String Cfg__font_name = "xowa.gui.window.font.name";
|
||||
public static final String Cfg__font_size = "xowa.gui.window.font.size";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user