protected virtual void Dispose(bool disposing) { if (_self != null) { cef_print_handler_t.Free(_self); _self = null; } }
protected CefPrintHandler() { _self = cef_print_handler_t.Alloc(); _ds0 = new cef_print_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_print_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_print_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_print_handler_t.on_print_settings_delegate(on_print_settings); _self->_on_print_settings = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_print_handler_t.on_print_dialog_delegate(on_print_dialog); _self->_on_print_dialog = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_print_handler_t.on_print_job_delegate(on_print_job); _self->_on_print_job = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_print_handler_t.on_print_reset_delegate(on_print_reset); _self->_on_print_reset = Marshal.GetFunctionPointerForDelegate(_ds6); }
private int has_one_ref(cef_print_handler_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
private void on_print_reset(cef_print_handler_t *self) { OnPrintReset(); }
internal static void Free(cef_print_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
private void on_print_reset(cef_print_handler_t *self) { CheckSelf(self); OnPrintReset(); }
/// <summary> /// Send the print job to the printer. Execute |callback| once the job is /// completed. Return true if the job will proceed or false to cancel the job /// immediately. /// </summary> // protected abstract int OnPrintJob(cef_string_t* document_name, cef_string_t* pdf_file_path, cef_print_job_callback_t* callback); private void on_print_reset(cef_print_handler_t *self) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefPrintHandler.OnPrintReset }
/// <summary> /// Reset client state related to printing. /// </summary> // protected abstract void OnPrintReset(); private cef_size_t get_pdf_paper_size(cef_print_handler_t *self, int device_units_per_inch) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefPrintHandler.GetPdfPaperSize }
/// <summary> /// Synchronize |settings| with client state. If |get_defaults| is true then /// populate |settings| with the default print settings. Do not keep a /// reference to |settings| outside of this callback. /// </summary> // protected abstract void OnPrintSettings(cef_print_settings_t* settings, int get_defaults); private int on_print_dialog(cef_print_handler_t *self, int has_selection, cef_print_dialog_callback_t *callback) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefPrintHandler.OnPrintDialog }
/// <summary> /// Show the print dialog. Execute |callback| once the dialog is dismissed. /// Return true if the dialog will be displayed or false to cancel the /// printing immediately. /// </summary> // protected abstract int OnPrintDialog(int has_selection, cef_print_dialog_callback_t* callback); private int on_print_job(cef_print_handler_t *self, cef_string_t *document_name, cef_string_t *pdf_file_path, cef_print_job_callback_t *callback) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefPrintHandler.OnPrintJob }
private void on_print_settings(cef_print_handler_t *self, cef_print_settings_t *settings, int get_defaults) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefPrintHandler.OnPrintSettings }
private int has_at_least_one_ref(cef_print_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
private int get_refct(cef_print_handler_t *self) { return(_refct); }
public CefPrintHandler(cef_print_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }
/// <summary> /// 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 printing page, |currentPage| is the current page number and /// |maxPages| is the total number of pages. Six default header locations /// are provided by the implementation: top left, top center, top right, /// bottom left, bottom center and bottom right. To use one of these /// default locations just assign a string to the appropriate variable. /// To draw the header and footer yourself return true. Otherwise, /// populate the approprate variables and return false. /// </summary> private int get_print_header_footer(cef_print_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, /*const*/ cef_print_info_t *printInfo, /*const*/ cef_string_t *url, /*const*/ cef_string_t *title, int currentPage, int maxPages, cef_string_t *topLeft, cef_string_t *topCenter, cef_string_t *topRight, cef_string_t *bottomLeft, cef_string_t *bottomCenter, cef_string_t *bottomRight) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_frame = CefFrame.From(frame); var m_printInfo = CefPrintInfo.From(printInfo); var m_url = cef_string_t.ToString(url); var m_title = cef_string_t.ToString(title); var m_topLeft = cef_string_t.ToString(topLeft); var m_topCenter = cef_string_t.ToString(topCenter); var m_topRight = cef_string_t.ToString(topRight); var m_bottomLeft = cef_string_t.ToString(bottomLeft); var m_bottomCenter = cef_string_t.ToString(bottomCenter); var m_bottomRight = cef_string_t.ToString(bottomRight); var o_topLeft = m_topLeft; var o_topCenter = m_topCenter; var o_topRight = m_topRight; var o_bottomLeft = m_bottomLeft; var o_bottomCenter = m_bottomCenter; var o_bottomRight = m_bottomRight; var handled = this.GetPrintHeaderFooter(m_browser, m_frame, m_printInfo, m_url, m_title, currentPage, maxPages, ref m_topLeft, ref m_topCenter, ref m_topRight, ref m_bottomLeft, ref m_bottomCenter, ref m_bottomRight); m_printInfo.Dispose(); if (!handled) { if ((object)m_topLeft != (object)o_topLeft) { cef_string_t.Copy(m_topLeft, topLeft); } if ((object)m_topCenter != (object)o_topCenter) { cef_string_t.Copy(m_topCenter, topCenter); } if ((object)m_topRight != (object)o_topRight) { cef_string_t.Copy(m_topRight, topRight); } if ((object)m_bottomLeft != (object)o_bottomLeft) { cef_string_t.Copy(m_bottomLeft, bottomLeft); } if ((object)m_bottomCenter != (object)o_bottomCenter) { cef_string_t.Copy(m_bottomCenter, bottomCenter); } if ((object)m_bottomRight != (object)o_bottomRight) { cef_string_t.Copy(m_bottomRight, bottomRight); } } return(handled ? 1 : 0); }