 |
GTK+ Forums Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
|
|
|
| Author |
Message |
|
|
jasonkb Familiar Face
Joined: 21 Apr 2007 Posts: 8 Location: Melbourne
|
Posted: Mon Dec 17, 2007 7:46 am Post subject: Embedding things in GTK+ |
|
|
Hi folks. Just wanted to know if it was a possibility to embed things into GTK as widgets. What I am referring to are things like Firefox html display window, or Evince pdf viewer. I'm writing a program (finally took the plunge) to manage PDF files on your computer, and wanted to know how I could embed a viewer that has already been made (if it is at all possible).
Many thanks guys!
Jason. |
|
| Back to top |
|
 |
Micah Carrick Never Seen the Sunlight
Joined: 21 Sep 2005 Posts: 497 Location: Portland, OR USA
|
Posted: Mon Dec 17, 2007 4:39 pm Post subject: |
|
|
For the most part, you're going to look for a widget that is already created for your purpose. That is, you can't just embed any application.
For HTML, GtkMozEmbed and GtkHtml2 and GtkHtml3 (they are different widgets) are readily available.
I have no idea about PDFs though. You may want to look at the source code for a GTK-based PDF viewer. |
|
| Back to top |
|
 |
caracal GTK+ Geek
Joined: 21 Jun 2007 Posts: 90 Location: Wilkes Barre Pa
|
Posted: Mon Jan 07, 2008 6:06 am Post subject: |
|
|
You can certanly embed things like firefox & evince using http://www.gtk.org/api/2.6/gtk/PlugSocket.html but for what you wan't to do there are better options.
Instead of embeding firefox you would be better off just useing Gtk+ WebCore "WebKit"
The WebKit framework uses Cairo for all rendering in the GTK+ port. Support has also been added for SVG and <canvas> content using Cairo.
http://trac.webkit.org/projects/webkit/wiki/BuildingGtk
And for pdf just use cairo with poppler installed.
The Poppler library uses Cairo to render PDF documents. Cairo enables the drawing of antialiased vector graphics and transparent objects.
http://cairographics.org/manual/cairo-PDF-Surfaces.html
Plus if you actualy want to generate pdf files for your viewer you can use Haru Free PDF Library
HARU is a free, cross platform, open-sourced software library for generating PDF. It supports the following features.
Generating PDF files with lines, text, images.
Outline, text annotation, link annotation.
Compressing document with deflate-decode.
Embedding PNG, Jpeg images.
Embedding Type1 font and TrueType font.
Creating encrypted PDF files.
Using various character set (ISO8859-1~16, MSCP1250~8, KOI-8R).
Supporting CJK fonts and encodings.
You can add the feature of PDF creation by using HARU without understanding complicated internal structure of PDF.
http://libharu.sourceforge.net/
If you want a canvas widget to tie everything together you can use goocanvas.
http://library.gnome.org/devel/goocanvas/unstable/
Features
Optional model/view split.
Uses interfaces for items and views.
Basic items - rect/ellipse/polyline/text/image/group.
Path item, using SVG path specification strings.
Table item for layout of other items (similar to the GtkTable widget). (This also supports items whose requested height changes according to their allocated width, such as text items.)
Embedded GTK+ widgets.
Layers/stacking order with raise/lower functions.
Cascading styles - line width/style/dashes, colors, fill patterns.
Affine transformations for all items - rotations/scales/skews.
Event handling - button/motion events, "pointer-events" property like SVG.
Grabs - support for pointer and keyboard grabs.
Keyboard focus traversal.
Accessibility (item title and description properties and hierarchy stuff).
Printing (output to a given cairo_t).
Scrolling.
Zooming.
Item visibility setting - on/off/above zoom threshold.
Simple animation.
Scalable - support for thousands of items over a large canvas area.
Support for different units - pixels/points/inches/millimeters.
Hope that helps :) |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group CodeBB 1.0 Beta 2
|