Mercurial > projects > dwt-samples
view dwtexamples/controlexample/CustomControlExample.d @ 0:052c3aebd1d3
initial import
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 01 Feb 2008 21:46:26 +0100 |
parents | |
children | c59fbc51bbff b61e7baf0574 |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwtexamples.controlexample.CustomControlExample; import dwt.layout.FillLayout; import dwt.widgets.Composite; import dwt.widgets.Display; import dwt.widgets.Shell; import dwtexamples.controlexample.ControlExample; import dwtexamples.controlexample.CComboTab; import dwtexamples.controlexample.CLabelTab; import dwtexamples.controlexample.CTabFolderTab; import dwtexamples.controlexample.SashFormTab; import dwtexamples.controlexample.StyledTextTab; import dwtexamples.controlexample.Tab; import tango.io.Stdout; version( CUSTOM_CONTROL_EXAMPLE_MAIN ){ void main(){ Stdout.formatln( "The CustomControlExample: still work left" ); Stdout.formatln( "warning in Control:setBounds() line=695 gtk_widget_size_allocate()" ); Stdout.formatln( "Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 15" ); Stdout.formatln( "for the CTabFolder widget. Params are OK. Further bugtracking needed." ); Stdout.formatln( "please report problems" ); CustomControlExample.main( null ); } } public class CustomControlExample : ControlExample { /** * Creates an instance of a CustomControlExample embedded * inside the supplied parent Composite. * * @param parent the container of the example */ public this(Composite parent) { super (parent); } /** * Answers the set of example Tabs */ Tab[] createTabs() { return [ cast(Tab) new CComboTab (this), new CLabelTab (this), new CTabFolderTab (this), new SashFormTab (this), new StyledTextTab (this) ]; } /** * Invokes as a standalone program. */ public static void main(char[][] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); CustomControlExample instance = new CustomControlExample(shell); shell.setText(getResourceString("custom.window.title")); setShellSize(instance, shell); shell.open(); while (! shell.isDisposed()) { if (! display.readAndDispatch()) display.sleep(); } instance.dispose(); } }