home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / ABDirListView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.9 KB  |  203 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.    ABDirListView.h -- class definition for ABDirListView
  20.    Created: Tao Cheng <tao@netscape.com>, 14-oct-97
  21.  */
  22.  
  23. #ifndef _XFE_ABDIRLISTVIEW_H
  24. #define _XFE_ABDIRLISTVIEW_H
  25.  
  26. #include "MNListView.h"
  27. #include "addrbk.h"
  28.  
  29. class XFE_ABDirListView : public XFE_MNListView
  30. {
  31. public:
  32.     XFE_ABDirListView(XFE_Component *toplevel_component,
  33.                       Widget         parent, 
  34.                       XFE_View      *parent_view, 
  35.                       MWContext     *context,
  36.                       XP_List       *directories);
  37.     virtual ~XFE_ABDirListView();
  38.  
  39.     void paneChanged(XP_Bool asynchronous,
  40.                      MSG_PANE_CHANGED_NOTIFY_CODE notify_code,
  41.                      int32 value);
  42.  
  43.  
  44.     /* used by toplevel to see which view can handle a command.  Returns true
  45.      * if we can handle it. 
  46.      */
  47.     virtual Boolean isCommandEnabled(CommandType command, 
  48.                                      void *calldata = NULL,
  49.                                      XFE_CommandInfo* i = NULL);
  50.  
  51.     virtual Boolean isCommandSelected(CommandType command, 
  52.                                       void *calldata = NULL,
  53.                                       XFE_CommandInfo* i = NULL);
  54.  
  55.     virtual Boolean handlesCommand(CommandType command, 
  56.                                    void *calldata = NULL,
  57.                                    XFE_CommandInfo* i = NULL);
  58.  
  59.     virtual void doCommand(CommandType command, 
  60.                            void *calldata = NULL,
  61.                            XFE_CommandInfo* i = NULL);
  62.  
  63.     // 
  64.     void    expandCollapse(XP_Bool expand);
  65.     //
  66. #if defined(USE_ABCOM)
  67.     void    selectContainer(AB_ContainerInfo *containerInfo);
  68.  
  69.     static int ShowPropertySheetForDirFunc(DIR_Server *server, 
  70.                                            MWContext  *context,
  71.                                            MSG_Pane   *pane,
  72.                                            XP_Bool     newDirectory);
  73. #endif /* USE_ABCOM */
  74.     void    selectLine(int line);
  75.     void    selectDir(DIR_Server* dir);
  76.     //
  77.     void    setDirServers(XP_List *dirs);
  78.  
  79.     // columns for the Outliner
  80.     enum {OUTLINER_COLUMN_NAME = 0,
  81.           OUTLINER_COLUMN_LAST
  82.     };
  83.  
  84.     // The Outlinable interface
  85.     void    *ConvFromIndex(int index);
  86.     int      ConvToIndex(void *item);
  87.  
  88.     //
  89.     char    *getColumnName(int column);
  90.     char    *getColumnHeaderText(int column);
  91.     fe_icon *getColumnHeaderIcon(int column);
  92.     EOutlinerTextStyle     getColumnHeaderStyle(int column);
  93.     EOutlinerTextStyle     getColumnStyle(int column);
  94.     char    *getColumnText(int column);
  95.     fe_icon *getColumnIcon(int column);
  96.     
  97.     //
  98.     fe_icon *treeInfoToIcon(int depth, int flags, XP_Bool expanded);
  99.     void     getTreeInfo(XP_Bool *expandable, 
  100.                          XP_Bool *is_expanded, 
  101.                          int *depth, 
  102.                          OutlinerAncestorInfo **ancestor);
  103.     //
  104.     void     Buttonfunc(const OutlineButtonFuncData *data);
  105.     //
  106.     virtual void clickHeader(const OutlineButtonFuncData *);
  107.     virtual void clickBody(const OutlineButtonFuncData *){};
  108.     virtual void clickShiftBody(const OutlineButtonFuncData *){};
  109.     virtual void doubleClickBody(const OutlineButtonFuncData *);
  110.     
  111.     void     Flippyfunc(const OutlineFlippyFuncData *data);
  112.     //
  113.     void     releaseLineData();
  114.     void    *acquireLineData(int line);    
  115.  
  116.     //
  117.     void     propertiesCB();
  118.  
  119.     //
  120.     static const char *dirCollapse; // toggle 2 pane ui
  121.     static const char *dirSelect; // select dir
  122.  
  123. #if defined(USE_MOTIF_DND)
  124.     /* motif drag and drop interface. 
  125.      */
  126.     fe_icon_data        *GetDragIconData(int row, int column);
  127.     static fe_icon_data *getDragIconData(void *this_ptr,
  128.                                          int row, int column);
  129.     
  130.     void                 GetDragTargets(int row, int column, 
  131.                                         Atom **targets, int *num_targets);
  132.     static void          getDragTargets(void *this_ptr,
  133.                                         int row, int col,
  134.                                         Atom **targets, int *num_targets);
  135.  
  136.     char                *DragConvert(Atom atom);
  137.     static char         *dragConvert(void *this_ptr,
  138.                                      Atom atom);
  139.   
  140.     int                  ProcessTargets(int row, int col,
  141.                                         Atom *targets,
  142.                                         const char **data,
  143.                                         int numItems);
  144.     static int           processTargets(void *this_ptr,
  145.                                         int row, int col,
  146.                                         Atom *targets,
  147.                                         const char **data,
  148.                                         int numItems);
  149.  
  150.     /* no instance method needed for getDropTargets 
  151.      */
  152.     static void          getDropTargets(void *this_ptr,
  153.                                         Atom **targets, int *num_targets);
  154.  
  155. #else
  156.     // external entry
  157.     static void dirListDropCallback(Widget, 
  158.                                     void *, 
  159.                                     fe_dnd_Event, 
  160.                                     fe_dnd_Source *, 
  161.                                     XEvent *);
  162. #endif
  163.     static void propertyCallback(DIR_Server *dir,
  164.                                  void       *callData);
  165.  
  166. protected:
  167. #if !defined(USE_MOTIF_DND)
  168.     // internal drop callback for addressbook drops
  169. #if defined(USE_ABCOM)
  170.     void        dirListDropCB(fe_dnd_Source*, XEvent *event);
  171. #else
  172.     void        dirListDropCB(fe_dnd_Source*);
  173. #endif /* USE_ABCOM */
  174. #endif
  175.  
  176. private:
  177.     static fe_icon m_openParentIcon;
  178.     static fe_icon m_closedParentIcon;
  179.     static fe_icon m_pabIcon;
  180.     static fe_icon m_ldapDirIcon;
  181.     static fe_icon m_mListIcon;
  182.  
  183.     /* temp assume no list entry yet
  184.      */
  185.     DIR_Server   *m_dir;
  186.     DIR_Server   *m_dirLine;
  187.     XP_List      *m_directories;
  188.     XP_List      *m_deleted_directories;
  189.     int           m_nDirs;
  190.  
  191.     OutlinerAncestorInfo *m_ancestorInfo;
  192.  
  193.     void propertyCB(DIR_Server *dir);
  194.  
  195. #if defined(USE_ABCOM)
  196.     AB_ContainerInfo *m_containerLine;
  197.     AB_ContainerInfo *m_activeContainer;
  198.     int32             m_numLines;
  199. #endif /* USE_ABCOM */
  200.  
  201. };
  202. #endif /* _XFE_ABDIRLISTVIEW_H */
  203.