+
+
+protected:
+
+ /**
+ This function doesn't have to be overridden but it may be useful to do
+ so if calculating the units' sizes is a relatively expensive operation
+ as it gives your code a chance to calculate several of them at once and
+ cache the result if necessary.
+
+ OnGetUnitsSizeHint() is normally called just before OnGetUnitSize() but
+ you shouldn't rely on the latter being called for all units in the
+ interval specified here. It is also possible that OnGetUnitSize() will
+ be called for units outside of this interval, so this is really just a
+ hint, not a promise.
+
+ Finally, note that @a unitMin is inclusive, while @a unitMax is
+ exclusive.
+ */
+ virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const;
+
+ /**
+ When the number of scroll units change, we try to estimate the total
+ size of all units when the full window size is needed (i.e. to
+ calculate the scrollbar thumb size). This is a rather expensive
+ operation in terms of unit access, so if the user code may estimate the
+ average size better or faster than we do, it should override this
+ function to implement its own logic. This function should return the
+ best guess for the total virtual window size.
+
+ @note Although returning a totally wrong value would still work, it
+ risks resulting in very strange scrollbar behaviour so this
+ function should really try to make the best guess possible.
+ */
+ virtual wxCoord EstimateTotalSize() const;
+
+ /**
+ This function must be overridden in the derived class, and should
+ return the size of the given unit in pixels.
+ */
+ virtual wxCoord OnGetUnitSize(size_t unit) const = 0;