forked from d-j-hirst/aus-polling-analyser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditModelFrame.h
More file actions
72 lines (54 loc) · 1.84 KB
/
EditModelFrame.h
File metadata and controls
72 lines (54 loc) · 1.84 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
#pragma once
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "StanModel.h"
class DateInput;
class FloatInput;
class IntInput;
class TextInput;
// *** EditModelFrame ***
// Frame that allows the user to edit an already-existing model
// or create a new one if isNewModel is set to true.
class EditModelFrame : public wxDialog
{
public:
enum class Function {
New,
Edit
};
typedef std::function<void(StanModel)> OkCallback;
// function: whether this is for a new model or editing an existing model
// callback: function to be called when the OK button is pressed
EditModelFrame(Function function, OkCallback callback, StanModel model = StanModel(""));
private:
void createControls(int& y);
// Each of these takes a value for the current y-position
void createNameInput(int& y);
void createTermCodeInput(int& y);
void createPartyCodesInput(int& y);
void createPreferenceInputs(int& y);
void createOkCancelButtons(int& y);
void setFinalWindowHeight(int y);
// Calls upon the window to send its data to the parent frame and close.
void OnOK(wxCommandEvent& WXUNUSED(event));
// Holds the preliminary settings for the model to be created.
StanModel model;
std::unique_ptr<TextInput> nameInput;
std::unique_ptr<TextInput> termCodeInput;
std::unique_ptr<TextInput> partyCodesInput;
std::unique_ptr<TextInput> preferenceFlowInput;
std::unique_ptr<TextInput> preferenceDeviationInput;
std::unique_ptr<TextInput> preferenceSamplesInput;
wxButton* okButton;
wxButton* cancelButton;
// function to call back to once the user clicks OK.
OkCallback callback;
};