home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / AddressOutliner.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.9 KB  |  171 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.    AddressOutliner.h -- class definition for the AddressOutliner object
  20.    Created: Dora Hsu<dora@netscape.com>, Sept-30-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_addressoutliner_h
  26. #define _xfe_addressoutliner_h
  27.  
  28. #include "NotificationCenter.h"
  29. #include "Outliner.h"
  30. #include "MNListView.h"
  31. #include "Addressable.h"
  32.  
  33. class XFE_AddressOutliner : public XFE_Outliner
  34. {
  35. public:
  36.   XFE_AddressOutliner(
  37.         const char *name,
  38.         XFE_MNListView *parent_view,
  39.         MAddressable *addressable_view,
  40.                Widget widget_parent,
  41.                Boolean constantSize,
  42.                int num_columns,
  43.                int *column_widths,
  44.                char *pos_prefname);
  45.  
  46.   XFE_AddressOutliner();
  47.   virtual ~XFE_AddressOutliner();
  48.  
  49.   XFE_CALLBACK_DECL(afterRealizeWidget)
  50.  
  51.   void keyIn(
  52.         Widget w,
  53.          XEvent *event,
  54.          String *params,
  55.          Cardinal *nparam);
  56.  
  57.   void fieldTraverse(
  58.         Widget w,
  59.          XEvent *event,
  60.          String *params,
  61.          Cardinal *nparam);
  62.  
  63.   void tableTraverse(
  64.         Widget w,
  65.          XEvent *event,
  66.          String *params,
  67.          Cardinal *nparam);
  68.  
  69.   void selectedMenu(char*);
  70.  
  71.   void onEnter();
  72.  
  73.   /* pretend the user types in text
  74.    */
  75.   void fillText(char *text);
  76.   void PlaceText(int row, int col, Boolean doUpdate = True);
  77.  
  78.   /* callback routine for the timer on user input
  79.    */
  80.   void processInput();
  81.  
  82.     /* Moved updateAddresses() to public because it's the only way
  83.      * to ensure that the last-typed-in address gets recorded
  84.      */
  85.   int  updateAddresses();
  86.  
  87.   static const char *tabPrev;
  88.   static const char *tabNext;
  89.   static const char *textFocusIn;
  90.   static const char *typeFocusIn;
  91.  
  92. protected:
  93.   void selectLine(int line);         // call with -1 to clear all selections
  94.   void extendSelection(int line);
  95.  
  96. private:
  97.  
  98.   // Data
  99.   int m_displayrows;
  100.   int m_numrows;
  101.   int m_rowindex;
  102.   Widget m_textWidget;
  103.   Widget m_typeWidget;
  104.   Widget m_lastFocus;
  105.   Widget m_popup;
  106.  
  107.   XFE_MNListView *m_parentView;
  108.   MAddressable *m_addressable;
  109.   int        m_focusRow;
  110.   int        m_focusCol;
  111.   XmTextPosition m_cursorPos;
  112.   Boolean    m_inPopup;
  113.   int       m_firstSelected;
  114.   int       m_lastSelected;
  115.   XtIntervalId m_textTimer;
  116.  
  117.   // Methods
  118.   void handleEvent(XEvent *event, Boolean *c); 
  119.   void textLosingFocus(XtPointer);
  120.   void textFocus();
  121.   void typeFocus();
  122.   void textactivate(XtPointer);
  123.   void textmodify(Widget, XtPointer);
  124.   void textmotion(XtPointer);
  125.   void MapText(int row);
  126.   void scroll(XtPointer);
  127.  
  128.   char *GetCellValue(int row, int col);
  129.   XFE_CALLBACK_DECL(tabToGrid)
  130.   char *nameCompletion(char *pString);
  131.   char *getLastEnterredName(char* str, int* pos, int* len, Boolean* moreRecipients);
  132.  
  133.  
  134.   // Static Methods
  135.   static void eventHandler(Widget, XtPointer, XEvent *, Boolean *);
  136.   static void typeFocusCallback(Widget, XtPointer clientData, XtPointer);
  137.   static void textFocusCallback(Widget, XtPointer clientData, XtPointer);
  138.   static void textLosingFocusCallback(Widget, XtPointer clientData, XtPointer
  139. callData);
  140.   static void textActivateCallback(Widget, XtPointer clientData, XtPointer
  141. callData);
  142.   static void scrollCallback(Widget, XtPointer clientData, XtPointer);
  143.   static void textModifyCallback(Widget, XtPointer clientData, XtPointer
  144. callData);
  145.   static void textMotionCallback(Widget, XtPointer clientData, XtPointer
  146. callData);
  147.  
  148.   static void popupCallback(Widget, XtPointer clientData, XtPointer);
  149.  
  150.   // New Communication methods with Parent View
  151.   void setTypeHeader(int row, MSG_HEADER_SET header, Boolean redisplay = True);
  152.   void setAddress(int row, char* pAddressesStr, Boolean redisplay = True);
  153.   void deleteRow(int row, int col);
  154.   void deleteRows(int startrow, int endrow);
  155.  
  156.   void doInsert(int row, int col);
  157.   void doDelete(int row, int col, XEvent *event);
  158.   void doBackSpace(int row, int col, XEvent *event);
  159.   void doEnd(int row, int col);
  160.   void doHome(int row, int col);
  161.   void doUp(int row, int col);
  162.   void doDown(int row, int col);
  163.   void doLeft(int row, int col);
  164.   void doRight(int row, int col);
  165.   void doNext(int row, int col);
  166.   void doPrevious(int row, int col);
  167.   void onLeave();
  168. };
  169.  
  170. #endif
  171.