~inkscape.dev/inkscape-devlibs/devlibs-gtk3

« back to all changes in this revision

Viewing changes to include/gtkmm-2.4/gtkmm/comboboxentrytext.h

  • Committer: JazzyNico
  • Date: 2013-01-21 10:11:05 UTC
  • Revision ID: nicoduf@yahoo.fr-20130121101105-i8d8slkq9ng4olx8
Adding gtk2 libraries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
#ifndef _GTKMM_COMBOBOXENTRYTEXT_H
 
3
#define _GTKMM_COMBOBOXENTRYTEXT_H
 
4
 
 
5
/* comboboxentrytext.h
 
6
 * 
 
7
 * Copyright (C) 2003 The gtkmm Development Team
 
8
 *
 
9
 * This library is free software; you can redistribute it and/or
 
10
 * modify it under the terms of the GNU Lesser General Public
 
11
 * License as published by the Free Software Foundation; either
 
12
 * version 2.1 of the License, or (at your option) any later version.
 
13
 *
 
14
 * This library is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
 * Lesser General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU Lesser General Public
 
20
 * License along with this library; if not, write to the Free
 
21
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
22
 */
 
23
 
 
24
#ifndef GTKMM_DISABLE_DEPRECATED
 
25
 
 
26
#include <gtkmm/comboboxentry.h>
 
27
 
 
28
namespace Gtk
 
29
{
 
30
 
 
31
//This is a C++ convenience class that is equivalent to the gtk_combo_box_entry_new_text() C convenience function.
 
32
//This is copy/paste/search/replaced from ComboBoxText, but the only alternative I see is to use multiple inheritance.
 
33
//murrayc.
 
34
//In gtkmm-3.0 we simply wrap GtkComboBoxText, which is also in GTK+ 2.24.
 
35
//But this C++ class was created before GtkComboBoxText existed and we want to avoid changing the ABI. 
 
36
 
 
37
/** This is a specialisation of the ComboBoxEntry which has one column of text (a simple list),
 
38
 * and appropriate methods for setting and getting the text.
 
39
 *
 
40
 * You should not call set_model() or attempt to pack more cells into this combo box via its CellLayout base class.
 
41
 *
 
42
 * @deprecated Instead use ComboBoxText with has_entry = true.
 
43
 *
 
44
 * @ingroup Widgets
 
45
 */
 
46
class ComboBoxEntryText
 
47
: public ComboBoxEntry
 
48
{
 
49
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
50
private:
 
51
  // noncopyable
 
52
  ComboBoxEntryText(const ComboBoxEntryText&);
 
53
  ComboBoxEntryText& operator=(const ComboBoxEntryText&);
 
54
 
 
55
protected:
 
56
  explicit ComboBoxEntryText(const Glib::ConstructParams& construct_params);
 
57
  explicit ComboBoxEntryText(GtkComboBoxEntry* castitem);
 
58
 
 
59
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
60
 
 
61
public:
 
62
  ComboBoxEntryText();
 
63
 
 
64
  /** Add an item to the end of the drop-down list.
 
65
   * @param text The text for the item.
 
66
   */
 
67
  void append(const Glib::ustring& text);
 
68
 
 
69
  void insert(int position, const Glib::ustring& text);
 
70
 
 
71
  /** Add an item to the beginning of the drop-down list.
 
72
   * @param text The text for the item.
 
73
   */
 
74
  void prepend(const Glib::ustring& text);
 
75
 
 
76
#ifndef GTKMM_DISABLE_DEPRECATED
 
77
  /** Add an item to the end of the drop-down list.
 
78
   * @param text The text for the item.
 
79
   *
 
80
   * @deprecated Use append().
 
81
   */
 
82
  void append_text(const Glib::ustring& text);
 
83
 
 
84
  /**
 
85
   * @deprecated Use insert().
 
86
   */
 
87
  void insert_text(int position, const Glib::ustring& text);
 
88
 
 
89
  /** Add an item to the beginning of the drop-down list.
 
90
   * @param text The text for the item.
 
91
   *
 
92
   * @deprecated Use prepend().
 
93
   */
 
94
  void prepend_text(const Glib::ustring& text);
 
95
#endif //GTKMM_DISABLE_DEPRECATED
 
96
 
 
97
  //@deprecated Use get_entry()->get_text() to get the actual entered text.
 
98
  Glib::ustring get_active_text() const;
 
99
 
 
100
  //@deprecated Use get_entry()->set_text() to set the actual entered text.
 
101
  void set_active_text(const Glib::ustring& text);
 
102
 
 
103
  //There is a clear() method in the CellLayout base class, so this would cause confusion.
 
104
  //TODO: Remove this when we can break API.
 
105
  /// @deprecated See clear_items(). Since 2.8.
 
106
  void clear();
 
107
 
 
108
  /** Remove all items from the drop-down menu.
 
109
   */
 
110
  void clear_items();
 
111
 
 
112
  /** Remove the specified item if it is in the drop-down menu.
 
113
   * @text The text of the item that should be removed.
 
114
   */
 
115
  void remove_text(const Glib::ustring& text);
 
116
 
 
117
protected:
 
118
 
 
119
  //Tree model columns:
 
120
  //These columns are used by the model that is created by the default constructor
 
121
  class TextModelColumns : public Gtk::TreeModel::ColumnRecord
 
122
  {
 
123
  public:
 
124
    TextModelColumns()
 
125
    { add(m_column); }
 
126
 
 
127
    Gtk::TreeModelColumn<Glib::ustring> m_column;
 
128
  };
 
129
 
 
130
  TextModelColumns m_text_columns;
 
131
};
 
132
 
 
133
 
 
134
} // namespace Gtk
 
135
 
 
136
#endif //GTKMM_DISABLE_DEPRECATED
 
137
 
 
138
#endif /* _GTKMM_COMBOBOXENTRYTEXT_H */
 
139