/src/wt/src/Wt/WDefaultLoadingIndicator.C
Line | Count | Source |
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 | | |
13 | | WDefaultLoadingIndicator::WDefaultLoadingIndicator() |
14 | 0 | { |
15 | 0 | setImplementation(std::unique_ptr<WWidget> |
16 | 0 | (new WText(tr("Wt.WDefaultLoadingIndicator.Loading")))); |
17 | 0 | setInline(false); |
18 | 0 | setStyleClass("Wt-loading"); |
19 | |
|
20 | 0 | WApplication *app = WApplication::instance(); |
21 | |
|
22 | 0 | app->styleSheet().addRule("div.Wt-loading", |
23 | 0 | "background-color: red; color: white;" |
24 | 0 | "font-family: Arial,Helvetica,sans-serif;" |
25 | 0 | "font-size: small;" |
26 | 0 | "position: absolute; right: 0px; top: 0px;"); |
27 | 0 | app->styleSheet().addRule("body div > div.Wt-loading", |
28 | 0 | "position: fixed;"); |
29 | |
|
30 | 0 | if (app->environment().userAgent().find("MSIE 5.5") != std::string::npos |
31 | 0 | || app->environment().userAgent().find("MSIE 6") != std::string::npos) |
32 | 0 | app->styleSheet().addRule |
33 | 0 | ("div.Wt-loading", |
34 | 0 | "right: expression(((" |
35 | 0 | "ignoreMe2 = document.documentElement.scrollLeft ? " |
36 | 0 | "document.documentElement.scrollLeft : " |
37 | 0 | "document.body.scrollLeft )) + 'px' );" |
38 | 0 | "top: expression(((" |
39 | 0 | "ignoreMe = document.documentElement.scrollTop ? " |
40 | 0 | "document.documentElement.scrollTop : " |
41 | 0 | "document.body.scrollTop)) + 'px' );"); |
42 | 0 | } |
43 | | |
44 | | void WDefaultLoadingIndicator::setMessage(const WString& text) |
45 | 0 | { |
46 | 0 | dynamic_cast<WText *>(implementation())->setText(text); |
47 | 0 | } |
48 | | |
49 | | } |