home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / Outlinable.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.0 KB  |  115 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* 
  19.    Outlinable.h -- interface definition for views which can
  20.     use the Outliner class to display their data.
  21.    Created: Chris Toshok <toshok@netscape.com>, 7-Aug-96.
  22.  */
  23.  
  24.  
  25. #ifndef _xfe_outlinable_h
  26. #define _xfe_outlinable_h
  27.  
  28. #include "Outliner.h"
  29. #include "mozilla.h" /* for MWContext! :( */
  30. #include "icons.h"
  31.  
  32. typedef struct OutlineFlippyFuncData {
  33.     int row;
  34.     XP_Bool do_selection;
  35. } OutlineFlippyFuncData;
  36.  
  37. typedef struct OutlinerAncestorInfo {
  38.   XP_Bool has_next;
  39.   XP_Bool has_prev;
  40. } OutlinerAncestorInfo;
  41.  
  42. typedef struct OutlineButtonFuncData {
  43.   int row; // where the click happened
  44.   int column;
  45.  
  46.   /* more specific information (with the origin being the x,y of
  47.      the row/column. */
  48.   int x;
  49.   int y;
  50.  
  51.   XP_Bool ctrl;  // modifiers
  52.   XP_Bool shift;
  53.   XP_Bool alt;
  54.  
  55.   int clicks;  // the number of clicks
  56.   int button;  // which button: Button1, Button2,...,Button5
  57. } OutlineButtonFuncData;
  58.  
  59. /*interface*/ class XFE_Outlinable
  60. {
  61. public:
  62.   // Converts between an index and some non positional data type.
  63.   // Used to maintain selection when the list is reordered.
  64.   virtual void *ConvFromIndex(int index) = 0;
  65.   virtual int ConvToIndex(void *item) = 0; // should return -1 if item does not map to an index
  66.  
  67.   // Returns the name of a column -- used for saving the column sizes,position,visibilities
  68.   // shall return non-zero length string
  69.   virtual char *getColumnName(int column) = 0;
  70.  
  71.   // Returns the text and/or icon to display at the top of the column.
  72.   virtual char *getColumnHeaderText(int column) = 0;
  73.   virtual fe_icon *getColumnHeaderIcon(int column) = 0;
  74.   virtual EOutlinerTextStyle getColumnHeaderStyle(int column) = 0;
  75.  
  76.   // Tells the Outlinable object that it should get the data
  77.   // for a line.  This line will be the focus of all requests
  78.   // by the Outliner.  The return value is not interrogated, and
  79.   // is only checked for NULL-ness.  return NULL if there isn't
  80.   // any information for this line, the line is invalid, etc, etc.
  81.   virtual void *acquireLineData(int line) = 0;
  82.  
  83.   //
  84.   // The following 4 requests deal with the currently acquired line.
  85.   //
  86.   virtual void getTreeInfo(XP_Bool *expandable, XP_Bool *is_expanded, int *depth, 
  87.                OutlinerAncestorInfo **ancestor) = 0;
  88.   virtual EOutlinerTextStyle getColumnStyle(int column) = 0;
  89.   // subclass need to allocate memory for the return string 
  90.   virtual char *getColumnText(int column) = 0;
  91.   virtual fe_icon *getColumnIcon(int column) = 0;
  92.  
  93.   // Tells the Outlinable object that the line data is no
  94.   // longer needed, and it can free any storage associated with
  95.   // it.
  96.   virtual void releaseLineData() = 0;
  97.  
  98.   virtual void Buttonfunc(const OutlineButtonFuncData *data) = 0;
  99.   virtual void Flippyfunc(const OutlineFlippyFuncData *data) = 0;
  100.  
  101.   // return the outliner associated with this outlinable.
  102.   virtual XFE_Outliner *getOutliner() = 0;
  103.  
  104.   // Get tooltipString & docString; 
  105.   // returned string shall be freed by the callee
  106.   // row < 0 indicates heading row; otherwise it is a content row
  107.   // (starting from 0)
  108.   //
  109.   virtual char *getCellTipString(int row, int column) = 0;
  110.   virtual char *getCellDocString(int row, int column) = 0;
  111.  
  112. };
  113.  
  114. #endif /* _xfe_outlinable_h */
  115.