mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
redrawing of editors (for drop down lists)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@155 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -99,6 +99,9 @@ class ValueEditor {
|
||||
virtual void determineSize(bool force_fit = false) {}
|
||||
/// The editor is shown or hidden
|
||||
virtual void onShow(bool) {}
|
||||
|
||||
/// Redraw this viewer
|
||||
virtual void redraw() = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : Utility
|
||||
@@ -106,6 +109,7 @@ class ValueEditor {
|
||||
#define DECLARE_VALUE_EDITOR(Type) \
|
||||
Type##ValueEditor(DataEditor& parent, const Type##StyleP& style); \
|
||||
virtual ValueEditor* getEditor() { return this; } \
|
||||
virtual void redraw(); \
|
||||
private: \
|
||||
inline DataEditor& editor() const { \
|
||||
return static_cast<DataEditor&>(viewer); \
|
||||
@@ -113,6 +117,9 @@ class ValueEditor {
|
||||
public:
|
||||
|
||||
#define IMPLEMENT_VALUE_EDITOR(Type) \
|
||||
void Type##ValueEditor::redraw() { \
|
||||
editor().redraw(*this); \
|
||||
} \
|
||||
Type##ValueEditor::Type##ValueEditor(DataEditor& parent, const Type##StyleP& style) \
|
||||
: Type##ValueViewer(parent, style)
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ void TextValueEditor::moveSelection(IndexType t, size_t new_end, bool also_move_
|
||||
if (ensureCaretVisible()) {
|
||||
// we can't redraw just the selection because we must scroll
|
||||
updateScrollbar();
|
||||
// editor.refreshEditor();
|
||||
redraw();
|
||||
} else {
|
||||
// draw new selection
|
||||
v.drawSelection(rdc, style(), selection_start_i, selection_end_i);
|
||||
@@ -605,7 +605,7 @@ void TextValueEditor::determineSize(bool force_fit) {
|
||||
style().top - 1,
|
||||
sbw,
|
||||
style().height + 2);
|
||||
// r.reset();
|
||||
v.reset();
|
||||
} else {
|
||||
// Height depends on font
|
||||
wxMemoryDC dc;
|
||||
@@ -637,7 +637,7 @@ void TextValueEditor::scrollTo(int pos) {
|
||||
v.scrollTo(pos);
|
||||
// move the cursor if needed
|
||||
// refresh
|
||||
// viewer.onChange();
|
||||
redraw();
|
||||
}
|
||||
|
||||
bool TextValueEditor::ensureCaretVisible() {
|
||||
|
||||
Reference in New Issue
Block a user