1 /**
2 * \brief SVG Fonts dialog
3 *
4 * Authors:
5 * Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
6 *
7 * Copyright (C) 2008 Authors
8 *
9 * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
10 */
12 #ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H
13 #define INKSCAPE_UI_DIALOG_SVG_FONTS_H
15 #include "ui/widget/panel.h"
16 #include "sp-font.h"
17 #include "verbs.h"
18 #include "document.h"
19 #include "desktop.h"
20 #include "desktop-handles.h"
22 #include <gtkmm.h>
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/treeview.h>
25 #include <gtkmm/entry.h>
26 #include <gtkmm/box.h>
28 #include "display/nr-svgfonts.h"
30 class SvgFontDrawingArea : Gtk::DrawingArea{
31 public:
32 SvgFontDrawingArea();
33 void set_text(Glib::ustring);
34 void set_svgfont(SvgFont*);
35 void redraw();
36 private:
37 SvgFont* svgfont;
38 Glib::ustring text;
39 bool on_expose_event (GdkEventExpose *event);
40 };
42 struct SPFont;
44 namespace Inkscape {
45 namespace UI {
46 namespace Dialog {
48 class GlyphComboBox : public Gtk::ComboBoxText {
49 public:
50 GlyphComboBox();
51 void update(SPFont*);
52 };
54 class SvgFontsDialog : public UI::Widget::Panel {
55 public:
56 SvgFontsDialog();
57 ~SvgFontsDialog();
59 static SvgFontsDialog &getInstance()
60 { return *new SvgFontsDialog(); }
62 void update_fonts();
63 SvgFont* get_selected_svgfont();
64 SPFont* get_selected_spfont();
65 void on_font_selection_changed();
66 void on_preview_text_changed();
67 void on_glyphs_changed();
68 private:
69 class Columns : public Gtk::TreeModel::ColumnRecord
70 {
71 public:
72 Columns()
73 {
74 add(spfont);
75 add(svgfont);
76 add(label);
77 }
79 Gtk::TreeModelColumn<SPFont*> spfont;
80 Gtk::TreeModelColumn<SvgFont*> svgfont;
81 Gtk::TreeModelColumn<Glib::ustring> label;
82 };
83 Glib::RefPtr<Gtk::ListStore> _model;
84 Columns _columns;
85 Gtk::TreeView _font_list;
86 Gtk::VBox _font_settings;
87 Gtk::Entry _preview_entry;
88 SvgFontDrawingArea _font_da, kerning_preview;
89 GlyphComboBox first_glyph, second_glyph;
91 class EntryWidget : public Gtk::HBox
92 {
93 public:
94 EntryWidget()
95 {
96 this->add(this->_label);
97 this->add(this->_entry);
98 }
99 void set_label(const gchar* l){
100 this->_label.set_text(l);
101 }
102 private:
103 Gtk::Label _label;
104 Gtk::Entry _entry;
105 };
106 EntryWidget _font_family, _font_variant;
107 };
109 } // namespace Dialog
110 } // namespace UI
111 } // namespace Inkscape
113 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H