Project

General

Profile

Feature #5685 ยป logo.patch

Benjamin Oldenburg, 04/28/2017 11:37 AM

View differences:

wt-3.3.7/src/Wt/WNavigationBar 2017-04-28 15:46:19.132519400 +0700
*/
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
wt-3.3.7/src/Wt/WNavigationBar.C 2017-04-28 15:36:04.637149000 +0700
#include "Wt/WNavigationBar"
#include "Wt/WPushButton"
#include "Wt/WTheme"
#include "Wt/WImage"
#include <exception>
......
{
bindEmpty("collapse-button");
bindEmpty("expand-button");
bindEmpty("logo-link");
bindEmpty("title-link");
bindWidget("contents", new NavContainer());
......
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<WAnchor *>("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<NavContainer *>("contents");
wt-3.3.7/src/xml/bootstrap3_theme.xml 2017-04-28 15:07:19.413987800 +0700
${collapse-button}
<div class="navbar-header">
${expand-button}
${logo-link}
${title-link}
</div>
${contents}
    (1-1/1)