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

  1. /* -*- Mode: C++; tab-width: 8; 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.    ComposeAttachFolderView.h -- class definitions for compose attachment folder
  20.    Created: Alastair Gourlay(SGI) c/o Dora Hsu<dora@netscape.com>, 26 Nov 1996
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _COMPOSE_ATTACH_FOLDER_VIEW_H
  26. #define _COMPOSE_ATTACH_FOLDER_VIEW_H
  27.  
  28. //
  29. // ComposeAttachFolderView.h
  30. //
  31. // Classes in this file:
  32. //      XFE_ComposeAttachFolderView
  33. //      XFE_ComposeAttachPanel
  34. //      XFE_ComposeAttachDrop
  35. //
  36.  
  37. #include "MNView.h"
  38. #include "AttachPanel.h"
  39. #include "DragDrop.h"
  40. #include "ComposeAttachDialog.h"
  41. #include "PopupMenu.h"
  42.  
  43. class XFE_ComposeAttachDrop;
  44. class XFE_ComposeAttachPanel;
  45. class XFE_ComposeAttachLocationDialog;
  46. class XFE_ComposeAttachFileDialog;
  47.  
  48. //
  49. // XFE_ComposeAttachFolderView 
  50. //
  51.  
  52. class XFE_ComposeAttachFolderView : public XFE_MNView
  53. {
  54. public:
  55.     XFE_ComposeAttachFolderView(
  56.                XFE_Component *toplevel_component, XFE_View *parent_view,
  57.                MSG_Pane *p = NULL, MWContext *context = NULL);
  58.     ~XFE_ComposeAttachFolderView();
  59.  
  60.     // widgets
  61.     virtual void createWidgets(Widget);
  62.     virtual void show();
  63.     virtual void hide();
  64.     virtual void updateSelectionUI();
  65.  
  66.     // commands
  67.     virtual Boolean isCommandEnabled(CommandType,void* calldata=NULL,
  68.                                    XFE_CommandInfo* i = NULL);
  69.     virtual Boolean handlesCommand(CommandType,void* calldata=NULL,
  70.                                    XFE_CommandInfo* i = NULL);
  71.     virtual void doCommand(CommandType,void* calldata=NULL,
  72.                                    XFE_CommandInfo* i = NULL);
  73.  
  74.     // attachments
  75.     void folderVisible(int);
  76.     int maxAttachments() { return _maxAttachments; };
  77.     int numAttachments() { return _numAttachments; };
  78.     int addAttachment(const char*,int pre_existing=FALSE,Boolean attach_binary=FALSE);
  79.     int addAttachments(const char**,int,int pre_existing=FALSE,Boolean attach_binary=FALSE);
  80.     void deleteAttachment(int);
  81.     void updateAttachments();
  82.     void addExistingAttachments();
  83.     void scrollToItem(int);
  84.     char *parseItemLabel(const char*);
  85.  
  86.     // entry point used by XFE_TaskBarDrop for mail+news drops
  87.     static int validateAttachment(Widget,const char*);
  88.  
  89.     // entry points for external objects to control attachments
  90.     void attachFile();
  91.     void attachLocation();
  92.     void deleteAttach();
  93.     void openAttachment(int);
  94.  
  95. #if !defined(USE_MOTIF_DND)
  96.     // internal drag management
  97.     static void AttachDropCb(Widget,void*,fe_dnd_Event,fe_dnd_Source*,XEvent*);
  98.     void attachDropCb(fe_dnd_Source*);
  99. #endif /* USE_MOTIF_DND */
  100.  
  101. private:
  102.     XFE_ComposeAttachPanel *_attachPanel;
  103.     XFE_ComposeAttachLocationDialog *_attachLocationDialog;
  104.     XFE_ComposeAttachFileDialog *_attachFileDialog;
  105.     XFE_PopupMenu *_xfePopup;
  106.     
  107.     int _addedExistingAttachments;
  108.     
  109.     MWContext* _context;
  110.  
  111.     int _folderVisible;
  112.     int _numAttachments;
  113.     struct MSG_AttachmentData *_attachments;
  114.  
  115.     Widget _deleteAttachButton;
  116.     
  117.     static char *_lastAttachmentType;
  118.     static const int _maxAttachments;
  119.  
  120.     // internal utilities
  121.     int verifySafeToAttach();
  122.  
  123. #if !defined(USE_MOTIF_DND)
  124.     void processBookmarkDrop(fe_dnd_Source*);
  125.     void processHistoryDrop(fe_dnd_Source*);
  126.     void processMessageDrop(fe_dnd_Source*);    
  127. #endif /* USE_MOTIF_DND */
  128. };
  129.  
  130.  
  131. //
  132. // XFE_ComposeAttachPanel
  133. //
  134.  
  135. class XFE_ComposeAttachPanel : public XFE_AttachPanel {
  136. public:
  137.     XFE_ComposeAttachPanel(XFE_ComposeAttachFolderView*,MWContext*);
  138.     ~XFE_ComposeAttachPanel();
  139.  
  140.     // widgets
  141.     void createWidgets(Widget);
  142.     void show();
  143.     void hide();
  144.     void setSensitive(Boolean);
  145.  
  146.     // hooks for XFE_DropAttach
  147.     int dropAttachment(const char *);
  148.     int dropAttachments(const char**,int);
  149. protected:
  150.     XFE_ComposeAttachFolderView *_attachFolder;
  151.     Widget _delete;
  152.     XFE_ComposeAttachDrop *_dropSite;
  153.  
  154.     // AttachPanel methods
  155.     void doubleClickCb(int);
  156.     
  157.     // internal UI management
  158.     virtual void updateSelectionUI();    
  159. private:
  160. };
  161.  
  162.  
  163. //
  164. // XFE_ComposeAttachDrop
  165. //
  166.  
  167. class XFE_ComposeAttachDrop : public XFE_DropNetscape
  168. {
  169. public:
  170.     XFE_ComposeAttachDrop(Widget,XFE_ComposeAttachPanel*);
  171.     ~XFE_ComposeAttachDrop();
  172.     
  173. protected:
  174.     XFE_ComposeAttachPanel *_attachPanel;
  175.  
  176.     // base class methods changed
  177.     void operations(); // override to set _operations
  178.     void targets(); // override to augment XFE_DropFile _targets
  179.     int processTargets(Atom*,const char**,int);
  180. private:
  181. };
  182.  
  183.  
  184. #endif // _COMPOSE_ATTACH_FOLDER_VIEW_H
  185.