Wt examples  4.10.4
Composer.h
Go to the documentation of this file.
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bv, Herent, 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 
35 
40 class Composer : public WCompositeWidget
41 {
42 public:
45  Composer();
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> to() const;
66 
69  std::vector<Contact> cc() const;
70 
73  std::vector<Contact> bcc() const;
74 
77  const WString& subject() const;
78 
84  std::vector<Attachment> attachments() const;
85 
88  const WString& message() const;
89 
90 public:
94 
98 
99 private:
101 
102  WPushButton *topSendButton_, *topSaveNowButton_, *topDiscardButton_;
103  WPushButton *botSendButton_, *botSaveNowButton_, *botDiscardButton_;
105 
107 
114 
117 
120 
123 
132 
134  std::vector<AttachmentEdit *> attachments_;
135 
138 
140  bool saving_, sending_;
141 
144 
147  void attachMore();
148 
151  void removeAttachment(AttachmentEdit *attachment);
152 
157  void sendIt();
158 
164  void saveNow();
165 
170  void discardIt();
171 
179  void attachmentDone();
180 
181 private:
182  // create the user-interface
183  void createUi();
184 
188  void saved();
189 
192  void setStatus(const WString& text, const WString& style);
193 
194  friend class AttachmentEdit;
195 };
196 
198 
199 #endif // COMPOSER_H_
An edit field for an email addressee.
Definition: AddresseeEdit.h:32
An edit field for an email attachment.
An E-mail composer widget.
Definition: Composer.h:41
WText * statusMsg_
Definition: Composer.h:104
Option * attachOtherFile_
Option for attaching another file.
Definition: Composer.h:131
WTextArea * message_
WTextArea for the main message.
Definition: Composer.h:137
Wt::Signal send
The message is ready to be sent...
Definition: Composer.h:93
Wt::Signal discard
The message must be discarded.
Definition: Composer.h:97
AddresseeEdit * toEdit_
To: Addressees edit.
Definition: Composer.h:109
bool saving_
state when waiting asyncrhonously for attachments to be uploaded
Definition: Composer.h:140
WLineEdit * subject_
The subject line edit.
Definition: Composer.h:119
WPushButton * topDiscardButton_
Definition: Composer.h:102
int attachmentsPending_
number of attachments waiting to be uploaded during saving
Definition: Composer.h:143
ContactSuggestions * contactSuggestions_
The suggestions popup for the addressee edits.
Definition: Composer.h:116
Option * attachFile_
Option for attaching a file.
Definition: Composer.h:129
WPushButton * botDiscardButton_
Definition: Composer.h:103
std::vector< AttachmentEdit * > attachments_
Array which holds all the attachments, including one extra invisible one.
Definition: Composer.h:134
WTable * edits_
Definition: Composer.h:106
Option * addbcc_
Option for editing Bcc:
Definition: Composer.h:127
AddresseeEdit * ccEdit_
Cc: Addressees edit.
Definition: Composer.h:111
WContainerWidget * layout_
Definition: Composer.h:100
Option * addcc_
Option for editing Cc:
Definition: Composer.h:125
AddresseeEdit * bccEdit_
Bcc: Addressees edit.
Definition: Composer.h:113
OptionList * options_
OptionsList for editing Cc or Bcc.
Definition: Composer.h:122
A suggestion popup suggesting contacts from an addressbook.
A list of options, separated by '|'.
Definition: OptionList.h:41
A clickable option.
Definition: Option.h:32