Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / dtmail / FindDialog.h
1 /*
2  *+SNOTICE
3  *
4  *      $XConsortium: FindDialog.h /main/4 1996/04/21 19:42:01 drk $
5  *
6  *      RESTRICTED CONFIDENTIAL INFORMATION:
7  *      
8  *      The information in this document is subject to special
9  *      restrictions in a confidential disclosure agreement between
10  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
11  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
12  *      Sun's specific written approval.  This document and all copies
13  *      and derivative works thereof must be returned or destroyed at
14  *      Sun's request.
15  *
16  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
17  *
18  *+ENOTICE
19  */
20
21 #ifndef FINDDIALOG_H
22 #define FINDDIALOG_H
23
24 #include <DtMail/DtMail.hh>
25 #include "Dialog.h"
26
27 //
28 // This class is used for the 'Mailer - Find' dialog box.
29 //
30 class FindDialog : public Dialog {
31
32 public:
33   FindDialog(RoamMenuWindow     * parent);
34   ~FindDialog() { clear(); };
35
36   //
37   // These come from 'Dialog'.
38   //
39   void          popped_up() { };
40   void          popped_down() { };
41   void          popup() { XtPopup(_w, XtGrabNone); };
42   void          popdown() { XtPopdown(_w); };
43   void          widgetDestroyed() {};
44
45   // The set/clear status methods will set and clear the status line.
46   //
47   void setStatus(const char * str);
48   void clearStatus(void);
49
50   Widget        createWorkArea(Widget);
51
52   //
53   // Like initialize() except returns success status.
54   //
55   Boolean               startup();
56
57   //
58   // Set the search direction for find.
59   //
60   void setSearchForward(Boolean forward) {      // True == Forward, False = Backward.
61     _searchForward = forward;
62   };
63
64 private:
65
66   struct ActionAreaItem {
67     char                * label;        // Button label.
68     XtCallbackProc        callback;
69     caddr_t               data;
70   };
71     
72   //
73   // Clear out the data. After this function is complete the
74   // data should look as if the constructor was just called and
75   // before initialize().
76   //
77   void          clear();
78
79   Boolean       findMatching(Boolean findAll = False);
80
81   Boolean       compareMessage(DtMailMessageHandle        handle);
82
83   Boolean       compareHeader(DtMailEnv         & error,
84                       DtMailValueSeq    & seq,
85                       const char        * cmpToString);
86
87   static void   directionCallback(Widget        button,
88                                   XtPointer     closure,
89                                   XtPointer     call_data);
90
91   static void   findCallback(Widget     button,
92                              XtPointer  closure,
93                              XtPointer  call_data);
94
95   static void   findSelectAllCallback(Widget    button,
96                                       XtPointer closure,
97                                       XtPointer call_data);
98
99   static void   clearCallback(Widget    button,
100                               XtPointer closure,
101                               XtPointer call_data);
102
103   static void   closeCallback(Widget    button,
104                               XtPointer closure,
105                               XtPointer call_data);
106
107   static void   helpCallback(Widget     button,
108                              XtPointer  closure,
109                              XtPointer  call_data);
110
111   static void   textFieldCallback(Widget, XtPointer, XtPointer);
112
113   //
114   // Pull all fields out of the dialog and store in _text_values;
115   //
116   void          getAllFields();
117
118   unsigned int     _num_text_fields;            // Array size.
119
120   Widget           _status_text;
121   Widget         * _text_fields;
122   char          ** _text_names;
123   char          ** _text_abstract_name;
124   char          ** _text_labels;
125   char          ** _text_values;
126
127   unsigned int     _num_buttons;                // Array size.
128   ActionAreaItem * _buttonData;
129
130   Boolean          _searchForward;
131   RoamMenuWindow * _roamWindow;
132 };
133
134 #endif