Improve wxRendererGTK drawing with HiDPI
This commit is contained in:
parent
4405176bb9
commit
5ff0d3a458
3 changed files with 14 additions and 8 deletions
|
|
@ -15,7 +15,7 @@
|
|||
class wxGtkStyleContext
|
||||
{
|
||||
public:
|
||||
wxGtkStyleContext();
|
||||
wxGtkStyleContext(double scale = 1);
|
||||
~wxGtkStyleContext();
|
||||
wxGtkStyleContext& Add(GType type, const char* objectName, ...) G_GNUC_NULL_TERMINATED;
|
||||
wxGtkStyleContext& Add(const char* objectName);
|
||||
|
|
@ -38,6 +38,7 @@ public:
|
|||
private:
|
||||
GtkStyleContext* m_context;
|
||||
GtkWidgetPath* const m_path;
|
||||
const int m_scale;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxGtkStyleContext);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
|
|||
if (flags & wxCONTROL_DIRTY)
|
||||
pos = 2;
|
||||
|
||||
wxGtkStyleContext sc;
|
||||
wxGtkStyleContext sc(dc.GetContentScaleFactor());
|
||||
sc.AddTreeviewHeaderButton(pos);
|
||||
|
||||
gtk_style_context_set_state(sc, stateTypeToFlags[state]);
|
||||
|
|
@ -450,7 +450,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win,
|
|||
x_diff = rect.width;
|
||||
|
||||
#ifdef __WXGTK3__
|
||||
wxGtkStyleContext sc;
|
||||
wxGtkStyleContext sc(dc.GetContentScaleFactor());
|
||||
sc.Add(GTK_TYPE_PANED, "paned", "pane-separator", NULL);
|
||||
if (gtk_check_version(3,20,0) == NULL)
|
||||
sc.Add("separator");
|
||||
|
|
@ -561,7 +561,7 @@ wxRendererGTK::GetCheckBoxSize(wxWindow* win)
|
|||
|
||||
#ifdef __WXGTK3__
|
||||
int min_width, min_height;
|
||||
wxGtkStyleContext sc;
|
||||
wxGtkStyleContext sc(win->GetContentScaleFactor());
|
||||
sc.AddCheckButton();
|
||||
if (gtk_check_version(3,20,0) == NULL)
|
||||
{
|
||||
|
|
@ -654,7 +654,7 @@ wxRendererGTK::DrawCheckBox(wxWindow*,
|
|||
state |= GTK_STATE_FLAG_PRELIGHT;
|
||||
|
||||
int min_width, min_height;
|
||||
wxGtkStyleContext sc;
|
||||
wxGtkStyleContext sc(dc.GetContentScaleFactor());
|
||||
sc.AddCheckButton();
|
||||
if (gtk_check_version(3,20,0) == NULL)
|
||||
{
|
||||
|
|
@ -851,7 +851,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow*, wxDC& dc, const wxRect& rect, int fl
|
|||
if (flags & wxCONTROL_DISABLED)
|
||||
state = GTK_STATE_FLAG_INSENSITIVE;
|
||||
|
||||
wxGtkStyleContext sc;
|
||||
wxGtkStyleContext sc(dc.GetContentScaleFactor());
|
||||
sc.Add(GTK_TYPE_ENTRY, "entry", "entry", NULL);
|
||||
|
||||
gtk_style_context_set_state(sc, GtkStateFlags(state));
|
||||
|
|
@ -1001,7 +1001,7 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow*, wxDC& dc, const wxRect& rect, int
|
|||
state |= GTK_STATE_FLAG_PRELIGHT;
|
||||
|
||||
int min_width, min_height;
|
||||
wxGtkStyleContext sc;
|
||||
wxGtkStyleContext sc(dc.GetContentScaleFactor());
|
||||
sc.Add(GTK_TYPE_RADIO_BUTTON, "radiobutton", NULL);
|
||||
#if GTK_CHECK_VERSION(3,20,0)
|
||||
if (gtk_check_version(3,20,0) == NULL)
|
||||
|
|
|
|||
|
|
@ -209,8 +209,9 @@ private:
|
|||
// wxGtkStyleContext
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxGtkStyleContext::wxGtkStyleContext()
|
||||
wxGtkStyleContext::wxGtkStyleContext(double scale)
|
||||
: m_path(gtk_widget_path_new())
|
||||
, m_scale(int(scale))
|
||||
{
|
||||
m_context = NULL;
|
||||
}
|
||||
|
|
@ -233,6 +234,10 @@ wxGtkStyleContext& wxGtkStyleContext::Add(GType type, const char* objectName, ..
|
|||
va_end(args);
|
||||
|
||||
GtkStyleContext* sc = gtk_style_context_new();
|
||||
#if GTK_CHECK_VERSION(3,10,0)
|
||||
if (gtk_check_version(3,10,0) == NULL)
|
||||
gtk_style_context_set_scale(sc, m_scale);
|
||||
#endif
|
||||
gtk_style_context_set_path(sc, m_path);
|
||||
if (m_context)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue