home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / ComposeView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.8 KB  |  191 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.    ComposeView.h -- class definition for ComposeView
  20.    Created: Dora Hsu<dora@netscape.com>, 23-Sept-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_composeview_h
  26. #define _xfe_composeview_h
  27.  
  28. #include "MNView.h"  /* Has to be the first include because of xp_xx.h */
  29. #include "msgcom.h"
  30. #include "Command.h" /* For compose window commands */
  31. #include "EditorToolbar.h"
  32. #include <Xm/Xm.h>
  33.  
  34.  
  35. /* Class Definition */
  36.  
  37. class XFE_ComposeView : public XFE_MNView
  38. {
  39. public:
  40.   XFE_ComposeView(XFE_Component *toplevel_component, Widget parent, XFE_View *parent_view, MWContext *context, 
  41.           MWContext *context_to_copy, MSG_CompositionFields* fields, MSG_Pane* p = NULL,
  42.     const char *pInitalText = NULL,
  43.     XP_Bool useHtml = False);
  44.  
  45.   virtual ~XFE_ComposeView();
  46.  
  47.   // Public functions
  48.   XFE_View* getComposeFolderView() { 
  49.     return m_folderViewAlias;}
  50.  
  51.   virtual Boolean isCommandEnabled(CommandType command, void *calldata = NULL,
  52.                                    XFE_CommandInfo* i = NULL);
  53.   virtual Boolean isCommandSelected(CommandType command, void *calldata = NULL,
  54.                                    XFE_CommandInfo* i = NULL);
  55.   virtual Boolean handlesCommand(CommandType command, void *calldata = NULL,
  56.                                    XFE_CommandInfo* i = NULL);
  57.   virtual void doCommand(CommandType command, void *calldata = NULL,
  58.                                    XFE_CommandInfo* i = NULL);
  59.   virtual char* commandToString(CommandType, void*, XFE_CommandInfo*);
  60.   XFE_Command* getCommand(CommandType cmd);
  61.   virtual XFE_View* getCommandView(XFE_Command*);
  62.   virtual char*      className() {return "XFE_ComposeView";}
  63.  
  64.     virtual int  initEditor();
  65.     virtual void initEditorContents();
  66.     virtual void updateCompToolbar();
  67.  
  68.     static const char* tabBeforeSubject;
  69.     static const char* tabAfterSubject;
  70.     static const char* tabPrev;
  71.     static const char* tabNext;
  72.     static const char* eFocusIn;
  73.     static const char* eFocusOut;
  74.     static const char* updateSecurityOption;
  75.  
  76.     static void    daFocusProc(Widget,XtPointer,XEvent*,Boolean*);
  77.     static void   topFocusProc(Widget,XtPointer,XEvent*,Boolean*);
  78.     static void  nullFocusProc(Widget,XtPointer,XEvent*,Boolean*);
  79.  
  80.     void saveFocus();
  81.     void focusIn();
  82.     void focusOut();
  83.  
  84.   void*   getComposerData();
  85.   void    setComposerData(void* data);
  86.  
  87.   void*   getAttachmentData();
  88.   void    setAttachmentData(void* data);
  89.   XFE_CALLBACK_DECL(afterRealizeWidget)
  90.  
  91.   void    insertMessageCompositionText(
  92.                 const char* text, XP_Bool leaveCursorBeginning);
  93.  
  94.   void       getMessageBody(char **pBody, uint32 *body_size, 
  95.         MSG_FontCode **font_changes);
  96.   void    doneWithMessageBody(char *pBody);
  97.   void    setComposeWrapState(XP_Bool wrap_p);
  98.   static int doQuoteMessage(void *closure, const char *data);
  99.   XP_Bool isDelayedSent();
  100.   XP_Bool isHTML();
  101.   static const char *newSubject;
  102.   static void selectPriorityCallback(Widget, XtPointer, XtPointer);
  103.  
  104.   static void unGrabEditorProc(Widget,XtPointer,XEvent*,Boolean*);
  105.   void unGrabEditor();
  106.   void editorFocus(Boolean);
  107.   void show();
  108.   Boolean isModified();
  109.  
  110.   XP_Bool hasFocus();
  111.  
  112. protected:
  113.   void      initialize();
  114.   void    updateHeaderInfo();
  115.   void  createSubjectBar(Widget);
  116.   XP_Bool   continueAfterSanityCheck();
  117.  
  118.   XP_Bool   handleStealthPasteQuote(CommandType, XFE_CommandInfo*);
  119.   void      quoteText(char *);
  120.  
  121. private:
  122.   void* mailComposer;
  123.   void* mailAttachment;
  124.   void  createWidget(Widget);
  125.  
  126.   XFE_View *m_folderViewAlias; // These are just pointer aliases to views
  127.   XFE_View *m_textViewAlias;   // this class does not own these views
  128.   XFE_View *m_htmlViewAlias;   // It's the parent class who owns these views
  129.  
  130.   Widget m_editorFormW;
  131.   Widget m_subjectFormW;
  132.   Widget m_subjectW;
  133.   Widget m_toolbarW;
  134.   Widget m_focusW;
  135.   Widget m_nullW;
  136.  
  137.   Widget m_addrTextW;
  138.   Widget m_addrTypeW;
  139.  
  140.   Widget m_daW;
  141.   Widget m_topW;
  142.   Widget m_expand_arrowW;
  143.  
  144.   XFE_EditorToolbar* m_format_toolbar;
  145.   Boolean m_expanded;
  146.  
  147.         XP_Bool m_editorFocusP;
  148.  
  149.         XP_Bool m_plaintextP;
  150.         XP_Bool m_requestHTML;
  151.         XP_Bool m_initEditorP;
  152.         XP_Bool m_postEditorP;
  153.         XP_Bool m_puntEditorP;
  154.         XP_Bool m_delayEditorP;
  155.         XP_Bool m_dontQuoteP;
  156.  
  157.   int quoteMessage(const char *data);
  158.   void displayDefaultTextBody();
  159.  
  160.   XFE_CALLBACK_DECL(tabToEditor)
  161.  
  162.   XP_Bool m_delayedSent;
  163.   char *m_pInitialText;
  164.  
  165.   void     subjectFocus();
  166.   void     textEditorFocus(Widget);
  167.   void     addressTextFocus(Widget);
  168.   void     addressTypeFocus(Widget);
  169.   void     subjectChange(Widget, XtPointer);
  170.   void     subjectUpdate(Widget, XtPointer);
  171.   void     toggleAddressArea();
  172.   void   setDefaultSubjectHeader();
  173.   XFE_CALLBACK_DECL(tabToSubject)
  174.   XFE_CALLBACK_DECL(textEditorFocusIn)
  175.   XFE_CALLBACK_DECL(addressTextFocusIn)
  176.   XFE_CALLBACK_DECL(addressTypeFocusIn)
  177.   static void subjectChangeCallback(Widget, XtPointer, XtPointer);
  178.   static void subjectFocusIn_CB(Widget, XtPointer, XtPointer);
  179.  
  180.   static void quotePrimarySel_cb(Widget, XtPointer, 
  181.                                  Atom *, Atom *, XtPointer, 
  182.                                  unsigned long *, int *);
  183.  
  184.   static void expandCallback(Widget, XtPointer, XtPointer);
  185.  
  186. };
  187.  
  188.  
  189.  
  190. #endif /* _xfe_composeview_h */
  191.