diff -Naur tmp/wt-3.3.7/src/Wt/WNavigationBar wt-3.3.7/src/Wt/WNavigationBar --- tmp/wt-3.3.7/src/Wt/WNavigationBar 2017-03-31 17:01:28.000000000 +0700 +++ wt-3.3.7/src/Wt/WNavigationBar 2017-04-28 15:46:19.132519400 +0700 @@ -35,6 +35,18 @@ */ void setTitle(const WString& title, const WLink& link = WLink()); + /*! \brief Sets a an image as 'title'. The image size should be 34x34 pixels; + * + * The title may optionally link to a 'homepage'. + */ + void setLogo(WImage* logo, const WLink& link = WLink()); + + /*! \brief Sets a an image as 'title'. The image size should be 34x34 pixels; + * + * The title may optionally link to a 'homepage'. + */ + void setLogo(const std::string &imageRef, const WLink &link = WLink()); + /*! \brief Sets whether the navigation bar will respond to screen size. * * For screens that are less wide, the navigation bar can be diff -Naur tmp/wt-3.3.7/src/Wt/WNavigationBar.C wt-3.3.7/src/Wt/WNavigationBar.C --- tmp/wt-3.3.7/src/Wt/WNavigationBar.C 2017-03-31 17:01:28.000000000 +0700 +++ wt-3.3.7/src/Wt/WNavigationBar.C 2017-04-28 15:36:04.637149000 +0700 @@ -11,6 +11,7 @@ #include "Wt/WNavigationBar" #include "Wt/WPushButton" #include "Wt/WTheme" +#include "Wt/WImage" #include @@ -52,6 +53,7 @@ { bindEmpty("collapse-button"); bindEmpty("expand-button"); + bindEmpty("logo-link"); bindEmpty("title-link"); bindWidget("contents", new NavContainer()); @@ -75,6 +77,29 @@ titleLink->setLink(link); } +void WNavigationBar::setLogo(const std::string &imageRef, const WLink &link) +{ + this->setLogo(new WImage(imageRef), link); +} + +void WNavigationBar::setLogo(WImage* logoImg, const WLink& link) +{ + WAnchor *logoLink = resolve("logo-link"); + + if (!logoLink) + { + bindWidget("logo-link", logoLink = new WAnchor()); + wApp->theme()->apply(this, logoLink, NavBrandRole); + } + if (logoImg) + { + logoImg->resize(34, 34); + logoImg->setMargin(-7, Top); + } + logoLink->setImage(logoImg); + logoLink->setLink(link); +} + void WNavigationBar::setResponsive(bool responsive) { NavContainer *contents = resolve("contents"); diff -Naur tmp/wt-3.3.7/src/xml/bootstrap3_theme.xml wt-3.3.7/src/xml/bootstrap3_theme.xml --- tmp/wt-3.3.7/src/xml/bootstrap3_theme.xml 2017-03-31 17:01:28.000000000 +0700 +++ wt-3.3.7/src/xml/bootstrap3_theme.xml 2017-04-28 15:07:19.413987800 +0700 @@ -59,6 +59,7 @@ ${collapse-button} ${contents}