Databasehandlingdialogclasses  0.5.3
hk_kdesimplegrid.h
1 // ****************************************************************************
2 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
3 // This file is part of the hk_kdeclasses library.
4 // This file may be distributed and/or modified under the terms of the
5 // GNU Library Public License version 2 as published by the Free Software
6 // Foundation and appearing in the file LGPL included in the
7 // packaging of this file.
8 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 // ****************************************************************************
11 
12 #ifndef HK_KDESIMPLEGRID
13 #define HK_KDESIMPLEGRID
14 #include <hk_dsvisible.h>
15 #include <qheader.h>
16 #include <qtimer.h>
17 #include <qtable.h>
18 #include <qgridview.h>
19 #include <hk_dsboolean.h>
20 
21 #include <hk_kderowselector.h>
22 class hk_kdesimpleform;
23 class hk_kdesimplegrid;
24 class hk_kdegridpart;
25 class hk_kdegrid;
26 class QLabel;
27 class hk_column;
28 class hk_kdelineedit;
47 class hk_kdesimplegrid :public QTable, public hk_dsvisible
48 {
49  Q_OBJECT
50  friend class hk_kdegrid;
51  public:
52  hk_kdesimplegrid(hk_kdegrid* grid, QLabel* statusbar, hk_kdesimpleform* form=NULL);
53  virtual ~hk_kdesimplegrid(void);
54  virtual QTableItem* item(int row,int col) const;
55  virtual void sortColumn ( int col, bool ascending = true, bool wholeRows = false );
56  hk_column* actual_column(void);
57  QString text(int row, int col) const;
58  hk_kdegrid* kdegrid() const;
59 
60  signals:
61  void signal_infocus(hk_kdegridpart*);
62  void signal_outfocus(hk_kdegridpart*,QFocusEvent*);
63  //void signal_verticalheader_mouserelease();
64  public slots:
68  void print_grid(void);
69  void show_gridcolumndialog(void);
70 
71  protected:
72  virtual void focusInEvent ( QFocusEvent * );
73  virtual void focusOutEvent ( QFocusEvent * );
74  virtual void widget_specific_tooltip_changed(void);
75  virtual void adjustRow(int){}
76  bool eventFilter(QObject* object,QEvent* event);
77  void widget_specific_enable_disable(void);
78  void widget_specific_row_added(void);
79  void widget_specific_row_deleted(void);
80  bool widget_specific_row_change(void);
81  void widget_specific_insert_mode(void);
82  void columns_created(void);
83  bool datasource_enable(void);
84  bool datasource_disable(void);
85  void activateNextCell(void);
86  void resizeData(int len);
87  void paintCell(QPainter* p,int row, int col, const QRect& cr,bool selected,const QColorGroup &cg);
88  void paint_textcell(QPainter* p,int row, int col, const QRect& cr,bool selected,const QColorGroup &cg);
89  void paint_boolcell(QPainter* p,int row, int col, const QRect& cr,bool selected,const QColorGroup &cg);
90  void paint_combocell(QPainter* p,int row, int col, const QRect& cr,bool selected,const QColorGroup &cg);
91  void setCellContentFromEditor( int row, int col);
92  QDragObject* dragObject ();
93  void contentsDragEnterEvent(QDragEnterEvent*);
94  void contentsDropEvent(QDropEvent*);
95  QWidget* createEditor(int row, int col,bool initFromCell) const;
96 //void before_row_change(void);
97  void keyPressEvent(QKeyEvent * );
98  bool key_pressevent_navigation(QKeyEvent *);
99 
100  public slots:
101  void copy(void);
102  void paste(void);
103  void cut(void);
104 
105 
106 
107  protected slots:
108  void row_changed(int row,int column);
109  void set_columnwidth(int col,int,int newwidth);
110  void column_moved(int section,int from,int to);
111  void show_contextmenu(int row, int col,const QPoint& pos);
112  void selection_changed(void);
113  void slot_mouse_clicked(void);
114  void slot_mouse_doubleclicked(void);
115  void slot_verticalheader_resized(int,int,int);
116  void slot_verticalheader_mouserelease(void);
117  void widget_specific_rowheight_changes(void);
118  void slot_content_moving(int,int);
119  private:
120  typedef class
121  {
122  public:
123  int start; //starting row or column
124  int end; //final row or column
125  int offset; // needed offset
126  } sectionclass;
127  void print_singlepage(QPainter&,QPaintDeviceMetrics&metrics,sectionclass& vertical,sectionclass& horizontal,int topborder,int bottomborder,int leftborder,int rightborder);
128  void paste_tsv(const QString&);
129  QString marked_text();
130  void set_statustext(void);
131  void nextcell();
132  void previouscell();
133  bool delete_selected_rows(void);
134  void clear_vertical_header(void);
135  void paint_vertical_header(void);
136  QWidget* create_lineeditor(int row, int col)const;
137  void print_frame(QPainter& painter,QPaintDeviceMetrics&metrics,int topborder,int bottomborder,int leftborder,int rightborder);
138  int print_header(QPainter& painter,QPaintDeviceMetrics&metrics,sectionclass& horizontal,int topborder,int bottomborder,int leftborder,int rightborder);
139  hk_kdegrid* p_grid;
140  QLabel* p_statusbar;
141 
142  hk_kdesimplegridprivate* p_hk_kdesimplegridprivate;
143  QPixmap arrow_image;
144  QIconSet no_image;
145  unsigned int p_currentrow,p_currentcolumn;
146  mutable bool p_combobox_created;
147  int pagenumber;
148 };
149 
153 class internalcheckbox :public QFrame, public hk_dsboolean
154 {
155  Q_OBJECT
156  public:
157  internalcheckbox(QWidget* w);
158  ~internalcheckbox();
159  void toggle_value();
160  protected:
161  void paintEvent(QPaintEvent*);
162  void focusInEvent(QFocusEvent * f);
163  bool datasource_enable(void);
164  void keyPressEvent(QKeyEvent* e);
165  void mousePressEvent(QMouseEvent* m);
166 
167  private slots:
168  void blinkcursorslot(void);
169 
170  private:
171  void blinkon();
172  QTimer p_blinktimer;
173  bool p_cursoron;
174  int p_blinkspeed;
175 };
176 #endif
KDE Widget to edit/display data in a field.
Definition: hk_kdelineedit.h:32
void print_grid(void)
Definition: hk_kdesimplegrid.cpp:1361
Definition: hk_kdesimplegrid.h:153
KDE Widget to display forms.
Definition: hk_kdesimpleform.h:41
KDE Widget to display data in a grid.
Definition: hk_kdesimplegrid.h:47
shows data in a grid without columnheaders.
Definition: hk_kdegrid.h:45
Definition: hk_kdesimplegrid.cpp:288