1 /*******************************************************************************
2 * Copyright (c) 2000, 2017 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.custom;
16 import java.util.function.*;
18 import org.eclipse.swt.internal.*;
21 * Classes which implement this interface provide methods
22 * that deal with the events that are generated by the CTabFolder
25 * After creating an instance of a class that implements
26 * this interface it can be added to a CTabFolder using the
27 * <code>addCTabFolder2Listener</code> method and removed using
28 * the <code>removeCTabFolder2Listener</code> method. When
29 * events occurs in a CTabFolder the appropriate method
33 * @see CTabFolder2Adapter
34 * @see CTabFolderEvent
38 public interface CTabFolder2Listener extends SWTEventListener {
41 * Sent when the user clicks on the close button of an item in the CTabFolder.
42 * The item being closed is specified in the event.item field.
43 * Setting the event.doit field to false will stop the CTabItem from closing.
44 * When the CTabItem is closed, it is disposed. The contents of the
45 * CTabItem (see CTabItem.setControl) will be made not visible when
46 * the CTabItem is closed.
48 * @param event an event indicating the item being closed
50 public void close(CTabFolderEvent event);
53 * Sent when the user clicks on the minimize button of a CTabFolder.
54 * The state of the CTabFolder does not change automatically - it
55 * is up to the application to change the state of the CTabFolder
56 * in response to this event using CTabFolder.setMinimized(true).
58 * @param event an event containing information about the minimize
60 * @see CTabFolder#getMinimized()
61 * @see CTabFolder#setMinimized(boolean)
62 * @see CTabFolder#setMinimizeVisible(boolean)
64 public void minimize(CTabFolderEvent event);
67 * Sent when the user clicks on the maximize button of a CTabFolder.
68 * The state of the CTabFolder does not change automatically - it
69 * is up to the application to change the state of the CTabFolder
70 * in response to this event using CTabFolder.setMaximized(true).
72 * @param event an event containing information about the maximize
74 * @see CTabFolder#getMaximized()
75 * @see CTabFolder#setMaximized(boolean)
76 * @see CTabFolder#setMaximizeVisible(boolean)
78 public void maximize(CTabFolderEvent event);
81 * Sent when the user clicks on the restore button of a CTabFolder.
82 * This event is sent either to restore the CTabFolder from the
83 * minimized state or from the maximized state. To determine
84 * which restore is requested, use CTabFolder.getMinimized() or
85 * CTabFolder.getMaximized() to determine the current state.
86 * The state of the CTabFolder does not change automatically - it
87 * is up to the application to change the state of the CTabFolder
88 * in response to this event using CTabFolder.setMaximized(false)
89 * or CTabFolder.setMinimized(false).
91 * @param event an event containing information about the restore
93 * @see CTabFolder#getMinimized()
94 * @see CTabFolder#getMaximized()
95 * @see CTabFolder#setMinimized(boolean)
96 * @see CTabFolder#setMinimizeVisible(boolean)
97 * @see CTabFolder#setMaximized(boolean)
98 * @see CTabFolder#setMaximizeVisible(boolean)
100 public void restore(CTabFolderEvent event);
103 * Sent when the user clicks on the chevron button of the CTabFolder.
104 * A chevron appears in the CTabFolder when there are more tabs
105 * than can be displayed at the current widget size. To select a
106 * tab that is not currently visible, the user clicks on the
107 * chevron and selects a tab item from a list. By default, the
108 * CTabFolder provides a list of all the items that are not currently
109 * visible, however, the application can provide its own list by setting
110 * the event.doit field to <code>false</code> and displaying a selection list.
112 * @param event an event containing information about the show list
114 * @see CTabFolder#setSelection(CTabItem)
116 public void showList(CTabFolderEvent event);
119 * Static helper method to create a <code>CTabFolder2Listener</code> for the
120 * {@link #close(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
122 * @param c the consumer of the event
123 * @return CTabFolder2Listener
126 public static CTabFolder2Listener closeAdapter(Consumer<CTabFolderEvent> c) {
127 return new CTabFolder2Adapter() {
129 public void close(CTabFolderEvent e) {
136 * Static helper method to create a <code>CTabFolder2Listener</code> for the
137 * {@link #minimize(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
139 * @param c the consumer of the event
140 * @return CTabFolder2Listener
143 public static CTabFolder2Listener minimizeAdapter(Consumer<CTabFolderEvent> c) {
144 return new CTabFolder2Adapter() {
146 public void minimize(CTabFolderEvent e) {
153 * Static helper method to create a <code>CTabFolder2Listener</code> for the
154 * {@link #maximize(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
156 * @param c the consumer of the event
157 * @return CTabFolder2Listener
160 public static CTabFolder2Listener maximizeAdapter(Consumer<CTabFolderEvent> c) {
161 return new CTabFolder2Adapter() {
163 public void maximize(CTabFolderEvent e) {
170 * Static helper method to create a <code>CTabFolder2Listener</code> for the
171 * {@link #restore(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
173 * @param c the consumer of the event
174 * @return CTabFolder2Listener
177 public static CTabFolder2Listener restoreAdapter(Consumer<CTabFolderEvent> c) {
178 return new CTabFolder2Adapter() {
180 public void restore(CTabFolderEvent e) {
187 * Static helper method to create a <code>CTabFolder2Listener</code> for the
188 * {@link #showList(CTabFolderEvent e)}) method, given a lambda expression or a method reference.
190 * @param c the consumer of the event
191 * @return CTabFolder2Listener
194 public static CTabFolder2Listener showListAdapter(Consumer<CTabFolderEvent> c) {
195 return new CTabFolder2Adapter() {
197 public void showList(CTabFolderEvent e) {