home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / AddressFolderView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  6.5 KB  |  199 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.    AddressAddressFolderView.h -- class definition for AddressAddressFolderView
  20.    Created: Dora Hsu<dora@netscape.com>, 23-Sept-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_addressfolderview_h
  26. #define _xfe_addressfolderview_h
  27.  
  28. #include "MNListView.h"
  29. #include "Addressable.h"
  30. #include "Outliner.h"
  31. #include "Command.h"
  32.  
  33. #include "addrbk.h"
  34.  
  35. typedef struct XFE_AddressFieldData {
  36.   const char *type;
  37.   char *receipient;
  38.   int  icon;
  39.   short security;
  40.   char *currStr;
  41.   int insertPos;
  42. } XFE_AddressFieldData;
  43.  
  44. class XFE_AddressFolderView : public XFE_MNListView, public MAddressable
  45. {
  46. public:
  47.   XFE_AddressFolderView(
  48.         XFE_Component *toplevel_component,
  49.         XFE_View *parent_view, 
  50.         MSG_Pane *p = NULL,
  51.         MWContext *context = NULL);
  52.  
  53.   virtual ~XFE_AddressFolderView();
  54.   virtual Boolean isCommandEnabled(CommandType command, void *calldata = NULL,
  55.                                    XFE_CommandInfo* i = NULL);
  56.   virtual Boolean handlesCommand(CommandType command, void *calldata = NULL,
  57.                                    XFE_CommandInfo* i = NULL);
  58.   virtual void doCommand(CommandType command, void *calldata = NULL,
  59.                                    XFE_CommandInfo* i = NULL);
  60.  
  61.  
  62.   void initialize();
  63.   void createWidgets(Widget);
  64.   void updateHeaderInfo();
  65.   /* Outlinable interface methods */
  66.  // Converts between an index and some non positional data type.
  67.   // Used to maintain selection when the list is reordered.
  68.   virtual void *ConvFromIndex(int index);
  69.   virtual int ConvToIndex(void *item);
  70.  
  71.   virtual char *getColumnName(int column);
  72.  
  73.   // Returns the text and/or icon to display at the top of the column.
  74.   virtual char *getColumnHeaderText(int column);
  75.   virtual fe_icon *getColumnHeaderIcon(int column);
  76.   virtual EOutlinerTextStyle getColumnHeaderStyle(int column);
  77.  
  78.   // Tells the Outlinable object that it should get the data
  79.   // for a line.  This line will be the focus of all requests
  80.   // by the Outliner.  The return value is not interrogated, and
  81.   // is only checked for NULL-ness.  return NULL if there isn't
  82.   // any information for this line, the line is invalid, etc, etc.
  83.   virtual void *acquireLineData(int line);
  84.  
  85.   //
  86.   // The following 4 requests deal with the currently acquired line.
  87.   //
  88.   virtual void getTreeInfo(XP_Bool *expandable, XP_Bool *is_expanded, int *depth,
  89.                            OutlinerAncestorInfo **ancestor);
  90.   virtual EOutlinerTextStyle getColumnStyle(int column);
  91.   virtual char *getColumnText(int column);
  92.   virtual fe_icon *getColumnIcon(int column);
  93.  
  94.   // Tells the Outlinable object that the line data is no
  95.   // longer needed, and it can free any storage associated with
  96.   // it.
  97.   virtual void releaseLineData();
  98.  
  99.   virtual void Buttonfunc(const OutlineButtonFuncData *data);
  100.   virtual void Flippyfunc(const OutlineFlippyFuncData *data);
  101.   Boolean removeDataAt(int line);
  102.  
  103.   // For address book button
  104.   XFE_CALLBACK_DECL(openAddrBk)
  105.  
  106.   void setHeader(int line, MSG_HEADER_SET header);
  107.   int getHeader(int line);
  108.   int setReceipient(int line,  char *pAddressStr);
  109.   void updateReceipient(int line);
  110.  
  111.   // Might want to delete these two lines
  112.   void setCurrentString(int line, const char *newStr);
  113.   void getCurrentString(int line, char**textstr);
  114.  
  115.   void getDataAt(int line, int column, char **textstr);
  116.   void insertNewDataAfter(int line);
  117.   Boolean hasDataAt(int line);
  118.  
  119.   char *changedItem(char *pString, int* iconType, short* security);
  120.  
  121.   // Return actual data count from the receipient data list
  122.   int getTotalData();
  123.  
  124.   static const char* tabPrev;
  125.   static const char* tabNext;
  126.  
  127.   static const int ADDRESS_OUTLINER_COLUMN_BTN;
  128.   static const int ADDRESS_OUTLINER_COLUMN_TYPE;
  129.   static const int ADDRESS_OUTLINER_COLUMN_ICON;
  130. #ifdef HAVE_ADDRESS_SECURITY_COLUMN
  131.   static const int ADDRESS_OUTLINER_COLUMN_SECURITY;
  132. #endif
  133.   static const int ADDRESS_OUTLINER_COLUMN_RECEIPIENT;
  134.  
  135.   static const char *TO;
  136.   static const char *CC;
  137.   static const char *BCC;
  138.   static const char *REPLY;
  139.   static const char *NEWSGROUP;
  140.   static const char *FOLLOWUP;
  141.  
  142.   static const int ADDRESS_ICON_PERSON;
  143.   static const int ADDRESS_ICON_NEWS;
  144.   static const int ADDRESS_ICON_LIST;
  145.  
  146.   /* Addressee Picker
  147.    */
  148.   ABAddrMsgCBProcStruc* exportAddressees();
  149.   static void addrMsgCallback(ABAddrMsgCBProcStruc* clientData, 
  150.             void*                 callData);
  151.   void addrMsgCB(ABAddrMsgCBProcStruc* clientData);
  152.   void purgeAll();
  153.  
  154.   // internal drop callback for addressbook and address search window drops
  155.   static void AddressDropCb(Widget,void*,fe_dnd_Event,fe_dnd_Source*,XEvent*);
  156.   void addressDropCb(fe_dnd_Source*);
  157.   void processAddressBookDrop(XFE_Outliner*,DIR_Server *abDir,ABook *abBook,
  158.                               AddressPane*);
  159.   void processLDAPDrop(fe_dnd_Source*);
  160. private:
  161.  
  162.   XP_Bool m_clearAddressee;
  163.  
  164.   // icons for the outliner
  165.   static fe_icon arrowIcon;
  166.   static fe_icon personIcon;
  167.   static fe_icon listIcon;
  168.   static fe_icon newsIcon;
  169.  
  170.   static fe_icon securityIcon;
  171.   const char *setData(int line,  char *receipient);
  172.  
  173.   // These member data may not need to be here ??
  174.   Widget m_addBtnW;
  175.   
  176.   XFE_AddressFieldData *m_fieldData;
  177.   XP_List     *m_fieldList;
  178.   XFE_Outliner *m_outliner;
  179.  
  180.   void setupIcons();
  181.   void setupAddressHeadings();
  182.   void btnActivate(Widget w, XtPointer);
  183.   XFE_CALLBACK_DECL(tabToButton)
  184.   void initializeData(XFE_AddressFieldData *data);
  185.   static void btnActivateCallback(Widget w, XtPointer clientData, 
  186.                     XtPointer callData);
  187.  
  188. };
  189.  
  190. ////////////////////////////////////////////////////////////
  191. // backend candidates
  192.  
  193. const char * MSG_HeaderMaskToString(MSG_HEADER_SET header);
  194. MSG_HEADER_SET  MSG_HeaderStringToMask(const char *strheader);
  195. ////////////////////////////////////////////////////////////
  196. // end backend candidates
  197.  
  198. #endif /* _xfe_folderview_h */
  199.