20 #include "MainWindow.h" 21 #include "ChartWindow.h" 22 #include "TextBoxNumber.h" 23 #include "DefaultDecorators.h" 28 VoltmeterSensor *_voltmeter;
40 void Initialize(VoltmeterSensor *voltmeter,
int buf_size,
float minV,
float maxV)
43 int wnd_width=
Width();
53 Label *labelTimeSTep=
new Label(x,y+10,width,height,F(
"Tstep mus:"));
54 initTextBox(labelTimeSTep,
true);
57 _txtTimeStep->
SetNumber(voltmeter->TimeStep());
58 initTextBox(_txtTimeStep,
false);
60 Label *labelBufsize=
new Label(x,y+10,width,height,F(
"Buf. size:"));
61 initTextBox(labelBufsize,
true);
64 initTextBox(_txtBufSize,
false);
67 y=_txtBufSize->
Top()+_txtBufSize->
Height()+1;
68 int cy=wnd_height-y-height*1.2;
72 _chartWnd=
new ChartWindow(NULL,_chartYAxis,x,y,wnd_width-2,cy);
80 Label *labelMinV=
new Label(x,y+10,width,height,F(
"Vmin/max:"));
89 initTextBox(labelMinV,
true);
90 initTextBox(_txtMinV,
false);
91 initTextBox(_txtMaxV,
false);
93 void initTextBox(
TextBox *textBox,
bool isLabel)
111 if(textBox == _txtMinV || textBox == _txtMaxV)
113 _chartYAxis->
SetMinMax(_txtMinV->GetNumber(),_txtMaxV->GetNumber());
116 else if(textBox == _txtTimeStep)
118 _voltmeter->SetTimeStep(_txtTimeStep->GetNumber());
120 else if(textBox == _txtBufSize)
122 _voltmeter->Buffer()->SetSize(_txtBufSize->GetNumber());
123 _txtBufSize->
SetNumber(_voltmeter->Buffer()->Size());
Base class for all window objects. Provides basic window functionality.
Definition: Window.h:34
Osciloscope main window.
Definition: Oscilloscope.h:26
void SetFont(uint8_t *font)
Sets font.
Definition: TextBox.h:64
Base class for window with text content.
Definition: TextBox.h:30
Interface that provides content change notifications (like text is changed in text box) from child wi...
Definition: IContentChangedEventReceiver.h:24
static Environment * Get()
Returns singltone instance of environment.
Definition: Environment.h:44
Vertcal axis with the labels left to the axis.
Definition: DecoratorPrimitives.h:152
Text box for numbers.
Definition: TextBoxNumber.h:24
void SetOffset(int offsetX, int offsetY)
Sets decorator offset in the parent window coordinate system.
Definition: DecoratorPrimitives.h:188
Axis decorator primitive. It is shared between gauge and chart objects. Overriden members description...
Definition: DecoratorPrimitives.h:145
Chart window implement XY plots.
Definition: ChartWindow.h:30
int Height()
Returns window height.
Definition: Window.h:189
void Invalidate()
If function is called than the window manager updates the window.
Definition: Window.h:157
Decorator primitive for 3D rectangle. Overriden members description see Decorator class documentation...
Definition: DecoratorPrimitives.h:130
Decorator primitive that sets current color. Overriden members description see Decorator class docume...
Definition: DecoratorPrimitives.h:24
void AddChild(Window *window)
Adds window child window.
Definition: Window.h:194
void RegisterContentChangedReceiver(IContentChangedEventReceiver *event)
Application need to call this function if it wants receive notification about this window content cha...
Definition: TextBox.h:53
void SetNumber(float number)
Initialize window with number.
Definition: TextBoxNumber.h:74
void AddDecorator(Decorator *decorator)
Adds decorator to the decaorator list.
Definition: Window.h:86
MainWindow(int width, int height)
Constructor.
Definition: MainWindow.h:52
int Top()
Returns window top coordinate relative to the parent window.
Definition: Window.h:179
void SetMinMax(float minVal, float maxVal)
Sets min and max for label values.
Definition: DecoratorPrimitives.h:200
virtual void SetDecorators(DecoratorList *decorators)
Sets window decorators list.
Definition: Window.h:76
void NotifyContentChanged(Window *textBox)
Has to be implemented in target class.
Definition: Oscilloscope.h:109
Base class for main application window. Each application has to have one main window, which is root parent for all other application windows.
Definition: MainWindow.h:38
DecoratorList * FindDecorators(const __FlashStringHelper *id)
Finds registered decorators by the name.
Definition: Environment.h:59
int Width()
Returns window width.
Definition: Window.h:184
Implement Label control.
Definition: Label.h:24
void SetMargins(int offset_x, int offset_y)
Defines offset from left and top for text.
Definition: TextBox.h:58