/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Original Author: David W. Hyatt (hyatt@netscape.com)
 *
 * Contributor(s): 
 *  Ben Goodger <ben@netscape.com>
 */

#include "nsISupports.idl"
#include "domstubs.idl"

interface nsIOutlinerView;
interface nsIOutlinerSelection;
interface nsIDOMEvent;

[scriptable, uuid(8398C757-6387-480c-82B2-C914E15CE00D)]
interface nsIOutlinerBoxObject : nsISupports
{
  /**
   * The view that backs the outliner and that supplies it with its data.
   * It is dynamically settable, either using a view attribute on the
   * outliner tag or by setting this attribute to a new value.
   */
  attribute nsIOutlinerView view;

  /**
   * Whether or not we are currently focused.
   */
  attribute boolean focused;

  /**
   * Obtain the outlinerbody content node
   */
  readonly attribute nsIDOMElement outlinerBody;

  /**
   * Obtains the selection from the view.
   */
  readonly attribute nsIOutlinerSelection selection;

  /**
   * Obtain the height of a row.
   */
  readonly attribute long rowHeight;

  /**
   * Get the index of the first visible row.
   */
  long getFirstVisibleRow();

  /**
   * Get the index of the last visible row.
   */
  long getLastVisibleRow();

  /**
   * Gets the number of possible visible rows.
   */
  long getPageCount();

  /**
   * Ensures that a row at a given index is visible.
   */
  void ensureRowIsVisible(in long index);

  /**
   * Scrolls such that the row at index is at the top of the visible view.
   */
  void scrollToRow(in long index);

  /**
   * Scroll the outliner up or down by numLines lines. Positive
   * values move down in the outliner. Prevents scrolling off the
   * end of the outliner. 
   */
  void scrollByLines(in long numLines);

  /**
   * Scroll the outliner up or down by numPages pages. A page
   * is considered to be the amount displayed by the outliner.
   * Positive values move down in the outliner. Prevents scrolling
   * off the end of the outliner.
   */
  void scrollByPages(in long numPages);
  
  /**
   * Invalidation methods for fine-grained painting control.
   */
  void invalidate();
  void invalidateRow(in long index);
  void invalidateCell(in long row, in wstring colID);
  void invalidateRange(in long startIndex, in long endIndex);
  void invalidateScrollbar();

  /**
   * A hit test that can tell you what cell the mouse is over.  Row is the row index
   * hit.  ColID is the column hit.  ChildElt is the pseudoelement hit: this can have
   * values of "cell", "twisty", "image", and "text".
   */
  void getCellAt(in long x, in long y, out long row, out wstring colID, out wstring childElt);

  /** 
   * Find the coordinates of an element within a specific cell. 
   */
  void getCoordsForCellItem(in long row, in wstring colID, in wstring element, 
                            out long x, out long y, out long width, out long height);

  /**
   * The view is responsible for calling these notification methods when
   * rows are added or removed.  Index is the position at which the new
   * rows were added or at which rows were removed.  For
   * non-contiguous additions/removals, this method should be called multiple times.
   */
  void rowCountChanged(in long index, in long count);
  
  /**
   * Drag handlers, installed from XBL, called when drags occur to handle painting
   */
  void onDragEnter ( in nsIDOMEvent event ) ;
  void onDragExit ( in nsIDOMEvent event ) ;
  void onDragOver ( in nsIDOMEvent event)  ;
  void onDragDrop ( in nsIDOMEvent event ) ;
  
};

%{C++
// Initializer,
%}

