Mercurial > projects > dwt2
annotate org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabFolder2Listener.d @ 120:536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
===D2===
* added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements
used these templates to work with strict type storage rules of dmd-2.053
* com.ibm.icu now also compilable with D2, but not tested yet
* small fixes
Snippet288 - shared data is in TLS
===Phobos===
* fixed critical bugs in Phobos implemention
completely incorrect segfault prone fromStringz (Linux's port ruthless killer)
terrible, incorrect StringBuffer realization (StyledText killer)
* fixed small bugs as well
Snippet72 - misprint in the snippet
* implemented missed functionality for Phobos
ByteArrayOutputStream implemented (image loading available)
formatting correctly works for all DWT's cases
As a result, folowing snippets now works with Phobos (Snippet### - what is fixed):
Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting
Snippet48, 282 - crash on image loading
Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText
Snippet244 - hang-up
===Tango===
* few changes for the latest Tango trunc-r5661
* few small performance improvments
===General===
* implMissing-s for only one version changed to implMissingInTango/InPhobos
* incorrect calls to Format in toString-s fixed
* fixed loading \uXXXX characters in ResourceBundle
* added good UTF-8 support for StyledText, TextLayout (Win32) and friends
UTF functions revised and tested. It is now in java.nonstandard.*Utf modules
StyledText and TextLayout (Win32) modules revised for UTF-8 support
* removed small diferences in most identical files in *.swt.* folders
*.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32
now 179 of 576 (~31%) files in *.swt.* folders are fully identical
* Win32: snippets now have right subsystem, pretty icons and native system style controls
* small fixes in snippets
Snippet44 - it's not Snippet44
Snippet212 - functions work with different images and offsets arrays
Win32: Snippet282 - crash on close if the button has an image
Snippet293 - setGrayed is commented
and others
Win32: As a result, folowing snippets now works
Snippet68 - color doesn't change
Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above)
Snippet193 - no tabel headers
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Sat, 09 Jul 2011 15:50:20 +0300 |
parents | 7a2dd761a8b2 |
children |
rev | line source |
---|---|
25 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2004 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.swt.custom.CTabFolder2Listener; | |
14 | |
15 import org.eclipse.swt.internal.SWTEventListener; | |
16 import org.eclipse.swt.custom.CTabFolderEvent; | |
17 | |
48 | 18 version(Tango){ |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
19 import tango.core.Traits; |
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
20 import tango.core.Tuple; |
48 | 21 } else { // Phobos |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
22 import std.traits; |
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
23 import std.typetuple; |
48 | 24 } |
25 | 25 |
26 /** | |
27 * Classes which implement this interface provide methods | |
28 * that deal with the events that are generated by the CTabFolder | |
29 * control. | |
30 * <p> | |
31 * After creating an instance of a class that : | |
32 * this interface it can be added to a CTabFolder using the | |
33 * <code>addCTabFolder2Listener</code> method and removed using | |
34 * the <code>removeCTabFolder2Listener</code> method. When | |
35 * events occurs in a CTabFolder the appropriate method | |
36 * will be invoked. | |
37 * </p> | |
38 * | |
39 * @see CTabFolder2Adapter | |
40 * @see CTabFolderEvent | |
41 * | |
42 * @since 3.0 | |
43 */ | |
44 public interface CTabFolder2Listener : SWTEventListener { | |
45 public enum { | |
46 MINIMIZE, | |
47 MAXIMIZE, | |
48 SHOWLIST, | |
49 RESTORE, | |
50 CLOSE | |
51 } | |
52 | |
53 /** | |
54 * Sent when the user clicks on the close button of an item in the CTabFolder. | |
55 * The item being closed is specified in the event.item field. | |
56 * Setting the event.doit field to false will stop the CTabItem from closing. | |
57 * When the CTabItem is closed, it is disposed. The contents of the | |
58 * CTabItem (see CTabItem.setControl) will be made not visible when | |
59 * the CTabItem is closed. | |
60 * | |
61 * @param event an event indicating the item being closed | |
62 */ | |
63 public void close(CTabFolderEvent event); | |
64 | |
65 /** | |
66 * Sent when the user clicks on the minimize button of a CTabFolder. | |
67 * The state of the CTabFolder does not change automatically - it | |
68 * is up to the application to change the state of the CTabFolder | |
69 * in response to this event using CTabFolder.setMinimized(true). | |
70 * | |
71 * @param event an event containing information about the minimize | |
72 * | |
73 * @see CTabFolder#getMinimized() | |
74 * @see CTabFolder#setMinimized(bool) | |
75 * @see CTabFolder#setMinimizeVisible(bool) | |
76 */ | |
77 public void minimize(CTabFolderEvent event); | |
78 | |
79 /** | |
80 * Sent when the user clicks on the maximize button of a CTabFolder. | |
81 * The state of the CTabFolder does not change automatically - it | |
82 * is up to the application to change the state of the CTabFolder | |
83 * in response to this event using CTabFolder.setMaximized(true). | |
84 * | |
85 * @param event an event containing information about the maximize | |
86 * | |
87 * @see CTabFolder#getMaximized() | |
88 * @see CTabFolder#setMaximized(bool) | |
89 * @see CTabFolder#setMaximizeVisible(bool) | |
90 */ | |
91 public void maximize(CTabFolderEvent event); | |
92 | |
93 /** | |
94 * Sent when the user clicks on the restore button of a CTabFolder. | |
95 * This event is sent either to restore the CTabFolder from the | |
96 * minimized state or from the maximized state. To determine | |
97 * which restore is requested, use CTabFolder.getMinimized() or | |
98 * CTabFolder.getMaximized() to determine the current state. | |
99 * The state of the CTabFolder does not change automatically - it | |
100 * is up to the application to change the state of the CTabFolder | |
101 * in response to this event using CTabFolder.setMaximized(false) | |
102 * or CTabFolder.setMinimized(false). | |
103 * | |
104 * @param event an event containing information about the restore | |
105 * | |
106 * @see CTabFolder#getMinimized() | |
107 * @see CTabFolder#getMaximized() | |
108 * @see CTabFolder#setMinimized(bool) | |
109 * @see CTabFolder#setMinimizeVisible(bool) | |
110 * @see CTabFolder#setMaximized(bool) | |
111 * @see CTabFolder#setMaximizeVisible(bool) | |
112 */ | |
113 public void restore(CTabFolderEvent event); | |
114 | |
115 /** | |
116 * Sent when the user clicks on the chevron button of the CTabFolder. | |
117 * A chevron appears in the CTabFolder when there are more tabs | |
118 * than can be displayed at the current widget size. To select a | |
119 * tab that is not currently visible, the user clicks on the | |
120 * chevron and selects a tab item from a list. By default, the | |
121 * CTabFolder provides a list of all the items that are not currently | |
122 * visible, however, the application can provide its own list by setting | |
123 * the event.doit field to <code>false</code> and displaying a selection list. | |
124 * | |
125 * @param event an event containing information about the show list | |
126 * | |
127 * @see CTabFolder#setSelection(CTabItem) | |
128 */ | |
129 public void showList(CTabFolderEvent event); | |
130 } | |
131 | |
132 | |
133 | |
134 /// Helper class for the dgListener template function | |
135 private class _DgCTabFolder2ListenerT(Dg,T...) : CTabFolder2Listener { | |
136 | |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
137 version(Tango){ |
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
138 alias ParameterTupleOf!(Dg) DgArgs; |
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
139 static assert( is(DgArgs == Tuple!(CTabFolderEvent,T)), |
120
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
49
diff
changeset
|
140 "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" ); |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
141 } else { // Phobos |
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
142 alias ParameterTypeTuple!(Dg) DgArgs; |
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
143 static assert( is(DgArgs == TypeTuple!(CTabFolderEvent,T)), |
120
536e43f63c81
Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661
Denis Shelomovskij <verylonglogin.reg@gmail.com>
parents:
49
diff
changeset
|
144 "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" ); |
49
7a2dd761a8b2
more work until dmd 2.026 linux segfaults.
Frank Benoit <benoit@tionex.de>
parents:
48
diff
changeset
|
145 } |
25 | 146 |
147 Dg dg; | |
148 T t; | |
149 int type; | |
150 | |
151 private this( int type, Dg dg, T t ){ | |
152 this.type = type; | |
153 this.dg = dg; | |
154 static if( T.length > 0 ){ | |
155 this.t = t; | |
156 } | |
157 } | |
158 | |
159 void itemClosed( CTabFolderEvent e ){ | |
160 dg(e,t); | |
161 } | |
162 public void close(CTabFolderEvent e){ | |
163 if( type is CTabFolder2Listener.CLOSE ){ | |
164 dg(e,t); | |
165 } | |
166 } | |
167 public void minimize(CTabFolderEvent e){ | |
168 if( type is CTabFolder2Listener.MINIMIZE ){ | |
169 dg(e,t); | |
170 } | |
171 } | |
172 public void maximize(CTabFolderEvent e){ | |
173 if( type is CTabFolder2Listener.MAXIMIZE ){ | |
174 dg(e,t); | |
175 } | |
176 } | |
177 public void restore(CTabFolderEvent e){ | |
178 if( type is CTabFolder2Listener.RESTORE ){ | |
179 dg(e,t); | |
180 } | |
181 } | |
182 public void showList(CTabFolderEvent e){ | |
183 if( type is CTabFolder2Listener.SHOWLIST ){ | |
184 dg(e,t); | |
185 } | |
186 } | |
187 } | |
188 | |
189 /++ | |
190 + dgListener creates a class implementing the Listener interface and delegating the call to | |
191 + handleEvent to the users delegate. This template function will store also additional parameters. | |
192 + | |
193 + Examle of usage: | |
194 + --- | |
195 + void handleTextEvent ( Event e, int inset ) { | |
196 + // ... | |
197 + } | |
198 + text.addListener (SWT.FocusOut, dgListener( &handleTextEvent, inset )); | |
199 + --- | |
200 +/ | |
201 CTabFolder2Listener dgCTabFolder2Listener( Dg, T... )( int type, Dg dg, T args ){ | |
202 return new _DgCTabFolder2ListenerT!( Dg, T )( type, dg, args ); | |
203 } | |
204 | |
205 | |
206 |