From 570916ddc376b09205125eaaab517561dfead9f0 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:31:50 +0200 Subject: 6.3 --- wx+/graph.cpp | 4 ++-- wx+/graph.h | 5 +++++ wx+/image_resources.cpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'wx+') diff --git a/wx+/graph.cpp b/wx+/graph.cpp index 9298b10b..1a8f4376 100644 --- a/wx+/graph.cpp +++ b/wx+/graph.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +//#include #include "dc.h" using namespace zen; @@ -556,7 +556,7 @@ void Graph2D::render(wxDC& dc) const { //paint graph background (excluding label area) wxDCPenChanger dummy (dc, wxColour(130, 135, 144)); //medium grey, the same Win7 uses for other frame borders => not accessible! but no big deal... - wxDCBrushChanger dummy2(dc, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + wxDCBrushChanger dummy2(dc, attr.backgroundColor); //accessibility: consider system text and background colors; small drawback: color of graphs is NOT connected to the background! => responsibility of client to use correct colors dc.DrawRectangle(graphArea); diff --git a/wx+/graph.h b/wx+/graph.h index 84aa56cf..bafbe4eb 100644 --- a/wx+/graph.h +++ b/wx+/graph.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -240,6 +241,7 @@ public: labelposY(Y_LABEL_LEFT), yLabelWidth(60), labelFmtY(std::make_shared()), + backgroundColor(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)), mouseSelMode(SELECT_RECTANGLE) {} MainAttributes& setMinX(double newMinX) { minX = newMinX; minXauto = false; return *this; } @@ -269,6 +271,8 @@ public: MainAttributes& setCornerText(const wxString& txt, PosCorner pos) { cornerTexts[pos] = txt; return *this; } + MainAttributes& setBackgroundColor(const wxColour& col) { backgroundColor = col; return *this; } + MainAttributes& setSelectionMode(SelMode mode) { mouseSelMode = mode; return *this; } private: @@ -294,6 +298,7 @@ public: std::map cornerTexts; + wxColour backgroundColor; SelMode mouseSelMode; }; void setAttributes(const MainAttributes& newAttr) { attr = newAttr; Refresh(); } diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp index ba725d63..09a34de0 100644 --- a/wx+/image_resources.cpp +++ b/wx+/image_resources.cpp @@ -41,6 +41,7 @@ class GlobalResources public: static GlobalResources& instance() { + //caveat: function scope static initialization is not thread-safe in VS 2010! => but we wouldn't use wxWidgets in combination with multithreading anyway! static GlobalResources inst; return inst; } -- cgit