Struct fltk::printer::Printer [−][src]
pub struct Printer { /* fields omitted */ }
Expand description
Defines a printer object. Example usage:
use fltk::{prelude::*, *}; let mut but = button::Button::default(); but.set_callback(|widget| { let mut printer = printer::Printer::default(); if printer.begin_job(1).is_ok() { printer.begin_page().ok(); let (width, height) = printer.printable_rect(); draw::set_draw_color(enums::Color::Black); draw::set_line_style(draw::LineStyle::Solid, 2); draw::draw_rect(0, 0, width, height); draw::set_font(enums::Font::Courier, 12); printer.set_origin(width / 2, height / 2); printer.print_widget(widget, -widget.width() / 2, -widget.height() / 2); printer.end_page().ok(); printer.end_job(); } });
Implementations
impl Printer
[src]
impl Printer
[src]pub fn begin_job(
&mut self,
pagecount: i32
) -> Result<(Option<i32>, Option<i32>), FltkError>
[src]
pub fn begin_job(
&mut self,
pagecount: i32
) -> Result<(Option<i32>, Option<i32>), FltkError>
[src]Begins a print job.
pagecount
The total number of pages to be created. Use 0 if this number is unknown
Returns a tuple (frompage, topage) indicating the chosen pages by the user
Errors
Errors on failure to print
pub fn begin_page(&mut self) -> Result<(), FltkError>
[src]
pub fn begin_page(&mut self) -> Result<(), FltkError>
[src]pub fn margins(&self) -> (i32, i32, i32, i32)
[src]
pub fn margins(&self) -> (i32, i32, i32, i32)
[src]Returns the coordinates of the printable margins. (left, top, right, bottom)
pub fn set_origin(&mut self, x: i32, y: i32)
[src]
pub fn set_origin(&mut self, x: i32, y: i32)
[src]Set the origin coordinates of the printable rect
pub fn untranslate(&mut self)
[src]
pub fn untranslate(&mut self)
[src]Untranslate the printable rect
pub fn is_current(&self) -> bool
[src]
pub fn is_current(&self) -> bool
[src]Check whether the printer is the current printer
pub fn set_current(&mut self)
[src]
pub fn set_current(&mut self)
[src]Set the printer to be the current printer
pub fn set_dialog_title(msg: &'static str)
[src]
pub fn set_dialog_title(msg: &'static str)
[src]Set the dialog “Title”
pub fn set_dialog_printer(msg: &'static str)
[src]
pub fn set_dialog_printer(msg: &'static str)
[src]Set the dialog “Printer”
pub fn set_dialog_range(msg: &'static str)
[src]
pub fn set_dialog_range(msg: &'static str)
[src]Set dialog “Range”
pub fn set_dialog_copies(msg: &'static str)
[src]
pub fn set_dialog_copies(msg: &'static str)
[src]Set dialog “Copies”
pub fn set_dialog_all(msg: &'static str)
[src]
pub fn set_dialog_all(msg: &'static str)
[src]Set dialog “All”
pub fn set_dialog_pages(msg: &'static str)
[src]
pub fn set_dialog_pages(msg: &'static str)
[src]Set dialog “Pages”
pub fn set_dialog_from(msg: &'static str)
[src]
pub fn set_dialog_from(msg: &'static str)
[src]Set dialog “From”
pub fn set_dialog_to(msg: &'static str)
[src]
pub fn set_dialog_to(msg: &'static str)
[src]Set dialog “To”
pub fn set_dialog_properties(msg: &'static str)
[src]
pub fn set_dialog_properties(msg: &'static str)
[src]Set dialog “Properties”
pub fn set_dialog_copy_number(msg: &'static str)
[src]
pub fn set_dialog_copy_number(msg: &'static str)
[src]Set dialog “Number of copies”
pub fn set_dialog_print_button(msg: &'static str)
[src]
pub fn set_dialog_print_button(msg: &'static str)
[src]Set dialog “Print” button
pub fn set_dialog_cancel_button(msg: &'static str)
[src]
pub fn set_dialog_cancel_button(msg: &'static str)
[src]Set dialog “Cancel” button
pub fn set_dialog_print_to_file(msg: &'static str)
[src]
pub fn set_dialog_print_to_file(msg: &'static str)
[src]Set dialog “Print to file” button
pub fn set_property_title(msg: &'static str)
[src]
pub fn set_property_title(msg: &'static str)
[src]Set property “Title”
pub fn set_property_pagesize(msg: &'static str)
[src]
pub fn set_property_pagesize(msg: &'static str)
[src]Set property “Page Size”
pub fn set_property_mode(msg: &'static str)
[src]
pub fn set_property_mode(msg: &'static str)
[src]Set property “Mode”
pub fn set_property_use(msg: &'static str)
[src]
pub fn set_property_use(msg: &'static str)
[src]Set property “Use”
pub fn set_property_save(msg: &'static str)
[src]
pub fn set_property_save(msg: &'static str)
[src]Set property “Save”
pub fn set_property_cancel(msg: &'static str)
[src]
pub fn set_property_cancel(msg: &'static str)
[src]Set property “Cancel”