Sprinkle grid sample with FromDIP() to improve its appearance
Make frame sizes and column/row sizes more appropriate for high DPI displays.
This commit is contained in:
@@ -432,18 +432,15 @@ GridFrame::GridFrame()
|
|||||||
grid = new wxGrid( this,
|
grid = new wxGrid( this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxPoint( 0, 0 ),
|
wxPoint( 0, 0 ),
|
||||||
wxSize( 400, 300 ) );
|
FromDIP(wxSize( 400, 300 )) );
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
int gridW = 600, gridH = 300;
|
|
||||||
int logW = gridW, logH = 100;
|
|
||||||
|
|
||||||
logWin = new wxTextCtrl( this,
|
logWin = new wxTextCtrl( this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
wxPoint( 0, gridH + 20 ),
|
wxDefaultPosition,
|
||||||
wxSize( logW, logH ),
|
wxDefaultSize,
|
||||||
wxTE_MULTILINE );
|
wxTE_MULTILINE );
|
||||||
|
|
||||||
logger = new wxLogTextCtrl( logWin );
|
logger = new wxLogTextCtrl( logWin );
|
||||||
@@ -464,7 +461,7 @@ GridFrame::GridFrame()
|
|||||||
grid->DeleteRows(0, ir);
|
grid->DeleteRows(0, ir);
|
||||||
grid->AppendRows(ir);
|
grid->AppendRows(ir);
|
||||||
|
|
||||||
grid->SetRowSize( 0, 60 );
|
grid->SetRowSize( 0, FromDIP(60) );
|
||||||
grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
|
grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
|
||||||
|
|
||||||
grid->SetCellValue( 0, 1, "A long piece of text to demonstrate wrapping." );
|
grid->SetCellValue( 0, 1, "A long piece of text to demonstrate wrapping." );
|
||||||
@@ -477,7 +474,7 @@ GridFrame::GridFrame()
|
|||||||
|
|
||||||
grid->SetCellValue( 0, 4, "Can veto edit this cell" );
|
grid->SetCellValue( 0, 4, "Can veto edit this cell" );
|
||||||
|
|
||||||
grid->SetColSize(10, 150);
|
grid->SetColSize(10, FromDIP(150));
|
||||||
wxString longtext = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n";
|
wxString longtext = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n";
|
||||||
longtext += "With tabs :\n";
|
longtext += "With tabs :\n";
|
||||||
longtext += "Home,\t\thome\t\t\tagain\n";
|
longtext += "Home,\t\thome\t\t\tagain\n";
|
||||||
@@ -494,7 +491,7 @@ GridFrame::GridFrame()
|
|||||||
|
|
||||||
grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip over\ncells" );
|
grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip over\ncells" );
|
||||||
|
|
||||||
grid->SetRowSize( 99, 60 );
|
grid->SetRowSize( 99, FromDIP(60) );
|
||||||
grid->SetCellValue(98, 98, "Test background colour setting");
|
grid->SetCellValue(98, 98, "Test background colour setting");
|
||||||
grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127));
|
grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127));
|
||||||
grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127));
|
grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127));
|
||||||
@@ -537,8 +534,8 @@ GridFrame::GridFrame()
|
|||||||
grid->SetRowAttr(5, attr);
|
grid->SetRowAttr(5, attr);
|
||||||
|
|
||||||
grid->SetCellValue(2, 4, "a wider column");
|
grid->SetCellValue(2, 4, "a wider column");
|
||||||
grid->SetColSize(4, 120);
|
grid->SetColSize(4, FromDIP(120));
|
||||||
grid->SetColMinimalWidth(4, 120);
|
grid->SetColMinimalWidth(4, FromDIP(120));
|
||||||
|
|
||||||
grid->SetCellTextColour(5, 8, *wxGREEN);
|
grid->SetCellTextColour(5, 8, *wxGREEN);
|
||||||
grid->SetCellValue(5, 8, "Bg from row attr\nText col from cell attr");
|
grid->SetCellValue(5, 8, "Bg from row attr\nText col from cell attr");
|
||||||
@@ -611,7 +608,7 @@ GridFrame::GridFrame()
|
|||||||
|
|
||||||
// create a separator-like row: it's grey and it's non-resizable
|
// create a separator-like row: it's grey and it's non-resizable
|
||||||
grid->DisableRowResize(10);
|
grid->DisableRowResize(10);
|
||||||
grid->SetRowSize(10, 30);
|
grid->SetRowSize(10, FromDIP(30));
|
||||||
attr = new wxGridCellAttr;
|
attr = new wxGridCellAttr;
|
||||||
attr->SetBackgroundColour(*wxLIGHT_GREY);
|
attr->SetBackgroundColour(*wxLIGHT_GREY);
|
||||||
grid->SetRowAttr(10, attr);
|
grid->SetRowAttr(10, attr);
|
||||||
@@ -1669,8 +1666,7 @@ void MyGridCellRenderer::Draw(wxGrid& grid,
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
BigGridFrame::BigGridFrame(long sizeGrid)
|
BigGridFrame::BigGridFrame(long sizeGrid)
|
||||||
: wxFrame(NULL, wxID_ANY, "Plugin Virtual Table",
|
: wxFrame(NULL, wxID_ANY, "Plugin Virtual Table")
|
||||||
wxDefaultPosition, wxSize(500, 450))
|
|
||||||
{
|
{
|
||||||
m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
m_table = new BigGridTable(sizeGrid);
|
m_table = new BigGridTable(sizeGrid);
|
||||||
@@ -1681,12 +1677,7 @@ BigGridFrame::BigGridFrame(long sizeGrid)
|
|||||||
|
|
||||||
m_grid->AssignTable(m_table);
|
m_grid->AssignTable(m_table);
|
||||||
|
|
||||||
#if defined __WXMOTIF__
|
SetClientSize(FromDIP(wxSize(500, 450)));
|
||||||
// MB: the grid isn't getting a sensible default size under wxMotif
|
|
||||||
int cw, ch;
|
|
||||||
GetClientSize( &cw, &ch );
|
|
||||||
m_grid->SetSize( cw, ch );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -2363,7 +2354,7 @@ TabularGridFrame::TabularGridFrame()
|
|||||||
sizerStyles->Add(m_chkEnableColMove, wxSizerFlags().Border());
|
sizerStyles->Add(m_chkEnableColMove, wxSizerFlags().Border());
|
||||||
sizerControls->Add(sizerStyles);
|
sizerControls->Add(sizerStyles);
|
||||||
|
|
||||||
sizerControls->AddSpacer(10);
|
sizerControls->AddSpacer(FromDIP(10));
|
||||||
|
|
||||||
wxSizer * const sizerColumns = new wxBoxSizer(wxVERTICAL);
|
wxSizer * const sizerColumns = new wxBoxSizer(wxVERTICAL);
|
||||||
wxSizer * const sizerMoveCols = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer * const sizerMoveCols = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
Reference in New Issue
Block a user