Merge branch 'grid-hidpi'
wxGrid improvements for high DPI and DPI changes See https://github.com/wxWidgets/wxWidgets/pull/1776
This commit is contained in:
@@ -432,18 +432,15 @@ GridFrame::GridFrame()
|
||||
grid = new wxGrid( this,
|
||||
wxID_ANY,
|
||||
wxPoint( 0, 0 ),
|
||||
wxSize( 400, 300 ) );
|
||||
FromDIP(wxSize( 400, 300 )) );
|
||||
|
||||
|
||||
#if wxUSE_LOG
|
||||
int gridW = 600, gridH = 300;
|
||||
int logW = gridW, logH = 100;
|
||||
|
||||
logWin = new wxTextCtrl( this,
|
||||
wxID_ANY,
|
||||
wxEmptyString,
|
||||
wxPoint( 0, gridH + 20 ),
|
||||
wxSize( logW, logH ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxTE_MULTILINE );
|
||||
|
||||
logger = new wxLogTextCtrl( logWin );
|
||||
@@ -464,7 +461,7 @@ GridFrame::GridFrame()
|
||||
grid->DeleteRows(0, ir);
|
||||
grid->AppendRows(ir);
|
||||
|
||||
grid->SetRowSize( 0, 60 );
|
||||
grid->SetRowSize( 0, 4*grid->GetDefaultRowSize() );
|
||||
grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
|
||||
|
||||
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->SetColSize(10, 150);
|
||||
grid->SetColSize(10, FromDIP(150));
|
||||
wxString longtext = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n";
|
||||
longtext += "With tabs :\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->SetRowSize( 99, 60 );
|
||||
grid->SetRowSize( 99, 4*grid->GetDefaultRowSize() );
|
||||
grid->SetCellValue(98, 98, "Test background colour setting");
|
||||
grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127));
|
||||
grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127));
|
||||
@@ -537,8 +534,8 @@ GridFrame::GridFrame()
|
||||
grid->SetRowAttr(5, attr);
|
||||
|
||||
grid->SetCellValue(2, 4, "a wider column");
|
||||
grid->SetColSize(4, 120);
|
||||
grid->SetColMinimalWidth(4, 120);
|
||||
grid->SetColSize(4, 3*grid->GetDefaultColLabelSize()/2);
|
||||
grid->SetColMinimalWidth(4, grid->GetColSize(4));
|
||||
|
||||
grid->SetCellTextColour(5, 8, *wxGREEN);
|
||||
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
|
||||
grid->DisableRowResize(10);
|
||||
grid->SetRowSize(10, 30);
|
||||
grid->SetRowSize(10, 3*grid->GetDefaultRowSize()/2);
|
||||
attr = new wxGridCellAttr;
|
||||
attr->SetBackgroundColour(*wxLIGHT_GREY);
|
||||
attr->SetAlignment(wxALIGN_INVALID, wxALIGN_CENTRE);
|
||||
@@ -1669,8 +1666,7 @@ void MyGridCellRenderer::Draw(wxGrid& grid,
|
||||
// ============================================================================
|
||||
|
||||
BigGridFrame::BigGridFrame(long sizeGrid)
|
||||
: wxFrame(NULL, wxID_ANY, "Plugin Virtual Table",
|
||||
wxDefaultPosition, wxSize(500, 450))
|
||||
: wxFrame(NULL, wxID_ANY, "Plugin Virtual Table")
|
||||
{
|
||||
m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_table = new BigGridTable(sizeGrid);
|
||||
@@ -1681,12 +1677,7 @@ BigGridFrame::BigGridFrame(long sizeGrid)
|
||||
|
||||
m_grid->AssignTable(m_table);
|
||||
|
||||
#if defined __WXMOTIF__
|
||||
// MB: the grid isn't getting a sensible default size under wxMotif
|
||||
int cw, ch;
|
||||
GetClientSize( &cw, &ch );
|
||||
m_grid->SetSize( cw, ch );
|
||||
#endif
|
||||
SetClientSize(FromDIP(wxSize(500, 450)));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -2363,7 +2354,7 @@ TabularGridFrame::TabularGridFrame()
|
||||
sizerStyles->Add(m_chkEnableColMove, wxSizerFlags().Border());
|
||||
sizerControls->Add(sizerStyles);
|
||||
|
||||
sizerControls->AddSpacer(10);
|
||||
sizerControls->AddSpacer(FromDIP(10));
|
||||
|
||||
wxSizer * const sizerColumns = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer * const sizerMoveCols = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
Reference in New Issue
Block a user