// ButtonBar : Panel containing various miscellaneous buttons for the interface
//
// Distributed under the terms described in the LICENCE file.
//
// Developed by akuchlin@mems-exchange.org
//

import java.awt.*;
import java.awt.event.ActionListener;
import javax.swing.*;
import gui_util;

public class ButtonBar extends Panel {
    static String __revision__ = "$Id: ButtonBar.java,v 1.10 2002/01/03 18:22:52 akuchlin Exp $";

    public JButton take_button, cede_button, save_button, reload_button;
    public JButton email_button;
    public JButton small_button, medium_button, large_button;
    public JLabel status_line, message_line, connection_line;

    public ButtonBar(ActionListener client) {
    	this.setLayout( new GridBagLayout() );
        this.take_button = new JButton("Take");
	this.take_button.addActionListener(client);

        this.cede_button = new JButton("Cede");
	this.cede_button.setEnabled(false);
	this.cede_button.addActionListener(client);

        this.save_button = new JButton("Save");
        this.save_button.setEnabled(false);
	this.save_button.addActionListener(client);

        this.email_button = new JButton("Email");
        this.email_button.setEnabled(false);
	this.email_button.addActionListener(client);
        
        this.status_line = new JLabel( "", JLabel.LEFT );
        this.connection_line = new JLabel( "", JLabel.LEFT );
        this.message_line = new JLabel( "", JLabel.CENTER );

        Font f = new Font("SansSerif", Font.BOLD, 16);
        this.message_line.setFont( f );
        gui_util.constrain(this, this.connection_line, 0,0, 5,1);
        gui_util.constrain(this, this.status_line, 0,1, 5,1);

        this.reload_button = new JButton("Reload");
	this.reload_button.addActionListener(client);
        gui_util.constrain(this, this.take_button, 1,2);
        gui_util.constrain(this, this.cede_button, 2,2);
        gui_util.constrain(this, this.reload_button, 3,2);

        this.small_button = new JButton("Small");
        this.medium_button = new JButton("Medium");
        this.large_button = new JButton("Large");
	this.small_button.setEnabled(false);
	this.medium_button.setEnabled(false);
	this.large_button.setEnabled(false);
	this.small_button.addActionListener(client);
	this.medium_button.addActionListener(client);
	this.large_button.addActionListener(client);

	gui_util.constrain(this, new JLabel("Image Size:"), 0,3);
	gui_util.constrain(this, this.small_button, 1,3);
	gui_util.constrain(this, this.medium_button, 2,3);
	gui_util.constrain(this, this.large_button, 3,3);

        gui_util.constrain(this, this.save_button, 1,4);
        gui_util.constrain(this, this.email_button, 2,4);

	gui_util.constrain(this, this.message_line, 0,5, 5,1);
    }
}
