25 #ifndef CGU_TEXT_PRINTMANAGER_H
26 #define CGU_TEXT_PRINTMANAGER_H
36 #include <pango/pango-layout.h>
37 #include <glib-object.h>
49 #if defined(DOXYGEN_PARSING) || defined(CGU_USE_GTK)
51 #ifndef DOXYGEN_PARSING
54 class TPMPangoLayoutIterFree {
56 void operator()(PangoLayoutIter* obj_p) {
58 pango_layout_iter_free(obj_p);
63 typedef SharedHandle<PangoLayoutIter*, TPMPangoLayoutIterFree> TPMPangoLayoutIterSharedHandle;
65 #endif // DOXYGEN_PARSING
125 enum Mode {print_mode, view_mode, file_mode} mode;
131 TPMPangoLayoutIterSharedHandle current_line_iter_h;
132 std::unique_ptr<std::string> text_u;
133 std::string file_name;
134 std::vector<int> pages;
136 std::string font_family;
139 bool cancelled_when_drawing;
146 static std::string default_font_family;
147 static int default_font_size;
149 void paginate(GtkPrintContext*);
151 void begin_print_impl(GtkPrintOperation*, GtkPrintContext*);
152 void draw_page_impl(GtkPrintOperation*, GtkPrintContext*,
int);
153 GObject* create_custom_widget_impl(GtkPrintOperation*);
154 static void strip(std::string&);
159 #ifndef DOXYGEN_PARSING
212 const std::string& font_family =
"",
233 static void page_setup(GtkWindow* parent = 0);
257 #ifdef CGU_USE_AUTO_PTR
258 bool set_text(std::auto_ptr<std::string>& text);
260 bool set_text(std::unique_ptr<std::string>& text);
346 #ifdef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
351 #endif // CGU_USE_GTK
355 #endif // TEXT_PRINTMANAGER_H
static void page_setup(GtkWindow *parent=0)
A class to print plain text using the GTK+ print system.
Definition: text_print_manager.h:124
bool print_to_file(const char *filename)
Provides thread-safe signalling between a worker thread and the main program thread.
Definition: notifier.h:181
This is a smart pointer for managing objects allocated on freestore which maintain their own referenc...
Definition: intrusive_ptr.h:98
static Cgu::IntrusivePtr< Cgu::TextPrintManager > create_manager(GtkWindow *parent=0, const std::string &font_family="", int font_size=0)
A wrapper class for pthread mutexes.
Definition: mutex.h:117
This is a counter class providing the ref() and unref() functions required by IntrusivePtr, with a thread safe reference count..
Definition: intrusive_ptr.h:349
Provides wrapper classes for pthread mutexes and condition variables, and scoped locking classes for ...
TextPrintManager & operator=(const TextPrintManager &)=delete
Definition: application.h:44
bool set_text(std::unique_ptr< std::string > &text)
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
This file provides a Notifier class to provide thread-safe signalling between a worker thread and the...