Hey Peter,

2008/7/10 Peter Klar <[EMAIL PROTECTED]>:
> perhaps I missed something but I have a problem to center align an
> Ext::Button.

You didn't miss anything, this is a bug.
CSS properties didn't propagate properly to the Ext widget. This is
fixed now in CVS.

If you wish to back-port the fix to 2.1.4, find in attachment a patch.

Thanks for reporting this.

Regards,
koen
diff --git a/src/Ext/Widget.C b/src/Ext/Widget.C
index d2a6058..acd8225 100644
--- a/src/Ext/Widget.C
+++ b/src/Ext/Widget.C
@@ -83,7 +83,7 @@ std::string Widget::configStruct()
 {
   std::stringstream config;
 
-  config << "{id:'" << extId() << "'";
+  config << "{a:0";
   createConfig(config);
   config << "}";
 
@@ -94,6 +94,16 @@ void Widget::createConfig(std::ostream& config)
 { 
   Container *c = dynamic_cast<Container *>(parent());
 
+  config << ",id:'" << extId() << "'";
+
+  if (!styleClass().empty())
+    config << ",cls:'" << styleClass().toUTF8() << "'";
+
+  std::string cssStyle = inlineCssStyle();
+
+  if (!cssStyle.empty())
+    config << ",style:'" << cssStyle << "'";
+
   if (c)
     c->addLayoutConfig(this, config);
 }
diff --git a/src/wt/WWidget b/src/wt/WWidget
index d2be425..524e4b1 100644
--- a/src/wt/WWidget
+++ b/src/wt/WWidget
@@ -696,6 +696,8 @@ public:
    */
   virtual void htmlText(std::ostream& out);
 
+  std::string inlineCssStyle();
+
   std::string createJavaScript(std::string& js, const std::string& insertJS);
 
   Signal<WWidget *> destroyed;
diff --git a/src/wt/WWidget.C b/src/wt/WWidget.C
index ed5428d..441a96b 100644
--- a/src/wt/WWidget.C
+++ b/src/wt/WWidget.C
@@ -91,6 +91,16 @@ void WWidget::htmlText(std::ostream& out)
   delete element;
 }
 
+std::string WWidget::inlineCssStyle()
+{
+  WWebWidget *ww = webWidget();
+  DomElement *e = DomElement::getForUpdate(ww, ww->domElementType());
+  ww->updateDom(*e, true);
+  std::string result = e->cssStyle();
+  delete e;
+  return result;
+}
+
 void WWidget::setArguments(const ArgumentMap& arguments)
 {
   addHeader("Expires", "Sun, 14 Jun 2020 00:00:00 GMT");
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to