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
+14 -16
View File
@@ -39,26 +39,24 @@ ValueViewerP DataEditor::makeViewer(const StyleP& style) {
// ----------------------------------------------------------------------------- : Utility for ValueViewers
bool DataEditor::drawBorders() const {
return !nativeLook() &&
settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_borders();
}
bool DataEditor::drawEditing() const {
return nativeLook() ||
settings.stylesheetSettingsFor(set->stylesheetFor(card)).card_draw_editing();
}
bool DataEditor::drawFocus() const {
return FindFocus() == this;
DrawWhat DataEditor::drawWhat(const ValueViewer* viewer) const {
int what = DRAW_NORMAL
| DRAW_ACTIVE * viewerIsCurrent(viewer);
if (nativeLook()) {
what |= DRAW_BOXES | DRAW_EDITING | DRAW_NATIVELOOK;
} else {
StyleSheetSettings& ss = settings.stylesheetSettingsFor(set->stylesheetFor(card));
what |= DRAW_BORDERS * ss.card_borders()
| (DRAW_BOXES | DRAW_EDITING) * ss.card_draw_editing()
| DRAW_ERRORS;
}
return (DrawWhat)what;
}
wxPen DataEditor::borderPen(bool active) const {
return active ? wxPen(Color(0,128,255), 1, wxSOLID)
: wxPen(Color(128,128,128), 1, wxDOT);
bool DataEditor::viewerIsCurrent(const ValueViewer* viewer) const {
return viewer == current_viewer && FindFocus() == this;
}
ValueViewer* DataEditor::focusedViewer() const {
return FindFocus() == this ? current_viewer : nullptr;
}
void DataEditor::addAction(Action* action) {
set->actions.addAction(action);