1 /* $Id: combo.hg,v 1.7 2005/11/29 16:38:10 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 // This is for including the config header before any code (such as
23 // the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
24 _CONFIGINCLUDE(gtkmmconfig.h)
26 #include <glibmm/listhandle.h>
27 #include <glibmm/helperlist.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/button.h>
30 #include <gtkmm/entry.h>
31 #include <gtkmm/item.h>
33 _PINCLUDE(gtkmm/private/box_p.h)
34 _PINCLUDE(gtkmm/private/item_p.h)
40 /** An item in a ComboDropDownList.
42 * Items in a ComboDropDownList inherit Item. Two signals are added.
44 * @deprecated Use the ComboBox widget instead.
46 class ComboDropDownItem : public Gtk::Item
48 _CLASS_GTKOBJECT(ComboDropDownItem,GtkListItem,GTK_LIST_ITEM,Gtk::Item,GtkItem)
50 _IGNORE(gtk_list_item_select,gtk_list_item_deselect)
55 _WRAP_SIGNAL(void scroll_horizontal(ScrollType scroll_type, float position), "scroll-horizontal")
56 _WRAP_SIGNAL(void scroll_vertical(ScrollType scroll_type, float position), "scroll-vertical")
60 namespace ComboDropDown_Helpers
63 typedef Gtk::ComboDropDownItem Element;
66 GP_LIST(ComboDropDownList,ComboDropDown,GtkList,ComboDropDownItem,children)
67 GP_LIST_ITER(Glib::List_Cpp_Iterator<GtkListItem, ComboDropDownItem>)
71 } /* namespace ComboDropDown_Helpers */
76 /** The dropdown list of a Combo.
78 * A combo is a compound widget which crosses a text entry area and a pull
79 * down list. The dropdown list is implemented with the deprecated GtkList
80 * widget on the gtk+ side. ComboDropDown is a thin wrapper around GtkList
81 * containing just the functionality necessary for a Combo's list. To add
82 * and remove items use the STL-style interface that is accessible through
83 * ComboDropDown::children().
85 * @deprecated Use the ComboBox widget instead.
87 class ComboDropDown : public Gtk::Container
89 _CLASS_GTKOBJECT(ComboDropDown,GtkList,GTK_LIST,Gtk::Container,GtkContainer)
91 _IGNORE(gtk_list_remove_items_no_unref,gtk_list_select_item,gtk_list_unselect_item,gtk_list_set_selection_mode,gtk_list_extend_selection,gtk_list_start_selection,gtk_list_end_selection,gtk_list_select_all,gtk_list_unselect_all,gtk_list_toggle_add_mode,gtk_list_toggle_focus_row,gtk_list_toggle_row,gtk_list_undo_selection,gtk_list_end_drag_selection)
93 typedef ComboDropDown_Helpers::ComboDropDownList ComboDropDownList;
100 _WRAP_METHOD(void scroll_horizontal(ScrollType scroll_type, float position), gtk_list_scroll_horizontal)
101 _WRAP_METHOD(void scroll_vertical(ScrollType scroll_type, float position), gtk_list_scroll_vertical)
103 ComboDropDownList& children();
104 const ComboDropDownList& children() const;
106 _IGNORE(gtk_list_insert_items)
107 _IGNORE(gtk_list_append_items,gtk_list_prepend_items)
108 _IGNORE(gtk_list_child_position)
109 _IGNORE(gtk_list_remove_items)
111 _WRAP_SIGNAL(void select_child(Widget& item), "select_child")
112 _WRAP_SIGNAL(void selection_changed(), "selection_changed")
113 _WRAP_SIGNAL(void unselect_child(Widget& item), "unselect_child")
116 #ifndef DOXYGEN_SHOULD_SKIP_THIS
117 mutable ComboDropDownList children_proxy_;
118 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
122 class ScrolledWindow;
125 /** A text entry field with a dropdown list.
127 * A combo is a compound widget which crosses a text entry area and a pull
128 * down list. It may allow text entry or it may just allow list
129 * values depending on the settings.
131 * Access members allow altering of the widget components.
133 * @deprecated Use the ComboBox widget instead.
135 class Combo : public HBox
137 _CLASS_GTKOBJECT(Combo,GtkCombo,GTK_COMBO,Gtk::HBox,GtkHBox)
143 /** Allow direct text entry
144 * Whether the text in the entry must be or not be in the list.
146 * @param value Set to true if the value must be in list.
147 * @param empty Set to true if the text area is allowed to be empty.
149 _WRAP_METHOD(void set_value_in_list(bool value = true, bool empty = false), gtk_combo_set_value_in_list)
151 /** Set arrows keys to change value
152 * Up and down will scroll through the list items.
153 * Useful when there is a small list of value that the
156 * @param arrows_on true indicates the arrow keys scroll.
158 _WRAP_METHOD(void set_use_arrows(bool arrows_on = true), gtk_combo_set_use_arrows)
160 /** Set arrows keys to change if value not in list
161 * Up and down will scroll through the list items but only
162 * change the current value if the text does not match a list item..
163 * Useful when there is a small list of value that the
166 * @param arrows_always true indicates the value will change.
168 _WRAP_METHOD(void set_use_arrows_always(bool arrows_always = true), gtk_combo_set_use_arrows_always)
170 /** Sets list case sensitive
171 * Determines if the list items and text comparisons for
172 * set_use_arrows_always() should be case sensitive.
174 _WRAP_METHOD(void set_case_sensitive(bool val = true), gtk_combo_set_case_sensitive)
176 /** Set the current entry Glib::ustring
177 * Call this function on an item if it isn't a label or you
178 * want it to have a different value to be displayed in the entry
180 _WRAP_METHOD(void set_item_string(Gtk::Item& item, const Glib::ustring& item_value), gtk_combo_set_item_string)
181 void remove_item_string(Gtk::Item& item);
183 /// Insert a list of items.
184 _WRAP_METHOD(void set_popdown_strings(const Glib::ListHandle<Glib::ustring>& strings), gtk_combo_set_popdown_strings)
186 Glib::ListHandle<Glib::ustring> get_popdown_strings() const;
188 _WRAP_METHOD(void disable_activate(), gtk_combo_disable_activate)
190 _MEMBER_GET_PTR(entry,entry,Entry*,GtkWidget*)
191 _MEMBER_GET_PTR(list,list,ComboDropDown*,GtkWidget*)
193 _WRAP_PROPERTY("enable-arrow-keys", bool)
194 _WRAP_PROPERTY("enable-arrows-always", bool)
195 _WRAP_PROPERTY("case-sensitive", bool)
196 _WRAP_PROPERTY("allow-empty", bool)
197 _WRAP_PROPERTY("value-in-list", bool)
201 } /* namespace Gtk */