2caa33a09fbf3ed984a5f9b9bb27cd9a38ed13c3
[fedora-idea.git] / platform / platform-impl / src / com / intellij / openapi / wm / ex / WindowManagerEx.java
blob2caa33a09fbf3ed984a5f9b9bb27cd9a38ed13c3
1 /*
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;
27 import javax.swing.*;
28 import java.awt.*;
29 import java.awt.event.ComponentEvent;
31 /**
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);
47 /**
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);
53 /**
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();
67 /**
68 * @return default layout for tool windows.
70 public abstract DesktopLayout getLayout();
72 /**
73 * Copies <code>layout</code> into internal default layout.
75 public abstract void setLayout(DesktopLayout layout);
77 /**
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);
83 /**
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();
91 /**
92 * @return <code>true</code> is and only if current OS supports alpha mode for windows and
93 * all native libraries were successfully loaded.
95 public abstract boolean isAlphaModeSupported();
97 /**
98 * Sets alpha (transparency) ratio for the specified <code>window</code>.
99 * If alpha mode isn't supported by underlying windowing system then the method does nothing.
100 * The method also does nothing if alpha mode isn't enabled for the specified <code>window</code>.
101 * @param window <code>window</code> which transparency should be changed.
102 * @param ratio ratio of transparency. <code>0</code> means absolutely non transparent window.
103 * <code>1</code> means absolutely transparent window.
104 * @exception java.lang.IllegalArgumentException if <code>window</code> is not
105 * desplayable or not showing.
106 * @exception java.lang.IllegalArgumentException if <code>ration</code> isn't
107 * in <code>[0..1]</code> range.
109 public abstract void setAlphaModeRatio(Window window,float ratio);
111 public abstract void setWindowMask(Window window, Shape mask);
113 public abstract void resetWindow(final Window window);
116 * @return <code>true</code> if specified <code>window</code> is currently is alpha mode.
118 public abstract boolean isAlphaModeEnabled(Window window);
121 * Sets whether the alpha (transparent) mode is enabled for specified <code>window</code>.
122 * If alpha mode isn't supported by underlying windowing system then the method does nothing.
123 * @param window window which mode to be set.
124 * @param state determines the new alpha mode.
126 public abstract void setAlphaModeEnabled(Window window,boolean state);
129 * Either dispose the dialog immediately if project's frame has focus or just hide and dispose when frame gets focus or closes.
130 * @param dialog to hide and dispose later
131 * @param project the dialog has been shown for
133 public abstract void hideDialog(JDialog dialog, Project project);