Commit ac674464 authored by Daniel Dreibrodt's avatar Daniel Dreibrodt

new parsing system: checkbox support

parent f1a40811
......@@ -97,6 +97,8 @@ public class Layout implements ActionListener{
items.add(new Anchor(nodes.item(i), s));
else if(nodes.item(i).getNodeName().equals("Button"))
items.add(new Button(nodes.item(i), s));
else if(nodes.item(i).getNodeName().equals("Checkbox"))
items.add(new Checkbox(nodes.item(i), s));
}
}
......
......@@ -513,6 +513,7 @@ public class Skin implements ActionListener{
}
public ImageResource getImageResource(String id) {
if(id==null) return null;
for (Resource r:resources) {
if(r.getClass()==Bitmap.class) {
if(r.id.equals(id)) return (ImageResource)r;
......
......@@ -82,6 +82,7 @@ public class Button extends Item implements ActionListener{
ykeepratio = XML.getBoolAttributeValue(n, "ykeepratio", ykeepratio);
tooltiptext = XML.getStringAttributeValue(n, "tooltiptext", tooltiptext);
visible = XML.getStringAttributeValue(n, "visible", visible);
help = XML.getStringAttributeValue(n, "help", help);
created = true;
......
......@@ -29,6 +29,7 @@ import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.border.*;
import org.w3c.dom.Node;
import vlcskineditor.resources.ImageResource;
/**
......@@ -73,6 +74,39 @@ public class Checkbox extends Item implements ActionListener{
type = Language.get("CHECKBOX");
}
public Checkbox(Node n, Skin s_) {
s = s_;
id = XML.getStringAttributeValue(n, "id", Language.get("UNNAMED").replaceAll("%t",type).replaceAll("%i",String.valueOf(s.getNewId())));
state = XML.getStringAttributeValue(n, "state", state);
up1 = XML.getStringAttributeValue(n, "up1", up1);
over1 = XML.getStringAttributeValue(n, "over1", over1);
down1 = XML.getStringAttributeValue(n, "down1", down1);
action1 = XML.getStringAttributeValue(n, "action1", action1);
tooltiptext1 = XML.getStringAttributeValue(n, "tooltiptext1", tooltiptext1);
up2 = XML.getStringAttributeValue(n, "up2", up2);
over2 = XML.getStringAttributeValue(n, "over2", over2);
down2 = XML.getStringAttributeValue(n, "down2", down2);
action2 = XML.getStringAttributeValue(n, "action2", action2);
tooltiptext2 = XML.getStringAttributeValue(n, "tooltiptext2", tooltiptext2);
x = XML.getIntAttributeValue(n, "x", x);
y = XML.getIntAttributeValue(n, "y", y);
lefttop = XML.getStringAttributeValue(n, "lefttop", lefttop);
rightbottom = XML.getStringAttributeValue(n, "rightbottom", rightbottom);
xkeepratio = XML.getBoolAttributeValue(n, "xkeepratio", xkeepratio);
ykeepratio = XML.getBoolAttributeValue(n, "ykeepratio", ykeepratio);
visible = XML.getStringAttributeValue(n, "visible", visible);
help = XML.getStringAttributeValue(n, "help", help);
created = true;
up1_res = s.getImageResource(up1);
over1_res = s.getImageResource(over1);
down1_res = s.getImageResource(down1);
up2_res = s.getImageResource(up2);
over2_res = s.getImageResource(over2);
down2_res = s.getImageResource(down2);
}
/** Creates a new instance of Checkbox
* @param xmlcode The XML code
* @param s_ The parent skin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment