本文整理汇总了C++中wxGrid::GetCellEditor方法的典型用法代码示例。如果您正苦于以下问题:C++ wxGrid::GetCellEditor方法的具体用法?C++ wxGrid::GetCellEditor怎么用?C++ wxGrid::GetCellEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxGrid
的用法示例。
在下文中一共展示了wxGrid::GetCellEditor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBestSize
wxSize TimeRenderer::GetBestSize(wxGrid &grid,
wxGridCellAttr & WXUNUSED(attr),
wxDC & WXUNUSED(dc),
int row,
int col)
{
wxGridTableBase *table = grid.GetTable();
TimeEditor *te = (TimeEditor *) grid.GetCellEditor(row, col);
wxSize sz;
if (te) {
double value;
table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(NumericConverter::TIME, &grid,
wxID_ANY,
te->GetFormat(),
value,
te->GetRate(),
wxPoint(10000, 10000), // create offscreen
wxDefaultSize,
true);
sz = tt.GetSize();
te->DecRef();
}
return sz;
}
示例2: GetBestSize
wxSize NumericRenderer::GetBestSize(wxGrid &grid,
wxGridCellAttr & WXUNUSED(attr),
wxDC & WXUNUSED(dc),
int row,
int col)
{
wxGridTableBase *table = grid.GetTable();
NumericEditor *ne =
static_cast<NumericEditor *>(grid.GetCellEditor(row, col));
wxSize sz;
if (ne) {
double value;
table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(mType, &grid,
wxID_ANY,
ne->GetFormat(),
value,
ne->GetRate(),
wxPoint(10000, 10000), // create offscreen
wxDefaultSize,
true);
sz = tt.GetSize();
ne->DecRef();
}
return sz;
}
示例3: GetBestSize
wxSize TimeRenderer::GetBestSize(wxGrid &grid,
wxGridCellAttr &attr,
wxDC &dc,
int row,
int col)
{
wxGridTableBase *table = grid.GetTable();
TimeEditor *te = (TimeEditor *) grid.GetCellEditor(row, col);
wxSize sz;
if (te) {
double value;
table->GetValue(row, col).ToDouble(&value);
TimeTextCtrl tt(&grid,
wxID_ANY,
wxT(""),
value,
te->GetRate(),
wxPoint(10000, 10000), // create offscreen
wxDefaultSize,
true);
tt.SetFormatString(tt.GetBuiltinFormat(te->GetFormat()));
sz = tt.GetSize();
te->DecRef();
}
return sz;
}
示例4: Draw
void TimeRenderer::Draw(wxGrid &grid,
wxGridCellAttr &attr,
wxDC &dc,
const wxRect &rect,
int row,
int col,
bool isSelected)
{
wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
wxGridTableBase *table = grid.GetTable();
TimeEditor *te = (TimeEditor *) grid.GetCellEditor(row, col);
wxString tstr;
if (te) {
double value;
table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(NumericConverter::TIME, &grid,
wxID_ANY,
te->GetFormat(),
value,
te->GetRate(),
wxPoint(10000, 10000), // create offscreen
wxDefaultSize,
true);
tstr = tt.GetString();
te->DecRef();
}
dc.SetBackgroundMode(wxTRANSPARENT);
if (grid.IsEnabled())
{
if (isSelected)
{
dc.SetTextBackground(grid.GetSelectionBackground());
dc.SetTextForeground(grid.GetSelectionForeground());
}
else
{
dc.SetTextBackground(attr.GetBackgroundColour());
dc.SetTextForeground(attr.GetTextColour());
}
}
else
{
dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
}
dc.SetFont(attr.GetFont());
int hAlign, vAlign;
attr.GetAlignment(&hAlign, &vAlign);
grid.DrawTextRectangle(dc, tstr, rect, hAlign, vAlign);
}
示例5: Draw
void NumericRenderer::Draw(wxGrid &grid,
wxGridCellAttr &attr,
wxDC &dc,
const wxRect &rect,
int row,
int col,
bool isSelected)
{
wxGridCellRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
wxGridTableBase *table = grid.GetTable();
NumericEditor *ne =
static_cast<NumericEditor *>(grid.GetCellEditor(row, col));
wxString tstr;
if (ne) {
double value;
table->GetValue(row, col).ToDouble(&value);
NumericTextCtrl tt(&grid, wxID_ANY,
mType,
ne->GetFormat(),
value,
ne->GetRate(),
NumericTextCtrl::Options{}.AutoPos(true),
wxPoint(10000, 10000)); // create offscreen
tstr = tt.GetString();
ne->DecRef();
}
dc.SetBackgroundMode(wxTRANSPARENT);
if (grid.IsEnabled())
{
if (isSelected)
{
dc.SetTextBackground(grid.GetSelectionBackground());
dc.SetTextForeground(grid.GetSelectionForeground());
}
else
{
dc.SetTextBackground(attr.GetBackgroundColour());
dc.SetTextForeground(attr.GetTextColour());
}
}
else
{
dc.SetTextBackground(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
}
dc.SetFont(attr.GetFont());
int hAlign, vAlign;
attr.GetAlignment(&hAlign, &vAlign);
grid.DrawTextRectangle(dc, tstr, rect, hAlign, vAlign);
}