dialog.cpp

Go to the documentation of this file.
00001 /*
00002   libwt - Vassilis Virvilis Toolkit - a widget library
00003   Copyright (C) 2006 Vassilis Virvilis <vasvir2@fastmail.fm>
00004  
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014   
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the
00017   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018   Boston, MA  02111-1307, SA.
00019 */
00020 
00021 #include <wt/dialog.h>
00022 #include <wt/application.h>
00023 
00024 namespace Wt {
00025 
00026 Dialog::Dialog(Widget *parent, const std::string &name, int wflags)
00027         : Window(parent, name, wflags),
00028         result_(Rejected),
00029 running_(false) {
00030     hide();
00031 }
00032 
00033 int Dialog::result() const {
00034     return result_;
00035 }
00036 
00037 int Dialog::exec() {
00038     raise();
00039     show();
00040     running_ = true;
00041     trace("dialog", "start dialog\n");
00042     Application::instance()->processEvents(running_);
00043     trace("dialog", "returned with %d\n", result_);
00044     close();
00045     return result_;
00046 }
00047 
00048 void Dialog::setResult(int result) {
00049     result_ = result;
00050 }
00051 
00052 void Dialog::done(int result) {
00053     setResult(result);
00054     running_ = false;
00055 }
00056 
00057 void Dialog::accept() {
00058     done(Accepted);
00059 }
00060 
00061 void Dialog::reject() {
00062     done(Rejected);
00063 }
00064 
00065 }
00066 

Generated Fri Jul 28 19:23:00 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.