Trait sourceview5::prelude::PrintCompositorExt [−][src]
Required methods
fn draw_page(&self, context: &PrintContext, page_nr: i32)
[src]
Draw page page_nr
for printing on the the Cairo context encapsuled in context
.
This method has been designed to be called in the handler of the gtk::PrintOperation::draw_page
signal
as shown in the following example:
<informalexample>``<programlisting>
// Signal handler for the gtk::PrintOperation
::draw_page signal
static void
draw_page (gtk::PrintOperation
*operation,
gtk::PrintContext
*context,
gint page_nr,
gpointer user_data)
{
PrintCompositor
*compositor;
compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);
gtk_source_print_compositor_draw_page (compositor,
context,
page_nr);
}
</programlisting>``</informalexample>
context
the gtk::PrintContext
encapsulating the context information that is required when
drawing the page for printing.
page_nr
the number of the page to print.
fn get_body_font_name(&self) -> Option<GString>
[src]
Returns the name of the font used to print the text body. The returned string
must be freed with g_free
.
Returns
a new string containing the name of the font used to print the text body.
fn get_bottom_margin(&self, unit: Unit) -> f64
[src]
Gets the bottom margin in units of unit
.
unit
the unit for the return value.
Returns
the bottom margin.
fn get_buffer(&self) -> Option<Buffer>
[src]
Gets the Buffer
associated with the compositor. The returned
object reference is owned by the compositor object and
should not be unreferenced.
Returns
the Buffer
associated with the compositor.
fn get_footer_font_name(&self) -> Option<GString>
[src]
Returns the name of the font used to print the page footer.
The returned string must be freed with g_free
.
Returns
a new string containing the name of the font used to print the page footer.
fn get_header_font_name(&self) -> Option<GString>
[src]
Returns the name of the font used to print the page header.
The returned string must be freed with g_free
.
Returns
a new string containing the name of the font used to print the page header.
fn get_highlight_syntax(&self) -> bool
[src]
Determines whether the printed text will be highlighted according to the buffer rules. Note that highlighting will happen only if the buffer to print has highlighting activated.
Returns
true
if the printed output will be highlighted.
fn get_left_margin(&self, unit: Unit) -> f64
[src]
fn get_line_numbers_font_name(&self) -> Option<GString>
[src]
Returns the name of the font used to print line numbers on the left margin.
The returned string must be freed with g_free
.
Returns
a new string containing the name of the font used to print line numbers on the left margin.
fn get_n_pages(&self) -> i32
[src]
Returns the number of pages in the document or <code>
-1</code>
if the
document has not been completely paginated.
Returns
the number of pages in the document or <code>
-1</code>
if the
document has not been completely paginated.
fn get_pagination_progress(&self) -> f64
[src]
Returns the current fraction of the document pagination that has been completed.
Returns
a fraction from 0.0 to 1.0 inclusive.
fn get_print_footer(&self) -> bool
[src]
Determines if a footer is set to be printed for each page. A
footer will be printed if this function returns true
<emphasis>
and</emphasis>
some format strings have been specified
with PrintCompositorExt::set_footer_format
.
Returns
true
if the footer is set to be printed.
fn get_print_header(&self) -> bool
[src]
Determines if a header is set to be printed for each page. A
header will be printed if this function returns true
<emphasis>
and</emphasis>
some format strings have been specified
with PrintCompositorExt::set_header_format
.
Returns
true
if the header is set to be printed.
fn get_print_line_numbers(&self) -> u32
[src]
Returns the interval used for line number printing. If the value is 0, no line numbers will be printed. The default value is 1 (i.e. numbers printed in all lines).
Returns
the interval of printed line numbers.
fn get_right_margin(&self, unit: Unit) -> f64
[src]
Gets the right margin in units of unit
.
unit
the unit for the return value.
Returns
the right margin.
fn get_tab_width(&self) -> u32
[src]
fn get_top_margin(&self, unit: Unit) -> f64
[src]
fn get_wrap_mode(&self) -> WrapMode
[src]
fn paginate(&self, context: &PrintContext) -> bool
[src]
Paginate the document associated with the self
.
In order to support non-blocking pagination, document is paginated in small chunks.
Each time PrintCompositorExt::paginate
is invoked, a chunk of the document
is paginated. To paginate the entire document, PrintCompositorExt::paginate
must be invoked multiple times.
It returns true
if the document has been completely paginated, otherwise it returns false
.
This method has been designed to be invoked in the handler of the gtk::PrintOperation::paginate
signal,
as shown in the following example:
<informalexample>``<programlisting>
// Signal handler for the gtk::PrintOperation
::paginate signal
static gboolean
paginate (gtk::PrintOperation
*operation,
gtk::PrintContext
*context,
gpointer user_data)
{
PrintCompositor
*compositor;
compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);
if (gtk_source_print_compositor_paginate (compositor, context)) { gint n_pages;
n_pages = gtk_source_print_compositor_get_n_pages (compositor); gtk_print_operation_set_n_pages (operation, n_pages);
return TRUE; }
return FALSE;
}
</programlisting>``</informalexample>
If you don’t need to do pagination in chunks, you can simply do it all in the
gtk::PrintOperation::begin-print
handler, and set the number of pages from there, like
in the following example:
<informalexample>``<programlisting>
// Signal handler for the gtk::PrintOperation
::begin-print signal
static void
begin_print (gtk::PrintOperation
*operation,
gtk::PrintContext
*context,
gpointer user_data)
{
PrintCompositor
*compositor;
gint n_pages;
compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);
while (!gtk_source_print_compositor_paginate (compositor, context));
n_pages = gtk_source_print_compositor_get_n_pages (compositor);
gtk_print_operation_set_n_pages (operation, n_pages);
}
</programlisting>``</informalexample>
context
the gtk::PrintContext
whose parameters (e.g. paper size, print margins, etc.)
are used by the the self
to paginate the document.
Returns
true
if the document has been completely paginated, false
otherwise.
fn set_body_font_name(&self, font_name: &str)
[src]
Sets the default font for the printed text.
font_name
should be a
string representation of a font description Pango can understand.
(e.g. "Monospace 10"). See pango::FontDescription::from_string
for a description of the format of the string representation.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
font_name
the name of the default font for the body text.
fn set_bottom_margin(&self, margin: f64, unit: Unit)
[src]
Sets the bottom margin used by self
.
margin
the new bottom margin in units of unit
.
unit
the units for margin
.
fn set_footer_font_name(&self, font_name: Option<&str>)
[src]
Sets the font for printing the page footer. If
None
is supplied, the default font (i.e. the one being used for the
text) will be used instead.
font_name
should be a
string representation of a font description Pango can understand.
(e.g. "Monospace 10"). See pango::FontDescription::from_string
for a description of the format of the string representation.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
font_name
the name of the font for the footer text, or None
.
fn set_footer_format(
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
[src]
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
See PrintCompositorExt::set_header_format
for more information
about the parameters.
separator
true
if you want a separator line to be printed.
left
a format string to print on the left of the footer.
center
a format string to print on the center of the footer.
right
a format string to print on the right of the footer.
fn set_header_font_name(&self, font_name: Option<&str>)
[src]
Sets the font for printing the page header. If
None
is supplied, the default font (i.e. the one being used for the
text) will be used instead.
font_name
should be a
string representation of a font description Pango can understand.
(e.g. "Monospace 10"). See pango::FontDescription::from_string
for a description of the format of the string representation.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
font_name
the name of the font for header text, or None
.
fn set_header_format(
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
[src]
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
Sets strftime like header format strings, to be printed on the
left, center and right of the top of each page. The strings may
include strftime(3) codes which will be expanded at print time.
A subset of strftime
codes are accepted, see glib::DateTime::format
for more details on the accepted format specifiers.
Additionally the following format specifiers are accepted:
N
: the page numberQ
: the page count.
separator
specifies if a solid line should be drawn to separate
the header from the document text.
If None
is given for any of the three arguments, that particular
string will not be printed.
For the header to be printed, in
addition to specifying format strings, you need to enable header
printing with PrintCompositorExt::set_print_header
.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
separator
true
if you want a separator line to be printed.
left
a format string to print on the left of the header.
center
a format string to print on the center of the header.
right
a format string to print on the right of the header.
fn set_highlight_syntax(&self, highlight: bool)
[src]
Sets whether the printed text will be highlighted according to the buffer rules. Both color and font style are applied.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
highlight
whether syntax should be highlighted.
fn set_left_margin(&self, margin: f64, unit: Unit)
[src]
Sets the left margin used by self
.
margin
the new left margin in units of unit
.
unit
the units for margin
.
fn set_line_numbers_font_name(&self, font_name: Option<&str>)
[src]
Sets the font for printing line numbers on the left margin. If
None
is supplied, the default font (i.e. the one being used for the
text) will be used instead.
font_name
should be a
string representation of a font description Pango can understand.
(e.g. "Monospace 10"). See pango::FontDescription::from_string
for a description of the format of the string representation.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
font_name
the name of the font for line numbers, or None
.
fn set_print_footer(&self, print: bool)
[src]
Sets whether you want to print a footer in each page. The
footer consists of three pieces of text and an optional line
separator, configurable with
PrintCompositorExt::set_footer_format
.
Note that by default the footer format is unspecified, and if it’s empty it will not be printed, regardless of this setting.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
print
true
if you want the footer to be printed.
fn set_print_header(&self, print: bool)
[src]
Sets whether you want to print a header in each page. The
header consists of three pieces of text and an optional line
separator, configurable with
PrintCompositorExt::set_header_format
.
Note that by default the header format is unspecified, and if it’s empty it will not be printed, regardless of this setting.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
print
true
if you want the header to be printed.
fn set_print_line_numbers(&self, interval: u32)
[src]
Sets the interval for printed line numbers. If interval
is 0 no
numbers will be printed. If greater than 0, a number will be
printed every interval
lines (i.e. 1 will print all line numbers).
Maximum accepted value for interval
is 100.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
interval
interval for printed line numbers.
fn set_right_margin(&self, margin: f64, unit: Unit)
[src]
Sets the right margin used by self
.
margin
the new right margin in units of unit
.
unit
the units for margin
.
fn set_tab_width(&self, width: u32)
[src]
Sets the width of tabulation in characters for printed text.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
width
width of tab in characters.
fn set_top_margin(&self, margin: f64, unit: Unit)
[src]
Sets the top margin used by self
.
margin
the new top margin in units of unit
unit
the units for margin
fn set_wrap_mode(&self, wrap_mode: WrapMode)
[src]
Sets the line wrapping mode for the printed text.
This function cannot be called anymore after the first call to the
PrintCompositorExt::paginate
function.
wrap_mode
a gtk::WrapMode
.
fn connect_property_body_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_footer_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_header_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_highlight_syntax_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_line_numbers_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_n_pages_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_print_footer_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_print_header_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_print_line_numbers_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_tab_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
Implementors
impl<O: IsA<PrintCompositor>> PrintCompositorExt for O
[src]
fn draw_page(&self, context: &PrintContext, page_nr: i32)
[src]
fn get_body_font_name(&self) -> Option<GString>
[src]
fn get_bottom_margin(&self, unit: Unit) -> f64
[src]
fn get_buffer(&self) -> Option<Buffer>
[src]
fn get_footer_font_name(&self) -> Option<GString>
[src]
fn get_header_font_name(&self) -> Option<GString>
[src]
fn get_highlight_syntax(&self) -> bool
[src]
fn get_left_margin(&self, unit: Unit) -> f64
[src]
fn get_line_numbers_font_name(&self) -> Option<GString>
[src]
fn get_n_pages(&self) -> i32
[src]
fn get_pagination_progress(&self) -> f64
[src]
fn get_print_footer(&self) -> bool
[src]
fn get_print_header(&self) -> bool
[src]
fn get_print_line_numbers(&self) -> u32
[src]
fn get_right_margin(&self, unit: Unit) -> f64
[src]
fn get_tab_width(&self) -> u32
[src]
fn get_top_margin(&self, unit: Unit) -> f64
[src]
fn get_wrap_mode(&self) -> WrapMode
[src]
fn paginate(&self, context: &PrintContext) -> bool
[src]
fn set_body_font_name(&self, font_name: &str)
[src]
fn set_bottom_margin(&self, margin: f64, unit: Unit)
[src]
fn set_footer_font_name(&self, font_name: Option<&str>)
[src]
fn set_footer_format(
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
[src]
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
fn set_header_font_name(&self, font_name: Option<&str>)
[src]
fn set_header_format(
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
[src]
&self,
separator: bool,
left: Option<&str>,
center: Option<&str>,
right: Option<&str>
)
fn set_highlight_syntax(&self, highlight: bool)
[src]
fn set_left_margin(&self, margin: f64, unit: Unit)
[src]
fn set_line_numbers_font_name(&self, font_name: Option<&str>)
[src]
fn set_print_footer(&self, print: bool)
[src]
fn set_print_header(&self, print: bool)
[src]
fn set_print_line_numbers(&self, interval: u32)
[src]
fn set_right_margin(&self, margin: f64, unit: Unit)
[src]
fn set_tab_width(&self, width: u32)
[src]
fn set_top_margin(&self, margin: f64, unit: Unit)
[src]
fn set_wrap_mode(&self, wrap_mode: WrapMode)
[src]
fn connect_property_body_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_footer_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_header_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_highlight_syntax_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_line_numbers_font_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_n_pages_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_print_footer_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_print_header_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_print_line_numbers_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_tab_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_wrap_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId