00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <QWidget>
00022 #include <QAction>
00023
00024 #include "qworkspace2.h"
00025 #include "funcaux.h"
00026
00027
00029
00031 QWorkspace2::QWorkspace2(QWidget *) {
00032 _depura("QWorkspace2::QWorkspace2", 0);
00033 _depura("END QWorkspace2::QWorkspace2", 0);
00034 }
00035
00036
00038
00040 QWorkspace2::~QWorkspace2() {
00041 _depura("QWorkspace2::~QWorkspace2", 0);
00042 _depura("END QWorkspace2::~QWorkspace2", 0);
00043 }
00044
00045
00047
00050 void QWorkspace2::addWindow(QWidget * w) {
00051 _depura("QWorkspace2::addWindow", 0);
00052 int tamdispW;
00053 int tamdispH;
00054 int tamventanadecoW;
00055 int tamventanadecoH;
00056 int tamventanaW;
00057 int tamventanaH;
00058 int margen = 10;
00059
00060 QWorkspace::addWindow(w);
00061
00065
00067 tamdispW = this->width() - (margen * 2);
00068 tamdispH = this->height() - (margen * 2);
00069
00071 tamventanadecoW = w->parentWidget()->frameGeometry().width();
00072 tamventanadecoH = w->parentWidget()->frameGeometry().height();
00074 tamventanaW = w->geometry().width();
00075 tamventanaH = w->geometry().height();
00076
00078 if (tamventanadecoW > tamdispW)
00079 tamventanaW = tamdispW - (tamventanadecoW - tamventanaW);
00080 if (tamventanadecoH > tamdispH)
00081 tamventanaH = tamdispH - (tamventanadecoH - tamventanaH);
00082
00083 w->setGeometry(0, 0, tamventanaW, tamventanaH);
00084 w->parentWidget()->move(margen, margen);
00085
00087 QAction *accionEsc = new QAction(w);
00088 accionEsc->setShortcut(tr("Esc"));
00089 connect(accionEsc, SIGNAL(triggered()), w, SLOT(close()));
00090 w->addAction(accionEsc);
00091 _depura("END QWorkspace2::addWindow", 0);
00092 }
00093