-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsDialog.cpp
More file actions
71 lines (57 loc) · 2.2 KB
/
SettingsDialog.cpp
File metadata and controls
71 lines (57 loc) · 2.2 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
//
// Created by rostam on 15.05.25.
//
#include "SettingsDialog.h"
#include "Config.h"
SettingsDialog::SettingsDialog(wxWindow* parent)
: wxDialog(parent, wxID_ANY, "Settings", wxDefaultPosition, wxDefaultSize)
{
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
wxArrayString shapeChoices;
shapeChoices.Add("Circle");
shapeChoices.Add("Square");
shapeChoices.Add("Triangle");
shapeChoices.Add("Diamond");
shapeRadioBox = new wxRadioBox(this, wxID_ANY, "Vertex Shape",
wxDefaultPosition, wxDefaultSize,
shapeChoices, 1, wxRA_SPECIFY_COLS);
wxArrayString edgeShapeChoices;
edgeShapeChoices.Add("Line");
edgeShapeChoices.Add("Curve");
edgeShapeChoices.Add("Double Arrow");
edgeShapeChoices.Add("Dashed");
edgeShapeRadioBox = new wxRadioBox(this, wxID_ANY, "Edge Shape",
wxDefaultPosition, wxDefaultSize,
edgeShapeChoices, 1, wxRA_SPECIFY_COLS);
shapeRadioBox->SetSelection(static_cast<int>(Config::LoadVertexShape()));
edgeShapeRadioBox->SetSelection(static_cast<int>(Config::LoadEdgeShape()));
mainSizer->Add(shapeRadioBox, 0, wxALL | wxEXPAND, 5);
mainSizer->Add(edgeShapeRadioBox, 0, wxALL | wxEXPAND, 5);
wxStdDialogButtonSizer* buttonSizer = new wxStdDialogButtonSizer();
buttonSizer->AddButton(new wxButton(this, wxID_OK));
buttonSizer->AddButton(new wxButton(this, wxID_CANCEL));
buttonSizer->Realize();
mainSizer->Add(buttonSizer, 0, wxALL | wxEXPAND, 5);
SetSizer(mainSizer);
mainSizer->Fit(this);
}
VertexShape SettingsDialog::GetSelectedShape() const {
switch (shapeRadioBox->GetSelection()) {
case 0: return VertexShape::Circle;
case 1: return VertexShape::Square;
case 2: return VertexShape::Triangle;
case 3: return VertexShape::Diamond;
default: return VertexShape::Circle;
}
}
EdgeShape SettingsDialog::GetSelectedEdgeShape() const
{
switch (edgeShapeRadioBox->GetSelection())
{
case 0: return EdgeShape::Line;
case 1: return EdgeShape::Curve;
case 2: return EdgeShape::DoubleArrow;
case 3: return EdgeShape::Dashed;
default: return EdgeShape::Line;
}
}