FidMarkTable::FidMarkTable(Project *project)
	: wxGridTableBase()
	, m_project(project)
	, m_fidmark(project->GetFidMark())
	, m_component(project->GetComponent())
{
	wxGridCellAttrProvider *attrProvider = new wxGridCellAttrProvider;
	SetAttrProvider (attrProvider);

	wxGridCellAttr *ro_attr = new wxGridCellAttr();
	ro_attr->SetReadOnly();
	SetColAttr (ro_attr, COL_DESIGNATOR);
	SetColAttr (ro_attr, COL_NAME);
	SetColAttr (ro_attr, COL_LAYER);
	SetColAttr (ro_attr, COL_SUBPCB_INDEX);

	wxGridCellAttr *ro_float_attr = new wxGridCellAttr();
	wxGridCellFloatRenderer *float_rend = new wxGridCellFloatRenderer(5, 3);
	ro_float_attr->SetRenderer(float_rend);
	ro_float_attr->SetReadOnly();
	SetColAttr (ro_float_attr, COL_LOCATION_X);
	SetColAttr (ro_float_attr, COL_LOCATION_Y);

	wxGridCellAttr *choise_on_subpcb_attr = new wxGridCellAttr();
	wxGridCellChoiceEditor *choise_on_subpcb_edit = new wxGridCellChoiceEditor(G_array_on_subpcb);
	choise_on_subpcb_attr->SetEditor(choise_on_subpcb_edit);
	SetColAttr (choise_on_subpcb_attr, COL_USE_ON_SUBPCB);

	wxGridCellAttr *choise_global_attr = new wxGridCellAttr();
	wxGridCellChoiceEditor *choise_global_edit = new wxGridCellChoiceEditor(G_array_global);
	choise_global_attr->SetEditor(choise_global_edit);
	SetColAttr (choise_global_attr, COL_USE_GLOBAL);
}
/* for convienience purpose only */
void CBOINCGridCtrl::SetColAlignment(int col,int hAlign,int vAlign) {
    wxGridCellAttr *attr = m_table->GetAttr(-1, col, wxGridCellAttr::Col );
	if(!attr) {
		attr = new wxGridCellAttr;
	}
	attr->SetAlignment(hAlign,vAlign);
    SetColAttr(col, attr);
}
CatheterCmdGrid::CatheterCmdGrid(const CatheterCmdGrid& C) :
    wxGrid(C.GetParent(), wxID_ANY),
    cmd_count(C.cmd_count),
    dir_choices{ wxT("neg"), wxT("pos") } {

    dir_choices[DIR_POS] = wxT("pos");
    dir_choices[DIR_NEG] = wxT("neg");

    CreateGrid(NCHANNELS, NFIELDS);

    SetColLabelValue(CHANNEL_COL, wxT("Channel"));
    SetColLabelValue(CURRENT_COL, wxT("Current (MA)"));
    SetColLabelValue(DIR_COL, wxT("Direction"));
    SetColLabelValue(DELAY_COL, wxT("Delay (ms)"));
    //HideRowLabels();

    // set column attributes
    GetTable()->SetAttrProvider(new wxGridCellAttrProvider());
    for (int i = 0; i < NFIELDS; i++)
        GetTable()->GetAttrProvider()->SetColAttr(new wxGridCellAttr(), i);

    SetColFormatNumber(CHANNEL_COL); //channel address
    SetColFormatFloat(CURRENT_COL); // MA current
    SetColFormatNumber(DELAY_COL); //delay

    wxGridCellAttr* dirAttr = GetTable()->GetAttrProvider()->GetAttr(0, DIR_COL, wxGridCellAttr::Col);
    wxGridCellAttr* channelAttr = GetTable()->GetAttrProvider()->GetAttr(0, CHANNEL_COL, wxGridCellAttr::Col);
    if (channelAttr == NULL || dirAttr == NULL) {
        printf("attribute is NULL\n");
        exit(EXIT_FAILURE);
    }
    dirAttr->SetEditor(new wxGridCellChoiceEditor(2, dir_choices));
    channelAttr->SetEditor(new wxGridCellNumberEditor(1, NCHANNELS));
    SetColAttr(DIR_COL, dirAttr);
    SetColAttr(CHANNEL_COL, channelAttr);

    for (int i = 1; i < GetNumberRows(); i++) {
        setRowReadOnly(i, true);
    }
    appendCommandRow();
}
Example #4
0
void CListView::initWithReportItems()
{
	//
	DisableDragColSize();
	DisableDragColMove();
	DisableDragRowSize();
	DisableDragGridSize();
	CreateGrid(0, 2, wxGridSelectRows);
	SetColLabelValue(0, wxT("├ч│к"));
	SetColLabelValue(1, wxT("ох"));

	wxGridSizesInfo info;
	info.m_sizeDefault = 20;
	SetRowSizes(info);

	wxGridCellAttr *attrRO = new wxGridCellAttr;
	attrRO->SetReadOnly();
	SetColAttr(0, attrRO);

	registerItemWindow();

}
void CModifierSeqListView::initWithReportItems()
{
	DisableDragColSize();
	DisableDragColMove();
	DisableDragRowSize();
	DisableDragGridSize();

	CreateGrid(8, 4, wxGridSelectRows);
	SetColLabelValue(0, wxT("修改器ID"));
	SetColLabelValue(1, wxT("参数1"));
	SetColLabelValue(2, wxT("参数2"));
	SetColLabelValue(3, wxT("参数3"));
	
	wxGridCellAttr *pAttr = new wxGridCellAttr;
	
	pAttr->SetEditor(new CTextButtonEditor(wxT("编辑")));
	//pAttr->SetRenderer(new CGridCellTextButtonRenderer);
	SetColAttr(0, pAttr);

	wxGridSizesInfo info;
	info.m_sizeDefault = 30;
	SetRowSizes(info);
}
Example #6
0
/** InitGridSizes
  *
  * Initializes the Grid Sizes
  */
void MemoryGrid::InitGridSizes()
{
    int w, h;
    GetClientSize(&w, &h);
    w -= 24;

    AutoSizeColumn(MemoryBinary);

    w -= GetColSize(MemoryBinary);

    SetColSize(MemoryInfo, 22);
    SetColSize(MemoryAddress, 8 * w / 75 - 8);
    SetColSize(MemoryHexadecimal, 8 * w / 75);
    SetColSize(MemoryDecimal, 10 * w / 75);
    //SetColSize(MemoryBinary, 25 * w / 100);
    SetColSize(MemoryLabel, 18 * w / 75);
    SetColSize(MemoryInstruction, 31 * w / 75 + 9);

    wxGridCellAttr* info = new wxGridCellAttr; info->SetReadOnly(); info->SetTextColour(*wxBLACK);
    info->SetRenderer(new GridCellInfoRenderer());
    wxGridCellAttr* addr = new wxGridCellAttr; addr->SetReadOnly(); addr->SetTextColour(*wxBLACK);
    wxGridCellAttr* instr = new wxGridCellAttr; instr->SetTextColour(*wxBLACK);
    wxGridCellAttr* hex = new wxGridCellAttr; hex->SetTextColour(*wxBLUE);
    wxGridCellAttr* decimal = new wxGridCellAttr; decimal->SetTextColour(*wxRED);
    wxGridCellAttr* binary = new wxGridCellAttr; binary->SetTextColour(*wxWHITE); binary->SetBackgroundColour(wxTransparentColor);
    binary->SetRenderer(new GridCellBinaryRenderer());
    //binary->SetFont(wxFont( 10, 70, 90, wxFONTWEIGHT_BOLD, false, wxT("Courier New")));
    wxGridCellAttr* label = new wxGridCellAttr; label->SetTextColour(wxColour(64, 64, 64));

    SetColAttr(MemoryInfo, info);
    SetColAttr(MemoryAddress, addr);
    SetColAttr(MemoryHexadecimal, hex);
    SetColAttr(MemoryDecimal, decimal);
    SetColAttr(MemoryBinary, binary);
    SetColAttr(MemoryLabel, label);
    SetColAttr(MemoryInstruction, instr);
}
Example #7
0
void ctlSQLResult::DisplayData(bool single)
{
	if (!thread || !thread->DataValid())
		return;

	if (thread->ReturnCode() != PGRES_TUPLES_OK)
		return;

	rowcountSuppressed = single;
	Freeze();

	/*
	 * Resize and repopulate by informing it to delete all the rows and
	 * columns, then append the correct number of them. Probably is a
	 * better way to do this.
	 */
	wxGridTableMessage *msg;
	sqlResultTable *table = (sqlResultTable *)GetTable();
	msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, GetNumberRows());
	ProcessTableMessage(*msg);
	delete msg;
	msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_COLS_DELETED, 0, GetNumberCols());
	ProcessTableMessage(*msg);
	delete msg;
	msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, NumRows());
	ProcessTableMessage(*msg);
	delete msg;
	msg = new wxGridTableMessage(table, wxGRIDTABLE_NOTIFY_COLS_APPENDED, thread->DataSet()->NumCols());
	ProcessTableMessage(*msg);
	delete msg;

	if (single)
	{
		int w, h;
		if (colSizes.GetCount() == 1)
			w = colSizes.Item(0);
		else
			GetSize(&w, &h);

		colNames.Add(thread->DataSet()->ColName(0));
		colTypes.Add(wxT(""));
		colTypClasses.Add(0L);

		SetColSize(0, w);
	}
	else
	{
		wxString colName, colType;
		int w;

		size_t hdrIndex = 0;
		long col, nCols = thread->DataSet()->NumCols();

		for (col = 0 ; col < nCols ; col++)
		{
			colName = thread->DataSet()->ColName(col);
			colType = thread->DataSet()->ColFullType(col);
			colNames.Add(colName);
			colTypes.Add(colType);
			colTypClasses.Add(thread->DataSet()->ColTypClass(col));

			wxString colHeader = colName + wxT("\n") + colType;

			if (hdrIndex < colHeaders.GetCount() && colHeaders.Item(hdrIndex) == colHeader)
				w = colSizes.Item(hdrIndex++);
			else
				w = -1;

			SetColSize(col, w);
			if (thread->DataSet()->ColTypClass(col) == PGTYPCLASS_NUMERIC)
			{
				/*
				 * For numeric columns, set alignment to right.
				 */
				wxGridCellAttr *attr = new wxGridCellAttr();
				attr->SetAlignment(wxALIGN_RIGHT, wxALIGN_TOP);
				SetColAttr(col, attr);
			}
		}
	}
	Thaw();
}
Example #8
0
/** SetHighlight
  *
  * Sets Instruction Highlighting
  */
void MemoryGrid::SetHighlight(bool highlight)
{
    wxGridCellAttr* binary = new wxGridCellAttr; binary->SetTextColour(*wxWHITE); binary->SetBackgroundColour(wxTransparentColor);
    if (highlight) binary->SetRenderer(new GridCellBinaryRenderer());
    SetColAttr(MemoryBinary, binary);
}