umbrello API Documentation

assocpropdlg.cpp

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2002-2007                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 // own header
00013 #include "assocpropdlg.h"
00014 
00015 // qt/kde includes
00016 #include <qlayout.h>
00017 #include <qlabel.h>
00018 
00019 #include <klocale.h>
00020 #include <kmessagebox.h>
00021 #include <kiconloader.h>
00022 #include <kdebug.h>
00023 
00024 // local includes
00025 #include "assocgenpage.h"
00026 #include "assocrolepage.h"
00027 #include "classpropdlg.h"
00028 #include "classgenpage.h"
00029 #include "umlwidgetcolorpage.h"
00030 
00031 #include "../umlobject.h"
00032 #include "../umldoc.h"
00033 #include "../objectwidget.h"
00034 #include "../uml.h"
00035 #include "../umlview.h"
00036 
00037 
00038 AssocPropDlg::AssocPropDlg (QWidget *parent, AssociationWidget * assocWidget, int pageNum)
00039         : KDialogBase(IconList, i18n("Association Properties"), Ok | Apply | Cancel | Help,
00040                       Ok, parent, "_ASSOCPROPDLG_", true, true)
00041 {
00042     init();
00043     m_pAssoc = assocWidget;
00044 
00045     m_pDoc = ((UMLApp *)parent) -> getDocument(); // needed?
00046 
00047     setupPages(assocWidget);
00048     showPage(pageNum);
00049 }
00050 
00051 AssocPropDlg::~AssocPropDlg() { }
00052 
00053 void AssocPropDlg::init ( )
00054 {
00055     m_pAssoc = 0;
00056     m_pGenPage = 0;
00057     m_pRolePage = 0;
00058 }
00059 
00060 void AssocPropDlg::slotOk() {
00061     slotApply();
00062     KDialogBase::accept();
00063 }
00064 
00065 void AssocPropDlg::slotApply() {
00066 
00067     if (m_pGenPage) {
00068         m_pGenPage->updateObject();
00069     }
00070 
00071     if (m_pRolePage) {
00072         m_pRolePage->updateObject();
00073     }
00074 
00075     if (m_pAssoc) {
00076         m_pAssoc->lwSetFont( m_pChooser->font() );
00077     }
00078 
00079 
00080 }
00081 
00082 // void AssocPropDlg::setupPages (UMLObject * c)
00083 void AssocPropDlg::setupPages (AssociationWidget *assocWidget)
00084 {
00085 
00086     // general page
00087     QFrame *page = addPage( i18n("General"), i18n("General Settings"), DesktopIcon( "misc") );
00088     QHBoxLayout *genLayout = new QHBoxLayout(page);
00089     page -> setMinimumSize(310, 330);
00090     m_pGenPage = new AssocGenPage (m_pDoc, page, assocWidget);
00091     genLayout -> addWidget(m_pGenPage);
00092 
00093     // role page
00094     QFrame * newPage = addPage( i18n("Roles"), i18n("Role Settings"), DesktopIcon( "misc") );
00095     QHBoxLayout * roleLayout = new QHBoxLayout(newPage);
00096     // newPage -> setMinimumSize(310, 330);
00097     m_pRolePage = new AssocRolePage(m_pDoc, newPage, assocWidget);
00098     roleLayout -> addWidget(m_pRolePage);
00099 
00100     setupFontPage();
00101 
00102 }
00103 
00104 void AssocPropDlg::setupFontPage()
00105 {
00106     if( !m_pAssoc)
00107         return;
00108 
00109     QVBox *page = addVBoxPage( i18n("Font"), i18n("Font Settings"), DesktopIcon( "fonts"));
00110     m_pChooser = new KFontChooser( (QWidget*)page, "font", false, QStringList(), false);
00111     m_pChooser->setFont( m_pAssoc->getFont());
00112     m_pChooser->setSampleText(i18n("Association font"));
00113 }
00114 
00115 #include "assocpropdlg.moc"
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:54 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003