// The Janne directory contain some stuff to manipulate Xpm icons
// and create buttons. This was not written by me, and may only be
// used for non commercial product. Linuxconf fits that restriction
// but this Java "kit" is distribute like linuxconf with under GNU GLPL
// so it can be used widely. So don't use the jmform but only the mform
// and you won't need the code in Janne.
import java.awt.*;
import java.awt.image.*;
import java.util.*;
import java.net.*;
import java.io.*;

class janne {
	public static JanneButton New_button(
		mform mf,
		String _id,
		String img,
		String str){

		JanneButton ret = null;
		try {
			mform_c m = mf.alloc_mf(_id);
			FileInputStream is = new FileInputStream(img);
			Image image = mf.createImage(new XImageSource(is));
			ret = new JanneButton (image,str);
			m.c = ret;
			m.type = mform_c.T_BUTTON;
			mf.add (ret);
		} catch (IOException ioe) {
			System.out.println("IOException: " + ioe);
		}
		return ret;
	}
	public static JanneButton New_button(
		mform mf,
		String _id,
		String lines[],
		int nb,
		String str){

		mform_c m = mf.alloc_mf(_id);
		Image image = mf.createImage(new XImageSource(lines,nb));
		JanneButton ret = ret = new JanneButton (image,str,0,5,true,false);
		m.c = ret;
		m.type = mform_c.T_BUTTON;
		mf.add (ret);
		return ret;
	}
	public static JanneButton New_icon_xpm(mform mf, String lines[], int nb){
		mform_c m = mf.alloc_mf();
		Image image = mf.createImage(new XImageSource(lines,nb));
		JanneButton ret = ret = new JanneButton (image,null,0,0,false,false,10);
		m.c = ret;
		m.type = mform_c.T_ICON;
		mf.add (ret);
		return ret;
	}
	public static void New_icon_xpm(mform mf, String path){
		try {
			mform_c m = mf.alloc_mf("");
			FileInputStream is = new FileInputStream(path);
			Image image = mf.createImage(new XImageSource(is));
			JanneButton ret = new JanneButton (image,null,0,0
				,false,false,10);
			m.c = ret;
			m.type = mform_c.T_ICON;
			mf.add (ret);
		} catch (IOException ioe) {
			System.out.println("IOException: " + ioe);
		}
	}
}

