F:/KPlato/koffice/kplato/kptresourceview.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002   Copyright (C) 2003 - 2006 Dag Andersen <kplato@kde.org>
00003 
00004   This library is free software; you can redistribute it and/or
00005   modify it under the terms of the GNU Library General Public
00006   License as published by the Free Software Foundation; either
00007   version 2 of the License, or (at your option) any later version.
00008 
00009   This library is distributed in the hope that it will be useful,
00010   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012   Library General Public License for more details.
00013 
00014   You should have received a copy of the GNU Library General Public License
00015   along with this library; see the file COPYING.LIB.  If not, write to
00016   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017 * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KPTRESOURCEVIEW_H
00021 #define KPTRESOURCEVIEW_H
00022 
00023 #include <kptview.h>
00024 #include <QTreeWidget>
00025 
00026 #include "kptcontext.h"
00027 
00028 class QPoint;
00029 class QTreeWidgetItem;
00030 class QSplitter;
00031 
00032 class KToggleAction;
00033 class KPrinter;
00034 
00035 namespace KPlato
00036 {
00037 class ResListView;
00038 
00039 class View;
00040 class Project;
00041 class Resource;
00042 class Node;
00043 
00044 class ResourceAppointmentsView;
00045 class ResourceGroup;
00046 class Resource;
00047 class ResourceItemPrivate;
00048 
00049 class ResListView : public QTreeWidget
00050 {
00051     Q_OBJECT
00052 public:
00053     ResListView( QWidget * parent = 0 );
00054 
00055     int headerHeight() const;
00056     virtual void paintToPrinter( QPainter *p, int x, int y, int w, int h );
00057     int calculateY( int ymin, int ymax ) const;
00058     class DrawableItem
00059     {
00060     public:
00061         DrawableItem( int level, int ypos, QTreeWidgetItem *item ) { y = ypos; l = level; i = item; };
00062         int y;
00063         int l;
00064         QTreeWidgetItem * i;
00065     };
00066 signals:
00067     void contextMenuRequested( QTreeWidgetItem*, const QPoint&, int );
00068 protected:
00069     int buildDrawables( QList<ResListView::DrawableItem*> &lst, int level, int ypos, QTreeWidgetItem *item, int ymin, int ymax ) const;
00070     // This is a copy of QListView::drawContentsOffset(), with a few changes
00071     // because drawContentsOffset() only draws *visible* items,
00072     // we want to draw *all* items.
00073     // FIXME: Haven't got paintBranches() to work, atm live without it.
00074     virtual void drawAllContents( QPainter * p, int cx, int cy, int cw, int ch );
00075 private slots:
00076     void slotContextMenuRequested( const QPoint &p );
00077 };
00078 
00079 
00080 class ResourceView : public ViewBase
00081 {
00082     Q_OBJECT
00083 
00084 public:
00085     ResourceView( View *view, QWidget *parent );
00086 
00087     //~ResourceView();
00088 
00089     void zoom( double zoom );
00090 
00091     void draw( Project &project );
00092 
00093     Resource *currentResource();
00094 
00095     QList<int> listOffsets( int pageHeight ) const;
00096     void print( KPrinter &printer );
00097 
00098     Node *currentNode() const { return m_currentNode; }
00099 
00100     virtual bool setContext( Context::Resourceview &context );
00101     virtual void getContext( Context::Resourceview &context ) const;
00102 
00103     virtual QSize sizeHint() const;
00104 
00105 public slots:
00106     void setShowAppointments( bool on ) { m_showAppointments = on; }
00107 
00108 signals:
00109     void itemDoubleClicked();
00110 
00111 protected slots:
00112     void resSelectionChanged();
00113     void resSelectionChanged( QTreeWidgetItem *item );
00114     void slotItemActivated( QTreeWidgetItem* );
00115     void popupMenuRequested( QTreeWidgetItem * item, const QPoint & pos, int );
00116 
00117 private:
00118     void drawResources( const Project &proj, QTreeWidgetItem *parent, ResourceGroup *group );
00119     void clearResList();
00120 
00121 private:
00122     int m_defaultFontSize;
00123     QSplitter *m_splitter;
00124 
00125     Project *m_project;
00126     ResourceItemPrivate *m_selectedItem;
00127     ResListView *m_resListView;
00128     QTreeWidgetItem *m_header;
00129     ResourceAppointmentsView *m_appview;
00130     Node *m_currentNode;
00131     QDate m_start;
00132     QDate m_end;
00133 
00134     bool m_showAppointments;
00135 
00136 };
00137 
00138 }  //KPlato namespace
00139 
00140 #endif

Généré le Wed Nov 22 23:40:57 2006 pour KPlato par  doxygen 1.5.1-p1