utilities.hh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
  2. // vi:set ts=4 sts=4 sw=4 noet :
  3. //
  4. // Copyright 2010-2020 wkhtmltopdf authors
  5. //
  6. // This file is part of wkhtmltopdf.
  7. //
  8. // wkhtmltopdf is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU Lesser General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // wkhtmltopdf is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Lesser General Public License
  19. // along with wkhtmltopdf. If not, see <http://www.gnu.org/licenses/>.
  20. #ifndef __UTILITIES_HH__
  21. #define __UTILITIES_HH__
  22. #include <QProxyStyle>
  23. #include <QFile>
  24. #include <QFileInfo>
  25. #include <QImageWriter>
  26. #include <QPainter>
  27. #include <QStyleOption>
  28. #include <QSvgRenderer>
  29. #include <QUrl>
  30. #include <dllbegin.inc>
  31. /**
  32. * Custom simplistic style
  33. */
  34. class DLL_PUBLIC MyLooksStyle: public QProxyStyle {
  35. Q_OBJECT
  36. public:
  37. typedef QProxyStyle parent_t;
  38. MyLooksStyle();
  39. void drawPrimitive( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const;
  40. bool weAreDrawingForms;
  41. static QSvgRenderer * checkbox;
  42. static QSvgRenderer * checkbox_checked;
  43. static QSvgRenderer * radiobutton;
  44. static QSvgRenderer * radiobutton_checked;
  45. public slots:
  46. void producingForms(bool f);
  47. void setCheckboxSvg(const QString & path);
  48. void setCheckboxCheckedSvg(const QString & path);
  49. void setRadioButtonSvg(const QString & path);
  50. void setRadioButtonCheckedSvg(const QString & path);
  51. };
  52. DLL_PUBLIC int handleError(bool success, int errorCode);
  53. #include <dllend.inc>
  54. #endif //__UTILITIES_HH__