mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Added dummy CardEditor, implemented Stylesheet loading
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@50 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -10,6 +10,11 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : ValueViewer
|
||||
|
||||
void ValueViewer::setValue(const ValueP& value) {
|
||||
assert(value->fieldP == styleP->fieldP); // matching field
|
||||
valueP = value;
|
||||
onValueChange();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Development/debug
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <util/rotation.hpp>
|
||||
#include <util/real_point.hpp>
|
||||
#include <data/field.hpp>
|
||||
|
||||
class DataViewer;
|
||||
class ValueAction;
|
||||
@@ -26,7 +27,12 @@ class ValueViewer {
|
||||
public:
|
||||
/// Construct a ValueViewer, set the value at a later time
|
||||
ValueViewer(DataViewer& parent, const StyleP& style);
|
||||
virtual ~ValueViewer();
|
||||
virtual ~ValueViewer() {}
|
||||
|
||||
/// Change the associated value
|
||||
void setValue(const ValueP&);
|
||||
/// Return the associated field
|
||||
inline const FieldP& getField() const { return styleP->fieldP; }
|
||||
|
||||
// Draw this value
|
||||
virtual void draw(RotatedDC& dc) = 0;
|
||||
@@ -46,13 +52,10 @@ class ValueViewer {
|
||||
/// Called when an action is performed on the associated value
|
||||
virtual void onAction(const ValueAction&, bool undone) { onValueChange(); }
|
||||
|
||||
/// Change the associated value
|
||||
void setValue(const ValueP&);
|
||||
|
||||
protected:
|
||||
DataViewer& viewer; ///< Our parent object
|
||||
StyleP style_; ///< The style of this viewer
|
||||
ValueP value_; ///< The value we are currently viewing
|
||||
StyleP styleP; ///< The style of this viewer
|
||||
ValueP valueP; ///< The value we are currently viewing
|
||||
|
||||
/// Should this viewer render using a platform native look?
|
||||
bool nativeLook() const;
|
||||
@@ -70,8 +73,9 @@ class ValueViewer {
|
||||
public: \
|
||||
Type(DataViewer& parent, const Type ## StyleP& style) \
|
||||
private: \
|
||||
inline Type##Style style() const { return *value_; } \
|
||||
inline Type##Value value() const { return *value_; }
|
||||
inline Type##Style& style() const { return *styleP; } \
|
||||
inline Type##Value& value() const { return *valueP; } \
|
||||
inline Type##Field& field() const { return styleP->field(); }
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
Reference in New Issue
Block a user