001package org.vishia.gral.ifc;
002
003import org.vishia.gral.base.GralMenu;
004import org.vishia.gral.base.GralWidget;
005import org.vishia.gral.base.GralWindow_setifc;
006
007
008/**Interface to a Gral Window. In SWT ist is named as 'shell'. An application can have more as one window.
009 * The base classes {@link org.vishia.gral.base.GralWindow} is the base of implementation.
010 * This interface contains the get and set access-interfaces (the base ones)
011 * and contains the build-method-definition for windows.
012 */
013public interface GralWindow_ifc extends GralWindow_getifc, GralWindow_setifc, GralWidget_ifc 
014{
015  /**Version, history and license.
016   * <ul>
017   * <li>2016-09-18 Hartmut chg: renaming {@link #specifyActionOnCloseWindow(GralUserAction)} instead 'setActionOnSettingInvisible', more expressive name. 
018   * <li>2015-04-27 Hartmut new {@link #windRemoveOnClose}
019   * <li>2012-03-16 Hartmut new: {@value #windResizeable} defined and supported in SWT-implementation.
020   * <li>2012-03-13 Hartmut chg: This interface should be used for building the window. Therefore
021   *   all building methods should be contained here. Gotten from implementors. 
022   * <li>2011-06-00 Hartmut created
023   * </ul>
024   * <br><br>
025   * <b>Copyright/Copyleft</b>:<br>
026   * For this source the LGPL Lesser General Public License,
027   * published by the Free Software Foundation is valid.
028   * It means:
029   * <ol>
030   * <li> You can use this source without any restriction for any desired purpose.
031   * <li> You can redistribute copies of this source to everybody.
032   * <li> Every user of this source, also the user of redistribute copies
033   *    with or without payment, must accept this license for further using.
034   * <li> But the LPGL is not appropriate for a whole software product,
035   *    if this source is only a part of them. It means, the user
036   *    must publish this part of source,
037   *    but doesn't need to publish the whole source of the own product.
038   * <li> You can study and modify (improve) this source
039   *    for own using or for redistribution, but you have to license the
040   *    modified sources likewise under this LGPL Lesser General Public License.
041   *    You mustn't delete this Copyright/Copyleft inscription in this source file.
042   * </ol>
043   * If you intent to use this source without publishing its usage, you can get
044   * a second license subscribing a special contract with the author. 
045   * 
046   * @author Hartmut Schorrig = hartmut.schorrig@vishia.de
047   */
048  public static final int version = 20120317;
049
050  
051  
052  
053  /**Property defines that the window should be removed on closing.
054   * If this is not set the window is set to invisible but remain. It can be set to visible
055   * with its given content anytime again.
056   */
057  public static final int windRemoveOnClose = 1<<5;
058  
059  /**Property defines that the window is able to resize
060   */
061  public static final int windResizeable = 1<<4;
062  
063  /**Property defines that the window is opened exclusive for the application. 
064   * It means that the primary window is not accessible if this window is opened.
065   * It is 'application modal'. 
066   */
067  public static final int windExclusive = 1<<16;
068  
069  /**Property defines that the window is opened concurrently together with other windows 
070   * of the application, especially concurrently to the primary window. This property should be set
071   * if the {@link #windExclusive} property is not set.
072   * It is 'application non-modal'. 
073   */
074  public static final int windConcurrently = 1<<30;
075  
076  public static final int windOnTop =  1 << 14;
077  
078  public static final int windHasMenu =  1 << 31;
079  
080  static final int windIsMain =  1 ;
081  
082  
083  /**Sets an action which is invoked if the whole window is resized by user handling on the window borders.
084   * @param action The {@link GralUserAction#userActionGui(int, GralWidget, Object...)} will be called
085   *   without parameter.
086   */
087  public abstract void setResizeAction(GralUserAction action);
088  
089  /**Sets an action which is invoked if any mouse button is pressed in the windows area on the screen.
090   * @param action The {@link GralUserAction#userActionGui(int, GralWidget, Object...)} will be called
091   *   with parameter key: The mouse key. params[0]: Instance of {@link GralRectangle} with mouse coordinates.
092   */
093  abstract public void setMouseAction(GralUserAction action);
094  
095  /**Adds any menu item
096   * @param name name of the menu, it is used as widget name.
097   * @param sMenuPath Menu position. Use slash as separator, use & for hot key.
098   *   For example "&edit/&search/co&ntinue" creates a menu 'edit' or uses the existing one in the top level (menu bar),
099   *   then creates the search menu item as pull down in menu bar, and then 'continue' with 'n' as hot key as sub-menu. 
100   *   It is stored in {@link GralWidget#sDataPath}  
101   * @param action called on menu activation.
102   * @deprecated use {@link #getMenuBar()} and then {@link GralMenu#addMenuItem(String, String, GralUserAction)}
103   */
104  @Deprecated abstract public void addMenuBarItemGThread(String nameWidg, String sMenuPath, GralUserAction action);
105  
106  
107  /**Gets the menu bar to add a menu item. If this window hasn't a gral menu bar, then the menu bar
108   * is created by calling {@link GralMng#createMenuBar(GralWindow)}.
109   * If the window has a menu bar already, it is stored in the reference {@link #menuBarGral}.
110   * @return the menu root for this window.
111   */
112  GralMenu getMenuBar();
113  
114  /**Sets an action which is invoked if the window is set invisible or it is disposed.
115   * Note that depending of the property {@link #windRemoveOnClose} the window is disposed or it is set invisible without disposing
116   * if the close action is done by the user. In both cases this action will be invoked.
117   * @since 2015-09 renamed, old identifier is 'setActionOnSettingInvisible'
118   * @param action The {@link GralUserAction#userActionGui(int, GralWidget, Object...)} will be called
119   *   without parameter.
120   */
121  public abstract void specifyActionOnCloseWindow(GralUserAction action);
122
123  void setFullScreen(boolean full);
124
125
126  
127  public abstract void setTitle(String sTitle);
128
129
130}