X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.eclipse.swt.win32.win32.x86_64%2Fsrc%2Forg%2Feclipse%2Fswt%2Fwidgets%2FTray.java;fp=bundles%2Forg.eclipse.swt.win32.win32.x86_64%2Fsrc%2Forg%2Feclipse%2Fswt%2Fwidgets%2FTray.java;h=a0f34b4525ea775bb3af462c746aba2455e7f205;hb=6b98970d0458754dd67f789afbd0a39e1e7ac6eb;hp=0000000000000000000000000000000000000000;hpb=56a61575ce0d27b340cb12438c8a7f303842095e;p=simantics%2Fplatform.git diff --git a/bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/Tray.java b/bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/Tray.java new file mode 100644 index 000000000..a0f34b452 --- /dev/null +++ b/bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/Tray.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.widgets; + + +import org.eclipse.swt.*; + +/** + * Instances of this class represent the system tray that is part + * of the task bar status area on some operating systems. + * + *
+ *
Styles:
+ *
(none)
+ *
Events:
+ *
(none)
+ *
+ *

+ * IMPORTANT: This class is not intended to be subclassed. + *

+ * + * @see Display#getSystemTray + * @see Tray, TrayItem snippets + * @see Sample code and further information + * + * @since 3.0 + * @noextend This class is not intended to be subclassed by clients. + */ +public class Tray extends Widget { + int itemCount; + TrayItem [] items = new TrayItem [4]; + +Tray (Display display, int style) { + this.display = display; + reskinWidget (); +} + +void createItem (TrayItem item, int index) { + if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE); + if (itemCount == items.length) { + TrayItem [] newItems = new TrayItem [items.length + 4]; + System.arraycopy (items, 0, newItems, 0, items.length); + items = newItems; + } + System.arraycopy (items, index, items, index + 1, itemCount++ - index); + items [index] = item; +} + +void destroyItem (TrayItem item) { + int index = 0; + while (index < itemCount) { + if (items [index] == item) break; + index++; + } + if (index == itemCount) return; + System.arraycopy (items, index + 1, items, index, --itemCount - index); + items [itemCount] = null; +} + +/** + * Returns the item at the given, zero-relative index in the + * receiver. Throws an exception if the index is out of range. + * + * @param index the index of the item to return + * @return the item at the given index + * + * @exception IllegalArgumentException + * @exception SWTException + */ +public TrayItem getItem (int index) { + checkWidget (); + if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE); + return items [index]; +} + +/** + * Returns the number of items contained in the receiver. + * + * @return the number of items + * + * @exception SWTException + */ +public int getItemCount () { + checkWidget (); + return itemCount; +} + +/** + * Returns an array of TrayItems which are the items + * in the receiver. + *

+ * Note: This is not the actual structure used by the receiver + * to maintain its list of items, so modifying the array will + * not affect the receiver. + *

+ * + * @return the items in the receiver + * + * @exception SWTException + */ +public TrayItem [] getItems () { + checkWidget (); + TrayItem [] result = new TrayItem [itemCount]; + System.arraycopy (items, 0, result, 0, result.length); + return result; +} + +@Override +void releaseChildren (boolean destroy) { + if (items != null) { + for (int i=0; i