1 /*
2  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
3  *
4  * See the LICENSE file for terms of use.
5  */
6 
7 #include "Wt/WApplication.h"
8 #include "Wt/WEnvironment.h"
9 #include "Wt/WDefaultLoadingIndicator.h"
10 
11 namespace Wt {
12 
WDefaultLoadingIndicator()13 WDefaultLoadingIndicator::WDefaultLoadingIndicator()
14 {
15   setImplementation(std::unique_ptr<WWidget>
16 		    (new WText(tr("Wt.WDefaultLoadingIndicator.Loading"))));
17   setInline(false);
18   setStyleClass("Wt-loading");
19 
20   WApplication *app = WApplication::instance();
21 
22   app->styleSheet().addRule("div.Wt-loading",
23 			    "background-color: red; color: white;"
24 			    "font-family: Arial,Helvetica,sans-serif;"
25 			    "font-size: small;"
26 			    "position: absolute; right: 0px; top: 0px;");
27   app->styleSheet().addRule("body div > div.Wt-loading",
28 			    "position: fixed;");
29 
30   if (app->environment().userAgent().find("MSIE 5.5") != std::string::npos
31       || app->environment().userAgent().find("MSIE 6") != std::string::npos)
32     app->styleSheet().addRule
33       ("div.Wt-loading",
34        "right: expression((("
35        "ignoreMe2 = document.documentElement.scrollLeft ? "
36        "document.documentElement.scrollLeft : "
37        "document.body.scrollLeft )) + 'px' );"
38        "top: expression((("
39        "ignoreMe = document.documentElement.scrollTop ? "
40        "document.documentElement.scrollTop : "
41        "document.body.scrollTop)) + 'px' );");
42 }
43 
setMessage(const WString & text)44 void WDefaultLoadingIndicator::setMessage(const WString& text)
45 {
46   dynamic_cast<WText *>(implementation())->setText(text);
47 }
48 
49 }
50