forked from AuroraMiddleware/gtk
add docs
This commit is contained in:
parent
c8cbe9a1bc
commit
46466176e2
@ -1,5 +1,7 @@
|
||||
2006-06-01 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.c: Add some examples to the docs.
|
||||
|
||||
* gtk/gtkprintbackend.c (gtk_print_backend_class_init):
|
||||
Intern signal names.
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
2006-06-01 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.c: Add some examples to the docs.
|
||||
|
||||
* gtk/gtkprintbackend.c (gtk_print_backend_class_init):
|
||||
Intern signal names.
|
||||
|
||||
|
@ -379,7 +379,44 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
|
||||
* from @context using gtk_print_context_get_cairo_context().
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* FIXME: need an example here
|
||||
* static void
|
||||
* draw_page (GtkPrintOperation *operation,
|
||||
* GtkPrintContext *context,
|
||||
* gint page_nr,
|
||||
* gpointer user_data)
|
||||
* {
|
||||
* cairo_t *cr;
|
||||
* PangoLayout *layout;
|
||||
* gdouble width, text_height;
|
||||
* gint layout_height;
|
||||
* PangoFontDescription *desc;
|
||||
*
|
||||
* cr = gtk_print_context_get_cairo_context (context);
|
||||
* width = gtk_print_context_get_width (context);
|
||||
*
|
||||
* cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
|
||||
*
|
||||
* cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
|
||||
* cairo_fill (cr);
|
||||
*
|
||||
* layout = gtk_print_context_create_pango_layout (context);
|
||||
*
|
||||
* desc = pango_font_description_from_string ("sans 14");
|
||||
* pango_layout_set_font_description (layout, desc);
|
||||
* pango_font_description_free (desc);
|
||||
*
|
||||
* pango_layout_set_text (layout, "some text", -1);
|
||||
* pango_layout_set_width (layout, width);
|
||||
* pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
*
|
||||
* pango_layout_get_size (layout, NULL, &layout_height);
|
||||
* text_height = (gdouble)layout_height / PANGO_SCALE;
|
||||
*
|
||||
* cairo_move_to (cr, width / 2, (HEADER_HEIGHT - text_height) / 2);
|
||||
* pango_cairo_show_layout (cr, layout);
|
||||
*
|
||||
* g_object_unref (layout);
|
||||
* }
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* Use gtk_print_operation_set_use_full_page() and
|
||||
@ -1856,7 +1893,38 @@ print_pages (GtkPrintOperation *op,
|
||||
* See gtk_print_operation_run_async() if this is a problem.
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* FIXME: need an example here
|
||||
* if (settings != NULL)
|
||||
* gtk_print_operation_set_print_settings (print, settings);
|
||||
*
|
||||
* if (page_setup != NULL)
|
||||
* gtk_print_operation_set_default_page_setup (print, page_setup);
|
||||
*
|
||||
* g_signal_connect (print, "begin-print",
|
||||
* G_CALLBACK (begin_print), &data);
|
||||
* g_signal_connect (print, "draw-page",
|
||||
* G_CALLBACK (draw_page), &data);
|
||||
*
|
||||
* res = gtk_print_operation_run (print, parent, &error);
|
||||
*
|
||||
* if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
|
||||
* {
|
||||
* error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
|
||||
* GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
* GTK_MESSAGE_ERROR,
|
||||
* GTK_BUTTONS_CLOSE,
|
||||
* "Error printing file:\n%s",
|
||||
* error->message);
|
||||
* g_signal_connect (error_dialog, "response",
|
||||
* G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
* gtk_widget_show (error_dialog);
|
||||
* g_error_free (error);
|
||||
* }
|
||||
* else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
|
||||
* {
|
||||
* if (settings != NULL)
|
||||
* g_object_unref (settings);
|
||||
* settings = g_object_ref (gtk_print_operation_get_print_settings (print));
|
||||
* }
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* Return value: the result of the print operation. A return value of
|
||||
|
Loading…
Reference in New Issue
Block a user