Wtx ~ Wt Extension Library
WtxLib
Composer.h
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef COMPOSER_H_
8 #define COMPOSER_H_
9 
10 #include <Wt/WCompositeWidget.h>
11 
12 #include "Contact.h"
13 #include "Attachment.h"
14 
15 namespace Wt {
16 class WLineEdit;
17 class WPushButton;
18 class WTable;
19 class WText;
20 class WTextArea;
21 }
22 
23 class AddresseeEdit;
24 class AttachmentEdit;
25 class ContactSuggestions;
26 class OptionList;
27 class Option;
28 
29 using namespace Wt;
30 
31 
36 class Composer : public WCompositeWidget
37 {
38 public:
41  Composer();
42 
45  void setFrom(const std::vector<Contact>& from);
46 
49  void setTo(const std::vector<Contact>& to);
50 
53  void setSubject(const WString& subject);
54 
57  void setMessage(const WString& message);
58 
61  void setAddressBook(const std::vector<Contact>& addressBook);
62 
65  std::vector<Contact> from() const;
66 
69  std::vector<Contact> to() const;
70 
73  std::vector<Contact> cc() const;
74 
77  std::vector<Contact> bcc() const;
78 
81  const WString& subject() const;
82 
88  std::vector<Attachment> attachments() const;
89 
90  void addAttachment( const Attachment & attachment );
91 
94  const WString& message() const;
95 
96 public:
99  Wt::Signal<> send;
100 
103  Wt::Signal<> discard;
104 
105 private:
106  WContainerWidget *layout_;
107 
108  WPushButton *topSendButton_, *topSaveNowButton_, *topDiscardButton_;
109  WPushButton *botSendButton_, *botSaveNowButton_, *botDiscardButton_;
110  WText *statusMsg_;
111 
112  WTable *edits_;
113 
115  AddresseeEdit *fromEdit_;
117  AddresseeEdit *toEdit_;
119  AddresseeEdit *ccEdit_;
121  AddresseeEdit *bccEdit_;
122 
124  ContactSuggestions *contactSuggestions_;
125 
127  WLineEdit *subject_;
128 
130  OptionList *options_;
131 
133  Option *addcc_;
135  Option *addbcc_;
137  Option *attachFile_;
139  Option *attachOtherFile_;
140 
142  std::vector<AttachmentEdit *> attachments_;
143 
145  WTextArea *message_;
146 
148  bool saving_, sending_;
149 
151  int attachmentsPending_;
152 
155  void attachMore();
156 
159  void removeAttachment(AttachmentEdit *attachment);
160 
165  void sendIt();
166 
172  void saveNow();
173 
178  void discardIt();
179 
187  void attachmentDone();
188 
189 private:
190  // create the user-interface
191  void createUi();
192 
196  void saved();
197 
200  void setStatus(const WString& text, const WString& style);
201 
202  friend class AttachmentEdit;
203 };
204 
207 #endif // COMPOSER_H_
A clickable option.
Definition: Option.h:31
An email attachment.
Definition: Attachment.h:19
An edit field for an email attachment.
An E-mail composer widget.
Definition: Composer.h:36
Wt::Signal send
The message is ready to be sent...
Definition: Composer.h:99
A list of options, separated by &#39;|&#39;.
Definition: OptionList.h:40
An edit field for an email addressee.
Definition: AddresseeEdit.h:31
A suggestion popup suggesting contacts from an addressbook.
Wt::Signal discard
The message must be discarded.
Definition: Composer.h:103