initial kgraphinterface, by Yannick Schpilka
[kgraphinterface.git] / src / nodecontent.h~
blobd1723fd000c5eb5df8faaccb7952dc6601888e5e
1 /***************************************************************************
2  *   Copyright (C) 2007 by Schpilka Yannick   *
3  *   schpilka@gmail.com   *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  *                                                                         *
20  *   In addition, as a special exception, the copyright holders give       *
21  *   permission to link the code of this program with any edition of       *
22  *   the Qt library by Trolltech AS, Norway (or with modified versions     *
23  *   of Qt that use the same license as Qt), and distribute linked         *
24  *   combinations including the two.  You must obey the GNU General        *
25  *   Public License in all respects for all of the code used other than    *
26  *   Qt.  If you modify this file, you may extend this exception to        *
27  *   your version of the file, but you are not obligated to do so.  If     *
28  *   you do not wish to do so, delete this exception statement from        *
29  *   your version.                                                         *
30  ***************************************************************************/
31 #ifndef NODECONTENT_H
32 #define NODECONTENT_H
34 #include <qobject.h>
35 #include <qstring.h>
36 #include <qwidget.h>
37 #include "contentwindow.h"
38 #include "node.h"
40 /**
41         @author Schpilka Yannick <schpilka@gmail.com>
43         Representation abstraite du contenu d'un noeud
47 class NodeContent : public QObject{
48         Q_OBJECT
49         public:
50                 
51                 /** default constructor*/
52                 NodeContent(Node *n,int typ,int nbr, bool directload = true);
54                 ~NodeContent() {};
56                 enum ContentType {      Text = 1, 
57                                         Html = 2, 
58                                         Pdf  = 3,
59                                         Ps   = 4,
60                                         Image = 5,
61                                         Hexa = 6,
62                                         Graph = 7
63                                  };
65                 void    setUrl (QString url);
67                 void    load ();
69                 void    open(QString url);
71                 /** sauvegarde du contenu */
72                 bool    save();
74                 /** representation au format xml */
75                 QString toXml();
77                 /** get ptr sur le widget */
78                 QWidget*        getWidget() { return widget; }
80                 /** get nom de contenu */
81                 QString         getName() { return name; }
82                 
83                 /** get nom de contenu */
84                 QString         getCaption() { return window->caption(); }
86                 /** get type de contenu */
87                 int             getType() { return type; }
89                 int             getNumber()  { return number;  }
91                 QString         getUrl() { return url; }
93                 bool            isNull() { return window == 0; }
95                 /** get string type de contenu */
96                 static QString  getStrType(int t);
97                 static int      typeByName (QString n);
99         public slots:
100                 /** affichage isole du contenu d'un noeud */
101                 void windowClosed();
103                 void unpopWidget();
105                 void popWidget();
107                 void partNotLoad();
109                 void raiseWidget ();
110         
111         signals:
112                 void widgetPopped(QString,int);
113                 void widgetHided(QString,int);
114         protected:
115                 /** le widget contenu */
116                 QWidget *widget;
117                 /** noeud parent */
118                 Node *parent_node;
119                 /** fenetre d'affichage isole */
120                 ContentWindow *window;
122         private:
123                 void initWindow();
125                 /** Nom du contenu */
126                 QString name;
127                 QString url;
128                 /** type de contenu */
129                 int type;       
130                 int number;
132                 bool direct_load;
135 #endif