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
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// gqbGridRestTable.h - Table implementation for Restrictions Panel Grid
//
//////////////////////////////////////////////////////////////////////////
#ifndef GQBGRIDRESTTABLE_H
#define GQBGRIDRESTTABLE_H
#include <wx/grid.h>
#include <wx/laywin.h>
// App headers
#include "gqb/gqbModel.h"
#include "gqb/gqbArrayCollection.h"
class gqbGridRestTable : public wxGridTableBase
{
public:
gqbGridRestTable(gqbRestrictions *_restrictions);
~gqbGridRestTable();
int GetNumberRows();
int GetNumberCols();
bool IsEmptyCell( int row, int col );
wxString GetValue( int row, int col );
wxString GetColLabelValue( int col);
void SetValue( int row, int col, const wxString &value );
void AppendItem(gqbQueryRestriction *item);
void emptyTableData();
bool DeleteRows(size_t pos, size_t numRows);
private:
gqbRestrictions *restrictions;
};
//
// Cell rendering utilities classes
//
class wxGridCellComboBoxRenderer : public wxGridCellStringRenderer
{
public:
wxGridCellComboBoxRenderer(wxLayoutAlignment border = wxLAYOUT_NONE) :
m_border(border) {}
virtual void Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected);
virtual wxGridCellRenderer *Clone() const
{
return new wxGridCellComboBoxRenderer;
}
private:
wxLayoutAlignment m_border;
};
class wxGridCellButtonRenderer : public wxGridCellStringRenderer
{
public:
wxGridCellButtonRenderer(wxLayoutAlignment border = wxLAYOUT_NONE) :
m_border(border) {}
virtual void Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected);
virtual wxGridCellRenderer *Clone() const
{
return new wxGridCellComboBoxRenderer;
}
private:
wxLayoutAlignment m_border;
};
// Shows a wxGridCellChoiceEditor of cell's wide
class dxGridCellSizedChoiceEditor : public wxGridCellChoiceEditor
{
public:
dxGridCellSizedChoiceEditor(const wxArrayString &choices, bool allowOthers = false);
dxGridCellSizedChoiceEditor(size_t count = 0, const wxString choices[] = NULL, bool allowOthers = false);
~dxGridCellSizedChoiceEditor() {}
virtual wxGridCellEditor *Clone() const;
virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL);
protected:
int m_maxWide;
DECLARE_NO_COPY_CLASS(dxGridCellSizedChoiceEditor)
};
// GQB-TODO: don't use gqbObjsArray, use a new one in the model because violating MVC Pattern
// GQB-TODO: this is not needed the one in gqbArrayCollections works her ?????
// WX_DEFINE_ARRAY_PTR(gqbObject *, gqbObjsArray); this is not
// Create the Data Model that will be used by wxGrid Component
#endif
|