2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.openapi
.wm
.ex
;
18 import com
.intellij
.openapi
.project
.Project
;
19 import com
.intellij
.openapi
.wm
.WindowManager
;
20 import com
.intellij
.openapi
.wm
.IdeFrame
;
21 import com
.intellij
.openapi
.wm
.impl
.CommandProcessor
;
22 import com
.intellij
.openapi
.wm
.impl
.DesktopLayout
;
23 import com
.intellij
.openapi
.wm
.impl
.IdeFrameImpl
;
24 import org
.jetbrains
.annotations
.NotNull
;
25 import org
.jetbrains
.annotations
.Nullable
;
29 import java
.awt
.event
.ComponentEvent
;
32 * @author Anton Katilin
33 * @author Vladimir Kondratyev
35 public abstract class WindowManagerEx
extends WindowManager
{
36 public static WindowManagerEx
getInstanceEx(){
37 return (WindowManagerEx
)WindowManager
.getInstance();
41 public abstract IdeFrameImpl
getFrame(Project project
);
43 public abstract IdeFrameImpl
allocateFrame(Project project
);
45 public abstract void releaseFrame(IdeFrameImpl frame
);
48 * @return focus owner of the specified window.
49 * @exception IllegalArgumentException if <code>window</code> is <code>null</code>.
51 public abstract Component
getFocusedComponent(@NotNull Window window
);
54 * @param project may be <code>null</code> when no project is opened.
55 * @return focused component for the project. If project isn't specified then
56 * the method returns focused component in window which has no project.
57 * If there is no focused component at all then the method returns <code>null</code>.
59 public abstract Component
getFocusedComponent(Project project
);
61 public abstract Window
getMostRecentFocusedWindow();
63 public abstract IdeFrame
findFrameFor(@Nullable Project project
);
65 public abstract CommandProcessor
getCommandProcessor();
68 * @return default layout for tool windows.
70 public abstract DesktopLayout
getLayout();
73 * Copies <code>layout</code> into internal default layout.
75 public abstract void setLayout(DesktopLayout layout
);
78 * This method is invoked by <code>IdeEventQueue</code> to notify window manager that
79 * some window activity happens. <u><b>Do not invoke it in other places!!!<b></u>
81 public abstract void dispatchComponentEvent(ComponentEvent e
);
84 * @return union of bounds of all default screen devices. Note that <code>x</code> and/or <code>y</code>
85 * coordinates can be negative. It depends on phisical configuration of graphics devices.
86 * For example, the left monitor has negative coordinates on Win32 platform with dual monitor support
87 * (right monitor is the primer one) .
89 public abstract Rectangle
getScreenBounds();
92 * @return bounds for the screen device for the given project frame
94 public abstract Rectangle
getScreenBounds(@NotNull final Project project
);
97 * @return <code>true</code> is and only if current OS supports alpha mode for windows and
98 * all native libraries were successfully loaded.
100 public abstract boolean isAlphaModeSupported();
103 * Sets alpha (transparency) ratio for the specified <code>window</code>.
104 * If alpha mode isn't supported by underlying windowing system then the method does nothing.
105 * The method also does nothing if alpha mode isn't enabled for the specified <code>window</code>.
106 * @param window <code>window</code> which transparency should be changed.
107 * @param ratio ratio of transparency. <code>0</code> means absolutely non transparent window.
108 * <code>1</code> means absolutely transparent window.
109 * @exception java.lang.IllegalArgumentException if <code>window</code> is not
110 * desplayable or not showing.
111 * @exception java.lang.IllegalArgumentException if <code>ration</code> isn't
112 * in <code>[0..1]</code> range.
114 public abstract void setAlphaModeRatio(Window window
,float ratio
);
116 public abstract void setWindowMask(Window window
, Shape mask
);
118 public abstract void resetWindow(final Window window
);
121 * @return <code>true</code> if specified <code>window</code> is currently is alpha mode.
123 public abstract boolean isAlphaModeEnabled(Window window
);
126 * Sets whether the alpha (transparent) mode is enabled for specified <code>window</code>.
127 * If alpha mode isn't supported by underlying windowing system then the method does nothing.
128 * @param window window which mode to be set.
129 * @param state determines the new alpha mode.
131 public abstract void setAlphaModeEnabled(Window window
,boolean state
);
134 * Either dispose the dialog immediately if project's frame has focus or just hide and dispose when frame gets focus or closes.
135 * @param dialog to hide and dispose later
136 * @param project the dialog has been shown for
138 public abstract void hideDialog(JDialog dialog
, Project project
);