-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtractionWindow.h
More file actions
91 lines (76 loc) · 2.19 KB
/
Copy pathExtractionWindow.h
File metadata and controls
91 lines (76 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
/* ExtractionWindow.h – Coffee Toolkit
*
* Extraction yield calculator with TDS/Brix input,
* percolation/immersion toggle, a colour-coded gauge,
* and contextual brew tips.
*/
#include <Window.h>
#include <Button.h>
#include <GroupView.h>
#include <RadioButton.h>
#include <ScrollView.h>
#include <StringView.h>
#include <TextControl.h>
#include <TextView.h>
#include <View.h>
// -------------------------------------------------------
// ExtractionBarView
//
// Horizontal bar spanning 0–35%.
// under-extracted (< ideal_lo) → blue
// ideal zone → green
// over-extracted (> ideal_hi) → red
// A triangle pointer marks the current value.
// -------------------------------------------------------
class ExtractionBarView : public BView {
public:
ExtractionBarView(BRect frame);
void Draw(BRect updateRect) override;
// Pass extraction = -1 to show an empty bar.
void SetExtraction(float extraction, float idealLo, float idealHi);
private:
float fExtraction;
float fIdealLo;
float fIdealHi;
static const float kBarMax;
};
// -------------------------------------------------------
// ExtractionWindow
// -------------------------------------------------------
class ExtractionWindow : public BWindow {
public:
ExtractionWindow();
void MessageReceived(BMessage* msg) override;
private:
void Calculate();
void UpdateInputLabels();
void UpdateToggleStatus();
// Input mode radios
BRadioButton* fTdsRadio;
BRadioButton* fBrixRadio;
BStringView* fMeasureLbl;
BTextControl* fMeasureCtl;
// Brew type radios
BRadioButton* fPercRadio;
BRadioButton* fImmsRadio;
// Status label
BStringView* fStatusView;
// Inputs
BStringView* fLiquidLbl;
BTextControl* fLiquidCtl;
BStringView* fDoseLbl;
BTextControl* fDoseCtl;
// Calculate button
BButton* fCalcBtn;
// Results
ExtractionBarView* fBarView;
BTextView* fTipsView;
BScrollView* fTipsScroll;
// Radio group containers (isolate the two radio pairs)
BGroupView* fMeasureGroup;
BGroupView* fBrewGroup;
// State
bool fUseBrix;
bool fIsPercolation;
};