001package org.vishia.gral.base;
002
003import org.vishia.gral.ifc.GralRectangle;
004
005/**This interface is used as reference to the implementation layer for all widgets.
006 * It defines all possible calls from the application to the implementation widget.
007 * <br><br>
008 * Note that most of user requirements are done by the {@link GralWidget} capability and the
009 * capabilities of its derived classes, for example {@link GralWidget#setText(CharSequence)}
010 * or {@link GralWidget#setBackColor(org.vishia.gral.ifc.GralColor, int)}. That methods 
011 * stores the text, color etc. in graphic-independent attributes. The method 
012 * {@link #repaintGthread()} is the central method to realize that user stimuli for the
013 * implementation graphic layer. That method can use especially the {@link GralWidget.DynamicData}
014 * and there quest method {@link GralWidget.DynamicData#whatIsChanged}.
015 * There is no needing of methods such as <code>setText(String)</code> etc. because the user
016 * should able to set the text in any thread. See concept of data set described on {@link GralWidget#setText(CharSequence)} 
017 * See {@link GralWidget#_wdgImpl}. 
018 * @since 2013-06
019 * @author Hartmut Schorrig
020 *
021 */
022public interface GralWidgImpl_ifc
023{
024  
025  
026  
027  
028  /**Sets the focus to the widget.
029   * See {@link GralMng_ifc#setFocus(GralWidget)}.
030   * @return true if it has the focus after this operation.
031   *   false on any error.
032   */
033  boolean setFocusGThread();
034  
035  
036  /**Sets the implementation widget(s) visible state. The widgets are really invisible, or they are visible in principle, but they can be covered by other windows or clipping.
037   * This method should set the {@link GralWidget#bVisibleState} too. Therewith it is able to quest {@link GralWidget#isVisible()} in any thread.
038   * @param bVisible true then the widget should be visible, false it is set to invisible.
039   */
040  void setVisibleGThread(boolean bVisible);
041  
042  /**
043   * @param visible
044   * @return
045   * @deprecated
046   */
047  //@Deprecated
048  //boolean setVisible(boolean visible);
049
050  /**Removes the graphical widget in the graphic. */
051  void removeWidgetImplementation();
052  
053  
054  /**This method should be implemented in all Widget implementations of the adapter for the
055   * underlying graphic system. 
056   * <br>Implementation hints: In SWT it should call redraw(). 
057   * <br>It is possible that the widget
058   * consists of more as one graphical widget, then all of it should be redrawn. 
059   * It is possible that some data are set in another thread, they should be applied to the widgets firstly.
060   * It is possible that the widget is removed though a repaintGthread-order is pending from the time before deleting,
061   * for example if the graphic layout is changed. 
062   * <br><br>
063   * See {@link #repaintRequ}
064   * 
065   */
066  void repaintGthread();
067
068  
069  /**Returns the implementation class of the widget. If the widget has more as one implementation widgets,
070   * this method returns one of the widgets, usual the first important one respectively that widget which represents
071   * the implementation layer. A widget of the implementation layer is a SWT.control or a {@link java.awt.Component}.
072   * <br><br>
073   * If more as one widget are part of the GralWidget, use the special {@link GralWidget#_wdgImpl} class 
074   * which should contain the references to that implementation widgets.
075   * */
076  Object getWidgetImplementation();
077  
078  void setBoundsPixel(int x, int y, int dx, int dy);
079 
080  GralRectangle getPixelPositionSize();
081  
082  
083  
084
085  
086}