-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWMainPage.h
101 lines (94 loc) · 2.75 KB
/
WMainPage.h
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
92
93
94
95
96
97
98
99
100
101
#pragma once
#include <Wt/WContainerWidget>
#include <Wt/WStackedWidget>
#include <Wt/WRectArea>
#include <Wt/WImage>
#include <Wt/WTemplate>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WString>
#include <Wt/WText>
#include "MyApplication.h"
#include "WChoisePage.h"
#include "WDocsPage.h"
#include "WSpecsPage.h"
#include "WDateWidget.h"
#include "WTimeChoise.h"
#include "WNewPatientWidget.h"
#include "WCardView.h"
using namespace std;
class WMainPage : public Wt::WContainerWidget
{
public:
WMainPage(WContainerWidget* root){
WTemplate *temp = new WTemplate(tr("main-templ"), root);
//HEADER
WImage* image = new WImage("./header.jpg");
WLink _link (WLink::InternalPath, "/0");
WRectArea* area = new WRectArea(0, 0, 100, 100);
area->setToolTip("Home");
area->setLink(_link);
image->addArea(area);
//HIST
m_hist = new WText();
m_hist->setText("Select option");
//BODY
m_stack = new WStackedWidget();
WSpecsWidget* _specs = new WSpecsWidget();
WChoiseWidget* _choise = new WChoiseWidget();
WDocsWidget* _docs = new WDocsWidget();
WContainerWidget* _wempt = new WContainerWidget();
WDateWidget* _wdate = new WDateWidget();
WTimeWidget* _wtime = new WTimeWidget();
WNewPatientWidget* _newpat = new WNewPatientWidget();
WCardView* _card = new WCardView();
m_stack->addWidget(_choise);
m_stack->addWidget(_specs);
m_stack->addWidget(_card); //CARDS WIDGET
m_stack->addWidget(_docs);
m_stack->addWidget(_wdate);
m_stack->addWidget(_wtime);
m_stack->addWidget(_newpat);
//FOOTER
WContainerWidget* footer = new WContainerWidget();
m_next = new WPushButton("Next", footer);
m_next->clicked().connect(this, &WMainPage::nextClicked);
m_next->disable();
temp->bindWidget("head-ph", image);
temp->bindWidget("hist-ph", m_hist);
temp->bindWidget("page-ph", m_stack);
temp->bindWidget("foot-ph", footer);
}
void makeTransition(unsigned int page_id, map<string, boost::any>& params)
{
if(!m_stack)
return;
if(page_id < m_stack->children().size()){
WPageBase* _widget = static_cast<WPageBase*>(m_stack->children()[page_id]);
if(_widget){
_widget->setPageParams(params);
m_stack->setCurrentIndex(page_id);
updatePage();
}
}
}
void nextClicked(const WMouseEvent& evt){
WPageBase* _widget = static_cast<WPageBase*>(m_stack->currentWidget());
if (_widget && !_widget->getNextBase().empty()){
if(_widget->onleave())
WApplication::instance()->setInternalPath(_widget->getNextLink(), true);
}
}
void updatePage()
{
WPageBase* _widget = static_cast<WPageBase*>(m_stack->currentWidget());
if (_widget && !_widget->getNextBase().empty()){
m_next->enable();
}else
m_next->disable();
}
private:
WStackedWidget* m_stack;
WText* m_hist;
WPushButton* m_next;
};