www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - ui.SimpleForm

/******************************************************************************
 * All Right Reserved. 
 * Copyright (c) 1998, 2004 Jackwind Li Guojie
 * 
 * Created on 2004-6-13 13:32:48 by JACK
 * $Id$
 * Port to the D programming language:
 *     yidabu at gmail dot com  ( D China
http://www.d-programming-language-china.org/ ) 
 *****************************************************************************/

module ui.SimpleForm;

import dwtx.jface.action.Action;
import dwtx.jface.window.ApplicationWindow;
import dwt.DWT;
import dwt.layout.GridData;
import dwt.layout.GridLayout;
import dwt.widgets.Button;
import dwt.widgets.Composite;
import dwt.widgets.Control;
import dwt.widgets.Menu;
import dwt.widgets.MenuItem;
import dwt.widgets.Shell;
import dwtx.ui.forms.widgets.Form;
import dwtx.ui.forms.widgets.FormToolkit;

import dwt.dwthelper.utils;

void main(String[] args) {
    SimpleForm simpleForm = new SimpleForm(null);
    simpleForm.setBlockOnOpen(true);
    simpleForm.open();
}  


public class SimpleForm : ApplicationWindow {

    /**
    *  param parentShell
    */
    public this(Shell parentShell) {
        super(parentShell);
    }

    /* (non-Javadoc)
    *  see dwtx.jface.window.Window#createContents(dwt.widgets.Composite)
    */
    protected Control createContents(Composite parent) {
        Composite composite = new Composite(parent, DWT.NULL);
        composite.setLayout(new GridLayout());

        // Sets up the toolkit.
        FormToolkit toolkit = new FormToolkit(getShell().getDisplay());

        // create a form instance.
        Form form = toolkit.createForm(composite);
        form.setLayoutData(new GridData(GridData.FILL_BOTH));

        form.setText("Eclipse Forms");

        form.getBody().setLayout(new GridLayout());
        Button button = toolkit.createButton(form.getBody(), "Test", DWT.NULL);
 

        // tool bar
        form.getToolBarManager().add(new class("TEST") Action {
            
            this(char[] text) {
                super(text);
            }
            public void run() {
            }
        });

        Menu menu = new Menu(form.getBody());
        MenuItem item = new MenuItem(menu, DWT.NULL);
        item.setText("Testing item");
        form.setMenu(menu);

        form.updateToolBar();

        return composite;
    }

  
}




-- 
yidabu <yidabu.spam gmail.com>
http://www.dsource.org/projects/dwin

D ÓïÑÔ-ÖÐÎÄ(D Chinese):
http://www.d-programming-language-china.org/
http://bbs.d-programming-language-china.org/
http://dwin.d-programming-language-china.org/
http://scite4d.d-programming-language-china.org/
Jun 12 2008