summaryrefslogtreecommitdiff
path: root/wx+
diff options
context:
space:
mode:
Diffstat (limited to 'wx+')
-rw-r--r--[-rwxr-xr-x]wx+/app_main.h0
-rw-r--r--[-rwxr-xr-x]wx+/async_task.h5
-rw-r--r--[-rwxr-xr-x]wx+/bitmap_button.h4
-rw-r--r--[-rwxr-xr-x]wx+/choice_enum.h0
-rw-r--r--[-rwxr-xr-x]wx+/context_menu.h0
-rw-r--r--[-rwxr-xr-x]wx+/dc.h4
-rw-r--r--[-rwxr-xr-x]wx+/file_drop.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/file_drop.h0
-rw-r--r--[-rwxr-xr-x]wx+/focus.h0
-rw-r--r--[-rwxr-xr-x]wx+/font_size.h0
-rw-r--r--[-rwxr-xr-x]wx+/graph.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/graph.h0
-rw-r--r--[-rwxr-xr-x]wx+/grid.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/grid.h0
-rw-r--r--[-rwxr-xr-x]wx+/image_holder.h0
-rw-r--r--[-rwxr-xr-x]wx+/image_resources.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/image_resources.h0
-rw-r--r--[-rwxr-xr-x]wx+/image_tools.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/image_tools.h13
-rw-r--r--[-rwxr-xr-x]wx+/no_flicker.h0
-rw-r--r--[-rwxr-xr-x]wx+/popup_dlg.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/popup_dlg.h0
-rw-r--r--[-rwxr-xr-x]wx+/popup_dlg_generated.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/popup_dlg_generated.h0
-rw-r--r--[-rwxr-xr-x]wx+/rtl.h0
-rw-r--r--[-rwxr-xr-x]wx+/std_button_layout.h0
-rw-r--r--[-rwxr-xr-x]wx+/toggle_button.h0
-rw-r--r--[-rwxr-xr-x]wx+/tooltip.cpp0
-rw-r--r--[-rwxr-xr-x]wx+/tooltip.h0
29 files changed, 20 insertions, 6 deletions
diff --git a/wx+/app_main.h b/wx+/app_main.h
index 8d2a6eeb..8d2a6eeb 100755..100644
--- a/wx+/app_main.h
+++ b/wx+/app_main.h
diff --git a/wx+/async_task.h b/wx+/async_task.h
index 074f5337..04eac61c 100755..100644
--- a/wx+/async_task.h
+++ b/wx+/async_task.h
@@ -115,7 +115,7 @@ private:
class AsyncGuiQueue : private wxEvtHandler
{
public:
- AsyncGuiQueue() { timer_.Connect(wxEVT_TIMER, wxEventHandler(AsyncGuiQueue::onTimerEvent), nullptr, this); }
+ AsyncGuiQueue(int pollingMs = 50) : pollingMs_(pollingMs) { timer_.Connect(wxEVT_TIMER, wxEventHandler(AsyncGuiQueue::onTimerEvent), nullptr, this); }
template <class Fun, class Fun2>
void processAsync(Fun&& evalAsync, Fun2&& evalOnGui)
@@ -123,7 +123,7 @@ public:
asyncTasks_.add(std::forward<Fun >(evalAsync),
std::forward<Fun2>(evalOnGui));
if (!timer_.IsRunning())
- timer_.Start(50 /*unit: [ms]*/);
+ timer_.Start(pollingMs_ /*unit: [ms]*/);
}
private:
@@ -134,6 +134,7 @@ private:
timer_.Stop();
}
+ const int pollingMs_;
impl::AsyncTasks asyncTasks_;
wxTimer timer_; //don't use wxWidgets' idle handling => repeated idle requests/consumption hogs 100% cpu!
};
diff --git a/wx+/bitmap_button.h b/wx+/bitmap_button.h
index 738a62ff..bcbc7328 100755..100644
--- a/wx+/bitmap_button.h
+++ b/wx+/bitmap_button.h
@@ -56,8 +56,8 @@ void setBitmapTextLabel(wxBitmapButton& btn, const wxImage& img, const wxString&
wxImage dynImage = createImageFromText(text, btn.GetFont(), btn.GetForegroundColour());
if (img.IsOk())
dynImage = btn.GetLayoutDirection() != wxLayout_RightToLeft ?
- stackImages(img, dynImage, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap) :
- stackImages(dynImage, img, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap);
+ stackImages(img, dynImage, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap) :
+ stackImages(dynImage, img, ImageStackLayout::HORIZONTAL, ImageStackAlignment::CENTER, gap);
//SetMinSize() instead of SetSize() is needed here for wxWindows layout determination to work corretly
const int defaultHeight = wxButton::GetDefaultSize().GetHeight();
diff --git a/wx+/choice_enum.h b/wx+/choice_enum.h
index f2c93927..f2c93927 100755..100644
--- a/wx+/choice_enum.h
+++ b/wx+/choice_enum.h
diff --git a/wx+/context_menu.h b/wx+/context_menu.h
index d856db03..d856db03 100755..100644
--- a/wx+/context_menu.h
+++ b/wx+/context_menu.h
diff --git a/wx+/dc.h b/wx+/dc.h
index e1d803cb..311080dd 100755..100644
--- a/wx+/dc.h
+++ b/wx+/dc.h
@@ -52,9 +52,9 @@ inline
int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered)
{
-#ifdef wxHAVE_DPI_INDEPENDENT_PIXELS //pulled from wx/window.h
+#ifdef wxHAVE_DPI_INDEPENDENT_PIXELS //pulled from wx/window.h: https://github.com/wxWidgets/wxWidgets/blob/master/include/wx/window.h#L2029
return d; //e.g. macOS, GTK3
-#else
+#else //https://github.com/wxWidgets/wxWidgets/blob/master/src/common/wincmn.cpp#L2865
assert(wxTheApp); //only call after wxWidgets was initalized!
static const int dpiY = wxScreenDC().GetPPI().y; //perf: buffering for calls to ::GetDeviceCaps() needed!?
const int defaultDpi = 96;
diff --git a/wx+/file_drop.cpp b/wx+/file_drop.cpp
index 65d5d861..65d5d861 100755..100644
--- a/wx+/file_drop.cpp
+++ b/wx+/file_drop.cpp
diff --git a/wx+/file_drop.h b/wx+/file_drop.h
index ee5393b7..ee5393b7 100755..100644
--- a/wx+/file_drop.h
+++ b/wx+/file_drop.h
diff --git a/wx+/focus.h b/wx+/focus.h
index e2daef79..e2daef79 100755..100644
--- a/wx+/focus.h
+++ b/wx+/focus.h
diff --git a/wx+/font_size.h b/wx+/font_size.h
index 2f2d377c..2f2d377c 100755..100644
--- a/wx+/font_size.h
+++ b/wx+/font_size.h
diff --git a/wx+/graph.cpp b/wx+/graph.cpp
index 9cacd1bf..9cacd1bf 100755..100644
--- a/wx+/graph.cpp
+++ b/wx+/graph.cpp
diff --git a/wx+/graph.h b/wx+/graph.h
index f1ae5d5a..f1ae5d5a 100755..100644
--- a/wx+/graph.h
+++ b/wx+/graph.h
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index 3c19c246..3c19c246 100755..100644
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
diff --git a/wx+/grid.h b/wx+/grid.h
index 102396c3..102396c3 100755..100644
--- a/wx+/grid.h
+++ b/wx+/grid.h
diff --git a/wx+/image_holder.h b/wx+/image_holder.h
index b11ae451..b11ae451 100755..100644
--- a/wx+/image_holder.h
+++ b/wx+/image_holder.h
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp
index 5bc8006f..5bc8006f 100755..100644
--- a/wx+/image_resources.cpp
+++ b/wx+/image_resources.cpp
diff --git a/wx+/image_resources.h b/wx+/image_resources.h
index 5ea56679..5ea56679 100755..100644
--- a/wx+/image_resources.h
+++ b/wx+/image_resources.h
diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp
index b314e801..b314e801 100755..100644
--- a/wx+/image_tools.cpp
+++ b/wx+/image_tools.cpp
diff --git a/wx+/image_tools.h b/wx+/image_tools.h
index bef4cb67..e1a6953c 100755..100644
--- a/wx+/image_tools.h
+++ b/wx+/image_tools.h
@@ -52,6 +52,8 @@ void convertToVanillaImage(wxImage& img); //add alpha channel if missing + remov
//wxColor hsvColor(double h, double s, double v); //h within [0, 360), s, v within [0, 1]
+wxImage shrinkImage(const wxImage& img, int requestedSize);
+
inline
wxImage getTransparentPixel()
@@ -179,6 +181,17 @@ bool isEqual(const wxBitmap& lhs, const wxBitmap& rhs)
return true;
}
+
+inline
+wxImage shrinkImage(const wxImage& img, int requestedSize)
+{
+ const int maxExtent = std::max(img.GetWidth(), img.GetHeight());
+ assert(requestedSize <= maxExtent);
+ return img.Scale(img.GetWidth () * requestedSize / maxExtent,
+ img.GetHeight() * requestedSize / maxExtent, wxIMAGE_QUALITY_BILINEAR); //looks sharper than wxIMAGE_QUALITY_HIGH!
+}
+
+
/*
inline
wxColor gradient(const wxColor& from, const wxColor& to, double fraction)
diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h
index 03969c00..03969c00 100755..100644
--- a/wx+/no_flicker.h
+++ b/wx+/no_flicker.h
diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp
index 689b364e..689b364e 100755..100644
--- a/wx+/popup_dlg.cpp
+++ b/wx+/popup_dlg.cpp
diff --git a/wx+/popup_dlg.h b/wx+/popup_dlg.h
index 2aedf9b8..2aedf9b8 100755..100644
--- a/wx+/popup_dlg.h
+++ b/wx+/popup_dlg.h
diff --git a/wx+/popup_dlg_generated.cpp b/wx+/popup_dlg_generated.cpp
index 3e490757..3e490757 100755..100644
--- a/wx+/popup_dlg_generated.cpp
+++ b/wx+/popup_dlg_generated.cpp
diff --git a/wx+/popup_dlg_generated.h b/wx+/popup_dlg_generated.h
index 9d9bc3f8..9d9bc3f8 100755..100644
--- a/wx+/popup_dlg_generated.h
+++ b/wx+/popup_dlg_generated.h
diff --git a/wx+/rtl.h b/wx+/rtl.h
index 26380f9d..26380f9d 100755..100644
--- a/wx+/rtl.h
+++ b/wx+/rtl.h
diff --git a/wx+/std_button_layout.h b/wx+/std_button_layout.h
index cf0152de..cf0152de 100755..100644
--- a/wx+/std_button_layout.h
+++ b/wx+/std_button_layout.h
diff --git a/wx+/toggle_button.h b/wx+/toggle_button.h
index f61c3857..f61c3857 100755..100644
--- a/wx+/toggle_button.h
+++ b/wx+/toggle_button.h
diff --git a/wx+/tooltip.cpp b/wx+/tooltip.cpp
index a7bf85fe..a7bf85fe 100755..100644
--- a/wx+/tooltip.cpp
+++ b/wx+/tooltip.cpp
diff --git a/wx+/tooltip.h b/wx+/tooltip.h
index d74beb9d..d74beb9d 100755..100644
--- a/wx+/tooltip.h
+++ b/wx+/tooltip.h
bgstack15