Remove erase background event handlers, in favor of SetBackgroundStyle.

This commit is contained in:
Twan van Laarhoven
2020-05-16 01:56:17 +02:00
parent dbe6fbd33b
commit 92fbb9ea10
17 changed files with 38 additions and 38 deletions
+7 -5
View File
@@ -42,12 +42,12 @@ public:
{}
};
class MessageCtrl : public wxPanel {
class MessageCtrl : public wxControl {
public:
MessageCtrl(wxWindow* parent, int id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME | wxVSCROLL)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME | wxWANTS_CHARS | wxVSCROLL)
{
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
SetBackgroundStyle(wxBG_STYLE_PAINT);
// icons
static_assert(MESSAGE_TYPE_MAX == 7);
icons[MESSAGE_NONE] = wxBitmap();
@@ -102,6 +102,10 @@ public:
return ok;
}
bool AcceptsFocus() const override {
return true;
}
private:
DECLARE_EVENT_TABLE();
@@ -225,7 +229,6 @@ private:
// --------------------------------------------------- : Drawing
void onEraseBackground(wxEraseEvent&) {}
void onPaint(wxPaintEvent& ev) {
wxAutoBufferedPaintDC dc(this);
PrepareDC(dc);
@@ -382,7 +385,6 @@ BEGIN_EVENT_TABLE(MessageCtrl,wxScrolledWindow)
EVT_KILL_FOCUS(MessageCtrl::onFocus)
EVT_SCROLLWIN(MessageCtrl::onScroll)
EVT_MOUSEWHEEL(MessageCtrl::onMouseWheel)
EVT_ERASE_BACKGROUND(MessageCtrl::onEraseBackground)
EVT_SIZE(MessageCtrl::onSize)
END_EVENT_TABLE()
+3 -3
View File
@@ -144,9 +144,9 @@ void StylePanel::selectCard(const CardP& card) {
// ----------------------------------------------------------------------------- : Clipboard
// determine what control to use for clipboard actions
#define CUT_COPY_PASTE(op,return) \
if (!isInitialized()) return false; \
int id = focused_control(this); \
#define CUT_COPY_PASTE(op,return) \
if (!isInitialized()) return false; \
int id = focused_control(this); \
if (id == ID_EDITOR) { return editor->op(); } \
else { return false; }
+4 -2
View File
@@ -48,7 +48,10 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
, number_of_recent_sets(0)
{
SetIcon(load_resource_icon(_("app")));
// avoid flicker
SetBackgroundStyle(wxBG_STYLE_PAINT);
// initialize menu bar
auto menuBar = new wxMenuBar();
auto menuFile = new wxMenu();
@@ -899,5 +902,4 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
EVT_CARD_SELECT (wxID_ANY, SetWindow::onCardSelect)
EVT_CARD_ACTIVATE (wxID_ANY, SetWindow::onCardActivate)
EVT_SIZE_CHANGE (wxID_ANY, SetWindow::onSizeChange)
EVT_ERASE_BACKGROUND( SetWindow::onEraseBackground)
END_EVENT_TABLE ()
-1
View File
@@ -172,6 +172,5 @@ private:
void onIdle (wxIdleEvent&);
void onSizeChange (wxCommandEvent&);
void onEraseBackground (wxEraseEvent&) {} // reduce flicker
};