package nxm.sys.libg;

import java.awt.Container;

import nxm.sys.inc.InternalUseOnly;

/** SPLIT LIB LIBG VERSION / Future version where nxm.sys.inc.GPrimitive is gone
 *
 *  @author Jeanette McCall
 *  @since  NeXtMidas 4.0.0
 *
 */
class GPrimitiveModSwap extends nxm.sys.lib.GPrimitive {

  /** Midas Window
      NOTE: this should become protected (or maybe even private) in 3.9+
   */
  @InternalUseOnly("since 3.5.3, use getMWindow() or setMWindow")
  public MWindow MW;

  @Override
  public Object getNextLink() { return MW; }

  @Override
  public void checkout() {
    super.checkout();

    if (MW != null) { MW.close(); }
    MW = null;
  }

  /** Gets the primary container used when displaying this graphical primitive. Subclasses may
      override this as necessary.
      @return The graphics panel or null if none is set.
      @since NeXtMidas 2.5.0
   */
  public Container getGraphicsContainer() {
    return (MW == null)? null: MW.panel;
  }

  /** @return MWindow for this graphical primitive
      @since NeXtMidas 3.5.3
   */
  public MWindow getMWindow () { return MW; }

  /** @param mw MWindow to use for this graphical primitive
      @since NeXtMidas 3.5.3
   */
  protected void setMWindow (MWindow mw) { MW = mw; }

}
