comparison dwtx/ui/forms/widgets/ScrolledPageBook.d @ 104:04b47443bb01

Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections. These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author Frank Benoit <benoit@tionex.de>
date Thu, 07 Aug 2008 15:01:33 +0200
parents 5d489b9f966c
children c3583c6ec027
comparison
equal deleted inserted replaced
103:2d6540440fe6 104:04b47443bb01
24 import dwt.widgets.Event; 24 import dwt.widgets.Event;
25 import dwt.widgets.Listener; 25 import dwt.widgets.Listener;
26 import dwtx.ui.internal.forms.widgets.WrappedPageBook; 26 import dwtx.ui.internal.forms.widgets.WrappedPageBook;
27 27
28 import dwt.dwthelper.utils; 28 import dwt.dwthelper.utils;
29 import tango.util.collection.HashMap; 29 import dwtx.dwtxhelper.Collection;
30
30 /** 31 /**
31 * ScrolledPageBook is a class that is capable of stacking several composites 32 * ScrolledPageBook is a class that is capable of stacking several composites
32 * (pages), while showing one at a time. The content is scrolled if there is 33 * (pages), while showing one at a time. The content is scrolled if there is
33 * not enough space to fit it in the client area. 34 * not enough space to fit it in the client area.
34 * 35 *
35 * @since 3.0 36 * @since 3.0
36 */ 37 */
37 public class ScrolledPageBook : SharedScrolledComposite { 38 public class ScrolledPageBook : SharedScrolledComposite {
38 private WrappedPageBook pageBook; 39 private WrappedPageBook pageBook;
39 private HashMap!(Object,Object) pages; 40 private Hashtable pages;
40 private Composite emptyPage; 41 private Composite emptyPage;
41 private Control currentPage; 42 private Control currentPage;
42 /** 43 /**
43 * Creates a new instance in the provided parent 44 * Creates a new instance in the provided parent
44 * 45 *
58 */ 59 */
59 public this(Composite parent, int style) { 60 public this(Composite parent, int style) {
60 super(parent, style); 61 super(parent, style);
61 pageBook = new WrappedPageBook(this, DWT.NULL); 62 pageBook = new WrappedPageBook(this, DWT.NULL);
62 setContent(pageBook); 63 setContent(pageBook);
63 pages = new HashMap!(Object,Object); 64 pages = new Hashtable();
64 setExpandHorizontal(true); 65 setExpandHorizontal(true);
65 setExpandVertical(true); 66 setExpandVertical(true);
66 this.addListener(DWT.Traverse, dgListener( (Event e) { 67 this.addListener(DWT.Traverse, dgListener( (Event e) {
67 switch (e.detail) { 68 switch (e.detail) {
68 case DWT.TRAVERSE_ESCAPE : 69 case DWT.TRAVERSE_ESCAPE :
108 * the page key 109 * the page key
109 * @return the newly created page composite 110 * @return the newly created page composite
110 */ 111 */
111 public Composite createPage(Object key) { 112 public Composite createPage(Object key) {
112 Composite page = createPage(); 113 Composite page = createPage();
113 pages.add(key, page); 114 pages.put(key, page);
114 return page; 115 return page;
115 } 116 }
116 /** 117 /**
117 * Returns the page book container. 118 * Returns the page book container.
118 * 119 *
131 * the page composite to register 132 * the page composite to register
132 * @see #createPage(Object) 133 * @see #createPage(Object)
133 * @see #getContainer 134 * @see #getContainer
134 */ 135 */
135 public void registerPage(Object key, Control page) { 136 public void registerPage(Object key, Control page) {
136 pages.add(key, page); 137 pages.put(key, page);
137 } 138 }
138 /** 139 /**
139 * Removes the page under the provided key from the page book. Does nothing 140 * Removes the page under the provided key from the page book. Does nothing
140 * if page with that key does not exist. 141 * if page with that key does not exist.
141 * 142 *