Struct fltk::printer::Printer [−][src]
Defines a printer object. Example usage:
use fltk::*; let mut but = button::Button::default(); but.set_callback2(|widget| { let mut printer = printer::Printer::default(); if printer.begin_job(1).is_ok() { printer.begin_page(); let (width, height) = printer.printable_rect(); draw::set_draw_color(Color::Black); draw::set_line_style(draw::LineStyle::Solid, 2); draw::draw_rect(0, 0, width, height); draw::set_font(Font::Courier, 12); printer.set_origin(width / 2, height / 2); printer.print_widget(widget, -widget.width() / 2, -widget.height() / 2); printer.end_page(); printer.end_job(); } });
Implementations
impl Printer
[src]
pub fn default() -> Self
[src]
Creates a printer object
pub fn begin_job(
&mut self,
pagecount: u32
) -> Result<(Option<u32>, Option<u32>), FltkError>
[src]
&mut self,
pagecount: u32
) -> Result<(Option<u32>, Option<u32>), FltkError>
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
pub fn end_page(&mut self)
[src]
End the print page
pub fn end_job(&mut self)
[src]
Ends the print job
pub fn begin_page(&mut self)
[src]
Begins a print page
pub fn printable_rect(&self) -> (i32, i32)
[src]
Returns the width and height of the printable rect
pub fn margins(&self) -> (i32, i32, i32, i32)
[src]
Returns the coordinates of the printable margins (left, top, right, bottom)
pub fn origin(&self) -> (i32, i32)
[src]
Get the origin coordinates of the printable rect
pub fn set_origin(&mut self, x: i32, y: i32)
[src]
Set the origin coordinates of the printable rect
pub fn scale(&mut self, scale_x: f32, scale_y: f32)
[src]
Scale the printable rect
pub fn rotate(&mut self, angle: f32)
[src]
Rotate the printable rect
pub fn translate(&mut self, x: i32, y: i32)
[src]
Translate the printable rect
pub fn untranslate(&mut self)
[src]
Untranslate the printable rect
pub fn is_current(&self) -> bool
[src]
Check whether the printer is the current printer
pub fn set_current(&mut self)
[src]
Set the printer to be the current printer
pub fn print_widget<W: WidgetExt>(&self, widget: &W, delta_x: i32, delta_y: i32)
[src]
Print a widget
pub fn print_window<W: WindowExt>(&self, win: &W, x_offset: i32, y_offset: i32)
[src]
Print a window
pub fn set_dialog_title(msg: &str)
[src]
Set the dialog “Title”
pub fn set_dialog_printer(msg: &str)
[src]
Set the dialog “Printer”
pub fn set_dialog_range(msg: &str)
[src]
Set dialog “Range”
pub fn set_dialog_copies(msg: &str)
[src]
Set dialog “Copies”
pub fn set_dialog_all(msg: &str)
[src]
Set dialog “All”
pub fn set_dialog_pages(msg: &str)
[src]
Set dialog “Pages”
pub fn set_dialog_from(msg: &str)
[src]
Set dialog “From”
pub fn set_dialog_to(msg: &str)
[src]
Set dialog “To”
pub fn set_dialog_properties(msg: &str)
[src]
Set dialog “Properties”
pub fn set_dialog_copy_number(msg: &str)
[src]
Set dialog “Number of copies”
pub fn set_dialog_print_button(msg: &str)
[src]
Set dialog “Print” button
pub fn set_dialog_cancel_button(msg: &str)
[src]
Set dialog “Cancel” button
pub fn set_dialog_print_to_file(msg: &str)
[src]
Set dialog “Print to file” button
pub fn set_property_title(msg: &str)
[src]
Set property “Title”
pub fn set_property_pagesize(msg: &str)
[src]
Set property “Page Size”
pub fn set_property_mode(msg: &str)
[src]
Set property “Mode”
pub fn set_property_use(msg: &str)
[src]
Set property “Use”
pub fn set_property_save(msg: &str)
[src]
Set property “Save”
pub fn set_property_cancel(msg: &str)
[src]
Set property “Cancel”
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Printer
impl !Send for Printer
impl !Sync for Printer
impl Unpin for Printer
impl UnwindSafe for Printer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,