mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Implemented ImageValueViewer, and more of the related classes
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@54 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -7,15 +7,47 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <render/value/viewer.hpp>
|
||||
#include <render/value/text.hpp>
|
||||
#include <render/value/choice.hpp>
|
||||
#include <render/value/multiple_choice.hpp>
|
||||
#include <render/value/boolean.hpp>
|
||||
#include <render/value/image.hpp>
|
||||
#include <render/value/symbol.hpp>
|
||||
#include <render/value/color.hpp>
|
||||
#include <render/card/viewer.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : ValueViewer
|
||||
|
||||
ValueViewer::ValueViewer(DataViewer& parent, const StyleP& style)
|
||||
: viewer(parent), styleP(style)
|
||||
{}
|
||||
|
||||
Set& ValueViewer::getSet() const { return *viewer.getSet(); }
|
||||
|
||||
void ValueViewer::setValue(const ValueP& value) {
|
||||
assert(value->fieldP == styleP->fieldP); // matching field
|
||||
valueP = value;
|
||||
onValueChange();
|
||||
}
|
||||
|
||||
bool ValueViewer::containsPoint(const RealPoint& p) const {
|
||||
return p.x >= styleP->left
|
||||
&& p.y >= styleP->top
|
||||
&& p.x < styleP->left + (int)(styleP->width)
|
||||
&& p.y < styleP->top + (int)(styleP->height);
|
||||
}
|
||||
RealRect ValueViewer::boundingBox() const {
|
||||
return styleP->getRect().grow(1);
|
||||
}
|
||||
|
||||
void ValueViewer::drawFieldBorder(RotatedDC& dc) {
|
||||
if (viewer.drawBorders() && getField()->editable) {
|
||||
dc.SetPen(viewer.borderPen(viewer.focusedViewer() == this));
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.DrawRectangle(styleP->getRect().grow(dc.trInvS(1)));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Development/debug
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -31,11 +63,18 @@ void ValueViewer::setValue(const ValueP& value) {
|
||||
#include <data/field/symbol.hpp>
|
||||
#include <data/field/text.hpp>
|
||||
|
||||
#define IMPLEMENT_MAKE_VIEWER(Type) \
|
||||
ValueViewerP Type##Style::makeViewer(DataViewer& parent, const StyleP& thisP) { \
|
||||
assert(thisP.get() == this); \
|
||||
return ValueViewerP(new Type##ValueViewer(parent, static_pointer_cast<Type##Style>(thisP))); \
|
||||
}
|
||||
|
||||
ValueViewerP ChoiceStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
ValueViewerP BooleanStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
ValueViewerP MultipleChoiceStyle::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
ValueViewerP ColorStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
ValueViewerP ImageStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
//ValueViewerP ImageStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
IMPLEMENT_MAKE_VIEWER(Image);
|
||||
ValueViewerP SymbolStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
ValueViewerP TextStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user