Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

hk_kdedbdesigner.h

00001 // ****************************************************************************
00002 // copyright (c) 2000-2004 Horst Knorr <hk_classes@knoda.org>
00003 // This file is part of the hk_kdeclasses library.
00004 // This file may be distributed and/or modified under the terms of the
00005 // GNU Library Public License version 2 as published by the Free Software
00006 // Foundation and appearing in the file LGPL included in the
00007 // packaging of this file.
00008 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00009 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00010 // ****************************************************************************
00011 #ifndef HK_KDEDBDESIGNER
00012 #define HK_KDEDBDESIGNER
00013 #include <qwidget.h>
00014 #include <qlabel.h>
00015 #include <qlistbox.h>
00016 #include <qframe.h>
00017 #include <kparts/mainwindow.h>
00018 #include <hk_dbvisible.h>
00019 #include <hk_dsdatavisible.h>
00020 
00021 
00022 
00023 class hk_presentation;
00024 class hk_kdedbdesignerprivate;
00025 class hk_kdedatasourceframe;
00026 class QVBoxLayout;
00027 class QGridLayout;
00028 class hk_kdedbrelation;
00029 
00030 
00031 class hk_kdedbdesigner:public QWidget, public hk_dbvisible
00032 {
00033     Q_OBJECT
00034 public:
00035 hk_kdedbdesigner(QWidget* parent=0);
00036 virtual ~hk_kdedbdesigner();
00037 void set_presentation(hk_presentation*);
00038 hk_presentation* presentation(void);
00039 QScrollView* scrollview(void) const;
00040 hk_kdedatasourceframe* get_dsframe(hk_datasource*);
00041 hk_kdedbrelation* get_relation(hk_datasource* master,hk_datasource* slave);
00042 hk_kdedbrelation* get_relation(hk_kdedatasourceframe* master,hk_kdedatasourceframe* slave);
00043 hk_kdedbrelation* add_relation(hk_kdedatasourceframe* master,hk_kdedatasourceframe* slave);
00044 hk_kdedbrelation* add_relation(hk_datasource* master,hk_datasource* slave);
00045 hk_kdedatasourceframe* add_dsframe(hk_datasource*);
00046 
00047 signals:
00048 void signal_definition_has_changed(void);
00049 void signal_field_doubleclicked(int,const hk_string&);
00050 
00051 public slots:
00052 void clear_datasources();
00053 void set_datasources();
00054 void relation_clicked(hk_kdedbrelation*);
00055 void new_focus(hk_kdedatasourceframe*);
00056 void delete_datasource(hk_kdedatasourceframe*);
00057 void delete_relation(hk_kdedbrelation*);
00058 void add_datasource(void);
00059 
00060 void slot_field_doubleclicked(int, const hk_string&);
00061 
00062 private:
00063   void raise_datasources(void);
00064 hk_kdedbdesignerprivate* p_private;
00065 };
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 class kdedatasourcelabel:public QLabel
00074 {
00075 public:
00076 friend class hk_kdedatasourceframe;
00077 kdedatasourcelabel(hk_kdedatasourceframe* w);
00078 protected:
00079 void mousePressEvent(QMouseEvent* event);
00080 void mouseReleaseEvent(QMouseEvent* event);
00081 virtual void mouseMoveEvent(QMouseEvent*);
00082 bool p_drag;
00083 int p_startx;
00084 int p_starty;
00085 int p_offsetx;
00086 int p_offsety;
00087 hk_kdedatasourceframe* p_datasourceframe;
00088 };
00089 
00090 
00091 
00092 class hk_kdefieldlist:public QListBox
00093 {
00094 Q_OBJECT
00095 public:
00096 hk_kdefieldlist(hk_kdedatasourceframe* parent);
00097 void setFocus(void);
00098 void clearFocus(void);
00099 
00100 signals:
00101 void signal_field_doubleclicked(int,const hk_string&);
00102 
00103 protected:
00104 void mouseMoveEvent(QMouseEvent*);
00105 void mouseReleaseEvent(QMouseEvent*);
00106 
00107 virtual void mouseDoubleClickEvent(QMouseEvent*);
00108 void dragEnterEvent(QDragEnterEvent*);
00109 void dropEvent(QDropEvent* );
00110 virtual void contextMenuEvent(QContextMenuEvent*);
00111 
00112 private:
00113 
00114 hk_kdedatasourceframe* p_datasourceframe;
00115 QPoint p_dragstartposition;
00116 };
00117 
00118 
00119 
00120 
00121 
00122 
00123 class hk_kdedatasourceframe :public QFrame, public hk_dsdatavisible
00124 {
00125 Q_OBJECT
00126 public:
00127 friend class hk_kdedbdesigner;
00128 hk_kdedatasourceframe(hk_kdedbdesigner* designer,QWidget* parent,hk_datasource* ds);
00129 void set_fields(void);
00130 void set_focus(hk_kdedatasourceframe*);
00131 void setFocus(void);
00132 void clearFocus(void);
00133 void mousePressEvent(QMouseEvent*);
00134 hk_kdedbdesigner* designer() const;
00135 kdedatasourcelabel* header() const {return p_header;}
00136 
00137 public slots:
00138 void edit(void);
00139 void set_header(void);
00140 signals:
00141 void signal_moved(void);
00142 
00143 protected:
00144 virtual void moveEvent(QMoveEvent*);
00145 virtual void resizeEvent(QResizeEvent*);
00146 bool eventFilter(QObject* object,QEvent* event);
00147 
00148 private:
00149 void set_new_position(void);
00150 hk_kdedbdesigner* p_designer;
00151 QListBox*       p_listbox;
00152 QGridLayout*    p_layout;
00153 kdedatasourcelabel* p_header;
00154 bool p_positionupdate;
00155 
00156 };  //end hk_kdedatasourceframe
00157 
00158 
00159 class hk_kdedbrelation:public QWidget,public hk_class
00160 {
00161 Q_OBJECT
00162 public:
00163 hk_kdedbrelation(QWidget* parent);
00164 ~hk_kdedbrelation();
00165 void setAutoMask(bool);
00166 void set_datasources(hk_kdedatasourceframe* master,hk_kdedatasourceframe* slave);
00167 hk_kdedatasourceframe* masterdatasource(void) const;
00168 hk_kdedatasourceframe* slavedatasource(void) const;
00169 void setFocus(void);
00170 void set_focus(void);
00171 signals:
00172 void signal_relation_clicked(hk_kdedbrelation*);
00173 
00174 public slots:
00175 void slot_relation_clicked(hk_kdedbrelation*);
00176 void edit(void);
00177 
00178 
00179 protected:
00180 void paint_relation(QPainter*);
00181 void paintEvent(QPaintEvent*);
00182 void keyPressEvent(QKeyEvent*);
00183 void updateMask(void);
00184 QString tooltipfields(void);
00185 virtual void mouseMoveEvent(QMouseEvent*);
00186 virtual void mousePressEvent(QMouseEvent*);
00187 virtual void mouseDoubleClickEvent(QMouseEvent*);
00188 virtual void contextMenuEvent(QContextMenuEvent*);
00189 
00190 protected slots:
00191 
00192 void datasource_moved(void);
00193 private:
00194 
00195 hk_kdedatasourceframe* p_masterdatasource;
00196 hk_kdedatasourceframe* p_slavedatasource;
00197 int p_fromx,p_fromy,p_tox,p_toy;
00198 bool p_is_focused;
00199 };
00200 
00201 
00202 class hk_kdemovewidget: public QWidget
00203 {
00204 Q_OBJECT
00205 public:
00206 enum enum_orientation {horizontal,vertical,diagonal};
00207 hk_kdemovewidget( enum_orientation orientation, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00208 ~hk_kdemovewidget();
00209 enum_orientation orientation(void) const {return p_orientation;}
00210 protected:
00211 void mousePressEvent(QMouseEvent* event);
00212 virtual void mouseMoveEvent(QMouseEvent*);
00213 
00214 private:
00215 bool p_drag;
00216 int p_startx;
00217 int p_starty;
00218 int p_offsetx;
00219 int p_offsety;
00220 enum_orientation p_orientation;
00221 
00222 };
00223 
00224 
00225 
00226 class hk_kdedbdesignerwindowprivate;
00227 
00228 class hk_kdedbdesignerwindow: public KParts::MainWindow
00229 {
00230 Q_OBJECT
00231 public:
00232 hk_kdedbdesignerwindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00233 ~hk_kdedbdesignerwindow();
00234 hk_kdedbdesigner* designer(void) const;
00235 
00236 signals:
00237 void signal_closed(void);
00238 
00239 protected:
00240 void closeEvent(QCloseEvent*);
00241 
00242 
00243 private:
00244 
00245 hk_kdedbdesignerwindowprivate* p_private;
00246 
00247 };
00248 
00249 #endif //HK_KDEDBDESIGNER

Generated on Tue Mar 22 23:28:15 2005 for Databasehandlingdialogclasses by  doxygen 1.4.1