mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Allow customization of print options via CefHandler::HandlePrintOptions() (issue #112).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@98 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -635,6 +635,19 @@ public:
|
||||
virtual RetVal HandleMenuAction(CefRefPtr<CefBrowser> browser,
|
||||
MenuId menuId) =0;
|
||||
|
||||
// Structure representing print options.
|
||||
typedef cef_print_options_t CefPrintOptions;
|
||||
|
||||
// Event called to allow customization of standard print options before the
|
||||
// print dialog is displayed. |printOptions| allows specification of paper
|
||||
// size, orientation and margins. Note that the specified margins may be
|
||||
// adjusted if they are outside the range supported by the printer. All units
|
||||
// are in inches. Return RV_CONTINUE to display the default print options or
|
||||
// RV_HANDLED to display the modified |printOptions|.
|
||||
/*--cef()--*/
|
||||
virtual RetVal HandlePrintOptions(CefRefPtr<CefBrowser> browser,
|
||||
CefPrintOptions& printOptions) = 0;
|
||||
|
||||
// Event called to format print headers and footers. |printInfo| contains
|
||||
// platform-specific information about the printer context. |url| is the
|
||||
// URL if the currently printing page, |title| is the title of the currently
|
||||
|
@@ -461,6 +461,16 @@ typedef struct _cef_handler_t
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
enum cef_handler_menuid_t menuId);
|
||||
|
||||
// Event called to allow customization of standard print options before the
|
||||
// print dialog is displayed. |printOptions| allows specification of paper
|
||||
// size, orientation and margins. Note that the specified margins may be
|
||||
// adjusted if they are outside the range supported by the printer. All units
|
||||
// are in inches. Return RV_CONTINUE to display the default print options or
|
||||
// RV_HANDLED to display the modified |printOptions|.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_print_options)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_print_options_t* printOptions);
|
||||
|
||||
// Event called to format print headers and footers. |printInfo| contains
|
||||
// platform-specific information about the printer context. |url| is the URL
|
||||
// if the currently printing page, |title| is the title of the currently
|
||||
@@ -534,9 +544,13 @@ typedef struct _cef_handler_t
|
||||
enum cef_handler_keyevent_type_t type, int code, int modifiers,
|
||||
int isSystemKey);
|
||||
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_tooltip)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
cef_string_t* text);
|
||||
// Event called when the browser is about to display a tooltip. |text|
|
||||
// contains the text that will be displayed in the tooltip. To handle the
|
||||
// display of the tooltip yourself return RV_HANDLED. Otherwise, you can
|
||||
// optionally modify |text| and then return RV_CONTINUE to allow the browser
|
||||
// to display the tooltip.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_tooltip)(struct _cef_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_string_t* text);
|
||||
|
||||
// Called to display a console message. Return RV_HANDLED to stop the message
|
||||
// from being output to the console.
|
||||
|
@@ -237,6 +237,55 @@ enum cef_thread_id_t
|
||||
TID_FILE = 2,
|
||||
};
|
||||
|
||||
// Paper type for printing.
|
||||
enum cef_paper_type_t
|
||||
{
|
||||
PT_LETTER = 0,
|
||||
PT_LEGAL,
|
||||
PT_EXECUTIVE,
|
||||
PT_A3,
|
||||
PT_A4,
|
||||
PT_CUSTOM
|
||||
};
|
||||
|
||||
// Paper metric information for printing.
|
||||
struct cef_paper_metrics
|
||||
{
|
||||
enum cef_paper_type_t paper_type;
|
||||
//Length and width needed if paper_type is custom_size
|
||||
//Units are in inches.
|
||||
double length;
|
||||
double width;
|
||||
};
|
||||
|
||||
// Paper print margins.
|
||||
struct cef_print_margins
|
||||
{
|
||||
//Margin size in inches for left/right/top/bottom (this is content margins).
|
||||
double left;
|
||||
double right;
|
||||
double top;
|
||||
double bottom;
|
||||
//Margin size (top/bottom) in inches for header/footer.
|
||||
double header;
|
||||
double footer;
|
||||
};
|
||||
|
||||
// Page orientation for printing
|
||||
enum cef_page_orientation
|
||||
{
|
||||
PORTRAIT = 0,
|
||||
LANDSCAPE
|
||||
};
|
||||
|
||||
// Printing options.
|
||||
typedef struct _cef_print_options_t
|
||||
{
|
||||
enum cef_page_orientation page_orientation;
|
||||
struct cef_paper_metrics paper_metrics;
|
||||
struct cef_print_margins paper_margins;
|
||||
} cef_print_options_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user