Skip to content

Commit 78e1e95

Browse files
committed
WT-9350: customize widget gallery theme
This adds a theme that changes the widget gallery colors to the Wt purple, or JWt orange. The paintbrush example was updated with button colors that match the color that is actually used. The JWt logo was added, and the JWt widget gallery will now use the JWt logo.
1 parent b01667d commit 78e1e95

File tree

23 files changed

+3433
-40
lines changed

23 files changed

+3433
-40
lines changed

.dprint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"src/js/*.{js}",
1919
"src/web/skeleton/*.{js}",
2020
"src/themes/bootstrap/5/*.{js}",
21-
"examples/custom-bs-theme/theme/*.{js}"
21+
"examples/custom-bs-theme/theme/*.{js}",
22+
"examples/widgetgallery/style/*.{js}"
2223
],
2324
"excludes": [
2425
"**/node_modules",

examples/widgetgallery/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SET(WIDGETGALLERY_SOURCES
88
Media.h Media.C
99
Navigation.h Navigation.C
1010
Sample.h
11+
Theme.h Theme.C
1112
Topic.h Topic.C
1213
TopicTemplate.h TopicTemplate.C
1314
TreesTables.h TreesTables.C

examples/widgetgallery/Theme.C

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (C) 2022 Emweb bv, Herent, Belgium
3+
*
4+
* See the LICENSE file for terms of use.
5+
*/
6+
7+
#include "Theme.h"
8+
9+
#include <Wt/WLink.h>
10+
11+
Theme::Theme(const std::string &name)
12+
: name_(name)
13+
{}
14+
15+
std::vector<Wt::WLinkedCssStyleSheet> Theme::styleSheets() const
16+
{
17+
return {
18+
Wt::WLinkedCssStyleSheet(Wt::WLink("style/" + name_ + ".css"))
19+
};
20+
}

examples/widgetgallery/Theme.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This may look like C code, but it's really -*- C++ -*-
2+
/*
3+
* Copyright (C) 2022 Emweb bv, Herent, Belgium
4+
*
5+
* See the LICENSE file for terms of use.
6+
*/
7+
8+
#ifndef THEME_H_
9+
#define THEME_H_
10+
11+
#include <Wt/WBootstrap5Theme.h>
12+
#include <Wt/WLinkedCssStyleSheet.h>
13+
14+
#include <vector>
15+
16+
class Theme : public Wt::WBootstrap5Theme {
17+
public:
18+
explicit Theme(const std::string& name);
19+
20+
std::vector<Wt::WLinkedCssStyleSheet> styleSheets() const override;
21+
22+
private:
23+
std::string name_;
24+
};
25+
26+
#endif // THEME_H_

examples/widgetgallery/WidgetGallery.C

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ WidgetGallery::WidgetGallery()
2626
openMenuButton_(nullptr),
2727
menuOpen_(false) // once applies when responsive UI
2828
{
29+
#ifndef WT_TARGET_JAVA
30+
setCondition("if:cpp", true);
31+
setCondition("if:java", false);
32+
#else
33+
setCondition("if:cpp", false);
34+
setCondition("if:java", true);
35+
#endif
36+
2937
contentsStack_ = bindNew<Wt::WStackedWidget>("contents");
3038

3139
Wt::WAnimation animation(Wt::AnimationEffect::Fade,

examples/widgetgallery/approot/src.xml

Lines changed: 32 additions & 16 deletions
Large diffs are not rendered by default.

examples/widgetgallery/approot/tpl.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
<div class="wg-wrapper">
55
<div class="wg-sidebar">
66
<div class="wg-logo">
7-
<img src="/icons/wt.png" />
7+
${<if:cpp>}
8+
<img src="/icons/wt.png" />
9+
${</if:cpp>}
10+
${<if:java>}
11+
<img src="/icons/jwt.png" />
12+
${</if:java>}
813
<h1>Widget Gallery</h1>
914
</div>
1015
${menu}
2.7 KB
Loading

examples/widgetgallery/docroot/style/everywidget.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
line-height: 100%;
44
}
55

6-
.contents h1,
7-
.contents h2,
8-
.contents h3 {
9-
color: #007bff;
10-
}
11-
126
.submenu {
137
overflow: auto;
148
}

examples/widgetgallery/docroot/style/jwt.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)