2009-12-31 03:51:59 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gprinter.h
|
|
|
|
|
2011-12-31 03:39:20 +01:00
|
|
|
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
|
2009-12-31 03:51:59 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2009-12-31 03:51:59 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GPRINTER_H
|
|
|
|
#define __GPRINTER_H
|
|
|
|
|
2011-04-13 00:57:32 +02:00
|
|
|
#include <gtk/gtkunixprint.h>
|
2010-03-14 23:02:21 +01:00
|
|
|
|
2009-12-31 03:51:59 +01:00
|
|
|
class gPrinter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gPrinter();
|
|
|
|
virtual ~gPrinter();
|
|
|
|
void *tag;
|
|
|
|
|
2010-01-04 13:04:53 +01:00
|
|
|
bool configure() { return run(true); }
|
|
|
|
bool print() { return run(false); }
|
2009-12-31 03:51:59 +01:00
|
|
|
void cancel();
|
|
|
|
|
|
|
|
void setPageCount(int v);
|
|
|
|
int pageCount() const { return _page_count; }
|
|
|
|
bool isPageCountSet() const { return _page_count_set; }
|
|
|
|
|
2010-01-01 03:12:35 +01:00
|
|
|
int orientation() const;
|
|
|
|
void setOrientation(int v);
|
|
|
|
|
|
|
|
int paperModel() const { return _paper_size; }
|
|
|
|
void setPaperModel(int v);
|
|
|
|
|
2010-03-27 09:14:06 +01:00
|
|
|
void getPaperSize(double *width, double *height);
|
2010-01-01 03:12:35 +01:00
|
|
|
void setPaperSize(double width, double height);
|
|
|
|
|
|
|
|
bool collateCopies() const;
|
|
|
|
void setCollateCopies(bool v);
|
|
|
|
|
|
|
|
bool reverserOrder() const;
|
|
|
|
void setReverseOrder(bool v);
|
|
|
|
|
|
|
|
int duplex() const;
|
|
|
|
void setDuplex(int v);
|
|
|
|
|
|
|
|
bool useColor() const;
|
|
|
|
void setUseColor(bool v);
|
|
|
|
|
|
|
|
int numCopies() const;
|
|
|
|
void setNumCopies(int v);
|
|
|
|
|
|
|
|
int resolution() const;
|
|
|
|
void setResolution(int v);
|
|
|
|
|
|
|
|
void getPrintPages(int *from, int *to) const;
|
|
|
|
void setPrintPages(int from, int to);
|
|
|
|
|
|
|
|
bool useFullPage() const { return _use_full_page; }
|
|
|
|
void setUseFullPage(bool v);
|
|
|
|
|
|
|
|
const char *name() const;
|
|
|
|
void setName(const char *name);
|
|
|
|
|
2010-01-04 13:04:53 +01:00
|
|
|
const char *outputFileName() const;
|
|
|
|
void setOutputFileName(const char *file);
|
|
|
|
|
2009-12-31 03:51:59 +01:00
|
|
|
// Signals
|
|
|
|
|
2010-03-13 19:27:51 +01:00
|
|
|
void (*onBegin)(gPrinter *me, GtkPrintContext *context);
|
2009-12-31 03:51:59 +01:00
|
|
|
void (*onEnd)(gPrinter *me);
|
|
|
|
void (*onDraw)(gPrinter *me, GtkPrintContext *context, int page);
|
|
|
|
void (*onPaginate)(gPrinter *me);
|
|
|
|
|
2010-03-14 23:02:21 +01:00
|
|
|
void defineSettings();
|
|
|
|
void storeSettings();
|
|
|
|
|
|
|
|
bool _preview;
|
|
|
|
GtkPrinter *_printer;
|
2011-02-23 16:49:56 +01:00
|
|
|
GtkPrintSettings *_settings;
|
|
|
|
|
|
|
|
static void fixPrintDialog(GtkPrintUnixDialog *dialog);
|
2011-12-22 14:14:08 +01:00
|
|
|
static gPrinter *_current;
|
2010-03-14 23:02:21 +01:00
|
|
|
|
2009-12-31 03:51:59 +01:00
|
|
|
private:
|
2010-01-04 13:04:53 +01:00
|
|
|
bool run(bool configure);
|
2011-02-05 02:28:12 +01:00
|
|
|
bool isVirtual();
|
2010-03-27 09:14:06 +01:00
|
|
|
GtkPaperSize *getPaperSize();
|
2010-01-04 13:04:53 +01:00
|
|
|
|
2009-12-31 03:51:59 +01:00
|
|
|
GtkPrintOperation *_operation;
|
|
|
|
GtkPageSetup *_page;
|
|
|
|
int _page_count;
|
|
|
|
bool _page_count_set;
|
2010-01-01 03:12:35 +01:00
|
|
|
int _paper_size;
|
|
|
|
bool _use_full_page;
|
2009-12-31 03:51:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|