tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsITreeView.idl (5757B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "nsISupports.idl"
      7 
      8 interface nsITreeSelection;
      9 
     10 webidl DataTransfer;
     11 webidl TreeColumn;
     12 webidl XULTreeElement;
     13 
     14 [scriptable, uuid(091116f0-0bdc-4b32-b9c8-c8d5a37cb088)]
     15 interface nsITreeView : nsISupports
     16 {
     17  /**
     18   * The total number of rows in the tree (including the offscreen rows).
     19   */
     20  readonly attribute long rowCount;
     21 
     22  /**
     23   * The selection for this view.
     24   */
     25  attribute nsITreeSelection selection;
     26 
     27  /**
     28   * A whitespace delimited list of properties.  For each property X the view
     29   * gives back will cause the pseudoclasses  ::-moz-tree-cell(x),
     30   * ::-moz-tree-row(x), ::-moz-tree-twisty(x), ::-moz-tree-image(x),
     31   * ::-moz-tree-cell-text(x).  to be matched on the pseudoelement
     32   * ::moz-tree-row.
     33   */
     34  AString getRowProperties(in long index);
     35 
     36  /**
     37   * A whitespace delimited list of properties for a given cell.  Each
     38   * property, x, that the view gives back will cause the pseudoclasses
     39   *  ::-moz-tree-cell(x), ::-moz-tree-row(x), ::-moz-tree-twisty(x),
     40   *  ::-moz-tree-image(x), ::-moz-tree-cell-text(x). to be matched on the
     41   *  cell.
     42   */
     43  AString getCellProperties(in long row, in TreeColumn col);
     44 
     45  /**
     46   * Called to get properties to paint a column background.  For shading the sort
     47   * column, etc.
     48   */
     49  AString getColumnProperties(in TreeColumn col);
     50 
     51  /**
     52   * Methods that can be used to test whether or not a twisty should be drawn,
     53   * and if so, whether an open or closed twisty should be used.
     54   */
     55  boolean isContainer(in long index);
     56  boolean isContainerOpen(in long index);
     57  boolean isContainerEmpty(in long index);
     58 
     59  /**
     60   * isSeparator is used to determine if the row at index is a separator.
     61   * A value of true will result in the tree drawing a horizontal separator.
     62   * The tree uses the ::moz-tree-separator pseudoclass to draw the separator.
     63   */
     64  boolean isSeparator(in long index);
     65 
     66  /**
     67   * Specifies if there is currently a sort on any column. Used mostly by dragdrop
     68   * to affect drop feedback.
     69   */
     70  boolean isSorted();
     71 
     72  const short DROP_BEFORE = -1;
     73  const short DROP_ON = 0;
     74  const short DROP_AFTER = 1;
     75  /**
     76   * Methods used by the drag feedback code to determine if a drag is allowable at
     77   * the current location. To get the behavior where drops are only allowed on
     78   * items, such as the mailNews folder pane, always return false when
     79   * the orientation is not DROP_ON.
     80   */
     81  boolean canDrop(in long index, in long orientation, in DataTransfer dataTransfer);
     82 
     83  /**
     84   * Called when the user drops something on this view. The |orientation| param
     85   * specifies before/on/after the given |row|.
     86   */
     87  void drop(in long row, in long orientation, in DataTransfer dataTransfer);
     88 
     89  /**
     90   * Methods used by the tree to draw thread lines in the tree.
     91   * getParentIndex is used to obtain the index of a parent row.
     92   * If there is no parent row, getParentIndex returns -1.
     93   */
     94  long getParentIndex(in long rowIndex);
     95 
     96  /**
     97   * hasNextSibling is used to determine if the row at rowIndex has a nextSibling
     98   * that occurs *after* the index specified by afterIndex.  Code that is forced
     99   * to march down the view looking at levels can optimize the march by starting
    100   * at afterIndex+1.
    101   */
    102  boolean hasNextSibling(in long rowIndex, in long afterIndex);
    103 
    104  /**
    105   * The level is an integer value that represents
    106   * the level of indentation.  It is multiplied by the width specified in the
    107   * :moz-tree-indentation pseudoelement to compute the exact indendation.
    108   */
    109  long getLevel(in long index);
    110 
    111  /**
    112   * The image path for a given cell. For defining an icon for a cell.
    113   * If the empty string is returned, the :moz-tree-image pseudoelement
    114   * will be used.
    115   */
    116  AString getImageSrc(in long row, in TreeColumn col);
    117 
    118  /**
    119   * The value for a given cell. This method is only called for columns
    120   * of type other than |text|.
    121   */
    122  AString getCellValue(in long row, in TreeColumn col);
    123 
    124  /**
    125   * The text for a given cell.  If a column consists only of an image, then
    126   * the empty string is returned.
    127   */
    128  AString getCellText(in long row, in TreeColumn col);
    129 
    130  /**
    131   * Called during initialization to link the view to the front end box object.
    132   */
    133  void setTree(in XULTreeElement tree);
    134 
    135  /**
    136   * Called on the view when an item is opened or closed.
    137   */
    138  void toggleOpenState(in long index);
    139 
    140  /**
    141   * Called on the view when a header is clicked.
    142   */
    143  void cycleHeader(in TreeColumn col);
    144 
    145  /**
    146   * Should be called from a XUL onselect handler whenever the selection changes.
    147   */
    148  [binaryname(SelectionChangedXPCOM)]
    149  void selectionChanged();
    150 
    151  /**
    152   * Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
    153   */
    154  void cycleCell(in long row, in TreeColumn col);
    155 
    156  /**
    157   * isEditable is called to ask the view if the cell contents are editable.
    158   * A value of true will result in the tree popping up a text field when
    159   * the user tries to inline edit the cell.
    160   */
    161  boolean isEditable(in long row, in TreeColumn col);
    162 
    163  /**
    164   * setCellValue is called when the value of the cell has been set by the user.
    165   * This method is only called for columns of type other than |text|.
    166   */
    167  void setCellValue(in long row, in TreeColumn col, in AString value);
    168 
    169  /**
    170   * setCellText is called when the contents of the cell have been edited by the user.
    171   */
    172  void setCellText(in long row, in TreeColumn col, in AString value);
    173 };