Use more FromDIP for hardcoded sizes
This commit is contained in:
@@ -763,7 +763,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
wxDataViewTextRenderer *tr =
|
||||
new wxDataViewTextRenderer( "string", wxDATAVIEW_CELL_INERT );
|
||||
wxDataViewColumn *column0 =
|
||||
new wxDataViewColumn( "title", tr, 0, 200, wxALIGN_LEFT,
|
||||
new wxDataViewColumn( "title", tr, 0, FromDIP(200), wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE );
|
||||
m_ctrl[Page_Music]->AppendColumn( column0 );
|
||||
#if 0
|
||||
@@ -776,10 +776,10 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
|
||||
tr = new wxDataViewTextRenderer( "string", wxDATAVIEW_CELL_EDITABLE );
|
||||
wxDataViewColumn *column1 =
|
||||
new wxDataViewColumn( "artist", tr, 1, 150, wxALIGN_LEFT,
|
||||
new wxDataViewColumn( "artist", tr, 1, FromDIP(150), wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE |
|
||||
wxDATAVIEW_COL_RESIZABLE );
|
||||
column1->SetMinWidth(150); // this column can't be resized to be smaller
|
||||
column1->SetMinWidth(FromDIP(150)); // this column can't be resized to be smaller
|
||||
m_ctrl[Page_Music]->AppendColumn( column1 );
|
||||
|
||||
// column 2 of the view control:
|
||||
@@ -788,7 +788,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
new wxDataViewSpinRenderer( 0, 2010, wxDATAVIEW_CELL_EDITABLE,
|
||||
wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
|
||||
wxDataViewColumn *column2 =
|
||||
new wxDataViewColumn( "year", sr, 2, 60, wxALIGN_LEFT,
|
||||
new wxDataViewColumn( "year", sr, 2, FromDIP(60), wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE );
|
||||
m_ctrl[Page_Music]->AppendColumn( column2 );
|
||||
|
||||
@@ -802,19 +802,19 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
new wxDataViewChoiceRenderer( choices, wxDATAVIEW_CELL_EDITABLE,
|
||||
wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
|
||||
wxDataViewColumn *column3 =
|
||||
new wxDataViewColumn( "rating", c, 3, 100, wxALIGN_LEFT,
|
||||
new wxDataViewColumn( "rating", c, 3, FromDIP(100), wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_RESIZABLE );
|
||||
m_ctrl[Page_Music]->AppendColumn( column3 );
|
||||
|
||||
// column 4 of the view control:
|
||||
|
||||
m_ctrl[Page_Music]->AppendProgressColumn( "popularity", 4, wxDATAVIEW_CELL_INERT, 80 );
|
||||
m_ctrl[Page_Music]->AppendProgressColumn( "popularity", 4, wxDATAVIEW_CELL_INERT, FromDIP(80) );
|
||||
|
||||
// column 5 of the view control:
|
||||
|
||||
MyCustomRenderer *cr = new MyCustomRenderer(wxDATAVIEW_CELL_ACTIVATABLE);
|
||||
wxDataViewColumn *column5 =
|
||||
new wxDataViewColumn( "custom", cr, 5, -1, wxALIGN_LEFT,
|
||||
new wxDataViewColumn( "custom", cr, 5, wxCOL_WIDTH_DEFAULT, wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_RESIZABLE );
|
||||
column5->SetBitmap(wxArtProvider::GetBitmap(wxART_INFORMATION, wxART_MENU));
|
||||
m_ctrl[Page_Music]->AppendColumn( column5 );
|
||||
@@ -900,7 +900,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
lc->AppendColumn(colRadio, "bool");
|
||||
|
||||
lc->AppendTextColumn( "Text" );
|
||||
lc->AppendProgressColumn( "Progress" )->SetMinWidth(100);
|
||||
lc->AppendProgressColumn( "Progress" )->SetMinWidth(FromDIP(100));
|
||||
|
||||
wxVector<wxVariant> data;
|
||||
for (unsigned int i=0; i<10; i++)
|
||||
@@ -957,17 +957,17 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
MultiLineCustomRenderer *tr =
|
||||
new MultiLineCustomRenderer();
|
||||
wxDataViewColumn *column0 =
|
||||
new wxDataViewColumn("title", tr, 0, 200, wxALIGN_LEFT,
|
||||
new wxDataViewColumn("title", tr, 0, FromDIP(200), wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_RESIZABLE);
|
||||
m_ctrl[Page_VarHeight]->AppendColumn(column0);
|
||||
|
||||
// column 1 of the view control:
|
||||
tr = new MultiLineCustomRenderer();
|
||||
wxDataViewColumn *column1 =
|
||||
new wxDataViewColumn("artist", tr, 1, 150, wxALIGN_LEFT,
|
||||
new wxDataViewColumn("artist", tr, 1, FromDIP(150), wxALIGN_LEFT,
|
||||
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE |
|
||||
wxDATAVIEW_COL_RESIZABLE);
|
||||
column1->SetMinWidth(150); // this column can't be resized to be smaller
|
||||
column1->SetMinWidth(FromDIP(150)); // this column can't be resized to be smaller
|
||||
m_ctrl[Page_VarHeight]->AppendColumn(column1);
|
||||
}
|
||||
break;
|
||||
|
@@ -307,7 +307,8 @@ bool MyApp::OnInit()
|
||||
// Create the main frame window
|
||||
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
|
||||
"wxToolBar Sample",
|
||||
wxPoint(100, 100), wxSize(650, 350));
|
||||
wxPoint(100, 100), wxDefaultSize);
|
||||
frame->SetSize(frame->FromDIP(wxSize(650, 350)));
|
||||
|
||||
frame->Show(true);
|
||||
|
||||
@@ -440,7 +441,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
||||
// adding a combo to a vertical toolbar is not very smart
|
||||
if ( !toolBar->IsVertical() )
|
||||
{
|
||||
wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) );
|
||||
wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, FromDIP(wxSize(100,-1)) );
|
||||
combo->Append("This");
|
||||
combo->Append("is a");
|
||||
combo->Append("combobox with extremely, extremely, extremely, extremely long label");
|
||||
@@ -891,7 +892,7 @@ void MyFrame::OnToggleSearch(wxCommandEvent& WXUNUSED(event))
|
||||
if ( !m_searchTool )
|
||||
{
|
||||
wxSearchCtrl * const srch = new wxSearchCtrl(tb, wxID_ANY, "needle");
|
||||
srch->SetMinSize(wxSize(80, -1));
|
||||
srch->SetMinSize(FromDIP(wxSize(80, -1)));
|
||||
m_searchTool = tb->AddControl(srch);
|
||||
}
|
||||
else // tool already exists
|
||||
|
@@ -107,7 +107,7 @@ wxChoiceBase::~wxChoiceBase()
|
||||
wxSize wxChoiceBase::DoGetBestSize() const
|
||||
{
|
||||
// a reasonable width for an empty choice list
|
||||
wxSize best(80, -1);
|
||||
wxSize best(FromDIP(80), -1);
|
||||
|
||||
const unsigned int nItems = GetCount();
|
||||
if ( nItems > 0 )
|
||||
|
@@ -1374,7 +1374,7 @@ void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust
|
||||
|
||||
wxSize wxComboCtrlBase::DoGetBestSize() const
|
||||
{
|
||||
int width = m_text ? m_text->GetBestSize().x : 80;
|
||||
int width = m_text ? m_text->GetBestSize().x : FromDIP(80);
|
||||
|
||||
return GetSizeFromTextSize(width);
|
||||
}
|
||||
|
@@ -327,7 +327,7 @@ wxSize wxAnimationCtrl::DoGetBestSize() const
|
||||
if (m_animation.IsOk() && !this->HasFlag(wxAC_NO_AUTORESIZE))
|
||||
return m_animation.GetSize();
|
||||
|
||||
return wxSize(100, 100);
|
||||
return FromDIP(wxSize(100, 100));
|
||||
}
|
||||
|
||||
void wxAnimationCtrl::SetAnimation(const wxAnimation& animation)
|
||||
|
@@ -431,7 +431,7 @@ wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size
|
||||
//
|
||||
// Note that we intentionally don't use GetDefaultSize() here, because
|
||||
// it's inexact -- dialog units depend on this dialog's font.
|
||||
const wxSize sizeDef = btn->ConvertDialogToPixels(wxSize(50, 14));
|
||||
const wxSize sizeDef = btn->ConvertDialogToPixels(btn->FromDIP(wxSize(50, 14)));
|
||||
|
||||
sizeBtn.IncTo(sizeDef);
|
||||
}
|
||||
|
@@ -122,9 +122,9 @@ wxSize wxGauge::DoGetBestSize() const
|
||||
// the smaller one.
|
||||
|
||||
if (HasFlag(wxGA_VERTICAL))
|
||||
return ConvertDialogToPixels(wxSize(8, 107));
|
||||
return ConvertDialogToPixels(FromDIP(wxSize(8, 107)));
|
||||
else
|
||||
return ConvertDialogToPixels(wxSize(107, 8));
|
||||
return ConvertDialogToPixels(FromDIP(wxSize(107, 8)));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -3808,7 +3808,7 @@ void wxRichTextCtrl::OnDropFiles(wxDropFilesEvent& event)
|
||||
|
||||
wxSize wxRichTextCtrl::DoGetBestSize() const
|
||||
{
|
||||
return wxSize(10, 10);
|
||||
return FromDIP(wxSize(10, 10));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user