The CalcDocument class
The CalcDocument
class is the main class of the application. It catches mouse and keyboard events, handles scrolling and painting, and processes menu actions. However, the cell-level operations are handled by the Cell
class, which we will cover in Chapter 9, Formula Interpretation.
The user can mark one or several cells, in which case, the private field calcMode
is set to Mark
. The user can also edit the text in one cell, in which case the calcMode
field is set to Edit
. Similar to the word processor in the previous chapters, we refer to the current value of the calcMode
field in expressions such as in mark mode and in edit mode.
class CalcDocument : public StandardDocument { public: CalcDocument(WindowShow windowShow);
The OnMouseDown
, OnMouseMove
, and OnDoubleClick
methods catch the mouse actions in the same way as in the previous applications. Note that we do not override the OnMouseUp
method. Contrary to the word processor of Chapter...