/home/koen/project/wt/cvs/wt/examples/javascript/Popup.h

Go to the documentation of this file.
00001 // This may look like C code, but it's really -*- C++ -*-
00002 /*
00003  * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
00004  *
00005  * See the LICENSE file for terms of use.
00006  */
00007 #ifndef POPUP_H_
00008 #define POPUP_H_
00009 
00010 #include <WObject>
00011 #include <WString>
00012 #include <WJavaScript>
00013 
00014 using namespace Wt;
00015 
00020 
00032 class Popup : public WObject
00033 {
00034 public:
00037   static Popup *createConfirm(const WString& message, WObject *parent = 0);
00038 
00041   static Popup *createPrompt(const WString& message,
00042                              const std::string defaultValue,
00043                              WObject *parent = 0);
00044 
00047   static Popup *createAlert(const WString& message, WObject *parent = 0);
00048 
00051   void setMessage(const WString& message);
00052 
00055   void setDefaultValue(const std::string defaultValue);
00056 
00059   const WMessage& message() const { return message_; }
00060 
00063   const std::string& defaultValue() const { return defaultValue_; }
00064 
00070   JSlot show;
00071 
00074   JSignal<std::string> okPressed;
00075 
00078   JSignal<void>        cancelPressed;
00079 
00080 private:
00083   enum Type { Confirm, Alert, Prompt };
00084 
00087   Popup(Type t, const WString& message, const std::string defaultValue,
00088         WObject *parent);
00089 
00090   Type t_;
00091   WString message_;
00092   std::string defaultValue_;
00093 
00096   void setJavaScript();
00097 };
00098 
00101 #endif // POPUP_H_

Generated on Mon Apr 14 15:15:04 2008 for Wt by doxygen 1.5.3