Example #1
0
std::vector<WLinkedCssStyleSheet> WBootstrapTheme::styleSheets() const
{
  std::vector<WLinkedCssStyleSheet> result;

  std::string themeDir = resourcesUrl();
  std::stringstream themeVersionDir;
  themeVersionDir << themeDir << static_cast<unsigned int>(version_) << "/";

  result.push_back(WLinkedCssStyleSheet
		   (WLink(themeVersionDir.str() + "bootstrap.css")));

  WApplication *app = WApplication::instance();
 
  if (responsive_) {
    if (version_ == BootstrapVersion::v2)
      result.push_back(WLinkedCssStyleSheet
		       (WLink(themeVersionDir.str()
			      + "bootstrap-responsive.css")));
    else if (app) {
      WString v = app->metaHeader(MetaHeaderType::Meta, "viewport");
      if (v.empty())
	app->addMetaHeader("viewport",
			   "width=device-width, initial-scale=1");
    }
  }

  result.push_back(WLinkedCssStyleSheet
		   (WLink(themeVersionDir.str() + "wt.css")));

  return result;
}