2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
26 * $TOG: MsgScrollingList.hh /main/12 1998/10/22 19:56:25 mgreess $
28 * RESTRICTED CONFIDENTIAL INFORMATION:
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
38 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 #ifndef MSGSCROLLINGLIST_H
44 #define MSGSCROLLINGLIST_H
48 #endif /* DEAD_WOOD */
49 #include "MsgHndArray.hh"
51 #include "ScrollingList.h"
52 #include "UIComponent.h"
53 #include "XmStrCollector.h"
54 #include "XtArgCollector.h"
57 //#include "UndeleteMessageFromListDialog.h"
60 #include <X11/Intrinsic.h>
61 #include <X11/Xatom.h>
66 /* MSGLIST_* msgid 200 -299
68 #define MSGLIST_SELMV 200
69 #define MSGLIST_SELCP 201
70 #define MSGLIST_NORC 202
71 #define MSGLIST_NOBOX 203
72 #define MSGLIST_NOOPEN 204
73 #define MSGLIST_MSGMV 205
74 #define MSGLIST_MSGSMV 206
75 #define MSGLIST_MSGCP 207
76 #define MSGLIST_MSGSCP 208
77 #define MSGLIST_NOSEL 209
78 #define MSGLIST_RAISE 210
79 #define MSGLIST_EXIT 211
80 #define MSGLIST_OKBUT 212
81 #define MSGLIST_DLGTTL 213
84 class MsgScrollingList : public ScrollingList {
88 MsgScrollingList ( RoamMenuWindow *, Widget, char * );
92 int selected_item_position() { return _selected_item_position; }
93 RoamMenuWindow *parent() { return _parent; }
96 void addChooseCommand( ChooseCmd * );
97 void addDeleteCommand( DeleteCmd * );
98 #endif /* DEAD_WOOD */
99 void select_next_item();
100 void select_prev_item();
102 DtMailMessageHandle msgno(int index);
103 MsgStruct* get_message_struct(int index);
105 DtMailMessageHandle current_msg_handle();
106 int position(DtMailMessageHandle msgno);
108 int position(MsgStruct* a_msg_struct);
109 #endif /* DEAD_WOOD */
111 virtual const char *const className() {return ("MsgScrollingList");}
112 virtual void insertMsg(DtMailMessageHandle);
113 virtual void insertDeletedMsg(DtMailMessageHandle);
114 virtual void deleteSelected(Boolean silent = TRUE);
116 int copySelected(DtMailEnv &, char *, int delete_after_copy, int silent);
117 void items( XmString [], int );
120 void appendMsg(DtMailMessageHandle msg_hndl, int sess_num);
122 void appendMsg(DtMailMessageHandle msgno);
124 DtMailMessageHandle lastMsg();
125 #endif /* DEAD_WOOD */
129 void updateListItems(int current,
130 Boolean renumber_only = TRUE,
131 MsgHndArray *selected = NULL);
132 DtMailBoolean senderIsToHeaderWhenMailFromMe(void);
133 void checkDisplayProp(void);
135 XmString formatHeader(DtMailHeaderLine & retrieved,
137 DtMailBoolean has_attachments,
138 DtMailBoolean new_msg);
140 void visibleItems(int n_vis)
142 XtVaSetValues(_w, XmNvisibleItemCount, n_vis, NULL);
145 int visibleItems(void)
148 XtVaGetValues(_w, XmNvisibleItemCount, &n_vis, NULL);
152 Widget get_scrolling_list();
153 MsgHndArray *selected();
154 DtMailBoolean show_with_attachments(DtMailMessageHandle);
155 DtMailBoolean show_with_attachments(DtMail::Message * msg);
157 void display_message( DtMailEnv &, DtMailMessageHandle );
158 void display_and_select_message(DtMailEnv &, DtMailMessageHandle );
160 // Select all of the messages in the list and display the last one.
161 void select_all_and_display_last(DtMailEnv &);
164 // Select all of the messages in the array[] of DtMailMessageHandle.
165 // 'array' is NULL terminated list.
167 void select_all_and_display_last(DtMailEnv &,
168 DtMailMessageHandle *array,
169 unsigned int elements);
171 void display_no_message();
172 void scroll_to_bottom();
173 void scroll_to_position( int );
174 virtual void extended_selection( DtMailEnv &, int );
175 int get_selected_item();
176 int get_displayed_item();
177 int get_num_new_messages() { return num_new_messages; }
178 int get_num_deleted_messages() { return num_deleted_messages; }
180 int resetIndexNums(void);
181 int resetSessionNums(void);
183 void layoutLabels(Widget, Widget, Widget, Widget);
184 int get_num_messages() { return _msgs->length(); }
185 MsgHndArray *get_deleted_messages() { return _deleted_messages; }
186 MsgHndArray *get_messages() { return _msgs; }
187 void sort_messages();
189 void viewInSeparateWindow(DtMailEnv &);
192 void undelete_messages(MsgHndArray *);
193 void undelete_last_deleted();
194 void display_message_summary();
196 void display_message_selected();
197 #endif /* DEAD_WOOD */
198 void display_message(DtMailEnv &, int a_position);
200 int load_headers(DtMailEnv &);
201 void load_headers(DtMailEnv &, DtMailMessageHandle last);
202 void do_list_vis_adjustment();
204 // Save these to adjust as msg numbers changed ON/OFF.
211 virtual void defaultAction( Widget, XtPointer, XmListCallbackStruct * );
212 static void extendedSelectionCallback( Widget, XtPointer, XmListCallbackStruct * );
214 DtMailHeaderRequest _header_info;
217 Widget _msgsPopupMenu;
218 MenuBar *_menuPopupMsgs;
222 Image *_attach_image;
223 Image *_letter_image;
224 #endif /* DEAD_WOOD */
225 RoamMenuWindow *_parent;
228 int _selected_item_position;
229 int _displayed_item_position;
230 int session_message_number;
232 int num_new_messages;
233 int num_deleted_messages;
234 MsgHndArray *_deleted_messages;
236 DtMailBoolean _numbered;
237 Boolean _selection_on;
240 // Collect the arguments to SetValues in load_headers
241 // This prevents multiple redisplays of the XmList widget
242 XtArgCollector *_xtarg_collector;
244 // Collect the XmString items in load_headers
245 XmStrCollector *_xmstr_collector;
247 // Save the XmString that was allocated so that we can
248 // free it later. It would probably be better to add this
249 // to the XtArgCollector class, but since it's only one
250 // item it's easier to do it this way.
251 XmString _selected_items;