Cleaned up handling of what things should be drawn by using the DrawWhat enumeration type.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1072 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-06 03:05:40 +00:00
parent 6c782bb033
commit b586790421
16 changed files with 113 additions and 82 deletions
+15 -7
View File
@@ -96,13 +96,21 @@ void DataViewer::updateStyles(bool only_content_dependent) {
// ----------------------------------------------------------------------------- : Utility for ValueViewers
bool DataViewer::nativeLook() const { return false; }
bool DataViewer::drawBorders() const { return false; }
bool DataViewer::drawEditing() const { return false; }
bool DataViewer::drawFocus() const { return false; }
wxPen DataViewer::borderPen(bool) const { return wxPen(); }
ValueViewer* DataViewer::focusedViewer() const { return nullptr; }
Context& DataViewer::getContext() const { return set->getContext(card); }
bool DataViewer::nativeLook() const {
return false;
}
DrawWhat DataViewer::drawWhat(const ValueViewer*) const {
return (DrawWhat)(DRAW_NORMAL | nativeLook() * DRAW_NATIVELOOK);
}
bool DataViewer::viewerIsCurrent(const ValueViewer*) const {
return false;
}
Context& DataViewer::getContext() const {
return set->getContext(card);
}
Rotation DataViewer::getRotation() const {
if (!stylesheet) stylesheet = set->stylesheet;
+6 -14
View File
@@ -12,6 +12,7 @@
#include <util/prec.hpp>
#include <util/rotation.hpp>
#include <data/set.hpp>
#include <data/draw_what.hpp>
DECLARE_POINTER_TYPE(Style);
DECLARE_POINTER_TYPE(ValueViewer);
@@ -39,20 +40,11 @@ class DataViewer : public SetView {
/// Should the ValueViewers use a platform native look and feel?
/** false by default, can be overloaded */
virtual bool nativeLook() const;
/// Should field borders be drawn?
/** false by default, can be overloaded */
virtual bool drawBorders() const;
/// Should editing specific things be drawn?
/** false by default, can be overloaded */
virtual bool drawEditing() const;
/// Should focus only editing specific things be drawn?
/** false by default, can be overloaded */
virtual bool drawFocus() const;
/// Pens for drawing field borders (only called if drawBorders())
virtual wxPen borderPen(bool active) const;
/// The viewer that is currently focused, may be null
/** null by default, can be overloaded */
virtual ValueViewer* focusedViewer() const;
/// Which things should be drawn for the given viewer?
/** can be overloaded */
virtual DrawWhat drawWhat(const ValueViewer*) const;
/// Is the given viewer currently selected?
virtual bool viewerIsCurrent(const ValueViewer*) const;
/// Get a script context to use for scripts in the viewers
Context& getContext() const;
/// The rotation to use