home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / FolderView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  6.0 KB  |  174 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.    FolderView.h -- class definition for FolderView
  20.    Created: Chris Toshok <toshok@netscape.com>, 7-Aug-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_folderview_h
  26. #define _xfe_folderview_h
  27.  
  28. #include "MNListView.h"
  29. #include "Outlinable.h"
  30. #include "PopupMenu.h"
  31. #include "Command.h"
  32.  
  33. class XFE_FolderView : public XFE_MNListView
  34. {
  35. public:
  36.   XFE_FolderView(XFE_Component *toplevel_component, Widget parent, 
  37.          XFE_View *parent_view, MWContext *context,
  38.          MSG_Pane *p = NULL);
  39.  
  40.   virtual ~XFE_FolderView();
  41.  
  42.   virtual void paneChanged(XP_Bool asynchronous, MSG_PANE_CHANGED_NOTIFY_CODE code, int32 value);
  43.  
  44.   // this gets called by our toplevel to let us do some things
  45.   // after it's been realized, but before we're on the screen.
  46.   XFE_CALLBACK_DECL(beforeToplevelShow)
  47.  
  48.   virtual Boolean isCommandEnabled(CommandType command, void *calldata = NULL,
  49.                                    XFE_CommandInfo* i = NULL);
  50.   virtual Boolean handlesCommand(CommandType command, void *calldata = NULL,
  51.                                    XFE_CommandInfo* i = NULL);
  52.   virtual void doCommand(CommandType command, void *calldata = NULL,
  53.                                    XFE_CommandInfo* i = NULL);
  54.   virtual char *commandToString(CommandType command, void *calldata = NULL,
  55.                                    XFE_CommandInfo* i = NULL);
  56.  
  57.   void selectFolder(MSG_FolderInfo *info);
  58.  
  59. #ifdef USE_3PANE
  60.   void processClick();
  61. #endif
  62.   /* This is static so the thread banner can get at it. */
  63. #if defined(USE_MOTIF_DND)
  64.   static fe_icon_data* treeInfoToIconData(int depth, int flags, XP_Bool expanded);
  65. #endif /* USE_MOTIF_DND */
  66.   static fe_icon* treeInfoToIcon(int depth, int flags, XP_Bool expanded, XP_Bool secure = FALSE);
  67.   static void initFolderIcons(Widget widget, Pixel bg_pixel, Pixel fg_pixel);
  68.     
  69.   /* Outlinable interface methods */
  70.   virtual void *ConvFromIndex(int index);
  71.   virtual int ConvToIndex(void *item);
  72.  
  73.   virtual char *getColumnName(int column);
  74.  
  75.   virtual char *getColumnHeaderText(int column);
  76.   virtual fe_icon *getColumnHeaderIcon(int column);
  77.   virtual EOutlinerTextStyle getColumnHeaderStyle(int column);
  78.   virtual void *acquireLineData(int line);
  79.   virtual void getTreeInfo(XP_Bool *expandable, XP_Bool *is_expanded, int *depth,
  80.                OutlinerAncestorInfo **ancestor);
  81.   virtual EOutlinerTextStyle getColumnStyle(int column);
  82.   virtual char *getColumnText(int column);
  83.   virtual fe_icon *getColumnIcon(int column);
  84.   virtual void releaseLineData();
  85.   // Get tooltipString & docString; 
  86.   // returned string shall be freed by the callee
  87.   // row < 0 indicates heading row; otherwise it is a content row
  88.   // (starting from 0)
  89.   //
  90.   virtual char *getCellTipString(int /* row */, int /* column */);
  91.   virtual char *getCellDocString(int /* row */, int /* column */);
  92.  
  93. #if defined(USE_MOTIF_DND)
  94.   /* motif drag and drop interface. */
  95.   fe_icon_data *GetDragIconData(int row, int column);
  96.   static fe_icon_data *getDragIconData(void *this_ptr,
  97.                                        int row, int column);
  98.  
  99.   void GetDragTargets(int row, int column, Atom **targets, int *num_targets);
  100.   static void getDragTargets(void *this_ptr,
  101.                              int row, int col,
  102.                              Atom **targets, int *num_targets);
  103.  
  104.   char *DragConvert(Atom atom);
  105.   static char* dragConvert(void *this_ptr,
  106.                            Atom atom);
  107.   
  108.   int ProcessTargets(int row, int col,
  109.                      Atom *targets,
  110.                      const char **data,
  111.                      int numItems);
  112.   static int processTargets(void *this_ptr,
  113.                             int row, int col,
  114.                             Atom *targets,
  115.                             const char **data,
  116.                             int numItems);
  117.  
  118.   /* no instance method needed for getDropTargets */
  119.   static void getDropTargets(void *this_ptr,
  120.                              Atom **targets, int *num_targets);
  121. #endif /* USE_MOTIF_DND */
  122.  
  123.   char *getColumnTextByFolderLine(MSG_FolderLine* folderLine, int column);
  124.  
  125.   virtual void Buttonfunc(const OutlineButtonFuncData *data);
  126.   virtual void Flippyfunc(const OutlineFlippyFuncData *data);
  127.  
  128.   // notification when a user clicks *once* on a folder. MSG_FolderInfo *is sent in calldata.
  129.   static const char *folderSelected;
  130.   // notification when a user double clicks on a folder.
  131.   static const char *folderDblClicked;
  132.   // notification when a user uses the alternate gesture on a folder.
  133.   static const char *folderAltDblClicked;
  134.  
  135.  
  136. private:
  137.   static const int OUTLINER_COLUMN_NAME;
  138.   static const int OUTLINER_COLUMN_UNREAD;
  139.   static const int OUTLINER_COLUMN_TOTAL;
  140.  
  141. #if !defined(USE_MOTIF_DND)
  142.   void dropfunc(Widget dropw, fe_dnd_Event type, fe_dnd_Source *source, XEvent *event);
  143.   static void drop_func(Widget dropw, void *closure, fe_dnd_Event type,
  144.             fe_dnd_Source *source, XEvent* event);
  145.  
  146.   void sourcedropfunc(fe_dnd_Source *src, fe_dnd_Message msg, void *closure);
  147.   static void source_drop_func(fe_dnd_Source *src, fe_dnd_Message msg, void *closure);
  148. #endif /* USE_MOTIF_DND */
  149.  
  150.   void toggleExpansion(int row);
  151.  
  152.   // for the outlinable stuff
  153.   OutlinerAncestorInfo *m_ancestorInfo;
  154.   MSG_FolderLine m_folderLine;
  155.  
  156.   // context menu
  157.   XFE_PopupMenu *m_popup;
  158.  
  159. #ifdef USE_3PANE
  160.   XtIntervalId m_clickTimer;
  161.   XtPointer m_clickData;
  162.   int *m_cur_selected;
  163.   int m_cur_count;
  164.  
  165. #endif
  166.  
  167.   static MenuSpec mailserver_popup_menu[];
  168.   static MenuSpec newshost_popup_menu[];
  169.   static MenuSpec mailfolder_popup_menu[];
  170.   static MenuSpec newsgroup_popup_menu[];
  171. };
  172.  
  173. #endif /* _xfe_folderview_h */
  174.