Improve high DPI support in wxAui

Window initial/minimum/maximum sizes are now treated as logical pixels.

Furthermore, many margins and paddings are now converted using
wxWindow::FromDIP() to allow their growth in accord with screen DPI.
This places buttons on toolbars more apart on high DPI screens providing
space for easier touch operations.

Closes https://github.com/wxWidgets/wxWidgets/pull/933
This commit is contained in:
Simon Rozman 2018-09-14 14:27:05 +02:00 committed by Vadim Zeitlin
parent 2af7e38153
commit 770e0bcd16
14 changed files with 294 additions and 268 deletions

View File

@ -98,6 +98,7 @@ All:
- Fix build issues under HaikuOS (mill-j).
- Fix problem with wx-config installation and use under NetBSD (wiz).
- Avoid spurious errors on thread creation under NetBSD.
- Improve high DPI support in wxAui (Simon Rozman).
All (GUI):

View File

@ -130,6 +130,7 @@ public:
wxAuiPaneInfo& pane) wxOVERRIDE;
void DrawIcon(wxDC& dc,
wxWindow *window,
const wxRect& rect,
wxAuiPaneInfo& pane);

View File

@ -338,6 +338,7 @@ public:
wxAuiPaneInfo& pane);
void DrawIcon(wxDC& dc,
wxWindow *window,
const wxRect& rect,
wxAuiPaneInfo& pane);

View File

@ -125,7 +125,7 @@ private:
wxTextCtrl* CreateTextCtrl(const wxString& text = wxEmptyString);
wxGrid* CreateGrid();
wxTreeCtrl* CreateTreeCtrl();
wxSizeReportCtrl* CreateSizeReportCtrl(int width = 80, int height = 80);
wxSizeReportCtrl* CreateSizeReportCtrl(const wxSize &size = wxWindow::FromDIP(wxSize(80, 80), NULL));
wxPoint GetStartPosition();
wxHtmlWindow* CreateHTMLCtrl(wxWindow* parent = NULL);
wxAuiNotebook* CreateNotebook();
@ -206,7 +206,7 @@ private:
dc.SetFont(*wxNORMAL_FONT);
dc.GetTextExtent(s, &w, &height);
height += 3;
height += FromDIP(3);
dc.SetBrush(*wxWHITE_BRUSH);
dc.SetPen(*wxWHITE_PEN);
dc.DrawRectangle(0, 0, size.x, size.y);
@ -287,132 +287,132 @@ public:
{
//wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
//vert->Add(1, 1, 1, wxEXPAND);
//vert->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
wxBoxSizer* s1 = new wxBoxSizer(wxHORIZONTAL);
m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
s1->Add(1, 1, 1, wxEXPAND);
m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
s1->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s1->Add(new wxStaticText(this, wxID_ANY, wxT("Pane Border Size:")));
s1->Add(m_border_size);
s1->Add(1, 1, 1, wxEXPAND);
s1->SetItemMinSize((size_t)1, 180, 20);
//vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
s1->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s1->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
//vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
wxBoxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE));
s2->Add(1, 1, 1, wxEXPAND);
m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE));
s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s2->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Size:")));
s2->Add(m_sash_size);
s2->Add(1, 1, 1, wxEXPAND);
s2->SetItemMinSize((size_t)1, 180, 20);
//vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s2->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
//vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
s3->Add(1, 1, 1, wxEXPAND);
m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s3->Add(new wxStaticText(this, wxID_ANY, wxT("Caption Size:")));
s3->Add(m_caption_size);
s3->Add(1, 1, 1, wxEXPAND);
s3->SetItemMinSize((size_t)1, 180, 20);
//vert->Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s3->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
//vert->Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
//vert->Add(1, 1, 1, wxEXPAND);
//vert->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
wxBitmap b = CreateColorBitmap(*wxBLACK);
wxBoxSizer* s4 = new wxBoxSizer(wxHORIZONTAL);
m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, wxSize(50,25));
s4->Add(1, 1, 1, wxEXPAND);
m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, FromDIP(wxSize(50,25)));
s4->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s4->Add(new wxStaticText(this, wxID_ANY, wxT("Background Color:")));
s4->Add(m_background_color);
s4->Add(1, 1, 1, wxEXPAND);
s4->SetItemMinSize((size_t)1, 180, 20);
s4->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s4->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s5 = new wxBoxSizer(wxHORIZONTAL);
m_sash_color = new wxBitmapButton(this, ID_SashColor, b, wxDefaultPosition, wxSize(50,25));
s5->Add(1, 1, 1, wxEXPAND);
s5->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s5->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Color:")));
s5->Add(m_sash_color);
s5->Add(1, 1, 1, wxEXPAND);
s5->SetItemMinSize((size_t)1, 180, 20);
s5->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s5->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s6 = new wxBoxSizer(wxHORIZONTAL);
m_inactive_caption_color = new wxBitmapButton(this, ID_InactiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
s6->Add(1, 1, 1, wxEXPAND);
s6->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s6->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption:")));
s6->Add(m_inactive_caption_color);
s6->Add(1, 1, 1, wxEXPAND);
s6->SetItemMinSize((size_t)1, 180, 20);
s6->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s6->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s7 = new wxBoxSizer(wxHORIZONTAL);
m_inactive_caption_gradient_color = new wxBitmapButton(this, ID_InactiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25));
s7->Add(1, 1, 1, wxEXPAND);
s7->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s7->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Gradient:")));
s7->Add(m_inactive_caption_gradient_color);
s7->Add(1, 1, 1, wxEXPAND);
s7->SetItemMinSize((size_t)1, 180, 20);
s7->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s7->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s8 = new wxBoxSizer(wxHORIZONTAL);
m_inactive_caption_text_color = new wxBitmapButton(this, ID_InactiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25));
s8->Add(1, 1, 1, wxEXPAND);
s8->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s8->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Text:")));
s8->Add(m_inactive_caption_text_color);
s8->Add(1, 1, 1, wxEXPAND);
s8->SetItemMinSize((size_t)1, 180, 20);
s8->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s8->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s9 = new wxBoxSizer(wxHORIZONTAL);
m_active_caption_color = new wxBitmapButton(this, ID_ActiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
s9->Add(1, 1, 1, wxEXPAND);
s9->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s9->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption:")));
s9->Add(m_active_caption_color);
s9->Add(1, 1, 1, wxEXPAND);
s9->SetItemMinSize((size_t)1, 180, 20);
s9->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s9->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s10 = new wxBoxSizer(wxHORIZONTAL);
m_active_caption_gradient_color = new wxBitmapButton(this, ID_ActiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25));
s10->Add(1, 1, 1, wxEXPAND);
s10->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s10->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Gradient:")));
s10->Add(m_active_caption_gradient_color);
s10->Add(1, 1, 1, wxEXPAND);
s10->SetItemMinSize((size_t)1, 180, 20);
s10->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s10->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s11 = new wxBoxSizer(wxHORIZONTAL);
m_active_caption_text_color = new wxBitmapButton(this, ID_ActiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25));
s11->Add(1, 1, 1, wxEXPAND);
s11->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s11->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Text:")));
s11->Add(m_active_caption_text_color);
s11->Add(1, 1, 1, wxEXPAND);
s11->SetItemMinSize((size_t)1, 180, 20);
s11->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s11->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s12 = new wxBoxSizer(wxHORIZONTAL);
m_border_color = new wxBitmapButton(this, ID_BorderColor, b, wxDefaultPosition, wxSize(50,25));
s12->Add(1, 1, 1, wxEXPAND);
s12->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s12->Add(new wxStaticText(this, wxID_ANY, wxT("Border Color:")));
s12->Add(m_border_color);
s12->Add(1, 1, 1, wxEXPAND);
s12->SetItemMinSize((size_t)1, 180, 20);
s12->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s12->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxBoxSizer* s13 = new wxBoxSizer(wxHORIZONTAL);
m_gripper_color = new wxBitmapButton(this, ID_GripperColor, b, wxDefaultPosition, wxSize(50,25));
s13->Add(1, 1, 1, wxEXPAND);
s13->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s13->Add(new wxStaticText(this, wxID_ANY, wxT("Gripper Color:")));
s13->Add(m_gripper_color);
s13->Add(1, 1, 1, wxEXPAND);
s13->SetItemMinSize((size_t)1, 180, 20);
s13->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s13->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
wxGridSizer* grid_sizer = new wxGridSizer(2);
grid_sizer->SetHGap(5);
grid_sizer->SetHGap(FromDIP(5));
grid_sizer->Add(s1); grid_sizer->Add(s4);
grid_sizer->Add(s2); grid_sizer->Add(s5);
grid_sizer->Add(s3); grid_sizer->Add(s13);
grid_sizer->Add(1,1); grid_sizer->Add(s12);
grid_sizer->Add(FromDIP(1),FromDIP(1)); grid_sizer->Add(s12);
grid_sizer->Add(s6); grid_sizer->Add(s9);
grid_sizer->Add(s7); grid_sizer->Add(s10);
grid_sizer->Add(s8); grid_sizer->Add(s11);
wxBoxSizer* cont_sizer = new wxBoxSizer(wxVERTICAL);
cont_sizer->Add(grid_sizer, 1, wxEXPAND | wxALL, 5);
cont_sizer->Add(grid_sizer, 1, wxEXPAND | wxALL, FromDIP(5));
SetSizer(cont_sizer);
GetSizer()->SetSizeHints(this);
@ -428,12 +428,13 @@ private:
wxBitmap CreateColorBitmap(const wxColour& c)
{
wxImage image;
image.Create(25,14);
for (int x = 0; x < 25; ++x)
for (int y = 0; y < 14; ++y)
wxSize size = FromDIP(wxSize(25, 14));
image.Create(size);
for (int x = 0; x < size.x; ++x)
for (int y = 0; y < size.y; ++y)
{
wxColour pixcol = c;
if (x == 0 || x == 24 || y == 0 || y == 13)
if (x == 0 || x == size.x || y == 0 || y == size.y)
pixcol = *wxBLACK;
image.SetRGB(x, y, pixcol.Red(), pixcol.Green(), pixcol.Blue());
}
@ -568,7 +569,7 @@ bool MyApp::OnInit()
wxID_ANY,
wxT("wxAUI Sample Application"),
wxDefaultPosition,
wxSize(800, 600));
wxWindow::FromDIP(wxSize(800, 600), NULL));
frame->Show();
return true;
@ -761,7 +762,7 @@ MyFrame::MyFrame(wxWindow* parent,
// min size for the frame itself isn't completely done.
// see the end up wxAuiManager::Update() for the test
// code. For now, just hard code a frame minimum size
SetMinSize(wxSize(400,300));
SetMinSize(FromDIP(wxSize(400,300)));
@ -781,7 +782,7 @@ MyFrame::MyFrame(wxWindow* parent,
// create some toolbars
wxAuiToolBar* tb1 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
tb1->SetToolBitmapSize(wxSize(48,48));
tb1->SetToolBitmapSize(FromDIP(wxSize(48,48)));
tb1->AddTool(ID_SampleItem+1, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR));
tb1->AddSeparator();
tb1->AddTool(ID_SampleItem+2, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION));
@ -794,9 +795,9 @@ MyFrame::MyFrame(wxWindow* parent,
wxAuiToolBar* tb2 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_HORIZONTAL);
tb2->SetToolBitmapSize(wxSize(16,16));
tb2->SetToolBitmapSize(FromDIP(wxSize(16,16)));
wxBitmap tb2_bmp1 = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(16,16));
wxBitmap tb2_bmp1 = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, FromDIP(wxSize(16,16)));
tb2->AddTool(ID_SampleItem+6, wxT("Disabled"), tb2_bmp1);
tb2->AddTool(ID_SampleItem+7, wxT("Test"), tb2_bmp1);
tb2->AddTool(ID_SampleItem+8, wxT("Test"), tb2_bmp1);
@ -816,8 +817,8 @@ MyFrame::MyFrame(wxWindow* parent,
wxAuiToolBar* tb3 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
tb3->SetToolBitmapSize(wxSize(16,16));
wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16));
tb3->SetToolBitmapSize(FromDIP(wxSize(16,16)));
wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, FromDIP(wxSize(16,16)));
tb3->AddTool(ID_SampleItem+16, wxT("Check 1"), tb3_bmp1, wxT("Check 1"), wxITEM_CHECK);
tb3->AddTool(ID_SampleItem+17, wxT("Check 2"), tb3_bmp1, wxT("Check 2"), wxITEM_CHECK);
tb3->AddTool(ID_SampleItem+18, wxT("Check 3"), tb3_bmp1, wxT("Check 3"), wxITEM_CHECK);
@ -839,8 +840,8 @@ MyFrame::MyFrame(wxWindow* parent,
wxAUI_TB_OVERFLOW |
wxAUI_TB_TEXT |
wxAUI_TB_HORZ_TEXT);
tb4->SetToolBitmapSize(wxSize(16,16));
wxBitmap tb4_bmp1 = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
tb4->SetToolBitmapSize(FromDIP(wxSize(16,16)));
wxBitmap tb4_bmp1 = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, FromDIP(wxSize(16,16)));
tb4->AddTool(ID_DropDownToolbarItem, wxT("Item 1"), tb4_bmp1);
tb4->AddTool(ID_SampleItem+23, wxT("Item 2"), tb4_bmp1);
tb4->AddTool(ID_SampleItem+24, wxT("Item 3"), tb4_bmp1);
@ -861,7 +862,7 @@ MyFrame::MyFrame(wxWindow* parent,
wxAuiToolBar* tb5 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_VERTICAL);
tb5->SetToolBitmapSize(wxSize(48,48));
tb5->SetToolBitmapSize(FromDIP(wxSize(48,48)));
tb5->AddTool(ID_SampleItem+30, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR));
tb5->AddSeparator();
tb5->AddTool(ID_SampleItem+31, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION));
@ -911,7 +912,7 @@ MyFrame::MyFrame(wxWindow* parent,
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test9")).Caption(wxT("Min Size 200x100")).
BestSize(wxSize(200,100)).MinSize(wxSize(200,100)).
BestSize(FromDIP(wxSize(200,100))).MinSize(FromDIP(wxSize(200,100))).
Bottom().Layer(1).
CloseButton(true).MaximizeButton(true));
@ -1396,7 +1397,7 @@ void MyFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& evt)
wxPoint MyFrame::GetStartPosition()
{
static int x = 0;
x += 20;
x += FromDIP(20);
wxPoint pt = ClientToScreen(wxPoint(0,0));
return wxPoint(pt.x + x, pt.y + x);
}
@ -1406,7 +1407,7 @@ void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
Caption(wxT("Tree Control")).
Float().FloatingPosition(GetStartPosition()).
FloatingSize(wxSize(150,300)));
FloatingSize(FromDIP(wxSize(150,300))));
m_mgr.Update();
}
@ -1415,7 +1416,7 @@ void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().
Caption(wxT("Grid")).
Float().FloatingPosition(GetStartPosition()).
FloatingSize(wxSize(300,200)));
FloatingSize(FromDIP(wxSize(300,200))));
m_mgr.Update();
}
@ -1424,7 +1425,7 @@ void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().
Caption(wxT("HTML Control")).
Float().FloatingPosition(GetStartPosition()).
FloatingSize(wxSize(300,200)));
FloatingSize(FromDIP(wxSize(300,200))));
m_mgr.Update();
}
@ -1433,7 +1434,7 @@ void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().
Caption(wxT("Notebook")).
Float().FloatingPosition(GetStartPosition()).
//FloatingSize(300,200).
//FloatingSize(FromDIP(wxSize(300,200))).
CloseButton(true).MaximizeButton(true));
m_mgr.Update();
}
@ -1477,7 +1478,7 @@ void MyFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& evt)
// create the popup menu
wxMenu menuPopup;
wxBitmap bmp = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(16,16));
wxBitmap bmp = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, FromDIP(wxSize(16,16)));
wxMenuItem* m1 = new wxMenuItem(&menuPopup, 10001, _("Drop Down Item 1"));
m1->SetBitmap(bmp);
@ -1555,7 +1556,7 @@ wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text)
text.Printf(wxT("This is text box %d"), ++n);
return new wxTextCtrl(this,wxID_ANY, text,
wxPoint(0,0), wxSize(150,90),
wxPoint(0,0), FromDIP(wxSize(150,90)),
wxNO_BORDER | wxTE_MULTILINE);
}
@ -1564,7 +1565,7 @@ wxGrid* MyFrame::CreateGrid()
{
wxGrid* grid = new wxGrid(this, wxID_ANY,
wxPoint(0,0),
wxSize(150,250),
FromDIP(wxSize(150,250)),
wxNO_BORDER | wxWANTS_CHARS);
grid->CreateGrid(50, 20);
return grid;
@ -1573,12 +1574,14 @@ wxGrid* MyFrame::CreateGrid()
wxTreeCtrl* MyFrame::CreateTreeCtrl()
{
wxTreeCtrl* tree = new wxTreeCtrl(this, wxID_ANY,
wxPoint(0,0), wxSize(160,250),
wxPoint(0,0),
FromDIP(wxSize(160,250)),
wxTR_DEFAULT_STYLE | wxNO_BORDER);
wxImageList* imglist = new wxImageList(16, 16, true, 2);
imglist->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16)));
imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)));
wxSize size = FromDIP(wxSize(16, 16));
wxImageList* imglist = new wxImageList(size.x, size.y, true, 2);
imglist->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, size));
imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, size));
tree->AssignImageList(imglist);
wxTreeItemId root = tree->AddRoot(wxT("wxAUI Project"), 0);
@ -1610,11 +1613,11 @@ wxTreeCtrl* MyFrame::CreateTreeCtrl()
return tree;
}
wxSizeReportCtrl* MyFrame::CreateSizeReportCtrl(int width, int height)
wxSizeReportCtrl* MyFrame::CreateSizeReportCtrl(const wxSize& size)
{
wxSizeReportCtrl* ctrl = new wxSizeReportCtrl(this, wxID_ANY,
wxDefaultPosition,
wxSize(width, height), &m_mgr);
size, &m_mgr);
return ctrl;
}
@ -1625,7 +1628,7 @@ wxHtmlWindow* MyFrame::CreateHTMLCtrl(wxWindow* parent)
wxHtmlWindow* ctrl = new wxHtmlWindow(parent, wxID_ANY,
wxDefaultPosition,
wxSize(400,300));
FromDIP(wxSize(400,300)));
ctrl->SetPage(GetIntroText());
return ctrl;
}
@ -1637,11 +1640,11 @@ wxAuiNotebook* MyFrame::CreateNotebook()
wxAuiNotebook* ctrl = new wxAuiNotebook(this, wxID_ANY,
wxPoint(client_size.x, client_size.y),
wxSize(430,200),
FromDIP(wxSize(430,200)),
m_notebook_style);
ctrl->Freeze();
wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, FromDIP(wxSize(16,16)));
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp);
ctrl->SetPageToolTip(0, "Welcome to wxAUI (this is a page tooltip)");
@ -1651,14 +1654,14 @@ wxAuiNotebook* MyFrame::CreateNotebook()
flex->AddGrowableRow( 0 );
flex->AddGrowableRow( 3 );
flex->AddGrowableCol( 1 );
flex->Add( 5,5 ); flex->Add( 5,5 );
flex->Add( new wxStaticText( panel, -1, wxT("wxTextCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 );
flex->Add( new wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, wxSize(100,-1)),
1, wxALL|wxALIGN_CENTRE, 5 );
flex->Add( new wxStaticText( panel, -1, wxT("wxSpinCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 );
flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) );
flex->Add( new wxStaticText( panel, -1, wxT("wxTextCtrl:") ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( new wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, FromDIP(wxSize(100,-1))),
1, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( new wxStaticText( panel, -1, wxT("wxSpinCtrl:") ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( new wxSpinCtrl( panel, -1, wxT("5"), wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
flex->Add( 5,5 ); flex->Add( 5,5 );
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) );
panel->SetSizer( flex );
ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp );

View File

@ -132,9 +132,9 @@ wxAuiGenericToolBarArt::wxAuiGenericToolBarArt()
m_textOrientation = wxAUI_TBTOOL_TEXT_BOTTOM;
m_highlightColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
m_separatorSize = 7;
m_gripperSize = 7;
m_overflowSize = 16;
m_separatorSize = wxWindow::FromDIP( 7, NULL);
m_gripperSize = wxWindow::FromDIP( 7, NULL);
m_overflowSize = wxWindow::FromDIP(16, NULL);
wxColor darker1Colour = m_baseColour.ChangeLightness(85);
wxColor darker2Colour = m_baseColour.ChangeLightness(75);
@ -142,10 +142,12 @@ wxAuiGenericToolBarArt::wxAuiGenericToolBarArt()
wxColor darker4Colour = m_baseColour.ChangeLightness(50);
wxColor darker5Colour = m_baseColour.ChangeLightness(40);
m_gripperPen1 = wxPen(darker5Colour);
m_gripperPen2 = wxPen(darker3Colour);
m_gripperPen3 = *wxWHITE_PEN;
int pen_width = wxWindow::FromDIP(1, NULL);
m_gripperPen1 = wxPen(darker5Colour, pen_width);
m_gripperPen2 = wxPen(darker3Colour, pen_width);
m_gripperPen3 = wxPen(*wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE), pen_width);
// TODO: Provide x1.5 and x2.0 versions or migrate to SVG.
static const unsigned char buttonDropdownBits[] = { 0xe0, 0xf1, 0xfb };
static const unsigned char overflowBits[] = { 0x80, 0xff, 0x80, 0xc1, 0xe3, 0xf7 };
@ -272,7 +274,7 @@ void wxAuiGenericToolBarArt::DrawLabel(
void wxAuiGenericToolBarArt::DrawButton(
wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect)
{
@ -307,13 +309,13 @@ void wxAuiGenericToolBarArt::DrawButton(
}
else if (m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT)
{
bmpX = rect.x + 3;
bmpX = rect.x + wnd->FromDIP(3);
bmpY = rect.y +
(rect.height/2) -
(item.GetBitmap().GetScaledHeight()/2);
textX = bmpX + 3 + item.GetBitmap().GetScaledWidth();
textX = bmpX + wnd->FromDIP(3) + item.GetBitmap().GetScaledWidth();
textY = rect.y +
(rect.height/2) -
(textHeight/2);
@ -383,20 +385,21 @@ void wxAuiGenericToolBarArt::DrawButton(
void wxAuiGenericToolBarArt::DrawDropDownButton(
wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect)
{
wxSize dropdownSize = wnd->FromDIP(wxSize(BUTTON_DROPDOWN_WIDTH, 0));
int textWidth = 0, textHeight = 0, textX = 0, textY = 0;
int bmpX = 0, bmpY = 0, dropBmpX = 0, dropBmpY = 0;
wxRect buttonRect = wxRect(rect.x,
rect.y,
rect.width-BUTTON_DROPDOWN_WIDTH,
rect.width-dropdownSize.x,
rect.height);
wxRect dropDownRect = wxRect(rect.x+rect.width-BUTTON_DROPDOWN_WIDTH-1,
wxRect dropDownRect = wxRect(rect.x+rect.width-dropdownSize.x-1,
rect.y,
BUTTON_DROPDOWN_WIDTH+1,
dropdownSize.x+1,
rect.height);
if (m_flags & wxAUI_TB_TEXT)
@ -437,13 +440,13 @@ void wxAuiGenericToolBarArt::DrawDropDownButton(
}
else if (m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT)
{
bmpX = rect.x + 3;
bmpX = rect.x + wnd->FromDIP(3);
bmpY = rect.y +
(rect.height/2) -
(item.GetBitmap().GetScaledHeight()/2);
textX = bmpX + 3 + item.GetBitmap().GetScaledWidth();
textX = bmpX + wnd->FromDIP(3) + item.GetBitmap().GetScaledWidth();
textY = rect.y +
(rect.height/2) -
(textHeight/2);
@ -588,11 +591,11 @@ wxSize wxAuiGenericToolBarArt::GetLabelSize(
wxSize wxAuiGenericToolBarArt::GetToolSize(
wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxAuiToolBarItem& item)
{
if (!item.GetBitmap().IsOk() && !(m_flags & wxAUI_TB_TEXT))
return wxSize(16,16);
return wnd->FromDIP(wxSize(16,16));
int width = item.GetBitmap().GetScaledWidth();
int height = item.GetBitmap().GetScaledHeight();
@ -610,14 +613,14 @@ wxSize wxAuiGenericToolBarArt::GetToolSize(
if ( !item.GetLabel().empty() )
{
dc.GetTextExtent(item.GetLabel(), &tx, &ty);
width = wxMax(width, tx+6);
width = wxMax(width, tx+wnd->FromDIP(6));
}
}
else if ( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT &&
!item.GetLabel().empty() )
{
width += 3; // space between left border and bitmap
width += 3; // space between bitmap and text
width += wnd->FromDIP(3); // space between left border and bitmap
width += wnd->FromDIP(3); // space between bitmap and text
if ( !item.GetLabel().empty() )
{
@ -630,14 +633,17 @@ wxSize wxAuiGenericToolBarArt::GetToolSize(
// if the tool has a dropdown button, add it to the width
if (item.HasDropDown())
width += (BUTTON_DROPDOWN_WIDTH+4);
{
wxSize dropdownSize = wnd->FromDIP(wxSize(BUTTON_DROPDOWN_WIDTH, 0));
width += dropdownSize.x + wnd->FromDIP(4);
}
return wxSize(width, height);
}
void wxAuiGenericToolBarArt::DrawSeparator(
wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxRect& _rect)
{
bool horizontal = true;
@ -649,7 +655,7 @@ void wxAuiGenericToolBarArt::DrawSeparator(
if (horizontal)
{
rect.x += (rect.width/2);
rect.width = 1;
rect.width = wnd->FromDIP(1);
int new_height = (rect.height*3)/4;
rect.y += (rect.height/2) - (new_height/2);
rect.height = new_height;
@ -657,7 +663,7 @@ void wxAuiGenericToolBarArt::DrawSeparator(
else
{
rect.y += (rect.height/2);
rect.height = 1;
rect.height = wnd->FromDIP(1);
int new_width = (rect.width*3)/4;
rect.x += (rect.width/2) - (new_width/2);
rect.width = new_width;
@ -669,7 +675,7 @@ void wxAuiGenericToolBarArt::DrawSeparator(
}
void wxAuiGenericToolBarArt::DrawGripper(wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxRect& rect)
{
int i = 0;
@ -679,28 +685,28 @@ void wxAuiGenericToolBarArt::DrawGripper(wxDC& dc,
if (m_flags & wxAUI_TB_VERTICAL)
{
x = rect.x + (i*4) + 5;
y = rect.y + 3;
if (x > rect.GetWidth()-5)
x = rect.x + (i*wnd->FromDIP(4)) + wnd->FromDIP(5);
y = rect.y + wnd->FromDIP(3);
if (x > rect.GetWidth()-wnd->FromDIP(5))
break;
}
else
{
x = rect.x + 3;
y = rect.y + (i*4) + 5;
if (y > rect.GetHeight()-5)
x = rect.x + wnd->FromDIP(3);
y = rect.y + (i*wnd->FromDIP(4)) + wnd->FromDIP(5);
if (y > rect.GetHeight()-wnd->FromDIP(5))
break;
}
dc.SetPen(m_gripperPen1);
dc.DrawPoint(x, y);
dc.SetPen(m_gripperPen2);
dc.DrawPoint(x, y+1);
dc.DrawPoint(x+1, y);
dc.DrawPoint(x , y+wnd->FromDIP(1));
dc.DrawPoint(x+wnd->FromDIP(1), y );
dc.SetPen(m_gripperPen3);
dc.DrawPoint(x+2, y+1);
dc.DrawPoint(x+2, y+2);
dc.DrawPoint(x+1, y+2);
dc.DrawPoint(x+wnd->FromDIP(2), y+wnd->FromDIP(1));
dc.DrawPoint(x+wnd->FromDIP(2), y+wnd->FromDIP(2));
dc.DrawPoint(x+wnd->FromDIP(1), y+wnd->FromDIP(2));
i++;
}
@ -708,7 +714,7 @@ void wxAuiGenericToolBarArt::DrawGripper(wxDC& dc,
}
void wxAuiGenericToolBarArt::DrawOverflowButton(wxDC& dc,
wxWindow* /*wnd*/,
wxWindow* WXUNUSED(wnd),
const wxRect& rect,
int state)
{
@ -861,8 +867,8 @@ void wxAuiToolBar::Init()
m_actionItem = NULL;
m_tipItem = NULL;
m_art = new wxAuiDefaultToolBarArt;
m_toolPacking = 2;
m_toolBorderPadding = 3;
m_toolPacking = FromDIP(2);
m_toolBorderPadding = FromDIP(3);
m_toolTextOrientation = wxAUI_TBTOOL_TEXT_BOTTOM;
m_gripperSizerItem = NULL;
m_overflowSizerItem = NULL;
@ -895,7 +901,9 @@ bool wxAuiToolBar::Create(wxWindow* parent,
m_orientation = wxHORIZONTAL;
}
SetMargins(5, 5, 2, 2);
wxSize margin_lt = FromDIP(wxSize(5, 5));
wxSize margin_rb = FromDIP(wxSize(2, 2));
SetMargins(margin_lt.x, margin_lt.y, margin_rb.x, margin_rb.y);
SetFont(*wxNORMAL_FONT);
SetArtFlags();
SetExtraStyle(wxWS_EX_PROCESS_IDLE);
@ -1272,7 +1280,7 @@ void wxAuiToolBar::SetToolBitmapSize(const wxSize& WXUNUSED(size))
wxSize wxAuiToolBar::GetToolBitmapSize() const
{
// TODO: wxToolBar compatibility
return wxSize(16,15);
return FromDIP(wxSize(16,15));
}
void wxAuiToolBar::SetToolProportion(int tool_id, int proportion)
@ -1304,7 +1312,7 @@ int wxAuiToolBar::GetToolSeparation() const
if (m_art)
return m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE);
else
return 5;
return FromDIP(5);
}
@ -2620,8 +2628,9 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt)
int mouse_x = evt.GetX();
wxRect rect = m_actionItem->m_sizerItem->GetRect();
wxSize dropdownSize = FromDIP(wxSize(BUTTON_DROPDOWN_WIDTH, 0));
const bool dropDownHit = m_actionItem->m_dropDown &&
mouse_x >= (rect.x+rect.width-BUTTON_DROPDOWN_WIDTH-1) &&
mouse_x > (rect.x+rect.width-dropdownSize.x) &&
mouse_x < (rect.x+rect.width);
e.SetDropDownClicked(dropDownHit);

View File

@ -517,7 +517,11 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
}
if (button.id == wxAUI_BUTTON_RIGHT)
{
if (visible_width < m_rect.GetWidth() - ((int)button_count*16))
int button_width = 0;
for (i = 0; i < button_count; ++i)
button_width += m_buttons.Item(button_count - i - 1).rect.GetWidth();
if (visible_width < m_rect.GetWidth() - button_width)
button.curState |= wxAUI_BUTTON_STATE_DISABLED;
else
button.curState &= ~wxAUI_BUTTON_STATE_DISABLED;
@ -651,7 +655,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
}
rect.x = offset;
rect.width = m_rect.width - right_buttons_width - offset - 2;
rect.width = m_rect.width - right_buttons_width - offset - wnd->FromDIP(2);
if (rect.width <= 0)
break;
@ -796,7 +800,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin
wxAuiTabContainerButton& tab_button = m_tabCloseButtons.Item(i);
rect.x = offset;
rect.width = m_rect.width - right_buttons_width - offset - 2;
rect.width = m_rect.width - right_buttons_width - offset - wnd->FromDIP(2);
if (rect.width <= 0)
return false; // haven't found the tab, and we've run out of space, so return false
@ -816,7 +820,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin
{
// If not all of the tab is visible, and supposing there's space to display it all,
// we could do better so we return false.
if (((m_rect.width - right_buttons_width - offset - 2) <= 0) && ((m_rect.width - right_buttons_width - left_buttons_width) > x_extent))
if (((m_rect.width - right_buttons_width - offset - wnd->FromDIP(2)) <= 0) && ((m_rect.width - right_buttons_width - left_buttons_width) > x_extent))
return false;
else
return true;
@ -1501,8 +1505,8 @@ public:
wxTabFrame()
{
m_tabs = NULL;
m_rect = wxRect(0,0,200,200);
m_tabCtrlHeight = 20;
m_rect = wxRect(wxPoint(0,0), FromDIP(wxSize(200,200)));
m_tabCtrlHeight = FromDIP(20);
}
~wxTabFrame()
@ -1672,7 +1676,7 @@ void wxAuiNotebook::Init()
m_curPage = -1;
m_tabIdCounter = wxAuiBaseTabCtrlId;
m_dummyWnd = NULL;
m_tabCtrlHeight = 20;
m_tabCtrlHeight = FromDIP(20);
m_requestedBmpSize = wxDefaultSize;
m_requestedTabCtrlHeight = -1;
}
@ -1700,7 +1704,7 @@ void wxAuiNotebook::InitNotebook(long style)
m_tabIdCounter = wxAuiBaseTabCtrlId;
m_dummyWnd = NULL;
m_flags = (unsigned int)style;
m_tabCtrlHeight = 20;
m_tabCtrlHeight = FromDIP(20);
m_normalFont = *wxNORMAL_FONT;
m_selectedFont = *wxNORMAL_FONT;
@ -1709,7 +1713,7 @@ void wxAuiNotebook::InitNotebook(long style)
SetArtProvider(new wxAuiDefaultTabArt);
m_dummyWnd = new wxWindow(this, wxID_ANY, wxPoint(0,0), wxSize(0,0));
m_dummyWnd->SetSize(200, 200);
m_dummyWnd->SetSize(FromDIP(wxSize(200, 200)));
m_dummyWnd->Show(false);
m_mgr.SetManagedWindow(this);
@ -1870,7 +1874,7 @@ wxSize wxAuiNotebook::CalculateNewSplitSize()
{
// this is in place of a more complicated calculation
// that needs to be implemented
new_split_size = wxSize(180,180);
new_split_size = FromDIP(wxSize(180,180));
}
return new_split_size;

View File

@ -174,13 +174,13 @@ void wxAuiMSWToolBarArt::DrawButton(
}
else if ( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
{
bmpX = rect.x + 3;
bmpX = rect.x + wnd->FromDIP(3);
bmpY = rect.y +
(rect.height / 2) -
(item.GetBitmap().GetHeight() / 2);
textX = bmpX + 3 + item.GetBitmap().GetWidth();
textX = bmpX + wnd->FromDIP(3) + item.GetBitmap().GetWidth();
textY = rect.y +
(rect.height / 2) -
(textHeight / 2);
@ -219,7 +219,7 @@ void wxAuiMSWToolBarArt::DrawDropDownButton(
{
wxUxThemeHandle hTheme(wnd, L"Toolbar");
int dropDownWidth = 14;
int dropDownWidth = wnd->FromDIP(14);
int textWidth = 0, textHeight = 0, textX = 0, textY = 0;
int bmpX = 0, bmpY = 0;
@ -292,13 +292,13 @@ void wxAuiMSWToolBarArt::DrawDropDownButton(
}
else if ( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
{
bmpX = rect.x + 3;
bmpX = rect.x + wnd->FromDIP(3);
bmpY = rect.y +
(rect.height / 2) -
(item.GetBitmap().GetHeight() / 2);
textX = bmpX + 3 + item.GetBitmap().GetWidth();
textX = bmpX + wnd->FromDIP(3) + item.GetBitmap().GetWidth();
textY = rect.y +
(rect.height / 2) -
(textHeight / 2);
@ -444,7 +444,7 @@ wxSize wxAuiMSWToolBarArt::GetToolSize(
wxSize size = wxAuiGenericToolBarArt::GetToolSize(dc, wnd, item);
size.IncBy(3); // Add some padding for native theme
size.IncBy(wnd->FromDIP(wxSize(3, 3))); // Add some padding for native theme
return size;
}

View File

@ -194,9 +194,10 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt()
m_gripperBrush = wxBrush(baseColour);
m_borderPen = wxPen(darker2Colour);
m_gripperPen1 = wxPen(darker5Colour);
m_gripperPen2 = wxPen(darker3Colour);
m_gripperPen3 = *wxWHITE_PEN;
int pen_width = wxWindow::FromDIP(1, NULL);
m_gripperPen1 = wxPen(darker5Colour, pen_width);
m_gripperPen2 = wxPen(darker3Colour, pen_width);
m_gripperPen3 = wxPen(*wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE), pen_width);
#ifdef __WXMAC__
m_captionFont = *wxSMALL_FONT;
@ -208,16 +209,16 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt()
#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
SInt32 height;
GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height );
m_sashSize = height;
m_sashSize = height;
#elif defined(__WXGTK__)
m_sashSize = wxRendererNative::Get().GetSplitterParams(NULL).widthSash;
m_sashSize = wxRendererNative::Get().GetSplitterParams(NULL).widthSash;
#else
m_sashSize = 4;
m_sashSize = wxWindow::FromDIP( 4, NULL);
#endif
m_captionSize = 17;
m_borderSize = 1;
m_buttonSize = 14;
m_gripperSize = 9;
m_captionSize = wxWindow::FromDIP(17, NULL);
m_borderSize = 1;
m_buttonSize = wxWindow::FromDIP(14, NULL);
m_gripperSize = wxWindow::FromDIP( 9, NULL);
m_gradientType = wxAUI_GRADIENT_VERTICAL;
InitBitmaps();
@ -227,6 +228,7 @@ void
wxAuiDefaultDockArt::InitBitmaps ()
{
// some built in bitmaps
// TODO: Provide x1.5 and x2.0 versions or migrate to SVG.
#if defined( __WXMAC__ )
static const unsigned char close_bits[]={
0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
@ -584,7 +586,8 @@ void wxAuiDefaultDockArt::DrawCaptionBackground(wxDC& dc, const wxRect& rect, bo
}
void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
void wxAuiDefaultDockArt::DrawCaption(wxDC& dc,
wxWindow* window,
const wxString& text,
const wxRect& rect,
wxAuiPaneInfo& pane)
@ -598,9 +601,9 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
int caption_offset = 0;
if ( pane.icon.IsOk() )
{
DrawIcon(dc, rect, pane);
DrawIcon(dc, window, rect, pane);
caption_offset += pane.icon.GetScaledWidth() + 3;
caption_offset += pane.icon.GetScaledWidth() + window->FromDIP(3);
}
if (pane.state & wxAuiPaneInfo::optionActive)
@ -613,8 +616,8 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);
wxRect clip_rect = rect;
clip_rect.width -= 3; // text offset
clip_rect.width -= 2; // button padding
clip_rect.width -= window->FromDIP(3); // text offset
clip_rect.width -= window->FromDIP(2); // button padding
if (pane.HasCloseButton())
clip_rect.width -= m_buttonSize;
if (pane.HasPinButton())
@ -625,20 +628,21 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
wxString draw_text = wxAuiChopText(dc, text, clip_rect.width);
dc.SetClippingRegion(clip_rect);
dc.DrawText(draw_text, rect.x+3 + caption_offset, rect.y+(rect.height/2)-(h/2)-1);
dc.DrawText(draw_text, rect.x+window->FromDIP(3) + caption_offset, rect.y+(rect.height/2)-(h/2)-1);
dc.DestroyClippingRegion();
}
void
wxAuiDefaultDockArt::DrawIcon(wxDC& dc, const wxRect& rect, wxAuiPaneInfo& pane)
wxAuiDefaultDockArt::DrawIcon(wxDC& dc, wxWindow *window, const wxRect& rect, wxAuiPaneInfo& pane)
{
// Draw the icon centered vertically
dc.DrawBitmap(pane.icon,
rect.x+2, rect.y+(rect.height-pane.icon.GetScaledHeight())/2,
true);
// Draw the icon centered vertically
dc.DrawBitmap(pane.icon,
rect.x+window->FromDIP(2), rect.y+(rect.height-pane.icon.GetScaledHeight())/2,
true);
}
void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window),
void wxAuiDefaultDockArt::DrawGripper(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxAuiPaneInfo& pane)
{
@ -649,47 +653,48 @@ void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window),
if (!pane.HasGripperTop())
{
int y = 5;
int y = window->FromDIP(5);
while (1)
{
dc.SetPen(m_gripperPen1);
dc.DrawPoint(rect.x+3, rect.y+y);
dc.DrawPoint(rect.x+window->FromDIP(3), rect.y+y);
dc.SetPen(m_gripperPen2);
dc.DrawPoint(rect.x+3, rect.y+y+1);
dc.DrawPoint(rect.x+4, rect.y+y);
dc.DrawPoint(rect.x+window->FromDIP(3), rect.y+y+window->FromDIP(1));
dc.DrawPoint(rect.x+window->FromDIP(4), rect.y+y );
dc.SetPen(m_gripperPen3);
dc.DrawPoint(rect.x+5, rect.y+y+1);
dc.DrawPoint(rect.x+5, rect.y+y+2);
dc.DrawPoint(rect.x+4, rect.y+y+2);
dc.DrawPoint(rect.x+window->FromDIP(5), rect.y+y+window->FromDIP(1));
dc.DrawPoint(rect.x+window->FromDIP(5), rect.y+y+window->FromDIP(2));
dc.DrawPoint(rect.x+window->FromDIP(4), rect.y+y+window->FromDIP(2));
y += 4;
if (y > rect.GetHeight()-5)
y += window->FromDIP(4);
if (y > rect.GetHeight()-window->FromDIP(5))
break;
}
}
else
{
int x = 5;
int x = window->FromDIP(5);
while (1)
{
dc.SetPen(m_gripperPen1);
dc.DrawPoint(rect.x+x, rect.y+3);
dc.DrawPoint(rect.x+x, rect.y+window->FromDIP(3));
dc.SetPen(m_gripperPen2);
dc.DrawPoint(rect.x+x+1, rect.y+3);
dc.DrawPoint(rect.x+x, rect.y+4);
dc.DrawPoint(rect.x+x+window->FromDIP(1), rect.y+window->FromDIP(3));
dc.DrawPoint(rect.x+x , rect.y+window->FromDIP(4));
dc.SetPen(m_gripperPen3);
dc.DrawPoint(rect.x+x+1, rect.y+5);
dc.DrawPoint(rect.x+x+2, rect.y+5);
dc.DrawPoint(rect.x+x+2, rect.y+4);
dc.DrawPoint(rect.x+x+window->FromDIP(1), rect.y+window->FromDIP(5));
dc.DrawPoint(rect.x+x+window->FromDIP(2), rect.y+window->FromDIP(5));
dc.DrawPoint(rect.x+x+window->FromDIP(2), rect.y+window->FromDIP(4));
x += 4;
if (x > rect.GetWidth()-5)
x += window->FromDIP(4);
if (x > rect.GetWidth()-window->FromDIP(5))
break;
}
}
}
void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window),
void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc,
wxWindow* window,
int button,
int button_state,
const wxRect& _rect,
@ -739,8 +744,8 @@ void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window),
if (button_state == wxAUI_BUTTON_STATE_PRESSED)
{
rect.x++;
rect.y++;
rect.x += window->FromDIP(1);
rect.y += window->FromDIP(1);
}
if (button_state == wxAUI_BUTTON_STATE_HOVER ||
@ -758,7 +763,7 @@ void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window),
}
// draw the background behind the button
dc.DrawRectangle(rect.x, rect.y, 15, 15);
dc.DrawRectangle(rect.x, rect.y, 16-window->FromDIP(1), 16-window->FromDIP(1));
}

View File

@ -236,6 +236,7 @@ void wxAuiFloatingFrame::OnMoveEvent(wxMoveEvent& event)
#ifndef __WXOSX__
// skip if moving too fast to avoid massive redraws and
// jumping hint windows
// TODO: Should 3x3px threshold increase on Retina displays?
if ((abs(winRect.x - m_lastRect.x) > 3) ||
(abs(winRect.y - m_lastRect.y) > 3))
{

View File

@ -116,12 +116,10 @@ public:
{
if (m_canSetShape)
{
int w=100; // some defaults
int h=100;
GetClientSize(&w, &h);
wxSize size = GetClientSize();
m_maxWidth = w;
m_maxHeight = h;
m_maxWidth = size.x;
m_maxHeight = size.y;
m_amount = alpha;
m_region.Clear();
// m_region.Union(0, 0, 1, m_maxWidth);
@ -299,6 +297,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame);
static wxBitmap wxPaneCreateStippleBitmap()
{
// TODO: Provide x1.5 and x2.0 versions.
unsigned char data[] = { 0,0,0,192,192,192, 192,192,192,0,0,0 };
wxImage img(2,2,data,true);
return wxBitmap(img);
@ -1836,7 +1835,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont,
// of them to ease visual crowding
if (button_count >= 1)
{
caption_sizer->Add(3,1);
caption_sizer->Add(m_frame->FromDIP(3),1);
}
// add the caption sizer
@ -2227,8 +2226,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
size = wxMin(size, max_dock_x_size);
// absolute minimum size for a dock is 10 pixels
if (size < 10)
size = 10;
size = wxMax(size, m_frame->FromDIP(10));
dock.size = size;
}
@ -2892,13 +2890,14 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
// (or near to the outside of the window), if so, dock it along the edge
int layer_insert_offset = auiLayerInsertOffset;
if (drop.IsToolbar())
layer_insert_offset = 0;
wxSize layer_insert_offset;
if (!drop.IsToolbar())
layer_insert_offset = m_frame->FromDIP(wxSize(auiLayerInsertOffset, auiLayerInsertOffset));
wxSize layer_insert_pixels = m_frame->FromDIP(wxSize(auiLayerInsertPixels, auiLayerInsertPixels));
if (pt.x < layer_insert_offset &&
pt.x > layer_insert_offset-auiLayerInsertPixels &&
if (pt.x < layer_insert_offset.x &&
pt.x > layer_insert_offset.x-layer_insert_pixels.x &&
pt.y > 0 &&
pt.y < cli_size.y)
{
@ -2915,8 +2914,8 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
Position(pt.y - GetDockPixelOffset(drop) - offset.y);
return ProcessDockResult(target, drop);
}
else if (pt.y < layer_insert_offset &&
pt.y > layer_insert_offset-auiLayerInsertPixels &&
else if (pt.y < layer_insert_offset.y &&
pt.y > layer_insert_offset.y-layer_insert_pixels.y &&
pt.x > 0 &&
pt.x < cli_size.x)
{
@ -2933,8 +2932,8 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
Position(pt.x - GetDockPixelOffset(drop) - offset.x);
return ProcessDockResult(target, drop);
}
else if (pt.x >= cli_size.x - layer_insert_offset &&
pt.x < cli_size.x - layer_insert_offset + auiLayerInsertPixels &&
else if (pt.x >= cli_size.x - layer_insert_offset.x &&
pt.x < cli_size.x - layer_insert_offset.x + layer_insert_pixels.x &&
pt.y > 0 &&
pt.y < cli_size.y)
{
@ -2951,8 +2950,8 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
Position(pt.y - GetDockPixelOffset(drop) - offset.y);
return ProcessDockResult(target, drop);
}
else if (pt.y >= cli_size.y - layer_insert_offset &&
pt.y < cli_size.y - layer_insert_offset + auiLayerInsertPixels &&
else if (pt.y >= cli_size.y - layer_insert_offset.y &&
pt.y < cli_size.y - layer_insert_offset.y + layer_insert_pixels.y &&
pt.x > 0 &&
pt.x < cli_size.x)
{
@ -3018,7 +3017,7 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
m_skipping = false;
m_lastRect = part->dock->rect;
m_lastRect.Inflate( 15, 15 );
m_lastRect.Inflate( m_frame->FromDIP(wxSize(15, 15)) );
drop.Dock().
Direction(part->dock->dock_direction).
@ -3153,26 +3152,27 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
int insert_row = part->pane->dock_row;
int insert_dir = part->pane->dock_direction;
int insert_layer = part->pane->dock_layer;
wxSize insert_row_pixels = m_frame->FromDIP(wxSize(auiInsertRowPixels, auiInsertRowPixels));
switch (part->pane->dock_direction)
{
case wxAUI_DOCK_TOP:
if (pt.y >= part->rect.y &&
pt.y < part->rect.y+auiInsertRowPixels)
pt.y < part->rect.y+insert_row_pixels.y)
insert_dock_row = true;
break;
case wxAUI_DOCK_BOTTOM:
if (pt.y > part->rect.y+part->rect.height-auiInsertRowPixels &&
if (pt.y > part->rect.y+part->rect.height-insert_row_pixels.y &&
pt.y <= part->rect.y + part->rect.height)
insert_dock_row = true;
break;
case wxAUI_DOCK_LEFT:
if (pt.x >= part->rect.x &&
pt.x < part->rect.x+auiInsertRowPixels)
pt.x < part->rect.x+insert_row_pixels.x)
insert_dock_row = true;
break;
case wxAUI_DOCK_RIGHT:
if (pt.x > part->rect.x+part->rect.width-auiInsertRowPixels &&
if (pt.x > part->rect.x+part->rect.width-insert_row_pixels.x &&
pt.x <= part->rect.x+part->rect.width)
insert_dock_row = true;
break;
@ -3180,8 +3180,9 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
{
// "new row pixels" will be set to the default, but
// must never exceed 20% of the window size
int new_row_pixels_x = auiNewRowPixels;
int new_row_pixels_y = auiNewRowPixels;
wxSize new_row_pixels = m_frame->FromDIP(wxSize(auiNewRowPixels, auiNewRowPixels));
int new_row_pixels_x = new_row_pixels.x;
int new_row_pixels_y = new_row_pixels.y;
if (new_row_pixels_x > (part->rect.width*20)/100)
new_row_pixels_x = (part->rect.width*20)/100;
@ -3361,9 +3362,9 @@ void wxAuiManager::ShowHint(const wxRect& rect)
wxRect r = pane.frame->GetRect();
#ifdef __WXGTK__
// wxGTK returns the client size, not the whole frame size
r.width += 15;
r.height += 35;
r.Inflate(5);
r.width += pane.frame->FromDIP(15);
r.height += pane.frame->FromDIP(35);
r.Inflate(pane.frame->FromDIP(wxSize(5, 5)));
#endif
clip.Subtract(r);
@ -3382,10 +3383,10 @@ void wxAuiManager::ShowHint(const wxRect& rect)
screendc.SetBrush(brush);
screendc.SetPen(*wxTRANSPARENT_PEN);
screendc.DrawRectangle(rect.x, rect.y, 5, rect.height);
screendc.DrawRectangle(rect.x+5, rect.y, rect.width-10, 5);
screendc.DrawRectangle(rect.x+rect.width-5, rect.y, 5, rect.height);
screendc.DrawRectangle(rect.x+5, rect.y+rect.height-5, rect.width-10, 5);
screendc.DrawRectangle(rect.x, rect.y, m_frame->FromDIP(5), rect.height);
screendc.DrawRectangle(rect.x + m_frame->FromDIP(5), rect.y, rect.width - m_frame->FromDIP(10), m_frame->FromDIP(5));
screendc.DrawRectangle(rect.x + rect.width - m_frame->FromDIP(5), rect.y, m_frame->FromDIP(5), rect.height);
screendc.DrawRectangle(rect.x + m_frame->FromDIP(5), rect.y + rect.height - m_frame->FromDIP(5), rect.width - m_frame->FromDIP(10), m_frame->FromDIP(5));
}
}
@ -3604,7 +3605,7 @@ void wxAuiManager::OnFloatingPaneMoving(wxWindow* wnd, wxDirection dir)
pos = wnd->ClientToScreen( pos );
pt.y = pos.y;
// and some more pixels for the title bar
pt.y -= 5;
pt.y -= wnd->FromDIP(5);
}
else if (dir == wxWEST)
{
@ -3707,7 +3708,7 @@ void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir)
pos = wnd->ClientToScreen( pos );
pt.y = pos.y;
// and some more pixels for the title bar
pt.y -= 10;
pt.y -= wnd->FromDIP(10);
}
else if (dir == wxWEST)
{
@ -4623,7 +4624,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
// in that case we need to set the action offset to a sensible value
wxSize frame_size = m_actionWindow->GetSize();
if (frame_size.x <= m_actionOffset.x)
m_actionOffset.x = 30;
m_actionOffset.x = paneInfo->frame->FromDIP(30);
}
}
else

View File

@ -75,6 +75,7 @@ wxBitmap wxAuiBitmapFromBits(const unsigned char bits[], int w, int h,
wxString wxAuiChopText(wxDC& dc, const wxString& text, int max_size);
static void DrawButtons(wxDC& dc,
const wxSize& offset,
const wxRect& _rect,
const wxBitmap& bmp,
const wxColour& bkcolour,
@ -84,8 +85,8 @@ static void DrawButtons(wxDC& dc,
if (button_state == wxAUI_BUTTON_STATE_PRESSED)
{
rect.x++;
rect.y++;
rect.x += offset.x;
rect.y += offset.y;
}
if (button_state == wxAUI_BUTTON_STATE_HOVER ||
@ -95,23 +96,24 @@ static void DrawButtons(wxDC& dc,
dc.SetPen(wxPen(bkcolour.ChangeLightness(75)));
// draw the background behind the button
dc.DrawRectangle(rect.x, rect.y, 15, 15);
dc.DrawRectangle(rect.x, rect.y, 16-offset.x, 16-offset.y);
}
// draw the button itself
dc.DrawBitmap(bmp, rect.x, rect.y, true);
}
static void IndentPressedBitmap(wxRect* rect, int button_state)
static void IndentPressedBitmap(const wxSize& offset, wxRect* rect, int button_state)
{
if (button_state == wxAUI_BUTTON_STATE_PRESSED)
{
rect->x++;
rect->y++;
rect->x += offset.x;
rect->y += offset.y;
}
}
// -- bitmaps --
// TODO: Provide x1.5 and x2.0 versions or migrate to SVG.
#if defined( __WXMAC__ )
static const unsigned char close_bits[]={
@ -159,7 +161,7 @@ wxAuiGenericTabArt::wxAuiGenericTabArt()
m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD);
m_measuringFont = m_selectedFont;
m_fixedTabWidth = 100;
m_fixedTabWidth = wxWindow::FromDIP(100, NULL);
m_tabCtrlHeight = 0;
#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
@ -217,7 +219,7 @@ void wxAuiGenericTabArt::SetFlags(unsigned int flags)
void wxAuiGenericTabArt::SetSizingInfo(const wxSize& tab_ctrl_size,
size_t tab_count)
{
m_fixedTabWidth = 100;
m_fixedTabWidth = wxWindow::FromDIP(100, NULL);
int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4;
@ -232,14 +234,12 @@ void wxAuiGenericTabArt::SetSizingInfo(const wxSize& tab_ctrl_size,
}
if (m_fixedTabWidth < 100)
m_fixedTabWidth = 100;
m_fixedTabWidth = wxMax(m_fixedTabWidth, wxWindow::FromDIP(100, NULL));
if (m_fixedTabWidth > tot_width/2)
m_fixedTabWidth = tot_width/2;
if (m_fixedTabWidth > 220)
m_fixedTabWidth = 220;
m_fixedTabWidth = wxMin(m_fixedTabWidth, wxWindow::FromDIP(220, NULL));
m_tabCtrlHeight = tab_ctrl_size.y;
}
@ -273,8 +273,8 @@ void wxAuiGenericTabArt::DrawBackground(wxDC& dc,
bottomLightness = 110;
}
wxColor top_color = m_baseColour.ChangeLightness(topLightness);
wxColor bottom_color = m_baseColour.ChangeLightness(bottomLightness);
wxColor top_color = m_baseColour.ChangeLightness(topLightness);
wxColor bottom_color = m_baseColour.ChangeLightness(bottomLightness);
wxRect r;
if (m_flags &wxAUI_NB_BOTTOM)
@ -619,7 +619,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc,
close_button_width,
tab_height);
IndentPressedBitmap(&rect, close_button_state);
IndentPressedBitmap(wnd->FromDIP(wxSize(1, 1)), &rect, close_button_state);
dc.DrawBitmap(bmp, rect.x, rect.y, true);
*out_button_rect = rect;
@ -632,7 +632,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc,
int wxAuiGenericTabArt::GetIndentSize()
{
return 5;
return wxWindow::FromDIP(5, NULL);
}
int wxAuiGenericTabArt::GetBorderWidth(wxWindow* wnd)
@ -653,7 +653,7 @@ int wxAuiGenericTabArt::GetAdditionalBorderSpace(wxWindow* WXUNUSED(wnd))
}
wxSize wxAuiGenericTabArt::GetTabSize(wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxString& caption,
const wxBitmap& bitmap,
bool WXUNUSED(active),
@ -684,8 +684,9 @@ wxSize wxAuiGenericTabArt::GetTabSize(wxDC& dc,
}
// add padding
tab_width += 16;
tab_height += 10;
wxSize padding = wnd->FromDIP(wxSize(16, 10));
tab_width += padding.x;
tab_height += padding.y;
if (m_flags & wxAUI_NB_TAB_FIXED_WIDTH)
{
@ -699,7 +700,7 @@ wxSize wxAuiGenericTabArt::GetTabSize(wxDC& dc,
void wxAuiGenericTabArt::DrawButton(wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
@ -757,7 +758,7 @@ void wxAuiGenericTabArt::DrawButton(wxDC& dc,
bmp.GetScaledWidth(), bmp.GetScaledHeight());
}
IndentPressedBitmap(&rect, button_state);
IndentPressedBitmap(wnd->FromDIP(wxSize(1, 1)), &rect, button_state);
dc.DrawBitmap(bmp, rect.x, rect.y, true);
*out_rect = rect;
@ -893,7 +894,7 @@ wxAuiSimpleTabArt::wxAuiSimpleTabArt()
m_measuringFont = m_selectedFont;
m_flags = 0;
m_fixedTabWidth = 100;
m_fixedTabWidth = wxWindow::FromDIP(100, NULL);
wxColour baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
@ -938,7 +939,7 @@ void wxAuiSimpleTabArt::SetFlags(unsigned int flags)
void wxAuiSimpleTabArt::SetSizingInfo(const wxSize& tab_ctrl_size,
size_t tab_count)
{
m_fixedTabWidth = 100;
m_fixedTabWidth = wxWindow::FromDIP(100, NULL);
int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - 4;
@ -953,14 +954,12 @@ void wxAuiSimpleTabArt::SetSizingInfo(const wxSize& tab_ctrl_size,
}
if (m_fixedTabWidth < 100)
m_fixedTabWidth = 100;
m_fixedTabWidth = wxMax(m_fixedTabWidth, wxWindow::FromDIP(100, NULL));
if (m_fixedTabWidth > tot_width/2)
m_fixedTabWidth = tot_width/2;
if (m_fixedTabWidth > 220)
m_fixedTabWidth = 220;
m_fixedTabWidth = wxMin(m_fixedTabWidth, wxWindow::FromDIP(220, NULL));
}
void wxAuiSimpleTabArt::SetColour(const wxColour& colour)
@ -1151,7 +1150,7 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc,
tab_y + (tab_height/2) - (bmp.GetScaledHeight()/2) + 1,
close_button_width,
tab_height - 1);
DrawButtons(dc, rect, bmp, *wxWHITE, close_button_state);
DrawButtons(dc, wnd->FromDIP(wxSize(1, 1)), rect, bmp, *wxWHITE, close_button_state);
*out_button_rect = rect;
}
@ -1215,7 +1214,7 @@ wxSize wxAuiSimpleTabArt::GetTabSize(wxDC& dc,
void wxAuiSimpleTabArt::DrawButton(wxDC& dc,
wxWindow* WXUNUSED(wnd),
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
@ -1273,7 +1272,7 @@ void wxAuiSimpleTabArt::DrawButton(wxDC& dc,
}
DrawButtons(dc, rect, bmp, *wxWHITE, button_state);
DrawButtons(dc, wnd->FromDIP(wxSize(1, 1)), rect, bmp, *wxWHITE, button_state);
*out_rect = rect;
}
@ -1299,12 +1298,13 @@ int wxAuiSimpleTabArt::ShowDropDown(wxWindow* wnd,
// find out where to put the popup menu of window
// items. Subtract 100 for now to center the menu
// a bit, until a better mechanism can be implemented
int offset = wnd->FromDIP(100);
wxPoint pt = ::wxGetMousePosition();
pt = wnd->ScreenToClient(pt);
if (pt.x < 100)
if (pt.x < offset)
pt.x = 0;
else
pt.x -= 100;
pt.x -= offset;
// find out the screen coordinate at the bottom of the tab ctrl
wxRect cli_rect = wnd->GetClientRect();

View File

@ -262,7 +262,7 @@ void wxAuiMSWTabArt::DrawTab(wxDC& dc,
int wxAuiMSWTabArt::GetIndentSize()
{
if ( IsThemed() )
return 3; // This should be 1 but we can't draw into the border from DrawTab
return wxWindow::FromDIP(3, NULL); // This should be 1 but we can't draw into the border from DrawTab
else
return wxAuiGenericTabArt::GetIndentSize();
}
@ -276,7 +276,7 @@ int wxAuiMSWTabArt::GetAdditionalBorderSpace(wxWindow* wnd)
{
if ( IsThemed() )
{
return 4;
return wnd->FromDIP(4, NULL);
}
else
return wxAuiGenericTabArt::GetAdditionalBorderSpace(wnd);
@ -400,7 +400,7 @@ void wxAuiMSWTabArt::DrawButton(wxDC& dc,
bitmap_id == wxAUI_BUTTON_RIGHT )
{
rect.y = in_rect.y;
rect.height = in_rect.height - 7;
rect.height = in_rect.height - wnd->FromDIP(7);
}
dc.SetPen(*wxTRANSPARENT_PEN);

View File

@ -728,7 +728,7 @@ bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame* parent, long style)
if (!wxAuiNotebook::Create(parent,
wxID_ANY,
wxPoint(0,0),
wxSize(100, 100),
parent->FromDIP(wxSize(100, 100)),
wxAUI_NB_DEFAULT_STYLE | wxNO_BORDER))
{
return false;

View File

@ -276,7 +276,7 @@ void wxAuiToolBarXmlHandler::MenuHandler::OnDropDown(wxAuiToolBarEvent& event)
if (menu != NULL)
{
wxRect rect = item->GetSizerItem()->GetRect();
toobar->PopupMenu(menu, rect.GetRight() - 10, rect.GetBottom());
toobar->PopupMenu(menu, rect.GetRight() - toobar->FromDIP(10), rect.GetBottom());
}
}
}