diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-02-06 11:25:14 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-02-06 11:25:14 +0000 |
commit | 8c71138ba5500a3d1bf446357992e8f165101173 (patch) | |
tree | a453bbcc0fba741aba3b3e16074933407f60dccc /examples/viewer-qt.h | |
parent | 9f81790eaec937ced41c31fb6204d63a377a00a7 (diff) | |
download | pango-8c71138ba5500a3d1bf446357992e8f165101173.tar.gz |
Bug 328067 – Install pango-view
2006-02-06 Behdad Esfahbod <behdad@gnome.org>
Bug 328067 – Install pango-view
Added a rather generic framework for a pango-view example. All
backends have their own pango*-view built, and a pango-view binary
is built too, that can choose backend via --backend. This one is
installed in bindir.
* examples/Makefile.am: Updated, to build pangox-view, pangoft2-view,
pangoxft-view, pangocairo-view, and pango-view.
* examples/viewer.h, examples/viewer-x.c, examples/viewer-x.h
examples/viewer-cairo.c, examples/viewer-cairo.h,
examples/viewer-main.c, examples/viewer-pangox.c,
examples/viewer-pangoft2.c, examples/viewer-pangoxft.c,
examples/viewer-pangocairo.c, examples/pango-view.c,
examples/pango-xview.c, examples/pango-ft2view.c,
examples/pango-xftview.c, examples/pango-cairoview.c: Added.
* examples/cairoview.c, examples/xftview.c, examples/pangoft2topgm.c,
examples/viewer-qt.cc, examples/viewer-qt.h: Removed.
* configure.in: Check for Cairo Xlib backend, also AC_DEFINE various
backend bits.
Diffstat (limited to 'examples/viewer-qt.h')
-rw-r--r-- | examples/viewer-qt.h | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/examples/viewer-qt.h b/examples/viewer-qt.h deleted file mode 100644 index 21307111..00000000 --- a/examples/viewer-qt.h +++ /dev/null @@ -1,116 +0,0 @@ -/* Pango - * viewer-qt.cc: Example program to view a UTF-8 encoding file - * using Pango to render result. - * - * Copyright (C) 1999-2000 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <qscrollview.h> -#include <qlist.h> -#include <qmainwindow.h> -#include <pango/pango.h> - -class QComboBox; -class QSpinBox; - -class ViewerPara -{ - public: - ViewerPara (PangoContext *context, const QString &text); - ~ViewerPara (); - - void setWidth (int width); - void contextChanged (); - int height (); - void draw (QPainter *painter, GC gc, int y); - QRect charBounds (int index); - gunichar getChar (int index); - int findPoint (int x, int y); - - private: - QCString text_; - int height_; - PangoLayout *layout_; -}; - -class ViewerView : public QScrollView -{ - Q_OBJECT - - public: - - ViewerView::ViewerView (QWidget *parent, QStatusBar *status = NULL); - ~ViewerView (); - - void readFile (const QString &name); - void setFontDesc (PangoFontDescription *font_desc); - void setDirection (PangoDirection base_dir); - - void computeHeight (); - - PangoContext *context() { return context_; } - - protected: - virtual void drawContents (QPainter *p, int clipx, int clipy, int clipw, int cliph); - virtual void viewportResizeEvent ( QResizeEvent *event ); - virtual void contentsMousePressEvent (QMouseEvent *event); - - private: - void contextChanged (); - void updateHighlightChar (); - - QStatusBar *status_; - - PangoContext *context_; - QList<ViewerPara> paragraphs_; - - ViewerPara *highlight_para_; - int highlight_index_; -}; - -class ViewerWindow : public QMainWindow -{ - Q_OBJECT - - public: - - ViewerWindow (const QString &filename); - ~ViewerWindow (); - - private: - ViewerView *view_; - - PangoContext *context_; - - QComboBox *family_combo_; - PangoFontFamily **families_; - - QComboBox *style_combo_; - PangoFontFace **faces_; - - QSpinBox *size_box_; - - QPopupMenu *file_menu_; - - int right_to_left_item_; - - private slots: - void fillStyleCombo (int index); - void fontChanged (); - void setRightToLeft (); -}; |