utilities.hh 1.8 KB

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