diff options
Diffstat (limited to 'wx+')
-rw-r--r-- | wx+/graph.cpp | 2 | ||||
-rw-r--r-- | wx+/grid.cpp | 4 | ||||
-rw-r--r-- | wx+/image_tools.h | 2 | ||||
-rw-r--r-- | wx+/popup_dlg.cpp | 24 | ||||
-rw-r--r-- | wx+/popup_dlg.h | 34 | ||||
-rw-r--r-- | wx+/rtl.h | 2 | ||||
-rw-r--r-- | wx+/tooltip.cpp | 16 |
7 files changed, 46 insertions, 38 deletions
diff --git a/wx+/graph.cpp b/wx+/graph.cpp index 41750a48..2440f77d 100644 --- a/wx+/graph.cpp +++ b/wx+/graph.cpp @@ -451,7 +451,7 @@ Graph2D::Graph2D(wxWindow* parent, { Connect(wxEVT_PAINT, wxPaintEventHandler(Graph2D::onPaintEvent), nullptr, this); Connect(wxEVT_SIZE, wxSizeEventHandler (Graph2D::onSizeEvent ), nullptr, this); - Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {}); //http://wiki.wxwidgets.org/Flicker-Free_Drawing + Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {}); //https://wiki.wxwidgets.org/Flicker-Free_Drawing //SetDoubleBuffered(true); slow as hell! diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 804c8fba..851146bc 100644 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -272,7 +272,7 @@ public: { Connect(wxEVT_PAINT, wxPaintEventHandler(SubWindow::onPaintEvent), nullptr, this); Connect(wxEVT_SIZE, wxSizeEventHandler (SubWindow::onSizeEvent), nullptr, this); - Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {}); //http://wiki.wxwidgets.org/Flicker-Free_Drawing + Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {}); //https://wiki.wxwidgets.org/Flicker-Free_Drawing //SetDoubleBuffered(true); slow as hell! @@ -1326,7 +1326,7 @@ Grid::Grid(wxWindow* parent, Connect(wxEVT_PAINT, wxPaintEventHandler(Grid::onPaintEvent), nullptr, this); Connect(wxEVT_SIZE, wxSizeEventHandler (Grid::onSizeEvent ), nullptr, this); - Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {}); //http://wiki.wxwidgets.org/Flicker-Free_Drawing + Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {}); //https://wiki.wxwidgets.org/Flicker-Free_Drawing Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(Grid::onKeyDown), nullptr, this); Connect(wxEVT_KEY_UP, wxKeyEventHandler(Grid::onKeyUp ), nullptr, this); diff --git a/wx+/image_tools.h b/wx+/image_tools.h index b1df41e6..2a0dd0d4 100644 --- a/wx+/image_tools.h +++ b/wx+/image_tools.h @@ -213,7 +213,7 @@ wxColor gradient(const wxColor& from, const wxColor& to, double fraction) inline wxColor hsvColor(double h, double s, double v) //h within [0, 360), s, v within [0, 1] { - //http://de.wikipedia.org/wiki/HSV-Farbraum + //https://de.wikipedia.org/wiki/HSV-Farbraum //make input values fit into bounds if (h > 360) diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp index 8ee44521..11c4511f 100644 --- a/wx+/popup_dlg.cpp +++ b/wx+/popup_dlg.cpp @@ -79,16 +79,16 @@ public: wxString titleTmp; switch (type) { - case DialogInfoType::INFO: + case DialogInfoType::info: //"Information" is meaningless as caption text! //confirmation doesn't use info icon //iconTmp = getResourceImage(L"msg_info"); break; - case DialogInfoType::WARNING: + case DialogInfoType::warning: iconTmp = getResourceImage(L"msg_warning"); titleTmp = _("Warning"); break; - case DialogInfoType::ERROR2: + case DialogInfoType::error: iconTmp = getResourceImage(L"msg_error"); titleTmp = _("Error"); break; @@ -204,28 +204,28 @@ public: } private: - void OnClose (wxCloseEvent& event) override { EndModal(static_cast<int>(ConfirmationButton3::CANCEL)); } - void OnCancel(wxCommandEvent& event) override { EndModal(static_cast<int>(ConfirmationButton3::CANCEL)); } + void OnClose (wxCloseEvent& event) override { EndModal(static_cast<int>(ConfirmationButton3::cancel)); } + void OnCancel(wxCommandEvent& event) override { EndModal(static_cast<int>(ConfirmationButton3::cancel)); } void OnButtonAccept(wxCommandEvent& event) override { if (checkBoxValue_) *checkBoxValue_ = m_checkBoxCustom->GetValue(); - EndModal(static_cast<int>(ConfirmationButton3::ACCEPT)); + EndModal(static_cast<int>(ConfirmationButton3::accept)); } void OnButtonAcceptAll(wxCommandEvent& event) override { if (checkBoxValue_) *checkBoxValue_ = m_checkBoxCustom->GetValue(); - EndModal(static_cast<int>(ConfirmationButton3::ACCEPT_ALL)); + EndModal(static_cast<int>(ConfirmationButton3::acceptAll)); } void OnButtonDecline(wxCommandEvent& event) override { if (checkBoxValue_) *checkBoxValue_ = m_checkBoxCustom->GetValue(); - EndModal(static_cast<int>(ConfirmationButton3::DECLINE)); + EndModal(static_cast<int>(ConfirmationButton3::decline)); } void OnKeyPressed(wxKeyEvent& event) @@ -241,7 +241,7 @@ private: } case WXK_ESCAPE: //handle case where cancel button is hidden! - EndModal(static_cast<int>(ConfirmationButton3::CANCEL)); + EndModal(static_cast<int>(ConfirmationButton3::cancel)); return; } event.Skip(); @@ -253,14 +253,14 @@ private: { switch (buttonToDisableWhenChecked_) { - case QuestionButton2::YES: + case QuestionButton2::yes: m_buttonAccept ->Enable(!m_checkBoxCustom->GetValue()); m_buttonAcceptAll->Enable(!m_checkBoxCustom->GetValue()); break; - case QuestionButton2::NO: + case QuestionButton2::no: m_buttonDecline->Enable(!m_checkBoxCustom->GetValue()); break; - case QuestionButton2::CANCEL: + case QuestionButton2::cancel: break; } } diff --git a/wx+/popup_dlg.h b/wx+/popup_dlg.h index 0acd2a95..1e0a1656 100644 --- a/wx+/popup_dlg.h +++ b/wx+/popup_dlg.h @@ -21,34 +21,34 @@ struct PopupDialogCfg; enum class DialogInfoType { - INFO, - WARNING, - ERROR2, //fuck the ERROR macro in WinGDI.h! + info, + warning, + error, }; enum class ConfirmationButton3 { - ACCEPT, - ACCEPT_ALL, - DECLINE, - CANCEL, + accept, + acceptAll, + decline, + cancel, }; enum class ConfirmationButton { - ACCEPT = static_cast<int>(ConfirmationButton3::ACCEPT), //[!] Clang requires a "static_cast" - CANCEL = static_cast<int>(ConfirmationButton3::CANCEL), // + accept = static_cast<int>(ConfirmationButton3::accept), //[!] Clang requires a "static_cast" + cancel = static_cast<int>(ConfirmationButton3::cancel), // }; enum class ConfirmationButton2 { - ACCEPT = static_cast<int>(ConfirmationButton3::ACCEPT), - ACCEPT_ALL = static_cast<int>(ConfirmationButton3::ACCEPT_ALL), - CANCEL = static_cast<int>(ConfirmationButton3::CANCEL), + accept = static_cast<int>(ConfirmationButton3::accept), + acceptAll = static_cast<int>(ConfirmationButton3::acceptAll), + cancel = static_cast<int>(ConfirmationButton3::cancel), }; enum class QuestionButton2 { - YES = static_cast<int>(ConfirmationButton3::ACCEPT), - NO = static_cast<int>(ConfirmationButton3::DECLINE), - CANCEL = static_cast<int>(ConfirmationButton3::CANCEL), + yes = static_cast<int>(ConfirmationButton3::accept), + no = static_cast<int>(ConfirmationButton3::decline), + cancel = static_cast<int>(ConfirmationButton3::cancel), }; void showNotificationDialog(wxWindow* parent, DialogInfoType type, const PopupDialogCfg& cfg); @@ -66,7 +66,7 @@ struct PopupDialogCfg PopupDialogCfg& setTitle (const wxString& label) { title = label; return *this; } PopupDialogCfg& setMainInstructions (const wxString& label) { textMain = label; return *this; } //set at least one of these! PopupDialogCfg& setDetailInstructions(const wxString& label) { textDetail = label; return *this; } // - PopupDialogCfg& setCheckBox(bool& value, const wxString& label, QuestionButton2 disableWhenChecked = QuestionButton2::CANCEL) + PopupDialogCfg& setCheckBox(bool& value, const wxString& label, QuestionButton2 disableWhenChecked = QuestionButton2::cancel) { checkBoxValue = &value; checkBoxLabel = label; @@ -83,7 +83,7 @@ private: wxString textDetail; bool* checkBoxValue = nullptr; //in/out wxString checkBoxLabel; - QuestionButton2 buttonToDisableWhenChecked = QuestionButton2::CANCEL; + QuestionButton2 buttonToDisableWhenChecked = QuestionButton2::cancel; }; } @@ -21,7 +21,7 @@ void drawBitmapRtlNoMirror(wxDC& dc, const wxBitmap& bmp, const wxRect& rect, in wxBitmap mirrorIfRtl(const wxBitmap& bmp); -//manual text flow correction: http://www.w3.org/International/articles/inline-bidi-markup/ +//manual text flow correction: https://www.w3.org/International/articles/inline-bidi-markup/ diff --git a/wx+/tooltip.cpp b/wx+/tooltip.cpp index 142c9b7f..42fb058a 100644 --- a/wx+/tooltip.cpp +++ b/wx+/tooltip.cpp @@ -13,6 +13,7 @@ #include <wx/app.h> #include "image_tools.h" #include "dc.h" + #include <gtk/gtk.h> using namespace zen; @@ -48,8 +49,8 @@ public: } - wxStaticText* staticTextMain_; - wxStaticBitmap* bitmapLeft_; + wxStaticText* staticTextMain_ = nullptr; + wxStaticBitmap* bitmapLeft_ = nullptr; }; @@ -80,7 +81,7 @@ void Tooltip::show(const wxString& text, wxPoint mousePos, const wxBitmap* bmp) mousePos + wxPoint(fastFromDIP(TIP_WINDOW_OFFSET_DIP), 0); if (newPos != tipWindow_->GetScreenPosition()) - tipWindow_->SetSize(newPos.x, newPos.y, wxDefaultCoord, wxDefaultCoord); + tipWindow_->Move(newPos); //attention!!! possible endless loop: mouse pointer must NOT be within tipWindow! //else it will trigger a wxEVT_LEAVE_WINDOW on middle grid which will hide the window, causing the window to be shown again via this method, etc. @@ -93,8 +94,15 @@ void Tooltip::hide() { if (tipWindow_) { - //on wxGTK the tooltip is sometimes not shown again after it was hidden: e.g. drag-selection on middle grid +#if GTK_MAJOR_VERSION == 2 //the tooltip sometimes turns blank or is not shown again after it was hidden: e.g. drag-selection on middle grid tipWindow_->Destroy(); //apply brute force: tipWindow_ = nullptr; // + +#elif GTK_MAJOR_VERSION == 3 + tipWindow_->Hide(); +#else +#error unknown GTK version! +#endif + } } |