Code

glyph-kerning setup user interface (not functional yet, just the gtk UI sketch)
[inkscape.git] / src / ui / dialog / svg-fonts-dialog.h
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::Combo {
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 private:
68     class Columns : public Gtk::TreeModel::ColumnRecord
69         {
70         public:
71             Columns()
72             {
73                 add(spfont);
74                 add(svgfont);
75                 add(label);
76             }
78             Gtk::TreeModelColumn<SPFont*> spfont;
79             Gtk::TreeModelColumn<SvgFont*> svgfont;
80             Gtk::TreeModelColumn<Glib::ustring> label;
81     };
82     Glib::RefPtr<Gtk::ListStore> _model;
83     Columns _columns;
84     Gtk::TreeView _font_list;
85     Gtk::VBox _font_settings;
86     Gtk::Entry _preview_entry;
87     SvgFontDrawingArea _font_da, kerning_preview;
88     GlyphComboBox first_glyph, second_glyph;
90     class EntryWidget : public Gtk::HBox
91         {
92         public:
93             EntryWidget()
94             {
95                 this->add(this->_label);
96                 this->add(this->_entry);
97             }
98             void set_label(const gchar* l){
99                 this->_label.set_text(l);
100             }
101         private:
102             Gtk::Label _label;
103             Gtk::Entry _entry;
104         };
105     EntryWidget _font_family, _font_variant;
106 };
108 } // namespace Dialog
109 } // namespace UI
110 } // namespace Inkscape
112 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H