1/*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package java.awt.peer;
27
28import java.awt.Image;
29import java.awt.PopupMenu;
30import java.awt.Taskbar;
31import java.awt.Taskbar.Feature;
32import java.awt.Taskbar.State;
33import java.awt.Window;
34
35
36/**
37 * The {@code TaskbarPeer} interface provides methods for interacting with
38 * system task area.
39 */
40public interface TaskbarPeer {
41
42    /**
43     * Requests user attention to this application.
44     *
45     * @param enabled disables this request if false
46     * @param critical if this is an important request
47     * @see Taskbar#requestUserAttention
48     */
49    default void requestUserAttention(boolean enabled, final boolean critical) {}
50
51    /**
52     * Requests user attention to the specified window.
53     *
54     * @param w window
55     */
56    default void requestWindowUserAttention(Window w) {}
57
58    /**
59     * Attaches the contents of the provided PopupMenu to the application icon
60     * in system task area.
61     *
62     * @param menu the PopupMenu to attach to this application
63     */
64    default void setMenu(final PopupMenu menu) {}
65
66    /**
67     * Gets PopupMenu used to add items to this application's icon in system task area.
68     *
69     * @return the PopupMenu
70     */
71    default PopupMenu getMenu() { return null; }
72
73    /**
74     * Changes this application's icon to the provided image.
75     *
76     * @param image to change
77     */
78    default void setIconImage(final Image image) {}
79
80    /**
81     * Obtains an image of this application's icon.
82     *
83     * @return an image of this application's icon
84     */
85    default Image getIconImage() { return null; }
86
87    /**
88     * Affixes a small system-provided badge to this application's icon.
89     * Usually a number.
90     *
91     * @param badge label to affix to the icon
92     */
93    default void setIconBadge(final String badge) {}
94
95    /**
96     * Affixes a small badge to this application's icon in task area
97     * for the specified window.
98     *
99     * @param w window to update
100     * @param badge image to affix to the icon
101     */
102    default void setWindowIconBadge(Window w, final Image badge) {}
103
104    /**
105     * Displays progress for specified window.
106     *
107     * @param w window to update
108     * @param value from 0 to 100, other to disable progress indication
109     */
110    default void setWindowProgressValue(Window w, int value) {}
111
112    /**
113     * Sets a progress state for a specified window.
114     *
115     * @param w window
116     * @param state to change to
117     * @see Taskbar#setWindowProgressState
118     */
119    default void setWindowProgressState(Window w, State state) {}
120
121    /**
122     * Affixes a small system-provided progress bar to this application's icon.
123     *
124     * @param value from 0 to 100, other to disable progress indication
125     */
126    default void setProgressValue(int value) {}
127
128    /**
129     * Tests support of {@code Feature} on current platform.
130     * @param f feature to test
131     * @return true if feature supported supported
132     */
133    default public boolean isSupported(Feature f) { return false; }
134}
135