// Copyright 1997
// Black Dirt Software
// All rights reserved

import java.util.*;
public class bdcMenu extends Control {
   

    /////////////////////////////////
    // Component Definition Methods
    //////////////////////////////////


    public void initialize(Control c) {
      super.initialize(c);
      this.setType("Menu");
      this.setJavaType("Menu"); // changed to MenuItem internally
    }

    public String declareString() {
      String returnString = "";
      if (getJavaType().equals("Menu")){
        returnString = "      Menu  " + this.getName() + " = new Menu(" +  "\"" + this.getCaption() + "\"" + "); " +"\n"  ;
      }
      else{
          returnString = "      MenuItem  " + this.getName() + " = new MenuItem(" +  "\"" + this.getCaption() + "\"" + "); " +"\n" ;
      }
      return(returnString);
    }


    public String controlArrayInitString() {
        return ("");//      " + this.getName() + "[" + getIndex() + "] = new Button(" + "\"" +  this.getCaption() + "\""  + ");"  );
    }

    public String addString( Control cParent) {
      String containerString;
      String returnString = "";
      String thisName;

      if (getJavaType().equals("Menu")){
          containerString = "topMenu.";
      }
      else{
          containerString =    cParent.getName() + "."; // Frame1. and so on
      }

      if (isControlArray()){
         thisName = this.getName() + "[" + getIndex() +"]";
      }
      else{
         thisName = getName();
      }
      
      returnString = returnString + "      " + containerString + "add(" +  thisName +");\n";
      return(returnString);
    }

    public String addString11( Control cParent) {
      return (addString(cParent));
    }


}
