mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Layout() always called when editor/viewer control changes size
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@145 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
#include <data/stylesheet.hpp>
|
||||
#include <wx/dcbuffer.h>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
DEFINE_EVENT_TYPE(EVENT_SIZE_CHANGE);
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardViewer
|
||||
|
||||
CardViewer::CardViewer(Window* parent, int id, long style)
|
||||
@@ -30,6 +34,16 @@ void CardViewer::onChange() {
|
||||
up_to_date = false;
|
||||
}
|
||||
|
||||
void CardViewer::onChangeSize() {
|
||||
wxSize ws = GetSize(), cs = GetClientSize();
|
||||
wxSize desired_cs = (wxSize)getRotation().getExternalSize() + ws - cs;
|
||||
if (desired_cs != cs) {
|
||||
wxCommandEvent ev(EVENT_SIZE_CHANGE, GetId());
|
||||
ProcessEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
DECLARE_DYNAMIC_ARG(bool, inOnPaint);
|
||||
IMPLEMENT_DYNAMIC_ARG(bool, inOnPaint, false);
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <render/card/viewer.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
/// Event that indicates the size of a CardViewer has changed
|
||||
DECLARE_EVENT_TYPE(EVENT_SIZE_CHANGE, <not used>)
|
||||
/// Handle EVENT_SIZE_CHANGE events
|
||||
#define EVT_SIZE_CHANGE(id, handler) EVT_COMMAND(id, EVENT_SIZE_CHANGE, handler)
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardViewer
|
||||
|
||||
/// A control to view a single card
|
||||
@@ -28,6 +35,7 @@ class CardViewer : public wxControl, public DataViewer {
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
virtual void onChange();
|
||||
virtual void onChangeSize();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
Reference in New Issue
Block a user