gecko/widget/gtk/nsPrintSettingsGTK.h
Martin Stransky c53988803d Bug 917270 - Rename widget/gtk2 to widget/gtk. r=karlt
--HG--
rename : widget/gtk2/Makefile.in => widget/gtk/Makefile.in
rename : widget/gtk2/WidgetTraceEvent.cpp => widget/gtk/WidgetTraceEvent.cpp
rename : widget/gtk2/compat/gdk/gdkdnd.h => widget/gtk/compat/gdk/gdkdnd.h
rename : widget/gtk2/compat/gdk/gdkkeysyms.h => widget/gtk/compat/gdk/gdkkeysyms.h
rename : widget/gtk2/compat/gdk/gdkvisual.h => widget/gtk/compat/gdk/gdkvisual.h
rename : widget/gtk2/compat/gdk/gdkwindow.h => widget/gtk/compat/gdk/gdkwindow.h
rename : widget/gtk2/compat/gdk/gdkx.h => widget/gtk/compat/gdk/gdkx.h
rename : widget/gtk2/compat/glib/gmem.h => widget/gtk/compat/glib/gmem.h
rename : widget/gtk2/compat/gtk/gtkcolorseldialog.h => widget/gtk/compat/gtk/gtkcolorseldialog.h
rename : widget/gtk2/compat/gtk/gtkdialog.h => widget/gtk/compat/gtk/gtkdialog.h
rename : widget/gtk2/compat/gtk/gtkplug.h => widget/gtk/compat/gtk/gtkplug.h
rename : widget/gtk2/compat/gtk/gtkselection.h => widget/gtk/compat/gtk/gtkselection.h
rename : widget/gtk2/compat/gtk/gtkwidget.h => widget/gtk/compat/gtk/gtkwidget.h
rename : widget/gtk2/compat/gtk/gtkwindow.h => widget/gtk/compat/gtk/gtkwindow.h
rename : widget/gtk2/crashtests/673390-1.html => widget/gtk/crashtests/673390-1.html
rename : widget/gtk2/crashtests/crashtests.list => widget/gtk/crashtests/crashtests.list
rename : widget/gtk2/gtk2drawing.c => widget/gtk/gtk2drawing.c
rename : widget/gtk2/gtk3drawing.c => widget/gtk/gtk3drawing.c
rename : widget/gtk2/gtkdrawing.h => widget/gtk/gtkdrawing.h
rename : widget/gtk2/maiRedundantObjectFactory.c => widget/gtk/maiRedundantObjectFactory.c
rename : widget/gtk2/maiRedundantObjectFactory.h => widget/gtk/maiRedundantObjectFactory.h
rename : widget/gtk2/moz.build => widget/gtk/moz.build
rename : widget/gtk2/mozcontainer.c => widget/gtk/mozcontainer.c
rename : widget/gtk2/mozcontainer.h => widget/gtk/mozcontainer.h
rename : widget/gtk2/nsAppShell.cpp => widget/gtk/nsAppShell.cpp
rename : widget/gtk2/nsAppShell.h => widget/gtk/nsAppShell.h
rename : widget/gtk2/nsBidiKeyboard.cpp => widget/gtk/nsBidiKeyboard.cpp
rename : widget/gtk2/nsBidiKeyboard.h => widget/gtk/nsBidiKeyboard.h
rename : widget/gtk2/nsCUPSShim.cpp => widget/gtk/nsCUPSShim.cpp
rename : widget/gtk2/nsCUPSShim.h => widget/gtk/nsCUPSShim.h
rename : widget/gtk2/nsClipboard.cpp => widget/gtk/nsClipboard.cpp
rename : widget/gtk2/nsClipboard.h => widget/gtk/nsClipboard.h
rename : widget/gtk2/nsColorPicker.cpp => widget/gtk/nsColorPicker.cpp
rename : widget/gtk2/nsColorPicker.h => widget/gtk/nsColorPicker.h
rename : widget/gtk2/nsDeviceContextSpecG.cpp => widget/gtk/nsDeviceContextSpecG.cpp
rename : widget/gtk2/nsDeviceContextSpecG.h => widget/gtk/nsDeviceContextSpecG.h
rename : widget/gtk2/nsDragService.cpp => widget/gtk/nsDragService.cpp
rename : widget/gtk2/nsDragService.h => widget/gtk/nsDragService.h
rename : widget/gtk2/nsFilePicker.cpp => widget/gtk/nsFilePicker.cpp
rename : widget/gtk2/nsFilePicker.h => widget/gtk/nsFilePicker.h
rename : widget/gtk2/nsGTKToolkit.h => widget/gtk/nsGTKToolkit.h
rename : widget/gtk2/nsGtkCursors.h => widget/gtk/nsGtkCursors.h
rename : widget/gtk2/nsGtkIMModule.cpp => widget/gtk/nsGtkIMModule.cpp
rename : widget/gtk2/nsGtkIMModule.h => widget/gtk/nsGtkIMModule.h
rename : widget/gtk2/nsGtkKeyUtils.cpp => widget/gtk/nsGtkKeyUtils.cpp
rename : widget/gtk2/nsGtkKeyUtils.h => widget/gtk/nsGtkKeyUtils.h
rename : widget/gtk2/nsGtkUtils.h => widget/gtk/nsGtkUtils.h
rename : widget/gtk2/nsIImageToPixbuf.h => widget/gtk/nsIImageToPixbuf.h
rename : widget/gtk2/nsIdleServiceGTK.cpp => widget/gtk/nsIdleServiceGTK.cpp
rename : widget/gtk2/nsIdleServiceGTK.h => widget/gtk/nsIdleServiceGTK.h
rename : widget/gtk2/nsImageToPixbuf.cpp => widget/gtk/nsImageToPixbuf.cpp
rename : widget/gtk2/nsImageToPixbuf.h => widget/gtk/nsImageToPixbuf.h
rename : widget/gtk2/nsLookAndFeel.cpp => widget/gtk/nsLookAndFeel.cpp
rename : widget/gtk2/nsLookAndFeel.h => widget/gtk/nsLookAndFeel.h
rename : widget/gtk2/nsNativeKeyBindings.cpp => widget/gtk/nsNativeKeyBindings.cpp
rename : widget/gtk2/nsNativeKeyBindings.h => widget/gtk/nsNativeKeyBindings.h
rename : widget/gtk2/nsNativeThemeGTK.cpp => widget/gtk/nsNativeThemeGTK.cpp
rename : widget/gtk2/nsNativeThemeGTK.h => widget/gtk/nsNativeThemeGTK.h
rename : widget/gtk2/nsPSPrinters.cpp => widget/gtk/nsPSPrinters.cpp
rename : widget/gtk2/nsPSPrinters.h => widget/gtk/nsPSPrinters.h
rename : widget/gtk2/nsPaperPS.cpp => widget/gtk/nsPaperPS.cpp
rename : widget/gtk2/nsPaperPS.h => widget/gtk/nsPaperPS.h
rename : widget/gtk2/nsPrintDialogGTK.cpp => widget/gtk/nsPrintDialogGTK.cpp
rename : widget/gtk2/nsPrintDialogGTK.h => widget/gtk/nsPrintDialogGTK.h
rename : widget/gtk2/nsPrintOptionsGTK.cpp => widget/gtk/nsPrintOptionsGTK.cpp
rename : widget/gtk2/nsPrintOptionsGTK.h => widget/gtk/nsPrintOptionsGTK.h
rename : widget/gtk2/nsPrintSettingsGTK.cpp => widget/gtk/nsPrintSettingsGTK.cpp
rename : widget/gtk2/nsPrintSettingsGTK.h => widget/gtk/nsPrintSettingsGTK.h
rename : widget/gtk2/nsScreenGtk.cpp => widget/gtk/nsScreenGtk.cpp
rename : widget/gtk2/nsScreenGtk.h => widget/gtk/nsScreenGtk.h
rename : widget/gtk2/nsScreenManagerGtk.cpp => widget/gtk/nsScreenManagerGtk.cpp
rename : widget/gtk2/nsScreenManagerGtk.h => widget/gtk/nsScreenManagerGtk.h
rename : widget/gtk2/nsSound.cpp => widget/gtk/nsSound.cpp
rename : widget/gtk2/nsSound.h => widget/gtk/nsSound.h
rename : widget/gtk2/nsToolkit.cpp => widget/gtk/nsToolkit.cpp
rename : widget/gtk2/nsWidgetFactory.cpp => widget/gtk/nsWidgetFactory.cpp
rename : widget/gtk2/nsWindow.cpp => widget/gtk/nsWindow.cpp
rename : widget/gtk2/nsWindow.h => widget/gtk/nsWindow.h
2013-09-23 09:21:57 -04:00

155 lines
5.5 KiB
C++

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPrintSettingsGTK_h_
#define nsPrintSettingsGTK_h_
#include "nsPrintSettingsImpl.h"
extern "C" {
#include <gtk/gtk.h>
#if (MOZ_WIDGET_GTK == 2)
#include <gtk/gtkprinter.h>
#include <gtk/gtkprintjob.h>
#else
#include <gtk/gtkunixprint.h>
#endif
}
#define NS_PRINTSETTINGSGTK_IID \
{ 0x758df520, 0xc7c3, 0x11dc, { 0x95, 0xff, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
//*****************************************************************************
//*** nsPrintSettingsGTK
//*****************************************************************************
class nsPrintSettingsGTK : public nsPrintSettings
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PRINTSETTINGSGTK_IID)
nsPrintSettingsGTK();
virtual ~nsPrintSettingsGTK();
// We're overriding these methods because we want to read/write with GTK objects,
// not local variables. This allows a simpler settings implementation between
// Gecko and GTK.
GtkPageSetup* GetGtkPageSetup() { return mPageSetup; };
void SetGtkPageSetup(GtkPageSetup *aPageSetup);
GtkPrintSettings* GetGtkPrintSettings() { return mPrintSettings; };
void SetGtkPrintSettings(GtkPrintSettings *aPrintSettings);
GtkPrinter* GetGtkPrinter() { return mGTKPrinter; };
void SetGtkPrinter(GtkPrinter *aPrinter);
bool GetForcePrintSelectionOnly() { return mPrintSelectionOnly; };
void SetForcePrintSelectionOnly(bool aPrintSelectionOnly) { mPrintSelectionOnly = aPrintSelectionOnly; };
// If not printing the selection, this is stored in the GtkPrintSettings. Printing the
// selection is stored as a protected boolean (mPrintSelectionOnly).
NS_IMETHOD GetPrintRange(int16_t *aPrintRange);
NS_IMETHOD SetPrintRange(int16_t aPrintRange);
// The page range is stored as as single range in the GtkPrintSettings object.
NS_IMETHOD GetStartPageRange(int32_t *aStartPageRange);
NS_IMETHOD SetStartPageRange(int32_t aStartPageRange);
NS_IMETHOD GetEndPageRange(int32_t *aEndPageRange);
NS_IMETHOD SetEndPageRange(int32_t aEndPageRange);
// Reversed, color, orientation and file name are all stored in the GtkPrintSettings.
// Orientation is also stored in the GtkPageSetup and its setting takes priority when getting the orientation.
NS_IMETHOD GetPrintReversed(bool *aPrintReversed);
NS_IMETHOD SetPrintReversed(bool aPrintReversed);
NS_IMETHOD GetPrintInColor(bool *aPrintInColor);
NS_IMETHOD SetPrintInColor(bool aPrintInColor);
NS_IMETHOD GetOrientation(int32_t *aOrientation);
NS_IMETHOD SetOrientation(int32_t aOrientation);
NS_IMETHOD GetToFileName(PRUnichar * *aToFileName);
NS_IMETHOD SetToFileName(const PRUnichar * aToFileName);
// Gets/Sets the printer name in the GtkPrintSettings. If no printer name is specified there,
// you will get back the name of the current internal GtkPrinter.
NS_IMETHOD GetPrinterName(PRUnichar * *aPrinter);
NS_IMETHOD SetPrinterName(const PRUnichar * aPrinter);
// Number of copies is stored/gotten from the GtkPrintSettings.
NS_IMETHOD GetNumCopies(int32_t *aNumCopies);
NS_IMETHOD SetNumCopies(int32_t aNumCopies);
NS_IMETHOD GetScaling(double *aScaling);
NS_IMETHOD SetScaling(double aScaling);
// A name recognised by GTK is strongly advised here, as this is used to create a GtkPaperSize.
NS_IMETHOD GetPaperName(PRUnichar * *aPaperName);
NS_IMETHOD SetPaperName(const PRUnichar * aPaperName);
NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin);
NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop);
NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft);
NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom);
NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight);
NS_IMETHOD GetPaperWidth(double *aPaperWidth);
NS_IMETHOD SetPaperWidth(double aPaperWidth);
NS_IMETHOD GetPaperHeight(double *aPaperHeight);
NS_IMETHOD SetPaperHeight(double aPaperHeight);
NS_IMETHOD SetPaperSizeUnit(int16_t aPaperSizeUnit);
NS_IMETHOD GetEffectivePageSize(double *aWidth, double *aHeight);
NS_IMETHOD SetupSilentPrinting();
NS_IMETHOD GetPageRanges(nsTArray<int32_t> &aPages);
NS_IMETHOD GetResolution(int32_t *aResolution);
NS_IMETHOD SetResolution(int32_t aResolution);
NS_IMETHOD GetDuplex(int32_t *aDuplex);
NS_IMETHOD SetDuplex(int32_t aDuplex);
protected:
nsPrintSettingsGTK(const nsPrintSettingsGTK& src);
nsPrintSettingsGTK& operator=(const nsPrintSettingsGTK& rhs);
virtual nsresult _Clone(nsIPrintSettings **_retval);
virtual nsresult _Assign(nsIPrintSettings *aPS);
GtkUnit GetGTKUnit(int16_t aGeckoUnit);
void SaveNewPageSize();
/**
* Re-initialize mUnwriteableMargin with values from mPageSetup.
* Should be called whenever mPageSetup is initialized or overwritten.
*/
void InitUnwriteableMargin();
/**
* On construction:
* - mPrintSettings, mPageSetup and mPaperSize are just new objects with defaults determined by GTK.
* - mGTKPrinter is NULL!!! Remember to be careful when accessing this property.
*/
GtkPageSetup* mPageSetup;
GtkPrintSettings* mPrintSettings;
GtkPrinter* mGTKPrinter;
GtkPaperSize* mPaperSize;
bool mPrintSelectionOnly;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPrintSettingsGTK, NS_PRINTSETTINGSGTK_IID)
#endif // nsPrintSettingsGTK_h_