Am Freitag, den 14.11.2008, 15:53 +0100 schrieb Koen Deforche:
> All,
>
> 2008/11/14 Brad Hubbard <[email protected]>:
> > Hey Koen,
> >
> > I think Goetz may have had something like this in mind
> > http://www.sitepoint.com/forums/showthread.php?t=581377
> >
> > Is that doable using your new loading indicator module? Basically this
> > form of loading indicator is becoming a kind of standard in itself and
> > attempts to prevent the user from clicking on elements in the page
> > before it is ready to accept user input. IMHO it is a good idea and has
> > been adapted by many.
>
> I've implemented it as WOverlayLoadingIndicator (now in CVS).
Last tests indicate it is a little bit "flashy"...
would the attached patch be acceptable ?
It allows to set style classes for the central box,
the text and the background.
Goetz
--
Goetz Babin-Ebell <[email protected]>
4G Systems GmbH & Co KG
Index: src/Wt/WOverlayLoadingIndicator
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WOverlayLoadingIndicator,v
retrieving revision 1.1
diff -u -r1.1 WOverlayLoadingIndicator
--- src/Wt/WOverlayLoadingIndicator 14 Nov 2008 14:49:26 -0000 1.1
+++ src/Wt/WOverlayLoadingIndicator 15 Dec 2008 12:52:30 -0000
@@ -41,7 +41,37 @@
public WLoadingIndicator
{
public:
- WOverlayLoadingIndicator();
+ /*! \brief construct the loading indicator
+ * \param styleClass the style class for the central box
+ * \param backgroundStyleClass the style class for the "background" part of the indicator
+ * \param textStyleClass the style class for the text that is displayed
+ * \note if styleClass is not set, the central box gets the CSS style elements
+ * \code
+ * background: white;
+ * border: 3px solid #333333;
+ * z-index: 10001; visibility: visible;
+ * position: absolute; left: 50%; top: 50%;
+ * margin-left: -50px; margin-top: -40px;
+ * width: 100px; height: 80px;
+ * font-family: arial,sans-serif;
+ * text-align: center
+ * \endcode
+ * \note if backgroundStyleClass is not set, the background gets the CSS style elements
+ * \code
+ * background: #DDDDDD;
+ * height: 100%; width: 100%;
+ * top: 0px; left: 0px;
+ * z-index: 10000;
+ * -moz-background-clip: -moz-initial;
+ * -moz-background-origin: -moz-initial;
+ * -moz-background-inline-policy: -moz-initial;
+ * opacity: 0.5; filter: alpha(opacity=50); -moz-opacity:0.5;
+ * position: absolute;
+ * \endcode
+ */
+ WOverlayLoadingIndicator(const WString &styleClass = WString(),
+ const WString &backgroundStyleClass = WString(),
+ const WString &textStyleClass = WString());
virtual WWidget *widget() { return this; }
virtual void setMessage(const WString& text);
Index: src/Wt/WOverlayLoadingIndicator.C
===================================================================
RCS file: /opt/cvs/wt/src/Wt/WOverlayLoadingIndicator.C,v
retrieving revision 1.1
diff -u -r1.1 WOverlayLoadingIndicator.C
--- src/Wt/WOverlayLoadingIndicator.C 14 Nov 2008 14:49:26 -0000 1.1
+++ src/Wt/WOverlayLoadingIndicator.C 15 Dec 2008 12:52:30 -0000
@@ -12,7 +12,7 @@
namespace Wt {
-WOverlayLoadingIndicator::WOverlayLoadingIndicator()
+WOverlayLoadingIndicator::WOverlayLoadingIndicator(const WString &styleClass, const WString &backgroundStyleClass, const WString &textStyleClass)
{
setInline(false);
@@ -29,30 +29,38 @@
text_->setInline(false);
text_->setMargin(WLength(), Left | Right);
+ if (!styleClass.empty())
+ center_->setStyleClass(styleClass);
+ if (!textStyleClass.empty())
+ text_->setStyleClass(textStyleClass);
+ if (!backgroundStyleClass.empty()) cover_->setStyleClass(backgroundStyleClass);
+
if (app->environment().agentIE())
app->styleSheet().addRule("body", "height: 100%; margin: 0;");
- app->styleSheet().addRule("div#" + cover_->id(),
- "background: #DDDDDD;"
- "height: 100%; width: 100%;"
- "top: 0px; left: 0px;"
- "z-index: 10000;"
- "-moz-background-clip: -moz-initial;"
- "-moz-background-origin: -moz-initial;"
- "-moz-background-inline-policy: -moz-initial;"
- "opacity: 0.5; position: absolute;"
- "filter: alpha(opacity=50); -moz-opacity:0.5;"
- "-khtml-opacity: 0.5");
-
- app->styleSheet().addRule("div#" + center_->id(),
- "background: white;"
- "border: 3px solid #333333;"
- "z-index: 10001; visibility: visible;"
- "position: absolute; left: 50%; top: 50%;"
- "margin-left: -50px; margin-top: -40px;"
- "width: 100px; height: 80px;"
- "font-family: arial,sans-serif;"
- "text-align: center");
+ if (backgroundStyleClass.empty())
+ app->styleSheet().addRule("div#" + cover_->id(),
+ "background: #DDDDDD;"
+ "height: 100%; width: 100%;"
+ "top: 0px; left: 0px;"
+ "z-index: 10000;"
+ "-moz-background-clip: -moz-initial;"
+ "-moz-background-origin: -moz-initial;"
+ "-moz-background-inline-policy: -moz-initial;"
+ "opacity: 0.5; position: absolute;"
+ "filter: alpha(opacity=50); -moz-opacity:0.5;"
+ "-khtml-opacity: 0.5");
+
+ if (styleClass.empty())
+ app->styleSheet().addRule("div#" + center_->id(),
+ "background: white;"
+ "border: 3px solid #333333;"
+ "z-index: 10001; visibility: visible;"
+ "position: absolute; left: 50%; top: 50%;"
+ "margin-left: -50px; margin-top: -40px;"
+ "width: 100px; height: 80px;"
+ "font-family: arial,sans-serif;"
+ "text-align: center");
}
void WOverlayLoadingIndicator::setMessage(const WString& text)
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest