home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class OCdgSlideM extends OCdg {
- Event the_e;
- Image mainoff;
- Graphics g_mainoff;
- int num_desc = 0;
- int num_icons = 0;
- private Color m_bgcolor;
- private int[] m_mainicon;
- private Image[] i_pic;
- private int[] m_main_icon;
- private String[] m_maindesc;
- private String[] m_iconfile;
- private int m_top_offset;
- private boolean m_tile_bg;
- private String m_main_bgfile;
- private Image m_main_bgimage;
- private Color m_main_ocolor;
- private Color m_main_textcolor;
- private int m_main_height;
- private int m_main_indent;
- private boolean m_tile_menus_only;
- private int m_main_icon_indent;
- Font main_font;
- FontMetrics fm_main_font;
-
- public void initIcon(String[] var1) {
- this.m_iconfile = var1;
- this.num_icons = this.m_iconfile.length;
- this.i_pic = new Image[this.num_icons];
- }
-
- private void reDraw() {
- boolean var1 = false;
- this.mainoff = ((Component)this).createImage(super.appWidth, this.m_main_height + 1);
- this.g_mainoff = this.mainoff.getGraphics();
- this.g_mainoff.setFont(this.main_font);
- super.g_off.setFont(this.main_font);
- if (this.m_tile_menus_only) {
- super.g_off.clipRect(0, 0, super.appWidth, this.m_main_height * this.m_maindesc.length + this.m_top_offset + 1);
- }
-
- if (this.m_bgcolor != null) {
- super.g_off.setColor(this.m_bgcolor);
- super.g_off.fillRect(0, 0, super.appWidth, super.appHeight);
- }
-
- if (this.m_main_bgimage != null) {
- if (this.m_tile_bg) {
- int var2 = 0;
- int var3 = 0;
- int var4 = this.m_main_bgimage.getWidth(this);
- int var5 = this.m_main_bgimage.getHeight(this);
-
- while(true) {
- super.g_off.drawImage(this.m_main_bgimage, var2, var3, this);
- var2 += var4;
- if (var2 > super.appWidth) {
- var2 = 0;
- var3 += var5;
- if (this.m_tile_menus_only) {
- if (var3 > this.m_main_height * this.m_maindesc.length) {
- break;
- }
- } else if (var3 > super.appHeight) {
- break;
- }
- }
- }
- } else {
- super.g_off.drawImage(this.m_main_bgimage, 0, 0, this);
- }
- }
-
- for(int var6 = 0; var6 < this.m_maindesc.length; ++var6) {
- if (this.i_pic != null && this.m_mainicon[var6] > -1 && this.i_pic.length > this.m_mainicon[var6] && this.i_pic[this.m_mainicon[var6]] != null) {
- super.g_off.drawImage(this.i_pic[this.m_mainicon[var6]], this.m_main_icon_indent, this.m_main_height * var6 + this.m_top_offset + this.m_main_height / 2 - this.i_pic[this.m_mainicon[var6]].getHeight(this) / 2, this);
- }
-
- if (this.m_main_ocolor != null) {
- super.g_off.setColor(this.m_main_ocolor);
- super.g_off.drawRect(0, this.m_main_height * var6 + this.m_top_offset, super.appWidth - 1, this.m_main_height);
- }
-
- super.g_off.setColor(this.m_main_textcolor);
- super.g_off.drawString(this.m_maindesc[var6], this.m_main_indent, this.m_main_height / 2 - this.fm_main_font.getHeight() / 2 + this.fm_main_font.getAscent() + this.m_main_height * var6 + this.m_top_offset);
- }
-
- super.g_off = super.off.getGraphics();
- }
-
- OCdgSlideM() {
- this.m_bgcolor = Color.black;
- this.m_main_bgfile = "-1";
- this.m_main_ocolor = null;
- this.m_main_textcolor = Color.white;
- this.the_e = new Event(this, 960, this);
- }
-
- public synchronized void DrawApplet() {
- super.off = ((Component)this).createImage(super.appWidth, super.appHeight);
- super.g_off = super.off.getGraphics();
- super.g_off.setColor(this.m_bgcolor);
- super.g_off.fillRect(0, 0, super.appWidth, super.appHeight);
- ACutil var1 = new ACutil();
- this.m_main_bgimage = var1.getImage(this.m_main_bgfile);
-
- for(int var2 = 0; var2 < this.num_icons; ++var2) {
- this.i_pic[var2] = var1.getImage(this.m_iconfile[var2]);
- }
-
- this.reDraw();
- }
-
- public void initDefault() {
- String var1 = ((OCdg)this).getParameterDefault("bgcolor");
- if (var1 != null) {
- this.m_bgcolor = occcolor.ConvertColor(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("mfont");
- if (var1 != null) {
- this.main_font = ocfontc.getFontSD(var1, ",");
- } else {
- this.main_font = new Font("Helvetica", 0, 12);
- }
-
- this.fm_main_font = ((Component)this).getFontMetrics(this.main_font);
- var1 = ((OCdg)this).getParameterDefault("mtextcolor");
- if (var1 != null) {
- this.m_main_textcolor = occcolor.ConvertColor(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("mindent");
- if (var1 != null) {
- this.m_main_indent = Integer.parseInt(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("moutcolor");
- if (var1 != null && !var1.equalsIgnoreCase("<none>")) {
- this.m_main_ocolor = occcolor.ConvertColor(var1);
- } else {
- this.m_main_ocolor = null;
- }
-
- var1 = ((OCdg)this).getParameterDefault("mbgfile");
- if (var1 != null) {
- this.m_main_bgfile = var1;
- }
-
- var1 = ((OCdg)this).getParameterDefault("mheight");
- if (var1 != null) {
- this.m_main_height = Integer.parseInt(var1);
- }
-
- if (this.m_main_height < 1) {
- this.m_main_height = this.fm_main_font.getHeight();
- }
-
- var1 = ((OCdg)this).getParameterDefault("mtilebg");
- if (var1 != null) {
- this.m_tile_bg = Boolean.valueOf(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("topoffset");
- if (var1 != null) {
- this.m_top_offset = Integer.parseInt(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("mbgonmenusonly");
- if (var1 != null) {
- this.m_tile_menus_only = Boolean.valueOf(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("miconindent");
- if (var1 != null) {
- this.m_main_icon_indent = Integer.parseInt(var1);
- }
-
- }
-
- public void initSpecifics() {
- boolean var2 = false;
- this.num_desc = super.spe_pv.size();
- this.m_maindesc = new String[this.num_desc];
- this.m_mainicon = new int[this.num_desc];
-
- for(int var4 = 0; var4 < this.num_desc; ++var4) {
- String var1 = ((OCdg)this).getParameterSpecific("maindesc", var4);
- if (var1 != null) {
- this.m_maindesc[var4] = var1;
- } else {
- this.m_maindesc[var4] = "";
- }
-
- var1 = ((OCdg)this).getParameterSpecificByTitle("icon image id", var4);
- if (var1 != null) {
- this.m_mainicon[var4] = Integer.parseInt(var1);
- } else {
- this.m_mainicon[var4] = -1;
- }
- }
-
- }
- }
-