/*
 * Created on 2004-12-05
 *
 * Part of the Symbian development plug-in for Eclipse
 * Copyright (C) Mikołaj Zalewski, 2004
 */
package pl.zalewski.mikolaj.symbdev.ui.mmpedit;

import org.eclipse.core.runtime.IPath;
import org.eclipse.swt.layout.GridData;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;

import pl.zalewski.mikolaj.symbdev.SymbianSDKEntry;
import pl.zalewski.mikolaj.symbdev.core.mmpmodel.IMMPModel;

/**
 * This page contains allows to control the compilation/build options
 * 
 * @author mikolaj
 */
public class OptionsPage extends MMPFormPage {

    public static final String PAGE_ID="mmp_options";

    /**
     * Constucts an Options page
     * @param editor The editor
     * @param model The model which options are being edited
     * @param dirPath The path to the directory containing the MMP file
     */
    public OptionsPage(FormEditor editor, IMMPModel model, SymbianSDKEntry sdk, IPath dirPath) {
        super(editor, PAGE_ID, "Options");
        fModel=model;
        fSDK=sdk;
        fDirPath=dirPath;
    }

    protected void createFormContent(IManagedForm managedForm)
    {
        super.createFormContent(managedForm);
        ScrolledForm form=managedForm.getForm();
        form.setText("Options");
        FormToolkit toolkit=managedForm.getToolkit();
        
        fCompiler=new CompilerOptionsSection(form.getBody(), toolkit, fModel, fSDK, fDirPath);
		GridData gd = new GridData(GridData.FILL_BOTH);
		gd.horizontalSpan = 1;
		gd.verticalSpan = 2;
		gd.grabExcessVerticalSpace=true;
		fCompiler.getSection().setLayoutData(gd);
		
		fLinker=new LinkerOptionsSection(form.getBody(), toolkit, fModel);
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.verticalAlignment=GridData.BEGINNING;
		fLinker.getSection().setLayoutData(gd);

		fAdvanced=new AdvancedOptionsSection(form.getBody(), toolkit, fModel);
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.verticalAlignment=GridData.BEGINNING;
		fAdvanced.getSection().setLayoutData(gd);    
    }
    
    IMMPModel fModel;
    CompilerOptionsSection fCompiler;
    LinkerOptionsSection fLinker;
    AdvancedOptionsSection fAdvanced;
    SymbianSDKEntry fSDK;
    IPath fDirPath;
}
