Code

it was a very stupid idea to sort all combos without asking - this broke the blend...
[inkscape.git] / src / ui / widget / text.cpp
1 /**
2  * \brief Text Widget - A labelled text box, with spin buttons and optional
3  *        icon or suffix, for entering arbitrary number values.
4  *
5  * Authors:
6  *   Carl Hetherington <inkscape@carlh.net>
7  *   Maximilian Albert <maximilian.albert@gmail.com>
8  *
9  * Copyright (C) 2004 Carl Hetherington
10  *
11  * Released under GNU GPL.  Read the file 'COPYING' for more information.
12  */
14 #ifdef HAVE_CONFIG_H
15 # include <config.h>
16 #endif
19 #include "text.h"
21 namespace Inkscape {
22 namespace UI {
23 namespace Widget {
25 /**
26  * Construct a Text Widget.
27  *
28  * \param label     Label.
29  * \param suffix    Suffix, placed after the widget (defaults to "").
30  * \param icon      Icon filename, placed before the label (defaults to "").
31  * \param mnemonic  Mnemonic toggle; if true, an underscore (_) in the label
32  *                  indicates the next character should be used for the
33  *                  mnemonic accelerator key (defaults to false).
34  */
35 Text::Text(Glib::ustring const &label, Glib::ustring const &tooltip,
36                Glib::ustring const &suffix,
37                Glib::ustring const &icon,
38                bool mnemonic)
39     : Labelled(label, tooltip, new Gtk::Entry(), suffix, icon, mnemonic),
40       setProgrammatically(false)
41 {
42 }
44 /** Get the text in the entry */
45 const char *
46 Text::getText() const
47 {
48     g_assert(_widget != NULL);
49     return static_cast<Gtk::Entry*>(_widget)->get_text().c_str();
50 }
52 /** Sets the text of the text entry */
53 void
54 Text::setText(const char* text)
55 {
56     g_assert(_widget != NULL);
57     setProgrammatically = true; // callback is supposed to reset back, if it cares
58     static_cast<Gtk::Entry*>(_widget)->set_text(text); // FIXME: set correctly
59 }
61 /** Signal raised when the spin button's value changes */
62 Glib::SignalProxy0<void>
63 Text::signal_activate()
64 {
65     return static_cast<Gtk::Entry*>(_widget)->signal_activate();
66 }
69 } // namespace Widget
70 } // namespace UI
71 } // namespace Inkscape
73 /*
74   Local Variables:
75   mode:c++
76   c-file-style:"stroustrup"
77   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78   indent-tabs-mode:nil
79   fill-column:99
80   End:
81 */
82 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :