//---------------------------------------------------------
void CVIEW_Table_Control::On_RClick_Label(wxGridEvent &event)
{
	wxMenu	Menu;

	//-----------------------------------------------------
	if( event.GetCol() != -1 )
	{
		Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Columns")));

		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_ADD);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_DEL);

		Menu.AppendSeparator();
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_COLS);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_SORT);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_RENAME);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_TYPE);

		PopupMenu(&Menu, event.GetPosition().x, event.GetPosition().y - GetColLabelSize());
	}

	//-----------------------------------------------------
	else if( event.GetRow() != -1 )
	{
		Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Rows")));

		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_ADD);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_INS);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL);
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL_ALL);

		Menu.AppendSeparator();
		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_ROWS);

		if( !FIXED_ROWS )
		{
			Menu.AppendSeparator();
			CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_SELECTION_TO_TOP);
			CMD_Menu_Add_Item(&Menu,  true, ID_CMD_TABLE_SELECTION_ONLY);
		}

		PopupMenu(&Menu, event.GetPosition().x - GetRowLabelSize(), event.GetPosition().y);
	}

	//-----------------------------------------------------
	else
	{
		ClearSelection();
	}
}
示例#2
0
const std::string wex::grid::build_page()
{
  wxString text;

  text << "<TABLE ";

  if (GridLinesEnabled())
    text << "border=1";
  else
    text << "border=0";

  text << " cellpadding=4 cellspacing=0 >\n";
  text << "<tr>\n";

  // Add the col labels only if they are shown.
  if (GetColLabelSize() > 0)
  {
    for (int c = 0 ; c < GetNumberCols(); c++)
    {
      text << "<td><i>" << GetColLabelValue(c) << "</i>\n";
    }
  }

  for (int i = 0 ; i < GetNumberRows(); i++)
  {
    text << "<tr>\n";

    for (int j = 0 ; j < GetNumberCols(); j++)
    {
      text << "<td>" <<
        (GetCellValue(i, j).empty() ? "&nbsp": GetCellValue(i, j)) << "\n";
    }
  }

  text << "</TABLE>\n";

  // This can be useful for testing, paste in a file and
  // check in your browser (there indeed rules are okay).
  // clipboard_add(text);

  return text;
}
示例#3
0
wxSize MultiDimGridGrid::DoGetBestSize() const
{
    // 100 is the default minimal size of a widget - taken from wx headers.
    int width  = std::max(GetRowLabelSize() + GetColSize(0), 100);
    int height = std::max(GetColLabelSize() + GetRowSize(0), 100);

    // The following is from the wx header file for wxScrollWindow:
    // Round up to a multiple the scroll rate NOTE: this still doesn't get rid
    // of the scrollbars, is there any magic incantaion for that?
    int xpu, ypu;
    GetScrollPixelsPerUnit(&xpu, &ypu);
    if(xpu)
        {
        width  += 1 + xpu - (width  % xpu);
        }
    if(ypu)
        {
        height += 1 + ypu - (height % ypu);
        }

    return wxSize(width, height);
}
//---------------------------------------------------------
void CActive_Attributes_Control::On_RClick_Label(wxGridEvent &event)
{
	//-----------------------------------------------------
	if( event.GetCol() != -1 )
	{
		wxMenu	Menu(_TL("Columns"));

		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_COLS);

		PopupMenu(&Menu, event.GetPosition().x, event.GetPosition().y - GetColLabelSize());
	}

	//-----------------------------------------------------
	else if( event.GetRow() != -1 )
	{
		wxMenu	Menu(_TL("Rows"));

		CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_ROWS);

		PopupMenu(&Menu, event.GetPosition().x - GetRowLabelSize(), event.GetPosition().y);
	}
}