Exemplo n.º 1
0
///
//  Constructor
//
ProjectChooser::ProjectChooser(WContainerWidget *parent) :
    WContainerWidget(parent)
{
    setStyleClass("maindiv");

    WGroupBox *mainBox = new WGroupBox("Select Existing Project");
    mainBox->setStyleClass("groupdiv");

    mProjectSelectionBox = new WSelectionBox();
    mProjectSelectionBox->setSelectionMode(SingleSelection);

    WPushButton *loadButton = new WPushButton("Load");
    mDeleteButton = new WPushButton("Delete");
    WGridLayout *buttonLayout = new WGridLayout();
    buttonLayout->addWidget(loadButton, 0, 0, AlignCenter | AlignMiddle);
    buttonLayout->addWidget(mDeleteButton, 0, 1, AlignCenter | AlignMiddle);

    WGridLayout *boxLayout = new WGridLayout();
    boxLayout->addWidget(new WText("Projects:"), 0, 0);
    boxLayout->addWidget(mProjectSelectionBox, 1, 0);
    boxLayout->addLayout(buttonLayout, 2, 0, AlignCenter);
    boxLayout->setRowStretch(0, -1);
    boxLayout->setRowStretch(1, 1);
    boxLayout->setRowStretch(2, -1);
    mainBox->setLayout(boxLayout);

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(mainBox, 0, 0);
    setLayout(layout);

    loadButton->clicked().connect(SLOT(this, ProjectChooser::loadClicked));
    mProjectSelectionBox->doubleClicked().connect(SLOT(this, ProjectChooser::loadClicked));
    mDeleteButton->clicked().connect(SLOT(this, ProjectChooser::deleteClicked));
    mProjectSelectionBox->clicked().connect(SLOT(this, ProjectChooser::selectionChanged));

    // Message Box
    mMessageBox = new WMessageBox();
    mMessageBox->buttonClicked().connect(SLOT(this, ProjectChooser::handleMessageBoxFinished));


    resetAll();
}