1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
/***************************************************************************
** xSQLTable.cpp $Revision: 1.12 $ - $Name: V2-18 $
** SQL View frame
**
** Copyright (C) 1996 Joseph Croft <jcroft@unicomp.net>
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Library General Public License for more details.
**
** You should have received a copy of the GNU Library General Public
** License along with this library; if not, write to the Free
** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
***************************************************************************/
#ifndef _XSQLTABLE_H
#define _XSQLTABLE_H
#include <qaccel.h>
#include <qdict.h>
#include <qlabel.h>
#include <qscrbar.h>
#include <qstring.h>
#include "xFrame.h"
#include "xResources.h"
#include "xSQLField.h"
#include "xTable.h"
class xSQLTable : public xFrame, public xSQLBase
{
Q_OBJECT
public:
xSQLTable(xWidgetResInfo *pPRes, QWidget *pParent, const char *pName,
int db, xSQLFieldDef *pFields, const char *pTitleStr = NULL,
int rows = 10);
~xSQLTable();
virtual bool query(int db, QList<QString> sort);
virtual bool query(int db, QString index, QList<QString> sort);
virtual bool query(int db, long index, QList<QString> sort);
virtual bool query(int db, QDict<QString> &match, QDict<QString> &links,
QList<QString> sort);
virtual bool query(int db, QDict<QString> &match, QDict<QString> &links,
QDict<QString> &skip, QList<QString> sort);
virtual bool validate(QString &err);
virtual bool validate(const char *pFieldName);
virtual bool validate(const char *pFieldName, const char *pData);
virtual xSQLField *getWidget(const char *pFieldName);
virtual QString getField(const char *pFieldName, bool editFirst = TRUE);
virtual QDict<QString> getEditFields(bool blankFields = FALSE);
virtual void clearEditFields();
virtual void clearEditFields(int row);
virtual void clearEntryFields();
QDict<QString> getRow();
long insertBlank(int db, int row);
void setFrameStyles(int enabled, int disabled);
void showRows();
void showRows(int row);
bool enableRow(int row, bool f);
int selectedRow() { return(selRow); };
void setSelectedRow(int row) { selRow = row; showRows(); };
int topRowOfTable() { return(curRow); };
void setTopRowOfTable(int row) { curRow = row; };
int tableHeight() { return(pFieldTable->rows()); };
void setEnableMargin(int n) { enableMargin = n; };
signals:
void rowClicked(int row);
void rowDoubleClicked(int row);
void entryComplete(int row);
void invalidEntry(xSQLField*);
void abortEntry(int row);
public slots:
virtual void abandonEntry(xSQLField*);
virtual void haveNewData(xSQLField*);
virtual void haveInvalidEntry(xSQLField*);
virtual void haveMousePressed(xMouseEvent*);
virtual void haveMouseDoubleClicked(xMouseEvent*);
virtual void highlightTopRow();
virtual void highlightRow(int idx);
virtual void highlightNext();
virtual void highlightPrev();
virtual void scroll(int idx);
virtual void scrollBack();
virtual void scrollFwd();
virtual void scrollPageBack();
virtual void scrollPageFwd();
private:
void setSB();
xTable *pLabelTable;
xTable *pFieldTable;
xFrame *pFrame;
xFrame *pFieldFrame;
QScrollBar *pSB;
QLabel *pTitle;
QAccel *pAccel;
int curRow;
int selRow;
int enbRow;
int insRow;
bool insMode;
bool connected;
int enableMargin;
xWidgetResInfo *wdtRes;
};
#endif
|