mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Remove erase background event handlers, in favor of SetBackgroundStyle.
This commit is contained in:
@@ -70,7 +70,9 @@ HoverButtonBase::HoverButtonBase(Window* parent, int id, bool accepts_focus)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER )
|
||||
, accepts_focus(accepts_focus)
|
||||
, hover(false), focus(false), mouse_down(false), key_down(false)
|
||||
{}
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
}
|
||||
|
||||
void HoverButtonBase::onMouseEnter(wxMouseEvent&) {
|
||||
hover = true;
|
||||
@@ -156,7 +158,6 @@ BEGIN_EVENT_TABLE(HoverButtonBase, wxControl)
|
||||
EVT_KEY_DOWN (HoverButtonBase::onKeyDown)
|
||||
EVT_KEY_UP (HoverButtonBase::onKeyUp)
|
||||
EVT_MOUSE_CAPTURE_LOST(HoverButtonBase::onLoseCapture)
|
||||
EVT_ERASE_BACKGROUND(HoverButtonBase::onEraseBackground)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
// ----------------------------------------------------------------------------- : Button with image and hover effect
|
||||
|
||||
@@ -60,7 +60,6 @@ private:
|
||||
void onKeyDown (wxKeyEvent&);
|
||||
void onKeyUp (wxKeyEvent&);
|
||||
void onPaint (wxPaintEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
|
||||
protected:
|
||||
bool hover, focus, mouse_down, key_down;
|
||||
|
||||
@@ -22,7 +22,9 @@ DEFINE_EVENT_TYPE(EVENT_SIZE_CHANGE);
|
||||
CardViewer::CardViewer(Window* parent, int id, long style)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, style)
|
||||
, up_to_date(false)
|
||||
{}
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
}
|
||||
|
||||
wxSize CardViewer::DoGetBestSize() const {
|
||||
wxSize ws = GetSize(), cs = GetClientSize();
|
||||
@@ -154,6 +156,5 @@ Rotation CardViewer::getRotation() const {
|
||||
// ----------------------------------------------------------------------------- : Event table
|
||||
|
||||
BEGIN_EVENT_TABLE(CardViewer, wxControl)
|
||||
EVT_PAINT (CardViewer::onPaint)
|
||||
EVT_ERASE_BACKGROUND(CardViewer::onEraseBackground)
|
||||
EVT_PAINT(CardViewer::onPaint)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
@@ -54,7 +54,6 @@ protected:
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
void onPaint(wxPaintEvent&);
|
||||
|
||||
Bitmap buffer; ///< Off-screen buffer we draw to
|
||||
|
||||
@@ -348,5 +348,4 @@ BEGIN_EVENT_TABLE(GalleryList, wxPanel)
|
||||
EVT_PAINT (GalleryList::onPaint)
|
||||
EVT_SIZE (GalleryList::onSize)
|
||||
EVT_SCROLLWIN (GalleryList::onScroll)
|
||||
EVT_ERASE_BACKGROUND(GalleryList::onEraseBackground)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
@@ -91,7 +91,6 @@ private:
|
||||
void onChar(wxKeyEvent& ev);
|
||||
void onFocus(wxFocusEvent&);
|
||||
void onPaint(wxPaintEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
void onSize(wxSizeEvent&);
|
||||
void onScroll(wxScrollWinEvent&);
|
||||
void OnDraw(DC& dc);
|
||||
|
||||
@@ -1019,7 +1019,9 @@ void GraphContainer::add(const GraphP& graph) {
|
||||
GraphControl::GraphControl(Window* parent, int id)
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxBORDER_THEME)
|
||||
, layout(GRAPH_TYPE_BAR)
|
||||
{}
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
}
|
||||
|
||||
void GraphControl::setLayout(GraphType type, bool force) {
|
||||
if (!force && graph && type == layout) return;
|
||||
@@ -1208,10 +1210,9 @@ void GraphControl::onMotion(wxMouseEvent& ev) {
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(GraphControl, wxControl)
|
||||
EVT_PAINT (GraphControl::onPaint)
|
||||
EVT_SIZE (GraphControl::onSize)
|
||||
EVT_LEFT_DOWN (GraphControl::onMouseDown)
|
||||
EVT_MOTION (GraphControl::onMotion)
|
||||
EVT_CHAR (GraphControl::onChar)
|
||||
EVT_ERASE_BACKGROUND(GraphControl::onEraseBackground)
|
||||
EVT_PAINT(GraphControl::onPaint)
|
||||
EVT_SIZE(GraphControl::onSize)
|
||||
EVT_LEFT_DOWN(GraphControl::onMouseDown)
|
||||
EVT_MOTION(GraphControl::onMotion)
|
||||
EVT_CHAR(GraphControl::onChar)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
@@ -371,7 +371,6 @@ private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
void onPaint(wxPaintEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
void onSize (wxSizeEvent&);
|
||||
void onMouseDown(wxMouseEvent& ev);
|
||||
void onMotion(wxMouseEvent& ev);
|
||||
|
||||
@@ -354,7 +354,9 @@ ImageSlicePreview::ImageSlicePreview(Window* parent, int id, ImageSlice& slice,
|
||||
, slice(slice)
|
||||
, mask(mask)
|
||||
, mouse_down(false)
|
||||
{}
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
}
|
||||
|
||||
void ImageSlicePreview::update() {
|
||||
bitmap = wxNullBitmap;
|
||||
@@ -430,7 +432,6 @@ BEGIN_EVENT_TABLE(ImageSlicePreview, wxControl)
|
||||
EVT_LEFT_UP (ImageSlicePreview::onLeftUp)
|
||||
EVT_MOTION (ImageSlicePreview::onMotion)
|
||||
EVT_MOUSE_CAPTURE_LOST(ImageSlicePreview::onLoseCapture)
|
||||
EVT_ERASE_BACKGROUND(ImageSlicePreview::onEraseBackground)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
|
||||
@@ -443,7 +444,9 @@ ImageSliceSelector::ImageSliceSelector(Window* parent, int id, ImageSlice& slice
|
||||
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME)
|
||||
, slice(slice)
|
||||
, mouse_down(false)
|
||||
{}
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
}
|
||||
|
||||
void ImageSliceSelector::update() {
|
||||
Refresh(false);
|
||||
@@ -696,5 +699,4 @@ BEGIN_EVENT_TABLE(ImageSliceSelector, wxControl)
|
||||
EVT_MOTION (ImageSliceSelector::onMotion)
|
||||
EVT_SIZE (ImageSliceSelector::onSize)
|
||||
EVT_MOUSE_CAPTURE_LOST(ImageSliceSelector::onLoseCapture)
|
||||
EVT_ERASE_BACKGROUND(ImageSliceSelector::onEraseBackground)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
@@ -141,7 +141,6 @@ private:
|
||||
void onLoseCapture(wxMouseCaptureLostEvent&);
|
||||
|
||||
void onPaint(wxPaintEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
void draw(DC& dc);
|
||||
};
|
||||
|
||||
@@ -176,7 +175,6 @@ private:
|
||||
void onLoseCapture(wxMouseCaptureLostEvent&);
|
||||
|
||||
void onPaint(wxPaintEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
void onSize(wxSizeEvent&);
|
||||
|
||||
// Is the mouse on a (scale) handle?
|
||||
|
||||
@@ -35,7 +35,6 @@ private:
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
void onPaint(wxPaintEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
void onTimer(wxTimerEvent&);
|
||||
void onSize(wxSizeEvent&);
|
||||
void draw_profiler(wxDC& dc, int x, int y);
|
||||
@@ -67,6 +66,7 @@ ProfilerPanel::ProfilerPanel(wxWindow* parent, bool fancy_effects)
|
||||
, fancy_effects(fancy_effects)
|
||||
, timer(this)
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
// profiler::set_function_leave_callback(refresh_profiler_panel);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,6 @@ BEGIN_EVENT_TABLE(ProfilerPanel, wxPanel)
|
||||
EVT_PAINT( ProfilerPanel::onPaint)
|
||||
EVT_SIZE( ProfilerPanel::onSize)
|
||||
EVT_TIMER(wxID_ANY, ProfilerPanel::onTimer)
|
||||
EVT_ERASE_BACKGROUND(ProfilerPanel::onEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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 ()
|
||||
|
||||
@@ -172,6 +172,5 @@ private:
|
||||
void onIdle (wxIdleEvent&);
|
||||
|
||||
void onSizeChange (wxCommandEvent&);
|
||||
void onEraseBackground (wxEraseEvent&) {} // reduce flicker
|
||||
};
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ WelcomeWindow::WelcomeWindow()
|
||||
{
|
||||
SetIcon(load_resource_icon(_("app")));
|
||||
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
// init controls
|
||||
#ifdef USE_HOVERBUTTON
|
||||
wxControl* new_set = new HoverButtonExt(this, ID_FILE_NEW, load_resource_image(_("welcome_new")), _BUTTON_("new set"), _HELP_("new set"));
|
||||
@@ -145,7 +147,6 @@ BEGIN_EVENT_TABLE(WelcomeWindow, wxFrame)
|
||||
EVT_BUTTON (ID_FILE_RECENT, WelcomeWindow::onOpenLast)
|
||||
EVT_BUTTON (ID_FILE_CHECK_UPDATES, WelcomeWindow::onCheckUpdates)
|
||||
EVT_PAINT ( WelcomeWindow::onPaint)
|
||||
EVT_ERASE_BACKGROUND(WelcomeWindow::onEraseBackground)
|
||||
// EVT_IDLE ( WelcomeWindow::onIdle)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ private:
|
||||
void onNewSet (wxCommandEvent&);
|
||||
void onOpenLast (wxCommandEvent&);
|
||||
void onCheckUpdates(wxCommandEvent&);
|
||||
void onEraseBackground(wxEraseEvent&) {}
|
||||
// void onIdle (wxIdleEvent& ev);
|
||||
|
||||
/// Close the welcome window, and show the given set
|
||||
|
||||
Reference in New Issue
Block a user