~BWTable();
void setColumns(BStringList columns);
void setRowCount(int num);
void setText(int row, int col, BString value);
BString getText(int row, int col);
void setEditable(int on);
void addButton(BString name, BString memberFunc);
BList<int> selectedDataRows(); ///< Return list of selected data row indexes
Bool isDataRowSelected(int r); ///< Check if given data row is selected
BWTableView* table();
public slots:
void appendRow();
void deleteRow();
protected:
int oeditable;
BWTableView* owTable;
BHBox* owButtons;
BList<QPushButton*> owButtonList;
};
class BWEditListSelect : public BHBox {
Q_OBJECT
public:
BWEditListSelect(QWidget* parent, BStringList selectionList = BStringList());
~BWEditListSelect();
void setReadOnly(int on);
void setSelection(BStringList selectionList);
void setString(BString str);
BString getString();
private:
BStringList oselectionList;
BList<QCheckBox*> oboxes;
};
class BWEditComboBox : public BHBox {
Q_OBJECT
public:
BWEditComboBox(QWidget* parent, BStringList options = BStringList(), int editable = 0);
~BWEditComboBox();
void setReadOnly(int on);
void clear();
void addItem(BString str);
void setSelection(BStringList selectionList);
void setCurrentIndex(int item);
void setString(BString str);
BString getString();
int getIndex();
signals:
void valueChanged(BString str);
private slots:
void update();
protected:
QComboBox owComboBox;
BArray<BString> ostringList;
};
class BWEditMoney : public BHBox {
Q_OBJECT
public:
BWEditMoney(QWidget* parent, BTimeStamp timeStamp = BTimeStamp());
~BWEditMoney();
void setReadOnly(int on);
void clear();
void setPaletteBackgroundColor (const QColor& colour);
void setMoney(double value, double vat);
void getMoney(double& value, double& vat);
signals:
void valueChanged();
private slots:
void updateValue();
void updateVat();
void updateTotal();
private:
double round(double value);
void setValue(QLineEdit*, double v);
double getValue(QLineEdit* w);
QLineEdit* owValue;
QLineEdit* owVat;
QLineEdit* owTotal;
};
class BWMessageBox : public QMessageBox {
Q_OBJECT
public:
static int warning(QWidget* parent, const QString& caption, const QString& text, const QString& button0Text = QString(), const QString& button1Text = QString(), const QString& button2Text = QString(), int defaultButtonNumber = 0, int escapeButtonNumber = -1);
};
class BField {
public:
BField(int pos = 0, int size = 0, BString post = "", int min = 0, int max = 0, int value = 0) : opos(pos), osize(size), opost(post), omin(min), omax(max), ovalue(value) {};
int opos;
int osize;
BString opost;
int omin;
int omax;
int ovalue;
};
class BFieldEdit : public QLineEdit {
Q_OBJECT
public:
BFieldEdit(QWidget* parent);
void setSize();
virtual int validate(int v = 1);
virtual void setBlank(Bool on);
signals:
void changed();
protected:
void keyPressEvent(QKeyEvent* event);
void focusInEvent(QFocusEvent* event);
void focusOutEvent(QFocusEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
void contextMenuEvent(QContextMenuEvent* event);
void updatePos();
void updateFromText();
void updateFromFields();
unsigned int ofield;
BArray<BField> ofields;
Bool oblank;
};
class BWEditDate : public BFieldEdit {
Q_OBJECT
public:
enum Format { ISO, UK, ISO_BLANK, UK_BLANK };
BWEditDate(QWidget* parent, Format format = ISO);
void setReadOnly(int on);
void clear();
void setDate(BDate date);
BDate getDate();
protected:
void keyPressEvent(QKeyEvent* event);
private:
void clearWhenNotSet();
int validate(int v = 1);
Format oformat;
BDate odate;
static BDate gdate;
};
class BWEditTimeStamp : public BFieldEdit {
Q_OBJECT
public:
enum Format { DATE_TIME_MICROSEC, DATE_TIME, DATE_TIME_MICROSEC_BLANK, DATE_TIME_BLANK};
BWEditTimeStamp(QWidget* parent, Format format = DATE_TIME_MICROSEC);
void setReadOnly(int on);
void setTimeStamp(BTimeStamp timeStamp);
BTimeStamp getTimeStamp();
protected:
void keyPressEvent(QKeyEvent* event);
private:
void clearWhenNotSet();
int validate(int v = 1);
Format oformat;
BTimeStamp otimeStamp;
static BTimeStamp gtimeStamp;
};
#endif