Code

Text Preview entry box on SVGFonts dialog (unfortunately crashing sometimes, dont...
[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 SvgFontsDialog : public UI::Widget::Panel {
49 public:
50     SvgFontsDialog();
51     ~SvgFontsDialog();
53     static SvgFontsDialog &getInstance()
54     { return *new SvgFontsDialog(); }
56     void update_fonts();
57     SvgFont* get_selected_svgfont();
58     void on_font_selection_changed();
59     void on_preview_text_changed();
60 private:
61     class Columns : public Gtk::TreeModel::ColumnRecord
62         {
63         public:
64             Columns()
65             {
66                 add(font);
67                 add(svgfont);
68                 add(label);
69             }
71             Gtk::TreeModelColumn<SPFont*> font;
72             Gtk::TreeModelColumn<SvgFont*> svgfont;
73             Gtk::TreeModelColumn<Glib::ustring> label;
74     };
75     Glib::RefPtr<Gtk::ListStore> _model;
76     Columns _columns;
77     Gtk::TreeView _font_list;
78     Gtk::VBox _font_settings;
79     Gtk::Entry _preview_entry;
80     SvgFontDrawingArea _font_da;
82     class EntryWidget : public Gtk::HBox
83         {
84         public:
85             EntryWidget()
86             {
87                 this->add(this->_label);
88                 this->add(this->_entry);
89             }
90             void set_label(const gchar* l){
91                 this->_label.set_text(l);
92             }
93         private:
94             Gtk::Label _label;
95             Gtk::Entry _entry;
96         };
97     EntryWidget _font_family, _font_variant;
98 };
100 } // namespace Dialog
101 } // namespace UI
102 } // namespace Inkscape
104 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H