Skip to content

Commit 876746b

Browse files
committed
Convert "Nuclide Search" tab to CSS flex layout.
Sometimes scroll-bars would show up on the nuclide search tool, and so rather than fight the Wt layout system to figure out why and fix, I just converted the whole widget to use CSS flex layout. Surprisingly the RowStretchTreeView is still functioning appropriately even when a child in a flex layout (the wtResize JS function looks to still being called).
1 parent f1115a8 commit 876746b

File tree

5 files changed

+160
-179
lines changed

5 files changed

+160
-179
lines changed

InterSpec/IsotopeSearchByEnergy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ namespace Wt
4545
class WText;
4646
class WCheckBox;
4747
class WLineEdit;
48-
class WTreeView;
4948
class WPushButton;
5049
}//namespace Wt
5150

5251
class InterSpec;
52+
class RowStretchTreeView;
5353
class NativeFloatSpinBox;
5454
class IsotopeSearchByEnergyModel;
5555

@@ -187,7 +187,7 @@ class IsotopeSearchByEnergy : public Wt::WContainerWidget
187187
Wt::WContainerWidget *m_searchEnergies;
188188
int m_currentSearch;
189189
Wt::WText *m_searching;
190-
Wt::WTreeView *m_results;
190+
RowStretchTreeView *m_results;
191191
NativeFloatSpinBox *m_minBranchRatio;
192192
Wt::WLineEdit *m_minHalfLife;
193193
IsotopeSearchByEnergyModel *m_model;

InterSpec/RowStretchTreeView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class RowStretchTreeView : public Wt::WTreeView
4242
*/
4343

4444
public:
45-
RowStretchTreeView();
45+
RowStretchTreeView( Wt::WContainerWidget *parent = nullptr );
4646
virtual ~RowStretchTreeView(){}
4747

4848
//Setting the width of a column will ensure it is never narrower
Lines changed: 89 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,104 @@
11
.IsotopeSearchByEnergy
22
{
3-
overflow-x: hidden;
3+
/* This is the parent div of the whole tool. It hold .IsotopeSearchConditions and .IsotopeSearchResultTable */
4+
display: flex;
5+
flex-flow: row nowrap;
6+
47
margin-top: 5px;
58
margin-bottom: 3px;
69
margin-right: 4px;
710
margin-left: 4px;
811
}
912

10-
.SearchEnergiesLeftDiv
13+
.IsotopeSearchConditions
1114
{
12-
border: 2px solid #e1e1e1;
13-
width: 25.7em;
14-
height: 100%;
15+
/* This is the div that holds the energies, source types, and BR/HL options. */
16+
display: flex;
17+
flex-flow: column nowrap;
18+
19+
width: 325px;
1520
}
1621

17-
.IsoSearchSrcCB
22+
23+
.IsotopeSearchEnergies
1824
{
19-
padding-right: 5px;
20-
padding-top: 2px;
25+
/* This div holds all the search energies. */
26+
flex: 1 1 auto;
27+
overflow-y: auto;
2128
}
2229

30+
.IsotopeSourceTypes
31+
{
32+
/* This is the div that holds the "Gammas", "X-rays", and "Reaction" check boxes. */
33+
display: flex;
34+
flex-flow: row nowrap;
35+
justify-content: space-between;
36+
padding-left: 7px;
37+
padding-top: 5px;
38+
padding-bottom: 5px;
39+
}
2340

24-
.SearchEnergies
41+
.IsotopeSearchMinimums
2542
{
26-
border: 1px solid #e1e1e1;
27-
overflow-y: auto;
28-
width: 25.2em;
43+
/* This div holds the help icon and BR/HL options. */
44+
display: flex;
45+
flex-flow: row nowrap;
46+
justify-content: space-between;
47+
padding-left: 1px;
2948
}
3049

31-
.SearchEnergiesButtonDiv
50+
.IsotopeSearchMinimums label
3251
{
33-
position:absolute;
34-
bottom: 0;
35-
right: 0;
36-
left: 0;
37-
width: 25em;
38-
padding-bottom: 5px;
52+
/* The labels for "Min. BR" and "Min. HL" */
53+
margin-right: 4px;
54+
text-align:center;
55+
vertical-align:middle;
3956
}
4057

41-
.SearchEnergy
58+
.IsotopeSearchMinimums input
4259
{
43-
border: 1px solid #e1e1e1;
44-
margin: 2px;
45-
margin-top: 0px;
46-
margin-bottom: 5px;
47-
padding-top: 4px;
48-
padding-bottom: 4px;
60+
font-size: 0.95em;
61+
width: 55px;
4962
}
5063

64+
.IsotopeSearchMinimums > .ContentHelpBtn
65+
{
66+
margin-top: auto; /* Push to bottom of row */
67+
}
5168

52-
/* Displayed while a search is in progress */
53-
.SearchingEnergiesTxt
69+
70+
.IsotopeSearchInProgress
5471
{
72+
/* Displayed only while a search is in progress */
5573
background: red;
5674
color: white;
75+
76+
padding-right: 5px;
77+
padding-left: 5px;
78+
79+
position: absolute;
80+
right: 50%;
81+
top: 40%;
82+
height: 30px;
83+
line-height: 30px;
84+
padding-left: 8px;
85+
padding-right: 8px;
86+
text-align: center;
5787
vertical-align: middle;
5888
}
5989

60-
.MinBrLabel
61-
{
62-
margin-left: 0.5em;
63-
margin-right: 0.1em;
64-
}
6590

6691
.IsotopeSearchResultTable
6792
{
93+
flex: 1 1 auto;
94+
6895
border: 2px solid #e1e1e1;
6996
margin-left: 5px;
7097
}
7198

7299

73100
.ActiveSearchEnergy
74101
{
75-
background: blue; /*for IEs sake*/
76102
background: rgba(36, 169, 211, 0.25);
77103
}
78104

@@ -82,13 +108,11 @@
82108
opacity: 0.6;
83109
cursor:pointer;
84110
background-repeat: no-repeat;
85-
width: 16px; /* width of the image plus a little extra padding */
86111
height: 21px;
87112
}
88113

89114
.AddSearchEnergy
90115
{
91-
margin-left: -4px;
92116
background-image: url('../InterSpec_resources/images/plus_min_black.svg');
93117
}
94118

@@ -109,19 +133,48 @@ div.AddSearchEnergy.Wt-disabled, div.DeleteSearchEnergy.Wt-disabled
109133
}
110134

111135

136+
.SearchEnergy
137+
{
138+
border: 1px solid #e1e1e1;
139+
margin: 2px;
140+
margin-top: 0px;
141+
margin-bottom: 5px;
142+
padding-top: 4px;
143+
padding-bottom: 4px;
144+
145+
display: flex;
146+
flex-flow: row nowrap;
147+
}
148+
112149
.SearchEnergyLabel
113150
{
114151
padding-left: 5px;
115152
padding-right: 5px;
153+
align-self: center;
116154
}
117155

118156
.SearchEnergyWindowLabel
119157
{
120158
padding-left: 5px;
121159
padding-right: 5px;
160+
align-self: center;
122161
}
123162

124163
.KeVLabel
125164
{
126165
padding-left: 5px;
166+
align-self: center;
167+
}
168+
169+
.SearchEnergy input
170+
{
171+
/* This is the search energy and window inputs */
172+
flex: 1 1 auto;
173+
min-width: 0;
174+
max-width: 125px;
175+
}
176+
177+
.SearchEnergySpacer
178+
{
179+
flex: 1 10 auto;
127180
}

0 commit comments

Comments
 (0)