Project

General

Profile

Bug #4726 » AnimationTest.cpp

 
1
/*
2
 * AnimationTest.cpp
3
 *
4
 *    Created on: 11.02.2016
5
 *        Author: Stoycho Stefanov
6
 */
7

    
8

    
9
#include <Wt/WBoxLayout>
10
#include <Wt/WCompositeWidget>
11
#include <Wt/WHBoxLayout>
12
#include <Wt/WVBoxLayout>
13
#include <Wt/WPushButton>
14
#include <Wt/WStackedWidget>
15
#include <Wt/WCssDecorationStyle>
16
#include <Wt/WMenu>
17
#include <Wt/WText>
18
#include <Wt/WAnimation>
19
#include <Wt/WApplication>
20
#include <boost/bind.hpp>
21
using namespace Wt;
22
using namespace std;
23
#include <iostream>
24

    
25
void AppPathChange(const std::string& path ,WStackedWidget *Stack,WContainerWidget *Panel) {
26
    cout << "path "<< path << endl;
27
    if (path == "/panel") {
28
        Stack->setCurrentWidget(Panel);
29
    }
30
}
31

    
32

    
33
Wt::WApplication* WMyApp(const Wt::WEnvironment& env) {
34

    
35
    auto App(new WApplication(env));
36

    
37
    auto w = App->root();
38
    w->decorationStyle().setBackgroundColor(Wt::darkYellow);
39
    auto Layout = new WHBoxLayout();
40
    Layout->setContentsMargins(0,0,0,0);
41
    w->setLayout(Layout);
42

    
43
    auto Stack = new WStackedWidget();
44
    auto Menu = new WMenu(Stack, Vertical);
45
    Menu->setStyleClass("menu");
46
    Menu->setInternalPathEnabled();
47
    Menu->setInternalBasePath("/");
48

    
49
    WAnimation animation(WAnimation::Fade, WAnimation::Ease,500);
50
    Stack->setTransitionAnimation(animation);
51

    
52
    auto Panel(new WContainerWidget());
53

    
54
    auto PanelLayout = new WVBoxLayout();
55
    auto Page= new WContainerWidget();
56
    new WText("PanelContent",Page);
57
    Page->decorationStyle().setBackgroundColor(Wt::darkGreen);
58
    PanelLayout->addWidget(Page,1);
59
    Panel->setLayout(PanelLayout);
60

    
61
    auto Container = new WContainerWidget();
62
    Container->decorationStyle().setBackgroundColor(Wt::darkMagenta);
63
    new WText("Container",Container);
64
    Menu->addItem("Container",Container);
65

    
66
    auto Item = Menu->addItem("Panel",nullptr);
67
    Item->setPathComponent("panel");
68
    Stack->addWidget(Panel);
69
    App->internalPathChanged().connect(boost::bind(&AppPathChange,_1,Stack,Panel));
70

    
71
    Layout->addWidget(Menu,0);
72
    Layout->addWidget(Stack,1);
73
    Layout->setResizable(0, true);
74
    return App;
75
}
76

    
77
int main(int argc, char** argv) {
78
    cout << WT_CLASS << endl;
79
//    imcValueRangeZones Zones;
80
//    cout << MSGAT << "" << endl;
81
//    TestZonesFindingWithGaps();
82
//    TestSerialisation();
83
//    TestZonesSetBoundary();
84
//    cout << MSGAT << "" << endl;
85
//    return 0;
86
    return WRun(argc,argv,&WMyApp);
87
}
(1-1/2)