dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtmail / dtmail / FindDialog.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  *+SNOTICE
25  *
26  *      $XConsortium: FindDialog.h /main/4 1996/04/21 19:42:01 drk $
27  *
28  *      RESTRICTED CONFIDENTIAL INFORMATION:
29  *      
30  *      The information in this document is subject to special
31  *      restrictions in a confidential disclosure agreement between
32  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
33  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
34  *      Sun's specific written approval.  This document and all copies
35  *      and derivative works thereof must be returned or destroyed at
36  *      Sun's request.
37  *
38  *      Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
39  *
40  *+ENOTICE
41  */
42
43 #ifndef FINDDIALOG_H
44 #define FINDDIALOG_H
45
46 #include <DtMail/DtMail.hh>
47 #include "Dialog.h"
48
49 //
50 // This class is used for the 'Mailer - Find' dialog box.
51 //
52 class FindDialog : public Dialog {
53
54 public:
55   FindDialog(RoamMenuWindow     * parent);
56   ~FindDialog() { clear(); };
57
58   //
59   // These come from 'Dialog'.
60   //
61   void          popped_up() { };
62   void          popped_down() { };
63   void          popup() { XtPopup(_w, XtGrabNone); };
64   void          popdown() { XtPopdown(_w); };
65   void          widgetDestroyed() {};
66
67   // The set/clear status methods will set and clear the status line.
68   //
69   void setStatus(const char * str);
70   void clearStatus(void);
71
72   Widget        createWorkArea(Widget);
73
74   //
75   // Like initialize() except returns success status.
76   //
77   Boolean               startup();
78
79   //
80   // Set the search direction for find.
81   //
82   void setSearchForward(Boolean forward) {      // True == Forward, False = Backward.
83     _searchForward = forward;
84   };
85
86 private:
87
88   struct ActionAreaItem {
89     char                * label;        // Button label.
90     XtCallbackProc        callback;
91     caddr_t               data;
92   };
93     
94   //
95   // Clear out the data. After this function is complete the
96   // data should look as if the constructor was just called and
97   // before initialize().
98   //
99   void          clear();
100
101   Boolean       findMatching(Boolean findAll = False);
102
103   Boolean       compareMessage(DtMailMessageHandle        handle);
104
105   #if !defined(CSRG_BASED) && !defined(__linux__)
106   static const char * strcasestr(const char *str,
107                                  const char *toFind);
108   #endif
109
110   Boolean       compareHeader(DtMailEnv         & error,
111                       DtMailValueSeq    & seq,
112                       const char        * cmpToString);
113
114   static void   directionCallback(Widget        button,
115                                   XtPointer     closure,
116                                   XtPointer     call_data);
117
118   static void   findCallback(Widget     button,
119                              XtPointer  closure,
120                              XtPointer  call_data);
121
122   static void   findSelectAllCallback(Widget    button,
123                                       XtPointer closure,
124                                       XtPointer call_data);
125
126   static void   clearCallback(Widget    button,
127                               XtPointer closure,
128                               XtPointer call_data);
129
130   static void   closeCallback(Widget    button,
131                               XtPointer closure,
132                               XtPointer call_data);
133
134   static void   helpCallback(Widget     button,
135                              XtPointer  closure,
136                              XtPointer  call_data);
137
138   static void   textFieldCallback(Widget, XtPointer, XtPointer);
139
140   //
141   // Pull all fields out of the dialog and store in _text_values;
142   //
143   void          getAllFields();
144
145   unsigned int     _num_text_fields;            // Array size.
146
147   Widget           _status_text;
148   Widget         * _text_fields;
149   char          ** _text_names;
150   char          ** _text_abstract_name;
151   char          ** _text_labels;
152   char          ** _text_values;
153
154   unsigned int     _num_buttons;                // Array size.
155   ActionAreaItem * _buttonData;
156
157   Boolean          _searchForward;
158   RoamMenuWindow * _roamWindow;
159 };
160
161 #endif