diff options
Diffstat (limited to 'wx+')
-rw-r--r-- | wx+/graph.cpp | 4 | ||||
-rw-r--r-- | wx+/graph.h | 5 | ||||
-rw-r--r-- | wx+/image_resources.cpp | 1 |
3 files changed, 8 insertions, 2 deletions
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 <numeric> #include <zen/basic_math.h> #include <zen/scope_guard.h> -#include <wx/settings.h> +//#include <wx/settings.h> #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 <vector> #include <memory> #include <wx/panel.h> +#include <wx/settings.h> #include <zen/string_tools.h> #include <zen/optional.h> @@ -240,6 +241,7 @@ public: labelposY(Y_LABEL_LEFT), yLabelWidth(60), labelFmtY(std::make_shared<DecimalNumberFormatter>()), + 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<PosCorner, wxString> 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; } |