00001 // **************************************************************************** 00002 // copyright (c) 2000-2005 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 00012 #ifndef HK_KDEform_H 00013 #define HK_KDEform_H 00014 #include <hk_form.h> 00015 #include <qvariant.h> 00016 #include <qwidget.h> 00017 #include <hk_presentation.h> 00018 //#include <fstream.h> 00019 #include <hk_class.h> 00020 #include <kparts/dockmainwindow.h> 00021 #include <kparts/partmanager.h> 00022 00023 #include "hk_kdeformpartwidget.h" 00024 00025 class QVBoxLayout; 00026 class QHBoxLayout; 00027 class QGridLayout; 00028 class QLabel; 00029 class QScrollView; 00030 class hk_kdesimpleform; 00031 class QToolButton; 00032 class QButtonGroup; 00033 class hk_kderowselector; 00034 class hk_kdetoolbar; 00035 class hk_kdeproperty; 00036 class hk_kdegridpart; 00037 00049 class hk_kdeform : public KParts::DockMainWindow,public hk_class 00050 { 00051 Q_OBJECT 00052 friend class hk_kdesimpleform; 00053 public: 00054 hk_kdeform( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 00055 virtual ~hk_kdeform(); 00056 00057 hk_presentation::enum_mode mode(void); 00061 void set_mode(hk_presentation::enum_mode s); 00062 void set_viewmode(void); 00063 void set_designmode(void); 00067 hk_dsgrid* new_grid(void); 00071 hk_dslineedit* new_lineedit(void); 00075 hk_dsboolean* new_bool(void); 00079 hk_button* new_button(void); 00083 hk_dsrowselector* new_rowselector(void); 00087 hk_dsmemo* new_memo(void); 00088 00089 hk_subform* new_subform(void); 00093 void set_formsize(unsigned int width, unsigned int height); 00097 void set_database(hk_database* db); 00098 hk_database* database(void); 00099 list<hk_datasource*>* datasources(void); 00100 long new_datasource(const hk_string& name,datasourcetype dt=dt_table); 00101 hk_datasource* get_datasource(long nr); 00105 hk_kdesimpleform* simpleform(void); 00109 bool set_presentationdatasource(long n,bool r=true); 00110 long presentationdatasource(void); 00111 void loaddata(const hk_string& definition); 00112 void savedata(ofstream& s); 00113 void load_form(const hk_string& n); 00119 void set_autoclose(bool c); 00123 void set_nodesignmode(bool n); 00124 void save_form_when_changed(void); 00125 00126 hk_kdeproperty* propertyeditor(void); 00127 signals: 00128 void signal_closed(QWidget*); 00129 00130 00131 00132 protected: 00133 virtual void closeEvent ( QCloseEvent* e); 00134 virtual void mousePressEvent(QMouseEvent*); 00135 KAction * p_closeaction; 00136 protected slots: 00137 void part_removed(void); 00138 void grid_partinfocus(hk_kdegridpart*); 00139 void grid_partoutfocus(hk_kdegridpart*); 00140 void close_form(void); 00141 private: 00142 void set_caption(void); 00143 KParts::ReadWritePart* p_part; 00144 KParts::PartManager* p_partmanager; 00145 hk_kdeformpartwidget* p_form; 00146 }; 00147 #endif