Project

General

Profile

Bug #1082 ยป hello.C

Pieter Libin, 01/27/2012 10:12 AM

 
/*
* Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
*
* See the LICENSE file for terms of use.
*/

#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WTableView>
#include <Wt/WStandardItemModel>
#include <Wt/WStandardItem>

using namespace Wt;

class HelloApplication : public WApplication
{
public:
HelloApplication(const WEnvironment& env);
};

HelloApplication::HelloApplication(const WEnvironment& env)
: WApplication(env)
{
WStandardItemModel *model = new WStandardItemModel(0, 0, root());
WStandardItem *name = new WStandardItem("1");
name->setFlags(ItemIsSelectable | ItemIsEditable);
model->setItem(0,0, name);
WStandardItem *name2 = new WStandardItem("2");
name2->setFlags(ItemIsSelectable | ItemIsEditable);
model->setItem(0,1, name2);
model->setHeaderData(0, WString("h0"));
model->setHeaderData(1, WString("h1"));
WTableView *table = new WTableView(root());
table->setModel(model);
table->setSelectionMode(Wt::SingleSelection);
table->setEditTriggers(WAbstractItemView::SelectedClicked);
}

WApplication *createApplication(const WEnvironment& env)
{
return new HelloApplication(env);
}

int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}

    (1-1/1)