File indexing completed on 2024-12-22 04:17:59
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2005 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 0014 #ifndef PAINTER_H 0015 #define PAINTER_H 0016 0017 #include <qpainter.h> 0018 0019 #include "kstmath_export.h" 0020 0021 namespace Kst { 0022 0023 class KSTMATH_EXPORT Painter : public QPainter 0024 { 0025 public: 0026 // KstPaintType - hints to paint to allow optimizations 0027 // P_PAINT: Neither 'data' nor 'plot' needs to change 0028 // P_PLOT: data didn't change 0029 // P_UPDATE: at least one curve was updated 0030 /* FIXME: Define P_PLOT better, and do we even need P_ZOOM, P_PLOT and 0031 P_PAINT? They should all do the same thing. 0032 */ 0033 enum PaintType { P_PAINT = 0, P_PLOT, P_ZOOM, P_UPDATE, P_PRINT, P_EXPORT }; 0034 0035 explicit Painter(PaintType t = P_PAINT); 0036 virtual ~Painter(); 0037 0038 // Defalut: P_PAINT 0039 void setType(PaintType t); 0040 PaintType type() const; 0041 0042 // True if UI elements such as focus rect should be drawn. default: false 0043 bool drawInlineUI() const; 0044 void setDrawInlineUI(bool draw); 0045 0046 inline QRegion& uiMask() { return _uiMask; } 0047 0048 bool makingMask() const; 0049 void setMakingMask(bool making); 0050 0051 int lineWidthAdjustmentFactor() const; 0052 0053 private: 0054 PaintType _type; 0055 bool _drawInlineUI; 0056 bool _makingMask; 0057 QRegion _uiMask; 0058 }; 0059 0060 } 0061 #endif 0062 // vim: ts=2 sw=2 et